Nicolas CARRIER
2010-Aug-30 15:01 UTC
[Mapstraction] Implementation of openBubble for openlayers
Hello, I''m back with another problem, the method Marker.openBubble isn''t implemented yet. I tried to hack a solution but I encountered some problems. When the popup is created in the toProprietary method from Marker in mxn.openlayers.core.js, I keep a reference on it with a this.infoPopup popup. Later in the openBubble method, I do : this.map.addPopup(this.infoPopup); this.infoPopup.show(); Which basically works but : * If that openBubble is called too early, a extent is null error happens, I think it''s because the map hasn''t been entirely drawn. I think it should somehow "register" to a "isDrawn" event from the map, but I don''t know how to manage this... * The toProprietary method creates a new Popup each time it''s called, there must be a way to create it only once but it has to be updated while calling setInfoBubble. As I''m quite new in using and hacking mapstraction, I think I''m not skilled enough to achieve a workaround. Could someone help ? Regards, Nicolas -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mapstraction.com/pipermail/mapstraction-mapstraction.com/attachments/20100830/b4542c4c/attachment.htm>
Dylan Kuhn
2010-Aug-30 16:39 UTC
[Mapstraction] Implementation of openBubble for openlayers
Hi Nicolas, I have some ideas for implementing infobubble in openlayers too, but they involve more code and decisions. I''ve put my ideas so into a personal branch on github - feel free to try it: http://github.com/cyberhobo/mxn/blob/ol-infobubble/source/mxn.openlayers.core.js -dylan- On Mon, Aug 30, 2010 at 9:01 AM, Nicolas CARRIER <carrier.nicolas0 at gmail.com> wrote:> Hello, > I''m back with another problem, the method Marker.openBubble isn''t > implemented yet. I tried to hack a solution but I encountered some problems. > When the popup is created in the toProprietary method from Marker in > mxn.openlayers.core.js, I keep a reference on it with a this.infoPopup > popup. > Later in the openBubble method, I do : > this.map.addPopup(this.infoPopup); > this.infoPopup.show(); > > Which basically works but : > * If that openBubble is called too early, a extent is null error happens, > I think it''s because the map hasn''t been entirely drawn. I think it should > somehow "register" to a "isDrawn" event from the map, but I don''t know how > to manage this... > * The toProprietary method creates a new Popup each time it''s called, > there must be a way to create it only once but it has to be updated while > calling setInfoBubble. > > As I''m quite new in using and hacking mapstraction, I think I''m not skilled > enough to achieve a workaround. > > Could someone help ? > > Regards, > Nicolas > > _______________________________________________ > Mapstraction mailing list > Mapstraction at lists.mapstraction.com > http://lists.mapstraction.com/listinfo.cgi/mapstraction-mapstraction.com > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mapstraction.com/pipermail/mapstraction-mapstraction.com/attachments/20100830/3e9ddcfd/attachment.htm>
cyberhobo
2010-Aug-30 16:46 UTC
[Mapstraction] Implementation of openBubble for openlayers
Hi Nicolas, I have some ideas for implementing infobubble in openlayers too, but they> involve more code and decisions. I''ve put my ideas so into a personal branch > on github - feel free to try it: > http://github.com/cyberhobo/mxn/blob/ol-infobubble/source/mxn.openlayers.core.jsAlso, the openlayers scripts are included differently for this version. See http://github.com/cyberhobo/mxn/blob/ol-infobubble/examples/openlayers.html. -dylan- On Mon, Aug 30, 2010 at 9:01 AM, Nicolas CARRIER <carrier.nicolas0 at gmail.com> wrote:> Hello, > I''m back with another problem, the method Marker.openBubble isn''t > implemented yet. I tried to hack a solution but I encountered some problems. > When the popup is created in the toProprietary method from Marker in > mxn.openlayers.core.js, I keep a reference on it with a this.infoPopup > popup. > Later in the openBubble method, I do : > this.map.addPopup(this.infoPopup); > this.infoPopup.show(); > > Which basically works but : > * If that openBubble is called too early, a extent is null error happens, > I think it''s because the map hasn''t been entirely drawn. I think it should > somehow "register" to a "isDrawn" event from the map, but I don''t know how > to manage this... > * The toProprietary method creates a new Popup each time it''s called, > there must be a way to create it only once but it has to be updated while > calling setInfoBubble. > > As I''m quite new in using and hacking mapstraction, I think I''m not skilled > enough to achieve a workaround. > > Could someone help ? > > Regards, > Nicolas > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mapstraction.com/pipermail/mapstraction-mapstraction.com/attachments/20100830/fa817c83/attachment.htm>
Nicolas CARRIER
2010-Aug-30 17:54 UTC
[Mapstraction] Implementation of openBubble for openlayers
Ok thanks a lot I will try this tomorrow at work. Le 30/08/2010 18:46, cyberhobo a ?crit :> Hi Nicolas, > > I have some ideas for implementing infobubble in openlayers too, > but they involve more code and decisions. I''ve put my ideas so > into a personal branch on github - feel free to try it: > http://github.com/cyberhobo/mxn/blob/ol-infobubble/source/mxn.openlayers.core.js > > > Also, the openlayers scripts are included differently for this > version. See > http://github.com/cyberhobo/mxn/blob/ol-infobubble/examples/openlayers.html. > > -dylan- > > On Mon, Aug 30, 2010 at 9:01 AM, Nicolas CARRIER > <carrier.nicolas0 at gmail.com <mailto:carrier.nicolas0 at gmail.com>> wrote: > > Hello, > I''m back with another problem, the method Marker.openBubble isn''t > implemented yet. I tried to hack a solution but I encountered some > problems. > When the popup is created in the toProprietary method from Marker > in mxn.openlayers.core.js, I keep a reference on it with a > this.infoPopup = popup. > Later in the openBubble method, I do : > this.map.addPopup(this.infoPopup); > this.infoPopup.show(); > > Which basically works but : > * If that openBubble is called too early, a extent is null error > happens, I think it''s because the map hasn''t been entirely drawn. > I think it should somehow "register" to a "isDrawn" event from the > map, but I don''t know how to manage this... > * The toProprietary method creates a new Popup each time it''s > called, there must be a way to create it only once but it has to > be updated while calling setInfoBubble. > > As I''m quite new in using and hacking mapstraction, I think I''m > not skilled enough to achieve a workaround. > > Could someone help ? > > Regards, > Nicolas > > > _______________________________________________ > Mapstraction mailing list > Mapstraction at lists.mapstraction.com > http://lists.mapstraction.com/listinfo.cgi/mapstraction-mapstraction.com >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mapstraction.com/pipermail/mapstraction-mapstraction.com/attachments/20100830/3c5fd915/attachment.htm>
Nicolas CARRIER
2010-Aug-31 12:03 UTC
[Mapstraction] Implementation of openBubble for openlayers
Hi dylan, I''ve tried to use the code you proposed to me, but I experienced some problems. First I couldn''t manage to make it work as is, I tried to replace the content of the mxn.openlayers.core.js of the mapstraction archive I downloaded from the mapstraction website, with the one you gave me the link to. I obtain an error like "...Mapnik isn''t a constructor", I think it''s at line 28. I didn''t understand neither what had changed in the way of including the openlayers scripts, but I''m pretty sure the two matters are linked... Eventually, I copied/pasted what seemed relevant to me to my original mxn.openlayers.core.js file, which is the end of the Marker.toProprietary() function from the if (this.infoBubble) { up to the end, and the content of the openBubble function. Here come some remarks : * The new look of infoBubles is far better than the former, that''s very cool ! * The problem I raised sooner is still here, when openBubble is called, a "extent is null" exception is raised. * When I call openBubble on two different markers, the first bubble disappear ! I really couldn''t figure out what happens here :S What''s more, I can make appear two different bubbles manually with a left-click, without any problem. * One left-click makes the marker appear, but the second left-click doesn''t make it disappear any more. And now some comments on the implementation : The popup is built in the toProprietary method and in the openBubble method. I think the popup''s construction should take place in the setInfoBubble method, or should be triggered by it, as ther could be only ONE instance of popup per marker, updated each time setInfoBuble is called (there could be a display refresh at that moment too). In my work, the toProprietary is called by an infinite timer, so it''s a memory leak which should potentially lead to a crash (I don''t know how garbage collection works in javascript or even if there is any). To deal with the "extent is null" stuff, I think openBubble should verify if extent is null or not and should delay it''s work, or register to an "extent_is_not_null_anymore" event (something like "mapDrawn" maybe...). regards, Nicolas 2010/8/30 Nicolas CARRIER <carrier.nicolas0 at gmail.com>> Ok thanks a lot I will try this tomorrow at work. > Le 30/08/2010 18:46, cyberhobo a ?crit : > > Hi Nicolas, > > I have some ideas for implementing infobubble in openlayers too, but they >> involve more code and decisions. I''ve put my ideas so into a personal branch >> on github - feel free to try it: >> http://github.com/cyberhobo/mxn/blob/ol-infobubble/source/mxn.openlayers.core.js > > > Also, the openlayers scripts are included differently for this version. > See > http://github.com/cyberhobo/mxn/blob/ol-infobubble/examples/openlayers.html > . > > -dylan- > > On Mon, Aug 30, 2010 at 9:01 AM, Nicolas CARRIER < > carrier.nicolas0 at gmail.com> wrote: > >> Hello, >> I''m back with another problem, the method Marker.openBubble isn''t >> implemented yet. I tried to hack a solution but I encountered some problems. >> When the popup is created in the toProprietary method from Marker in >> mxn.openlayers.core.js, I keep a reference on it with a this.infoPopup >> popup. >> Later in the openBubble method, I do : >> this.map.addPopup(this.infoPopup); >> this.infoPopup.show(); >> >> Which basically works but : >> * If that openBubble is called too early, a extent is null error happens, >> I think it''s because the map hasn''t been entirely drawn. I think it should >> somehow "register" to a "isDrawn" event from the map, but I don''t know how >> to manage this... >> * The toProprietary method creates a new Popup each time it''s called, >> there must be a way to create it only once but it has to be updated while >> calling setInfoBubble. >> >> As I''m quite new in using and hacking mapstraction, I think I''m not >> skilled enough to achieve a workaround. >> >> Could someone help ? >> >> Regards, >> Nicolas >> >> > _______________________________________________ > Mapstraction mailing list > Mapstraction at lists.mapstraction.comhttp://lists.mapstraction.com/listinfo.cgi/mapstraction-mapstraction.com > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mapstraction.com/pipermail/mapstraction-mapstraction.com/attachments/20100831/c4b5df12/attachment.htm>