[OpenLayers-Users] Having difficulty creating my own feature layer....
Erik Uzureau
euzuro at gmail.com
Wed Jun 21 06:29:01 CDT 2006
On 6/20/06, nick at hogweed.org <nick at hogweed.org> wrote:
> Erik, Paul,
>
> > The explanation that Paul gives here sounds good and is very thorough...
> > thanks for tackling that one! Can you let us know if this fixes the problem
> > you were having, Nick? Do you need some more help? I wrote most of the code
> > that is that WFS.js class, so feel free to fire away... :-)
> >
> > Thanks,
> >
> > Erik
> >
> > On 6/20/06, Paul Spencer <pspencer at dmsolutions.ca> wrote:
> > > Nick,
> > >
> > > I'm not that familiar with the openlayers code yet, but it seems to
> > > me that you need to call this.layer.addMarker(a)
>
> I tried that originally, as it seemed the most obvious thing to do :-) If you
> look at my code I have commented out
>
> /*
> this.layer.addMarker
> ( new OpenLayers.Marker
> (lonLat,new OpenLayers.Icon('images/amenity.png')));
> */
>
> However, that gave an error "this.layer has no properties". Since the
> Layer.OSMtest indeed does "inherit" from Layer.Markers I was puzzled by that.
> Also the Tile.WFS references this.layer so I'm doubly puzzled....
Is there any way that you could point me to a working url so that I could
step through this with a debugger? I just looked over your code and I
can't see why
you would be getting an error on "this.layer" -- there must be
something broken in the
initialization chain or something.
Im online for the next six or seven hours and available to help. Let me know...
Erik
>
> Nick
>
> > > From what I understand, the syntax that invokes
> > > xxx.prototype.xxx.apply(this, ...) is used to call base-class
> > > functions that have the same name as a sub-class function name. In
> > > javascript, there is no concept of a super class so you have to
> > > resort to 'tricks' like this.
> > >
> > > The addMarker method is a method of the Markers layer type. Since
> > > Layer.OSMtest extends Markers, you automatically gain an addMarker
> > > method in OSMtest.
> > >
> > > Your call to addMarker is coming from Tile.OSMtest. Tile has a
> > > member variable layer which points to the layer containing the tile.
> > > Therefore you can call addMarker directly.
> > >
> > > You would have needed to use the prototype/apply thing if you had
> > > defined an addMarker function in your Layer.OSMtest but actually
> > > needed to call addMarker in the Layers.Markers code.
> > >
> > > Um. Not sure if that explains things very well. It all makes sense
> > > in my head, though :)
> > >
> > > Cheers
> > >
> > > Paul
>
More information about the Users
mailing list