[OpenLayers-Trac] [OpenLayers] #1547: Format.GML: introduce option to postpone parsing of the geometries

OpenLayers trac at openlayers.org
Wed May 14 07:45:28 EDT 2008


#1547: Format.GML: introduce option to postpone parsing of the geometries
-------------------------+--------------------------------------------------
  Reporter:  bartvde     |       Owner:  tschaub         
      Type:  feature     |      Status:  new             
  Priority:  minor       |   Milestone:                  
 Component:  Format.GML  |     Version:  2.6             
Resolution:              |    Keywords:  needs discussion
     State:              |  
-------------------------+--------------------------------------------------
Changes (by bartvde):

  * keywords:  => needs discussion

Comment:

 I've attached a proposed patch. Things which need discussion:

 1) is it okay to add properties to OpenLayers.Feature.Vector which are not
 advertized in that class? I want to cache the geometryNode, and I named
 the property feature.geometryNode. But I don't know if this is allowed
 without specifying it in Vector.js.

 2) maybe it's necessary to create another APIProperty called
 cacheGeometryNode? Now by default I cache the node when parseGeometry is
 false, but maybe this is not flexible enough and we need an extra property
 to control the caching?

 An example usage is:

 {{{
             var gmlParser = new OpenLayers.Format.GML();
             var feature = row.get('feature');
             if (!feature.geometry) {
                 var type = feature.geometryNode.type;
                 var parser = gmlParser.parseGeometry[type.toLowerCase()];
                 if(parser) {
                     var geometry = parser.apply(gmlParser,
                         [feature.geometryNode.node]);
                     feature.geometry = geometry;
                     this.layer.addFeatures(feature);
                 }
             } else {
                 this.layer.addFeatures(feature);
             }

 }}}

-- 
Ticket URL: <http://trac.openlayers.org/ticket/1547#comment:1>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer


More information about the Trac mailing list