[OpenLayers-Users] Popup closebox and formatting.

Eric Lemoine Eric.Lemoine at camptocamp.com
Sun Jun 3 05:08:45 EDT 2007


On 6/2/07, Christopher Schmidt <crschmidt at metacarta.com> wrote:
> On Sat, Jun 02, 2007 at 11:00:23PM +0200, Eric Lemoine wrote:
> > On 6/2/07, Christopher Schmidt <crschmidt at metacarta.com> wrote:
> > >On Sat, Jun 02, 2007 at 03:13:53PM +0200, Eric Lemoine wrote:
> > >> On 5/31/07, kaka <drspencer at hotmail.com> wrote:
> > >> >
> > >> > I am trying to add a closebox to some markers, but I can??t get the
> > >close
> > >> > boxes to show up. See http://www.villageografica.com/test50/test.html
> > >for a
> > >> > test. The markers are located in
> > >> > http://www.villageografica.com/test50/ProjectLocations.txt . What am I
> > >doing
> > >> > wrong here?
> > >>
> > >> Unfortunatly I don' think you can have closeboxes with a Text layer.
> > >> Indeed, the Text layer uses feature.createPopup()  as opposed to
> > >> feature.createPopup(true). What you can do is create a class that
> > >> inherits from OpenLayers.Layer.Text and overrides the markerClick()
> > >> method - something along these lines (*untested*) :
> > >
> > >Just to throw my weight behind this: this is probably true at the
> > >moment, and Eric's suggested fix is about right (though I've similarly
> > >not tested it). I would consider this a bug though, and would take a
> > >patch to fix it.
> >
> > Christopher, what's the actual rationale behind having OL providing a
> > default onclick callback for features of a Text layer? Wouldn't it be
> > better to have a more generic mechanism where the user can choose the
> > events (and associated callbacks) attached to its Text layer's
> > features? Perhaps at this point you just want to avoid breaking
> > backward compatibilty and therefore keep that default onclick callback
> > thing?
>
> The text layer is designed for people who can't write Javascript --
> specifically, it's designed to support the MVS -- map viewer service, at
> http://openlayers.org/viewer/ -- it's not designed to be subclassed.

I understand what the text layer is for. What I don't understand is
why OpenLayers provides a default onclick callback. Would you accept a
patch where the programmer can specify events and callbacks at layer
creation time?

layer = new OpenLayers.Layer.Text("foo", {
    location: "file.txt",
    events : {
        "click" : click_callback,
        "mouseover" : mouseover_callback
    }
});

> I'm not sure I understand why people would want to use a text layer
> rather than something like georss. Are there really that many OpenLayers
> users who just use excel and still want to do more fancy things with a
> text layer?

Dunno. Maybe kaka could sched some light...

Thanks,

-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com



More information about the Users mailing list