public class PlaneNavigator extends Object implements Navigator<PlaneAspect>
Constructor and Description |
---|
PlaneNavigator(double zoomFactor,
boolean xZoom,
boolean yZoom,
boolean xPan,
boolean yPan,
double xAnchor,
double yAnchor)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
NavAction<PlaneAspect> |
click(Surface surface,
Point pos,
int ibutt,
java.util.function.Supplier<CoordSequence> dposSup)
Mouse click gesture.
|
NavAction<PlaneAspect> |
drag(Surface surface,
Point point,
int ibutt,
Point origin)
Drag gesture.
|
NavAction<PlaneAspect> |
endDrag(Surface surface,
Point pos,
int ibutt,
Point origin)
Terminating drag gesture.
|
static boolean[] |
getAxisNavFlags(Surface surface,
Point pos,
boolean xFlag,
boolean yFlag)
Determines which axes navigation should be performed on.
|
Map<Gesture,String> |
getNavOptions(Surface surface,
Point pos)
Returns a description of the available navigation gestures and the
behaviour they cause when the mouse is positioned at a particular point.
|
NavAction<PlaneAspect> |
wheel(Surface surface,
Point pos,
int wheelrot)
Mouse wheel gesture.
|
public PlaneNavigator(double zoomFactor, boolean xZoom, boolean yZoom, boolean xPan, boolean yPan, double xAnchor, double yAnchor)
zoomFactor
- amount of zoom for one mouse wheel clickxZoom
- true iff wheel operation will zoom in X directionyZoom
- true iff wheel operation will zoom in Y directionxPan
- true iff drag operation will pan in X directionyPan
- true iff drag operation will pan in Y directionxAnchor
- data value to pin X coordinate at during zooms;
NaN for no anchoryAnchor
- data value to pin Y coordinate at during zooms;
NaN for no anchorpublic NavAction<PlaneAspect> drag(Surface surface, Point point, int ibutt, Point origin)
Navigator
Drag gestures typically indicate panning, and in this case should
preferably have the outcome that the same data position remains
under the cursor before and after the pan (from origin
to evt.getPoint()
).
drag
in interface Navigator<PlaneAspect>
surface
- initial plot surfacepoint
- current mouse positionibutt
- logical mouse button index of dragorigin
- starting point of the drag gesturepublic NavAction<PlaneAspect> endDrag(Surface surface, Point pos, int ibutt, Point origin)
Navigator
endDrag
in interface Navigator<PlaneAspect>
surface
- initial plot surfacepos
- current mouse positionibutt
- logical mouse button index of terminated dragorigin
- starting point of drag gesturepublic NavAction<PlaneAspect> wheel(Surface surface, Point pos, int wheelrot)
Navigator
Wheel gestures usually indicate zooming, and in this case should preferably have the outcome that the same data position remains at the mouse position before and after the zoom.
wheel
in interface Navigator<PlaneAspect>
surface
- initial plot surfacepos
- current mouse positionwheelrot
- number of wheel rotation clickspublic NavAction<PlaneAspect> click(Surface surface, Point pos, int ibutt, java.util.function.Supplier<CoordSequence> dposSup)
Navigator
Note that other elements of the plotting system may intercept some mouse clicks for other purposes, so the navigator may not receive all clicks. For instance the topcat plot window currently intercepts button-1 clicks and interprets them as row selection requests. Typically this navigator method may only get invoked for modified or non-button-1 clicks.
Implementation of this gesture may require identifying
a data position from a screen position,
which is not always trivial, for instance in a 3D plot one
graphics position maps to a line of data positions.
The dposIt
argument can optionally
be supplied to cope with such instances. If a data pos cannot be
determined, null is returned. If dposIt
is absent,
the method will run quickly. If it's present, the method may or may
not run slowly by iterating over the data points.
click
in interface Navigator<PlaneAspect>
surface
- initial plot surfacepos
- current mouse positionibutt
- logical mouse button indexdposSup
- iterable over dataDimCount-element arrays
representing all the data space positions plotted,
or nullpublic Map<Gesture,String> getNavOptions(Surface surface, Point pos)
Navigator
getNavOptions
in interface Navigator<PlaneAspect>
surface
- plot surfacepos
- mouse positionpublic static boolean[] getAxisNavFlags(Surface surface, Point pos, boolean xFlag, boolean yFlag)
surface
- plotting surfacepos
- context position for mousexFlag
- whether navigation on X axis is active by defaultyFlag
- whether navigation on Y axis is active by defaultCopyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.