-
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
DefaultSelectionZoomStrategy
public interface SelectionZoomStrategy extends Serializable
A strategy for zooming plots on the chart panel by selecting a smaller region on the initial screen. SeeChartPanel.setSelectionZoomStrategy(SelectionZoomStrategy)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voiddrawZoomRectangle(Graphics2D g2, boolean xor)Draws zoom rectangle (if present).booleangetFillZoomRectangle()Returns the flag that controls whether or not the zoom rectangle is filled when drawn.PaintgetZoomFillPaint()Returns the zoom rectangle fill paint.PaintgetZoomOutlinePaint()Returns the zoom rectangle outline paint.Point2DgetZoomPoint()The zoom rectangle starting point (selected by the user with a mouse click).Rectangle2DgetZoomRectangle(boolean hZoom, boolean vZoom, Rectangle2D screenDataArea)Creates and returns current zoom rectangleintgetZoomTriggerDistance()Returns the zoom trigger distance.booleanisActivated()If controller currently tracking zoom rectanglevoidreset()Removes zoom rectanglevoidsetFillZoomRectangle(boolean flag)A flag that controls how the zoom rectangle is drawn.voidsetZoomFillPaint(Paint paint)Sets the zoom rectangle fill paint.voidsetZoomOutlinePaint(Paint paint)Sets the zoom rectangle outline paint.voidsetZoomPoint(Point2D zoomPoint)voidsetZoomTriggerDistance(int distance)Sets the zoom trigger distance.voidupdateZoomRectangleSelection(MouseEvent e, boolean hZoom, boolean vZoom, Rectangle2D scaledDataArea)Updates zoom rectangle with new mouse position
-
-
-
Method Detail
-
isActivated
boolean isActivated()
If controller currently tracking zoom rectangle- Returns:
trueif zoomRectangle exists for this controller andfalseotherwise
-
getZoomPoint
Point2D getZoomPoint()
The zoom rectangle starting point (selected by the user with a mouse click). This is a point on the screen, not the chart (which may have been scaled up or down to fit the panel).
-
setZoomPoint
void setZoomPoint(Point2D zoomPoint)
-
setZoomTriggerDistance
void setZoomTriggerDistance(int distance)
Sets the zoom trigger distance. This controls how far the mouse must move before a zoom action is triggered.- Parameters:
distance- the distance (in Java2D units).
-
getZoomTriggerDistance
int getZoomTriggerDistance()
Returns the zoom trigger distance. This controls how far the mouse must move before a zoom action is triggered.- Returns:
- The distance (in Java2D units).
-
getZoomOutlinePaint
Paint getZoomOutlinePaint()
Returns the zoom rectangle outline paint.- Returns:
- The zoom rectangle outline paint (never
null). - See Also:
setZoomOutlinePaint(java.awt.Paint),setFillZoomRectangle(boolean)
-
setZoomOutlinePaint
void setZoomOutlinePaint(Paint paint)
Sets the zoom rectangle outline paint.- Parameters:
paint- the paint (nullnot permitted).- See Also:
getZoomOutlinePaint(),getFillZoomRectangle()
-
getZoomFillPaint
Paint getZoomFillPaint()
Returns the zoom rectangle fill paint.- Returns:
- The zoom rectangle fill paint (never
null). - See Also:
setZoomFillPaint(Paint),setFillZoomRectangle(boolean)
-
setZoomFillPaint
void setZoomFillPaint(Paint paint)
Sets the zoom rectangle fill paint.- Parameters:
paint- the paint (nullnot permitted).- See Also:
getZoomFillPaint(),getFillZoomRectangle()
-
getFillZoomRectangle
boolean getFillZoomRectangle()
Returns the flag that controls whether or not the zoom rectangle is filled when drawn.- Returns:
- A boolean.
-
setFillZoomRectangle
void setFillZoomRectangle(boolean flag)
A flag that controls how the zoom rectangle is drawn.- Parameters:
flag-trueinstructs to fill the rectangle on zoom, otherwise it will be outlined.
-
updateZoomRectangleSelection
void updateZoomRectangleSelection(MouseEvent e, boolean hZoom, boolean vZoom, Rectangle2D scaledDataArea)
Updates zoom rectangle with new mouse position- Parameters:
e- mouse eventhZoom- if horizontal zoom allowedvZoom- if vertical zoom allowedscaledDataArea- plot area in screen coordinates
-
getZoomRectangle
Rectangle2D getZoomRectangle(boolean hZoom, boolean vZoom, Rectangle2D screenDataArea)
Creates and returns current zoom rectangle- Parameters:
hZoom- if horizontal zoom acceptablevZoom- if vertical zoom acceptablescreenDataArea- rectangle that describes plot on the screen- Returns:
- rectangle in java2d screen coordinates selected by user
-
reset
void reset()
Removes zoom rectangle
-
drawZoomRectangle
void drawZoomRectangle(Graphics2D g2, boolean xor)
Draws zoom rectangle (if present). The drawing is performed in XOR mode, therefore when this method is called twice in a row, the second call will completely restore the state of the canvas.- Parameters:
g2- the graphics device.xor- use XOR for drawing?
-
-