[OpenLayers-Dev] Fwd: [OpenLayers-Commits] r6979 - sandbox/topp/almanac/lib/OpenLayers/Format

Tim Schaub tschaub at openplans.org
Mon Apr 21 00:36:52 EDT 2008


Eric Lemoine wrote:
> Tim,
> 
> Wouldn't it make sense to add a "link" or "url" property to the
> Feature class (I like "link" better)? It would make sense to me in
> regards to the code we have in the 'delete' and 'update' methods of
> Protocol/HTTP.js (where we assume that feature.url exists).
> 
> Thoughts?

Hey Eric-

Yeah, I just kept link as a feature.attributes property because that was 
where Sean had it.  In the application that I'm using this for, I extend 
the Atom readers & writers to do a good bit of custom parsing.  There, I 
create a link object on features - keyed by the "rel" attribute of the 
incoming atom:link.

In general, I think it makes good sense to put things in 
feature.attributes that users are responsible for editing.  Other 
properties are better on the feature directly.

I look forward to having a discussion about our feature model.  I also 
will pass on info on how I am extending formats to get custom 
application behavior.  This is easy enough to do that I don't think we 
have to have a single feature model that works for everyone.

But, yeah, I agree.  The protocol should be setting feature links.

Tim



> --
> Eric
> 
> ---------- Forwarded message ----------
> From:  <commits at openlayers.org>
> Date: Sun, Apr 20, 2008 at 9:29 AM
> Subject: [OpenLayers-Commits] r6979 - sandbox/topp/almanac/lib/OpenLayers/Format
> To: commits at openlayers.org
> 
> 
> Author: tschaub
>  Date: 2008-04-20 03:29:40 -0400 (Sun, 20 Apr 2008)
>  New Revision: 6979
> 
>  Modified:
>    sandbox/topp/almanac/lib/OpenLayers/Format/Atom.js
>  Log:
>  atom requires href on link
> 
>  Modified: sandbox/topp/almanac/lib/OpenLayers/Format/Atom.js
>  ===================================================================
>  --- sandbox/topp/almanac/lib/OpenLayers/Format/Atom.js  2008-04-20
> 05:02:10 UTC (rev 6978)
>  +++ sandbox/topp/almanac/lib/OpenLayers/Format/Atom.js  2008-04-20
> 07:29:40 UTC (rev 6979)
>  @@ -208,11 +208,7 @@
>                  feature.attributes.content = this.getChildValue(node);
>              },
>              "link": function(node, feature) {
>  -                var href = this.getChildValue(node);
>  -                if(!href) {
>  -                    href = node.getAttribute("href");
>  -                }
>  -                feature.attributes.link = href;
>  +                feature.attributes.link = node.getAttribute("href");
>              },
>              "id": function(node, feature) {
>                  feature.fid = this.getChildValue(node);
> 
>  _______________________________________________
>  Commits mailing list
>  Commits at openlayers.org
>  http://openlayers.org/mailman/listinfo/commits
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev
> 
> !DSPAM:4033,480b8f6d149261439371379!
> 




More information about the Dev mailing list