-
Notifications
You must be signed in to change notification settings - Fork 0
Control Discussion
Tom, Bruno, Fred and I discussed the control/interaction architecture yesterday (Jan 15th, 2013). Quick report on the discussion.
Currently a Control is an object wrapping a DOM element and including a reference to the map. A control can be given a target DOM element (container). If no target is provided the map's "overlay container" is used as the target.
The map currently maintains a collection of controls, and provides a getControls
method for accessing the collection. The current design is flawed. In particular the following use-case doesn't work:
map1.getControls().push(aControl);
aControl.setMap(map2);
In this case the control is still in map1's controls collection, but it now includes a reference to map2.
The map has a collection of Interactions. The map listen to browser events, wrap these browser events in "map browser events" and pass them to the interactions by calling handleMapBrowserEvent
on every interaction of the collection. The interaction may handle or ignore the received map browser event, based on its role. The interaction reacts to the event by changing the view (calling view.setCenter
for example).
The order of interactions in the collection matters. If an interaction calls preventDefault()
on the map browser event other the interactions at lower indexes in the collection won't receive the event.
In OL2 everything is a Control. In particular the notion of Interactions does not exist. A control in OL2 may have no relationship with the DOM.
We have attempted to categorize each OL2 control and handler, to see where they fit in the OL3 architecture. See below. The result is that there are OL2 controls that are neither controls nor interactions in the OL3 architecture. Solutions must be found for those.
OL3 CONTROL
Attribution
LayerSwitcher
MousePosition
OverviewMap
Pan
PanZoomBar
Scale
ScaleLine
Zoom
ZoomToMaxExtent
OL3 INTERACTION
DragPan
GetFeature
KeyboardDefaults
PinchZoom
UTFGrid
WMSGetFeatureInfo
WMTSGetFeatureInfo
ZoomBox
Feature Handler (low level)
OL3 WE DON'T KNOW YET
ArgParser
Geolocate
NavigationHistory
Permalink
OL3 GEOMETRY MANIPULATION
DragFeature
DrawFeature
Measure
ModifyFeature
SLDSelect
SelectFeature
Snapping
Split
TransformFeature
Box
Path Handler
Point Handler
Polygon Handler
RegularPolygon Handler
OL3 NOT RELEVANT
Button
EditingToolbar
NavToolbar
Panel
ZoomIn
ZoomOut
ZoomPanel
OL3 SOURCE WRAPPER
CacheRead
CacheWrite
OL3 LAYER
Graticule
SHORTCUTS
Navigation
PanPanel
PanZoom
TouchNavigation
OL3 MAP BROWSER EVENT
Click Handler
Drag Handler
Hover Handler
Keyboard Handler
MouseWheel Handler
Pinch Handler
OL3 IDEAS
tree of controls
modifiers to listen to different events