Opened 12 years ago

Closed 12 years ago

#416 closed enhancement (fixed)

API, ZoomTo - add 'getCenter' and 'setCenter' methods

Reported by: adube Owned by: adube
Priority: major Milestone: 1.4.0
Component: widgets Version: trunk
Keywords: bis-1.4.0 api center set get Cc:

Description (last modified by adube)

The Need

We need to be able to get and set the center of the map from external libraries. We also need to be able to add a marker on the center of the map and have the possibility to set and get its position from externals libraries as well.

Technical details

What we currently have

  • an API widget used as a point of entry for external libraries to communicate with GeoPrisma.
  • a GeoExtUX_ZoomTo widget that allows input of x y coordinates and projection to set the center of the map. It also supports adding the marker

To do

  • API widgets :
    • new 'setcenter' event: fired by a new 'setCenter' API method, with an object as argument containing the center information (x, y, zoom, etc.)
    • new 'getCenter' method method that simply returns the same object the setCenter method would receive with infos about the current map extent
    • new 'centerchanged' event automatically fired on map 'moveend' event, which uses the 'getCenter' event to send the center infos
    • new 'centermarkermodified' event
    • new 'setmarkercenter' event
  • ZoomTo :
    • add a ModifyFeature control to allow dragging the marker around. The layer should listen to the 'featuremodified' event to fire the API 'centermarkermodified' event
    • update the x and y coordinates of the popup when changed that way

Change History (5)

comment:1 by adube, 12 years ago

Description: modified (diff)
Summary: API - add 'getCenter' and 'setCenter' methodsAPI, ZoomTo - add 'getCenter' and 'setCenter' methods

comment:2 by adube, 12 years ago

Requires #417.

comment:3 by adube, 12 years ago

r1329, featuring :

  • API widget new methods :
    • getCenter : to get a hash object of information about the map center
    • setCenter : to be able to set the map center
  • API widget new public events :
    • centerchanged : fired every time the center of the map is changed, whatever how
  • documentation about all this is detailed in the API documentation page
  • a new "api/setcenter" sample explaining and demonstrating these new features

All of theses only affect the API widget directly. It is responsible of setting and getting the map center (i.e. : it doesn't rely on any other widgets).

Coming up next

We want to be able to do more than just setting the map center. We want to be able to add a marker and be able to drag it independently of the actual map center. The ZoomTo widget already has the feature of adding a cross marker to the map, so we'll use it for that matter. Here's some details/requirements/features :

  • When using the setCenter method, if a ZoomTo widget is defined in the config, it will be automatically used to set the center instead of the API.
  • If the ZoomTo widget is set to add a marker upon centering, it will do so (as currently the case).
  • We need to be able to drag the marker. It won't change the center of the map unless needed which would require an option in that case
  • The marker position will be only be possible to change using the API with the 'setCenter' method. No need to have a specific method for that.
  • We need a new API method to be able to get the position of the marker
  • We might need a new public event to follow the marker position changes after it was dragged

comment:4 by adube, 12 years ago

The ZoomTo lib will require to be updated in order to do so, as described in #418. Required.

comment:5 by adube, 12 years ago

Resolution: fixed
Status: newclosed

r1338 :

  • API setCenter method updated to allow external widgets to attempt to set the center of the map
  • GeoExtUX_ZoomTo new "enableDrag" option (already covered in #418, but documented here)
  • GeoExtUX_ZoomTo new manager class to manage the marker drag events
  • API new "centermarkerchanged" event automatically fired by the ZoomTo manager
  • new sample (./api/setcenterzoomto) showing these new features
  • sample (./geoextux/zoomto) updated to show the new "enableDrag" option.

This completes the tasks required by this ticket. I'll leave the API and ZoomTo widget as stables. If any issue is found, please report in a new ticket.

Note: See TracTickets for help on using tickets.