public class MeasureBand extends DragInteractor
Modifier and Type | Field and Description |
---|---|
protected MouseFilter |
dragFilter
Used to filter mouse events
|
protected EventLayer |
eventLayer |
protected FigureLayer |
figureLayer |
protected DivaGraphicsImageDisplay |
imageDisplay
The image display that we are drawing on
|
protected CompositeFigure |
mband |
protected BasicFigure |
mbandAngle
Angle lines (horizontal and vertical)
|
protected BasicFigure |
mbandDiagRect
box around diagonal label
|
protected LabelFigure |
mbandDiagText
The diagonal label
|
protected BasicFigure |
mbandHeightRect
box around height label
|
protected LabelFigure |
mbandHeightText
The height label
|
protected BasicFigure |
mbandLine
Diagonal line with arrows
|
protected BasicFigure |
mbandWidthRect
box around width label
|
protected LabelFigure |
mbandWidthText
The width label
|
protected NumberFormat |
nf
Used to format values as strings.
|
protected double |
originX |
protected double |
originY |
Constructor and Description |
---|
MeasureBand(DivaGraphicsImageDisplay imageDisplay)
Create a new MeasureBand attached to the given graphics
pane.
|
Modifier and Type | Method and Description |
---|---|
String |
formatHM(double val) |
protected Rectangle2D |
getBoundsWithPadding(LabelFigure fig)
Return the bounds of the given label with padding
|
EventLayer |
getEventLayer()
Get the layer that drag events are listened on
|
FigureLayer |
getFigureLayer()
Get the layer that figures are selected on
|
static void |
main(String[] args)
test main: usage: java GraphicsImageDisplay
|
void |
mouseDragged(LayerEvent event)
Reshape the rubber-band, swapping coordinates if necessary.
|
void |
mousePressed(LayerEvent event)
Clear the selection, and create the rubber-band
|
void |
mouseReleased(LayerEvent event)
Delete the rubber-band
|
void |
setEnabled(boolean enabled)
Set the enabled state.
|
void |
setEventLayer(EventLayer l)
Set the layer that drag events are listened on
|
void |
setFigureLayer(FigureLayer l)
Set the layer that figures are selected on
|
protected void |
updateMBand(double x0,
double y0,
double x1,
double y1,
boolean showAngle)
Update the measure band.
|
addLayerListener, appendConstraint, constrainPoint, fireLayerEvent, getSelectiveEnabled, getTargetArray, getX, getY, prependConstraint, removeLayerListener, setSelectiveEnabled, setTargetArray, setup, targets, translate
accept, getMouseFilter, isConsuming, isEnabled, isMotionEnabled, mouseClicked, mouseEntered, mouseExited, mouseMoved, setConsuming, setMotionEnabled, setMouseFilter
protected DivaGraphicsImageDisplay imageDisplay
protected FigureLayer figureLayer
protected EventLayer eventLayer
protected CompositeFigure mband
protected BasicFigure mbandLine
protected BasicFigure mbandAngle
protected BasicFigure mbandWidthRect
protected BasicFigure mbandHeightRect
protected BasicFigure mbandDiagRect
protected LabelFigure mbandWidthText
protected LabelFigure mbandHeightText
protected LabelFigure mbandDiagText
protected double originX
protected double originY
protected MouseFilter dragFilter
protected NumberFormat nf
public MeasureBand(DivaGraphicsImageDisplay imageDisplay)
public FigureLayer getFigureLayer()
public EventLayer getEventLayer()
public void setFigureLayer(FigureLayer l)
public void setEventLayer(EventLayer l)
public void setEnabled(boolean enabled)
setEnabled
in interface Interactor
setEnabled
in class AbstractInteractor
public void mousePressed(LayerEvent event)
mousePressed
in interface LayerListener
mousePressed
in class DragInteractor
public void mouseDragged(LayerEvent event)
mouseDragged
in interface LayerListener
mouseDragged
in class DragInteractor
public void mouseReleased(LayerEvent event)
mouseReleased
in interface LayerListener
mouseReleased
in class DragInteractor
public String formatHM(double val)
protected void updateMBand(double x0, double y0, double x1, double y1, boolean showAngle)
x0
- the X screen coordinate of the starting point of the dragy0
- the Y screen coordinate of the starting point of the dragx1
- the X screen coordinate of the mouse pointery1
- the Y screen coordinate of the mouse pointershowAngle
- if true, show the mbandAngle item, otherwise only the diagonal line.protected Rectangle2D getBoundsWithPadding(LabelFigure fig)
public static void main(String[] args)
Copyright © 2023 Central Laboratory of the Research Councils. All Rights Reserved.