[OpenLayers-Dev] Overwriting attributes

Bart van den Eijnden (OSGIS) bartvde at osgis.nl
Tue Jun 29 07:46:47 EDT 2010


Hi Steven,

you should be able to do something like:

OpenLayers.Util.extend(OpenLayers.Format.WFST.v1.prototype.namespaces,
{foo: 'bar'});

the same trick applies to the readers:

OpenLayers.Util.extend(OpenLayers.Format.WFST.v1.prototype.readers.wfs,
{'foo': function(node, obj) { console.log(obj); }});

Best regards,
Bart

> Hi all,
>
> I want to add GML 3.2.1 support to an OpenLayers application but I don't
> want to modify OpenLayers.js so I want to override two classes
> (OpenLayers.Format.WFST.v1_1_0 and OpenLayers.Format.WFST.v1) Actually, I
> only want to add another namespace to v1.namespaces and an extra reader to
> v1_1_0.readers
> I found this thread:
> http://openlayers.org/pipermail/users/2009-April/011227.html which provide
> 3 ways to overwrite a class. They're all meant for either overwriting a
> class or a specific function within that class. The things I want to
> change, aren't functions so I've tried to overwrite the two classes.
> However, due to the way OpenLayers handles WFS/GML with formats, I don't
> believe I have the option to directly call the new classes instead of the
> original classes. The two WFST classes are called through a whole series
> of other classes, which would mean I have to change these as well
> (right?).
>
> So my question is, if there's an easy way to add the two attributes from
> outside openlayers.js?
>
> Regards,
> Steven
>
>
>
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev
>





More information about the Dev mailing list