The source code for the Map Builder demonstration, which contains
all of the code described in this section, can be found at <installdir> /jviews-maps810/samples/mapbuilder/index.html
Pan
![pan.png](../usrprgmaps/_media/pan_default.png)
The IlvMapPanInteractor allows the user to pan
a manager view by pressing and holding the space key. Once
installed, it is always available.
To create this interactor and attach it to a IlvManagerView, you can use the following
code:
IlvManagerView view = ... ... IlvMapPanInteractor pan = new IlvMapPanInteractor(); pan.setView(view);
Zoom rectangle
![zoomrect.png](../usrprgmaps/_media/zoomrect_default.png)
The IlvMapZoomInteractor allows the user to
select and zoom in on a rectangle in a manager view. The Zoom
Rectangle interactor includes the Zoom In and Zoom Out
interactors. It also provides simple click zoom and unzoom
interactions.To create this interactor, you can use the following
code:
IlvMapZoomInteractor interactor = new IlvMapZoomInteractor(); view.setInteractor(interactor);
Continuous zoom
![mapsprg_continuouszoom.png](../usrprgmaps/_media/mapsprg_continuouszoom_default.png)
The IlvContinuousZoomInteractor allows the user
to continuously zoom into or out from a map by pressing and
holding a mouse button. The zoom center, that is, the point in a
map that will be zoomed on, is the point in the map where the
mouse is clicked. By default, pressing the left button zooms into
the zoom center, pressing the right mouse button zooms out from
the zoom center. When you drag the mouse the current zoom
activity is paused and the map is panned to follow mouse
displacement.
This interactor also redirects mouse wheel
actions. After this interactor is activated, the user scrolls the
mouse wheel backwards to zoom in, and forwards to zoom out.
The delay and zoom factor can be
configured for each interactor instance.
IlvContinuousZoomInteractor interactor = new IlvContinuousZoomInteractor(); interactor.setContinuousZoomFactor(factor); interactor.setPeriod(period); view.setInteractor(interactor);
To activate this interactor, use the
following code:
Rotate
![rotate.png](../usrprgmaps/_media/rotate_default.png)
The IlvManagerViewRotateInteractor allows the
user to rotate the entire content of a manager view. Various
modes are available, such as immediate rotation, delayed
rotation, and key controlled rotation.
To create this interactor, you can use the
following code:
IlvManagerView view = …; ... IlvManagerViewRotateInteractor interactor = new IlvManagerViewRotateInteractor(); interactor.setMode(IlvManagerViewRotateInteractor.DYNAMIC_CONTINUOUS_MODE); view.setInteractor(interactor);
Distance measuring
![linedistance.png](../usrprgmaps/_media/linedistance_default.png)
The IlvMakeMeasureInteractor allows the user to
draw a line on a map in a manager view and automatically display
the distance represented by the line on the map.
To create a IlvMakeMeasureInteractor you can use the
following code:
final IlvMakeMeasureInteractor measure = new IlvMakeMeasureInteractor(); JButton b = new JButton(); b.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { view.setInteractor(measure); } });