[OpenLayers-Users] An App-Specific Feature.WMS subclass example, begs a slight API addition

Christopher Schmidt crschmidt at metacarta.com
Thu Jun 7 17:51:54 EDT 2007


On Thu, Jun 07, 2007 at 02:15:09PM -0700, mfrumin wrote:
> so, what I would really like is a "client data" that you give it when you
> create the WFS layer that then gets passed into the either the constructor
> or the processXML node method.  this way, it would work like this:

No code changes needed. Do:

layer = new OpenLayers.Layer.WFS( "Pics WFS", wfs,
        { typename: 'frumin:pictures', maxfeatures: 100 } ,
        { featureClass: OpenLayers.Feature.WFS.Pics, clientData: {
picUrlRoot: "http://frumin.net/pics/"}}
);

processXMLNode: function(xmlNode, clientData) {
    data.icon = new OpenLayers.Icon(this.layer.clientData.picUrlRoot + file, isize);
}

All options are copied to the layer, and the layer is accessible from
within the processXMLNode as this.layer.

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list