public class Polyline extends ZDisplayable implements Line3D, VectorData
Displayable.DataPackage, Displayable.DoEdit, Displayable.DoEdits, Displayable.DoTransforms, Displayable.SliderListener| Modifier and Type | Field and Description |
|---|---|
protected static int |
index
Helper vars for mouse events.
|
protected int |
n_points
The number of points.
|
protected double[][] |
p
The array of clicked x,y points as [2][n].
|
protected long[] |
p_layer
The array of Layers over which the points of this pipe live
|
layer_setalpha, annotation, at, color, COMPOSITE_ADD, COMPOSITE_COLOR_YCBCR, COMPOSITE_DIFFERENCE, COMPOSITE_MULTIPLY, COMPOSITE_NORMAL, COMPOSITE_SUBTRACT, compositeModes, height, hs_linked, last_color, layer, linked_props, linked_props_origins, locked, props, TAG_ATTR1, TAG_ATTR2, title, visible, width| Constructor and Description |
|---|
Polyline(Project project,
long id,
HashMap<String,String> ht_attr,
HashMap<Displayable,String> ht_links)
Reconstruct from XML.
|
Polyline(Project project,
long id,
String title,
float width,
float height,
float alpha,
boolean visible,
Color color,
boolean locked,
AffineTransform at) |
Polyline(Project project,
String title)
New empty Polyline.
|
| Modifier and Type | Method and Description |
|---|---|
protected int |
addPoint(int x_p,
int y_p,
long layer_id,
double magnification)
Add a point either at the end or between two existing points, with accuracy depending on magnification.
|
protected int |
appendPoint(int x_p,
int y_p,
long layer_id)
Append a point at the end.
|
protected void |
appendPoints(double[] px,
double[] py,
long[] p_layer_ids,
int len) |
boolean |
apply(Layer la,
Area roi,
CoordinateTransform ict)
Applies the 2D transform @ict (which is expected to operate on the
world coordinates version of the data contained here) only to the
data that falls within the @param roi (in world coords), and then
recomputes the bounding box and affine transform (to a translation
or identity).
|
boolean |
apply(VectorDataTransform vdt) |
VectorString3D |
asVectorString3D()
Returns a non-calibrated VectorString3D.
|
protected boolean |
calculateBoundingBox(boolean adjust_position,
Layer la) |
protected boolean |
calculateBoundingBox(Layer la) |
protected double[] |
calculateDataBoundingBox()
Returns min_x, min_y, max_x, max_y.
|
Displayable |
clone(Project pr,
boolean copy_id)
Performs a deep copy of this object, without the links.
|
boolean |
contains(Layer layer,
double x,
double y)
Calls contains(x_p, y_p) unless overriden -- in ZDisplayable objects, it tests whether the given point is contained in the part of the ZDisplayable that shows in the given layer.
|
protected boolean |
containsLocal(Layer layer,
double x,
double y,
double radius) |
boolean |
crop(List<Layer> range)
Retain the data within the layer range, and through out all the rest.
|
void |
destroy()
Release all memory resources taken by this object.
|
void |
dragPoint(int index,
int dx,
int dy)
Move backbone point by the given deltas.
|
protected void |
enlargeArrays()
Increase the size of the arrays by 5.
|
protected void |
enlargeArrays(int n_more) |
static void |
exportDTD(StringBuilder sb_header,
HashSet<String> hs,
String indent)
Exports to type t2_polyline.
|
void |
exportXML(StringBuilder sb_body,
String indent,
XMLOptions options)
Exports data.
|
protected int |
findClosestSegment(int x_p,
int y_p,
long layer_id,
double mag)
Returns the index of the first point in the segment made of any two consecutive points.
|
protected int |
findNearestPoint(int x_p,
int y_p,
long layer_id)
Find closest point within the current layer.
|
protected int |
findPoint(int x_p,
int y_p,
long layer_id,
double mag)
Find a point in an array, with a precision dependent on the magnification.
|
void |
flush()
Release memory resources used by this object: namely the arrays of points, which can be reloaded with a call to setupForDisplay()
|
static void |
flushTraceCache(Project project) |
List<Point3f> |
generateTriangles(double scale,
int parallels,
int resample)
Calibrated.
|
List<Point3f> |
generateTriangles(double scale,
int parallels,
int resample,
ij.measure.Calibration cal)
Returns a list of Point3f that define a polyline in 3D, for usage with an ij3d CustomLineMesh CONTINUOUS.
|
Area |
getAreaAt(Layer layer)
A little square for each pixel in @param layer.
|
Layer |
getFirstLayer()
Returns the layer of lowest Z coordinate where this ZDisplayable has a point in, or the creation layer if no points yet.
|
String |
getInfo()
Returns id and project name; this method is meant to be overriden by any of the subclasses.
|
Collection<Long> |
getLayerIds()
Get the list of Layer ids on which this ZDisplayable has data on.
|
Polygon |
getPerimeter()
The exact perimeter of this polyline, in integer precision.
|
void |
insertPoint(int i,
int x_p,
int y_p,
long layer_id) |
boolean |
intersects(Area area,
double z_first,
double z_last) |
boolean |
isDeletable() |
boolean |
isRoughlyInside(Layer layer,
Rectangle r)
If this Displayable intersects with @param r or almost intersects, then returns true.
|
void |
keyPressed(KeyEvent ke) |
protected boolean |
layerRemoved(Layer la)
Update internal datastructures to reflect the fact that @param layer has been removed from the containing LayerSet.
|
int |
length()
The number of points in this pipe.
|
boolean |
linkPatches()
Link the Patch objects that lay underneath the part of the bounding box of this profile that shows in the current layer, so that they cannot be dragged independently.
|
ij.measure.ResultsTable |
measure(ij.measure.ResultsTable rt)
Does nothing unless overriden.
|
void |
mouseDragged(MouseEvent me,
Layer layer,
int x_p,
int y_p,
int x_d,
int y_d,
int x_d_old,
int y_d_old) |
void |
mousePressed(MouseEvent me,
Layer layer,
int x_p,
int y_p,
double mag) |
void |
mouseReleased(MouseEvent me,
Layer layer,
int x_p,
int y_p,
int x_d,
int y_d,
int x_r,
int y_r) |
void |
paint(Graphics2D g,
Rectangle srcRect,
double magnification,
boolean active,
int channels,
Layer active_layer,
List<Layer> layers) |
protected void |
removePoint(int index)
Remove a point from the bezier backbone and its two associated control points.
|
void |
repaint(boolean repaint_navigator,
Layer la)
Repaints in the given ImageCanvas only the area corresponding to the bounding box of this Pipe.
|
void |
reverse() |
static Object[] |
simplify(double[] px,
double[] py,
long[] p_layer_ids,
int max_iterations,
LayerSet layer_set)
Resample the curve to, first, a number of points as resulting from resampling to a point interdistance of delta, and second, as adjustment by random walk of those points towards the original points.
|
protected double[] |
sqDistanceToEndPoints(double x_p,
double y_p,
long layer_id) |
Polyline |
sub(int start,
int end)
Create a shorter Polyline, from start to end (inclusive); not added to the LayerSet.
|
exportDTD, getBucketable, getLayerSet, paintsAt, remove, remove2, setColor, setLayer, setLayerSet, setLayerSet, setVisible, softRemove, transformPoints, updateBucket, updateBucketadjustProperties, areThereLayerCrossLinks, canSendTo, clone, clone, commonDTDChildren, contains, deselect, displacePoints, exportSVG, findById, findNearestPoint, findNearestPoint, getAffineTransform, getAffineTransformCopy, getAlpha, getAnnotation, getArea, getAreaForBucket, getBoundingBox, getBoundingBox, getBoundingBox, getBounds, getBounds, getColor, getComposite, getComposite, getCompositeMode, getHeight, getIntersection, getLayer, getLayersWithData, getLinked, getLinked, getLinkedBox, getLinkedGroup, getLinkedProperties, getLinkedProperties, getLinkedProperty, getLinkedProperty, getMinimalBoundingBox, getNameId, getPerimeter, getProperties, getProperty, getProperty, getShortTitle, getTitle, getWidth, getX, getXMLSafeValue, getXMLSafeValue, getY, hasLinkedGroupWithinLayer, hasProperties, intersects, intersects, intersects, intersects, inverseTransformPoint, isLinked, isLinked, isLinked, isLocked, isLocked2, isOnlyLinkedTo, isOnlyLinkedTo, isOutOfRepaintingClip, isOutOfRepaintingClip, isVisible, link, link, makeAdjustPropertiesDialog, mouseWheelMoved, paintAsBox, paintOffscreen, paintSnapshot, preConcatenate, prePaint, preTransform, processAdjustPropertiesDialog, removeLinkedProperties, removeLinkedPropertiesFromOrigins, repaint, restXML, rotate, rotate, rotatePoints, scale, scale, scalePoints, setAffineTransform, setAlpha, setAlpha, setAnnotation, setCompositeMode, setDimensions, setDimensions, setLayer, setLinkedProperties, setLinkedProperty, setLocation, setLocked, setProperty, setTitle, setVisible, snapTo, toString, transform, transformPoint, transformPoint, transformPoints, transformPoints, transformPoints, transformPoints, transformPoints, transformPoints, transformPoints, transformPoints, transformPoints, transformRectangle, translate, translate, unlink, unlink, unlinkAll, updateInDatabase, xmlError, xmlErroraddToDatabase, getId, getProject, getUniqueIdentifier, removeFromDatabase, updateInDatabaseequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetColor, getId, getLayerSet, getProject, toStringprotected int n_points
protected double[][] p
protected long[] p_layer
protected static int index
public Polyline(Project project, long id, String title, float width, float height, float alpha, boolean visible, Color color, boolean locked, AffineTransform at)
protected void enlargeArrays()
protected void enlargeArrays(int n_more)
protected int findClosestSegment(int x_p,
int y_p,
long layer_id,
double mag)
protected int findPoint(int x_p,
int y_p,
long layer_id,
double mag)
protected int findNearestPoint(int x_p,
int y_p,
long layer_id)
protected void removePoint(int index)
public void dragPoint(int index,
int dx,
int dy)
protected double[] sqDistanceToEndPoints(double x_p,
double y_p,
long layer_id)
x_p,y_p - in local coords.public void insertPoint(int i,
int x_p,
int y_p,
long layer_id)
protected int appendPoint(int x_p,
int y_p,
long layer_id)
protected int addPoint(int x_p,
int y_p,
long layer_id,
double magnification)
protected void appendPoints(double[] px,
double[] py,
long[] p_layer_ids,
int len)
public void paint(Graphics2D g, Rectangle srcRect, double magnification, boolean active, int channels, Layer active_layer, List<Layer> layers)
paint in interface Paintablepaint in class Displayablepublic void keyPressed(KeyEvent ke)
keyPressed in class Displayablepublic static void flushTraceCache(Project project)
public void mousePressed(MouseEvent me, Layer layer, int x_p, int y_p, double mag)
mousePressed in class Displayablepublic void mouseDragged(MouseEvent me, Layer layer, int x_p, int y_p, int x_d, int y_d, int x_d_old, int y_d_old)
mouseDragged in class Displayablepublic void mouseReleased(MouseEvent me, Layer layer, int x_p, int y_p, int x_d, int y_d, int x_r, int y_r)
mouseReleased in class Displayableprotected boolean calculateBoundingBox(Layer la)
calculateBoundingBox in class ZDisplayableprotected boolean calculateBoundingBox(boolean adjust_position,
Layer la)
protected double[] calculateDataBoundingBox()
public void destroy()
destroy in class Displayablepublic void flush()
public void repaint(boolean repaint_navigator,
Layer la)
public Polygon getPerimeter()
getPerimeter in class Displayablepublic Area getAreaAt(Layer layer)
getAreaAt in class Displayablepublic boolean isRoughlyInside(Layer layer, Rectangle r)
DisplayableisRoughlyInside in class Displayablepublic boolean isDeletable()
isDeletable in class Displayablepublic int length()
public boolean contains(Layer layer, double x, double y)
Displayablecontains in class Displayableprotected boolean containsLocal(Layer layer, double x, double y, double radius)
public boolean linkPatches()
ZDisplayablelinkPatches in class ZDisplayablepublic Layer getFirstLayer()
getFirstLayer in class ZDisplayablepublic void exportXML(StringBuilder sb_body, String indent, XMLOptions options)
exportXML in class ZDisplayablepublic static void exportDTD(StringBuilder sb_header, HashSet<String> hs, String indent)
public Displayable clone(Project pr, boolean copy_id)
clone in class Displayablepublic List<Point3f> generateTriangles(double scale, int parallels, int resample)
generateTriangles in interface Line3Dpublic List<Point3f> generateTriangles(double scale, int parallels, int resample, ij.measure.Calibration cal)
public boolean intersects(Area area, double z_first, double z_last)
intersects in class ZDisplayablepublic VectorString3D asVectorString3D()
asVectorString3D in interface Line3Dpublic String getInfo()
DBObjectpublic ij.measure.ResultsTable measure(ij.measure.ResultsTable rt)
Displayablemeasure in class Displayablepublic static Object[] simplify(double[] px, double[] py, long[] p_layer_ids, int max_iterations, LayerSet layer_set) throws Exception
Exceptionpublic boolean crop(List<Layer> range)
crop in class ZDisplayablepublic Polyline sub(int start, int end)
public void reverse()
protected boolean layerRemoved(Layer la)
ZDisplayablelayerRemoved in class ZDisplayablepublic boolean apply(Layer la, Area roi, CoordinateTransform ict) throws Exception
VectorDataapply in interface VectorDatala - Only data at this Layer may be transformed.roi - Only data inside this world-coordinates Area may be transformed.ict - The transform to apply to the data that is in @param la and within @param roi.Exceptionpublic boolean apply(VectorDataTransform vdt) throws Exception
apply in interface VectorDataExceptionpublic Collection<Long> getLayerIds()
ZDisplayablegetLayerIds in class ZDisplayableCopyright © 2015–2021 Fiji. All rights reserved.