Extending the Google Map widget [message #975505] |
Wed, 07 November 2012 23:09 |
Richard Moulton Messages: 92 Registered: August 2011 Location: Devon, UK |
Member |
|
|
I've just revisited the Google Maps widget that's included with the downloadable mortgage calculator project, found on the EDT downloads page.
With the application I had in mind I wanted to plot multiple markers on a map and then have the map automatically centre itself on those markers.
I couldn't see a way to do that with the supplied widget so I started googling to see how this could be done. It didn't take long to find an example of this in javascript that worked with the Google Maps v3 API so I've extended the Google Maps widget to include a new autoCenter() function.
I changed the EGLSource/utils/map/GoogleMap.egl external type to include a reference to the new function and modified the Webcontent/utils/maps/GoogleMap.js to include the new function.
The attached project includes the extended widget plus a sample EGL handler that demonstrates the new feature. The sample adds four markers (four IBM UK offices) to the map and by default the map is positioned to the last marker that was added. There's an 'Auto Center' button that when clicked executes the new autoCenter() function.
Richard
|
|
|
Powered by
FUDForum. Page generated in 0.03353 seconds