Hi devs,

I'd like to move a discussion I had on the GeoExt-Users mailing list here. I couldn't find any GeoExt nabble to show the thread. Is there such a thing ?

  *** The original issue ***

While using the GeoExt.data.WFSCapabilitiesStore, I had to override the strategy it creates by default. In the Reader, it's done as such :

{{{ ###
                layerOptions = {
                    protocol: new OpenLayers.Protocol.WFS(protocolOptions),
                    strategies: [new OpenLayers.Strategy.Fixed()]
                };
                if(this.meta.layerOptions) {
                    Ext.apply(layerOptions, this.meta.layerOptions);
                }
}}} ###

That means that we're able to override the layersOptions.strategies using the meta.layerOptions, but when we do so, it bugs because the same strategy object is then used for all created layers. To fix that problem, I had to hard-code the strategies I wanted instead, which isn't a really good long-term solution.

There could be a way to fix this issue with a fix in OpenLayers. Here's some more details :

  *** Proposed solution in OpenLayers ***

If we could send a hash instead of an instanced object as property values, we could then let the constructors create the objects accordingly. That method could be a new way of defining the properties without changing the previous method. Here's a example :

// ### currently ###
var layer = new OpenLayers.Layer.Vector("mylayer", {
    strategies: [new OpenLayers.Strategy.BBOX()]
});

// ### new alternative way, with or without full class name, with and without options ###
var layer = new OpenLayers.Layer.Vector("mylayer", {
    strategies: [{"OpenLayers.Strategy.BBOX"}]
});
var layer = new OpenLayers.Layer.Vector("mylayer", {
    strategies: [{"OpenLayers.Strategy.BBOX": {ratio: 1}}]
});
var layer = new OpenLayers.Layer.Vector("mylayer", {
    strategies: [{"BBOX"}]
});
var layer = new OpenLayers.Layer.Vector("mylayer", {
    strategies: [{"BBOX": {ratio: 1}}]
});

That way, we would be able to define non-instanced object properties and let the main object constructor taking care of creating the them. That would fix the issue in the GeoExt.data.WFSCapabilitiesStore mentioned above.

Thoughts ?

--
Alexandre Dubé
Mapgears
www.mapgears.com

_______________________________________________
Dev mailing list
d...@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-dev

Reply via email to