Class Line
java.lang.Object
org.micromanager.ndviewer.overlay.Roi
org.micromanager.ndviewer.overlay.Line
- All Implemented Interfaces:
Serializable,Cloneable
public class Line extends Roi
This class represents a straight line selection.
- See Also:
- Serialized Form
-
Field Summary
Fields Modifier and Type Field Description protected doublestartxdprotected doublestartydintx1doublex1dprotected doublex1Rintx2doublex2dprotected doublex2Rinty1doubley1dprotected doubley1Rinty2doubley2dprotected doubley2RFields inherited from class org.micromanager.ndviewer.overlay.Roi
ANGLE, asp_bk, aspect, center, clipHeight, clipWidth, clipX, clipY, COMPOSITE, constrain, CONSTRUCTING, defaultFillColor, fillColor, FREELINE, FREEROI, HANDLE_SIZE, handleColor, ignoreClipRect, instanceColor, LINE, lineWidth, mag, MOVING, MOVING_HANDLE, nonScalable, NORMAL, NOT_PASTING, oldHeight, oldWidth, oldX, oldY, onePixelWide, OVAL, overlay, POINT, POLYGON, POLYLINE, previousRoi, RECTANGLE, RESIZING, ROIColor, stroke, strokeColor, TRACED_ROI, type, updateFullWindow, wideLine, xMax, yMax -
Constructor Summary
Constructors Constructor Description Line(double ox1, double oy1, double ox2, double oy2)Creates a new straight line selection using the specified starting and ending offscreen double coordinates.Line(int ox1, int oy1, int ox2, int oy2)Creates a new straight line selection using the specified starting and ending offscreen integer coordinates. -
Method Summary
Modifier and Type Method Description protected intclipRectMargin()booleancontains(int x, int y)voiddraw(Graphics g)Draws this line on the image.protected voiddrawLine(int sx, int sy)RectanglegetBounds()Return the bounding rectangle of this line.booleangetDrawOffset()Returns true if this is a PolygonRoi that supports sub-pixel resolution and polygons are drawn on zoomed images offset down and to the right by 0.5 pixels..PolygongetPoints()Returns, as a Polygon, the two points that define this line.doublegetRawLength()Returns the length of this line in pixels.static intgetWidth()protected voidgrow(int sx, int sy)voidmouseMoved(MouseEvent e)voidsetDrawOffset(boolean drawOffset)voidsetLocation(int x, int y)Set the location of the ROI in image coordinates.voidsetStrokeWidth(float width)Sets the width of the line used to draw this ROI.static voidsetWidth(int w)booleansubPixelResolution()Always returns true.Methods inherited from class org.micromanager.ndviewer.overlay.Roi
copyAttributes, drawOverlay, enableSubPixelResolution, getAngle, getBoundingRect, getColor, getConvexHull, getCornerDiameter, getCPosition, getDebugInfo, getDefaultFillColor, getFillColor, getFloatBounds, getFloatHeight, getFloatWidth, getHashCode, getName, getPolygon, getPosition, getProperties, getProperty, getPropertyCount, getPrototypeOverlay, getRoundRectArcSize, getState, getStroke, getStrokeColor, getStrokeWidth, getTPosition, getType, getTypeAsString, getXBase, getYBase, getZPosition, isArea, isCursor, isDrawingTool, isLine, setColor, setCornerDiameter, setDefaultFillColor, setFillColor, setIgnoreClipRect, setIsCursor, setLocation, setName, setNonScalable, setPosition, setPosition, setProperty, setPrototypeOverlay, setRotationCenter, setRoundRectArcSize, setStroke, setStrokeColor, setStrokeWidth, temporarilyHide, toFloat, toInt, toInt, toIntR, toString
-
Field Details
-
x1
public int x1 -
y1
public int y1 -
x2
public int x2 -
y2
public int y2 -
x1d
public double x1d -
y1d
public double y1d -
x2d
public double x2d -
y2d
public double y2d -
x1R
protected double x1R -
y1R
protected double y1R -
x2R
protected double x2R -
y2R
protected double y2R -
startxd
protected double startxd -
startyd
protected double startyd
-
-
Constructor Details
-
Line
public Line(int ox1, int oy1, int ox2, int oy2)Creates a new straight line selection using the specified starting and ending offscreen integer coordinates. -
Line
public Line(double ox1, double oy1, double ox2, double oy2)Creates a new straight line selection using the specified starting and ending offscreen double coordinates.
-
-
Method Details
-
grow
protected void grow(int sx, int sy) -
mouseMoved
-
drawLine
protected void drawLine(int sx, int sy) -
draw
Draws this line on the image. -
getRawLength
public double getRawLength()Returns the length of this line in pixels. -
getPoints
Returns, as a Polygon, the two points that define this line. -
contains
public boolean contains(int x, int y) -
getWidth
public static int getWidth() -
setWidth
public static void setWidth(int w) -
setStrokeWidth
public void setStrokeWidth(float width)Description copied from class:RoiSets the width of the line used to draw this ROI. Set the width to 0.0 and the ROI will be drawn using a a 1 pixel stroke width regardless of the magnification.- Overrides:
setStrokeWidthin classRoi- See Also:
Roi.setStrokeColor(Color)
-
getBounds
Return the bounding rectangle of this line. -
clipRectMargin
protected int clipRectMargin()- Overrides:
clipRectMarginin classRoi
-
getDrawOffset
public boolean getDrawOffset()Description copied from class:RoiReturns true if this is a PolygonRoi that supports sub-pixel resolution and polygons are drawn on zoomed images offset down and to the right by 0.5 pixels..- Overrides:
getDrawOffsetin classRoi
-
setDrawOffset
public void setDrawOffset(boolean drawOffset)- Overrides:
setDrawOffsetin classRoi
-
subPixelResolution
public boolean subPixelResolution()Always returns true.- Overrides:
subPixelResolutionin classRoi
-
setLocation
public void setLocation(int x, int y)Description copied from class:RoiSet the location of the ROI in image coordinates.- Overrides:
setLocationin classRoi
-