Dojo/OpenLayers mashup

View: New views
2 Messages — Rating Filter:   Alert me  

Dojo/OpenLayers mashup

by Andre Steenveld :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello fellow JS programmers,

I have been working on integrating openlayers into a dojo widget. This widget can be configured with an XML file and can act and behave like a dojo widget as well as an instance of OpenLayers.Map. I am planning to write some code that makes it possible to configure the widget declaratively or via JSON.

This is all fine and well and works, with one very important exception. Panning does not work, more specific there are layers in which it doesn't work. Panning works in the Google layers because the drag and drop functionality is delegated to the Google layer. However for the "native" openlayers layers the events do fire but the map is not updated. Panning and then zooming in or out will cause the map to center on the correct point and so will panning and then resizing the window. It is not limited to a specific browser, I have tested FF3.5, IE8, IE7 emulation and Opera 10 all running on a windows XP box.
 
My hypothesis is that there is a mix up with some events that are attached via dijit._Widget and OpenLayers.Map, but I can't find exactly where or how to fix it properly. You can find the widget by typing "dijit.byId( 'map' )" in your console. The result will be a objet which inherets from OpenLayers.Map and mixes dijit._Widget.

If anyone has any suggestions at all I'd love to hear them. Any other feedback or suggestion are welcome as well. For a demo you can point the browser of your choice to http://bonsai.nmpo.nl/experiments/mapviewer.v2.html

For a zip file with the source, http://bonsai.nmpo.nl/experiments/viewer.zip. If you want to see more layers you can uncomment the layers in the XML file, they all work and have the data needed to fill them is supplied in the zip as well.

This message has been sent to the oplayers and dojo mailing lists.

Best regards, Andre Steenveld

_______________________________________________
FAQ: http://dojotoolkit.org/support/faq
Book: http://docs.dojocampus.org
Dojo-interest@...
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest

Re: Dojo/OpenLayers mashup

by John Locke :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Cool project, would love to see this get working...

I'm not sure if you've gotten further on this since you wrote to the
list, I was just scanning old topics. However, I don't see a reply....

The one thing that caught my eye was the order of inherited objects in
the widget declare:
nmpo.declare( "nmpo.geo.MapViewer", [ OpenLayers.Map, dijit._Widget ], {

... I really don't know much about OpenLayers, have never cracked the
code. But what caught my eye is that with dojo.declare, the order of the
2nd parameter matters--the first class listed acts as a base class,
while any additional classes just have methods/properties mixed in.

dijit._Widget, as I understand it, handles the creation lifecycle for
the widget. I've pretty much always listed that first in my custom
widgets, so that it starts up using the typical lifecycle.

I didn't dig much into your nmpo.declare method--perhaps the necessary
bits of that could be put in the widget constructor? Have you tried
using the native dojo.declare with dijit._Widget as the first base class?

I'm thinking that perhaps doing it that way would set up the dojo event
listeners in a way you could implement in your widget as a wrapper, and
call the appropriate openlayer code...

Just a thought, without digging into this much.

Cheers,
John Locke
http://freelock.com


-------- Original Message  --------
Subject: [Dojo-interest] Dojo/OpenLayers mashup
From: Andre Steenveld <andre.steenveld@...>
To: dojo-interest@...
Date: Mon 09 Nov 2009 01:59:09 AM PST

> Hello fellow JS programmers,
>
> I have been working on integrating openlayers into a dojo widget. This
> widget can be configured with an XML file and can act and behave like
> a dojo widget as well as an instance of OpenLayers.Map. I am planning
> to write some code that makes it possible to configure the widget
> declaratively or via JSON.
>
> This is all fine and well and works, with one very important
> exception. Panning does not work, more specific there are layers in
> which it doesn't work. Panning works in the Google layers because the
> drag and drop functionality is delegated to the Google layer. However
> for the "native" openlayers layers the events do fire but the map is
> not updated. Panning and then zooming in or out will cause the map to
> center on the correct point and so will panning and then resizing the
> window. It is not limited to a specific browser, I have tested FF3.5,
> IE8, IE7 emulation and Opera 10 all running on a windows XP box.
>  
> My hypothesis is that there is a mix up with some events that are
> attached via dijit._Widget and OpenLayers.Map, but I can't find
> exactly where or how to fix it properly. You can find the widget by
> typing "dijit.byId( 'map' )" in your console. The result will be a
> objet which inherets from OpenLayers.Map and mixes dijit._Widget.
>
> If anyone has any suggestions at all I'd love to hear them. Any other
> feedback or suggestion are welcome as well. For a demo you can point
> the browser of your choice to
> http://bonsai.nmpo.nl/experiments/mapviewer.v2.html
>
> For a zip file with the source,
> http://bonsai.nmpo.nl/experiments/viewer.zip. If you want to see more
> layers you can uncomment the layers in the XML file, they all work and
> have the data needed to fill them is supplied in the zip as well.
>
> This message has been sent to the oplayers and dojo mailing lists.
>
> Best regards, Andre Steenveld
> !DSPAM:4af7e809248238718113947!
> ------------------------------------------------------------------------
>
> _______________________________________________
> FAQ: http://dojotoolkit.org/support/faq
> Book: http://docs.dojocampus.org
> Dojo-interest@...
> http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
>
>
> !DSPAM:4af7e809248238718113947!
>  


_______________________________________________
FAQ: http://dojotoolkit.org/support/faq
Book: http://docs.dojocampus.org
Dojo-interest@...
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest