View navigation

From gvSIG CE Wiki

Jump to: navigation, search

This page collects information about the existing tools for navigating (zoom, pan) in the different data contexts (Views, Maps, Georeferencer, etc.).

Contents

Views

Navigating in Views is supported by two principal types of tools:

  1. Tools available as extensions that use their own listeners.
  2. Tools that are part of the MapControl class.

Both types are described below.

Layers in editing mode are a somewhat special case (see below).

Listener tools

Most of these tools are realized as extensions in 'appgvSIG' (entry point: 'com.iver.cit.gvsig.ViewControls'), but there are also other extensions that implement such tools (most notably extCAD). The tools in 'appgvSIG' use listeners defined and implemented in 'libFMap' (e.g. 'com.iver.cit.gvsig.fmap.tools.Listeners.PanListener'). The listeners in turn implement 'behaviours' (e.g. 'com.iver.cit.gvsig.fmap.tools.Behavior.MoveBehavior'), which take care of the largest part of the actual operation.

MapControl tools

The listeners are attached to libFMap's 'MapControl' (com.iver.cit.gvsig.fmap.MapControl.MapControl()). But 'MapControl' also provides its own navigation tools. The latter listens for all kinds of mouse events and - if no other tool has already processed them - reacts to some of them by itself:

  • zoom using mousewheel
  • center on RMB
  • pan while middle (wheel) button is pressed

Todo

Notes

A tool that changes the current View extent must make sure to refresh the main application controls, so that the "Undo zoom" tool will be notified of the change and can be enabled:

 PluginServices.getMainFrame().enableControls();

'MapControl' has public methods 'moveFromTo()' and 'centerAt()' which should make most panning ops straight-forward to implement. Both method take 'Point2D' objects with pixel coordinates.

Most (all?) interactive tools implement one of libFMap's listeners, such as 'PointListener':

 com.iver.cit.gvsig.fmap.tools.Listeners.PointListener

Many implementations are in 'appgvSIG', such as:

 com.iver.cit.gvsig.project.documents.view.toolListeners.InfoListener

But there are numerous extensions that also implement their own tools, based on one of libFMap's listeners.

CAD editor

If a layer is in editing mode, then we have a number of complications:

  • extCAD uses its own listener hierarchy that is not exposed to 'MapControl'. This is the reason why the two types often interact badly.
  • If the CAD console is open, then the true vertical center of the View shifts up by height of the console. However, 'MapControl' is not aware of this, so that canvas centering (e.g. "zoom to layer") does not work as expected.
  • extCAD attaches a context menu to right mouse button click events. So we cannot use this button for view centering if a layer is in editing mode.

Todo

Maps

Navigation tools in Map layouts are of two different kinds:

  • Navigating in the layout canvas.
  • Navigating within embedded Views in the layout.

Todo

Check how well these tools are aligned with those for Views and make keyboard shortcuts available.

Georeferencer

The Georeferencer has its own navigation tools that are available via icons on the right edge of each referencing view.

Todo

These tools should be better aligned with those available for Views and keyboard shortcuts need to be made available.