public class Pipe extends ZDisplayable implements Line3D, VectorData
Displayable.DataPackage, Displayable.DoEdit, Displayable.DoEdits, Displayable.DoTransforms, Displayable.SliderListener
Modifier and Type | Field and Description |
---|---|
protected int |
n_points
The number of points.
|
protected double[][] |
p
The array of clicked points.
|
protected double[][] |
p_i
The array of interpolated points generated from p, p_l and p_r.
|
protected double[][] |
p_l
The array of left control points, one for each clicked point.
|
protected long[] |
p_layer
The array of Layers over which the points of this pipe live
|
protected double[][] |
p_r
The array of right control points, one for each clicked point.
|
protected double[] |
p_width
The width of each point.
|
protected double[] |
p_width_i
The interpolated width for each interpolated point.
|
layer_set
alpha, 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 |
---|
Pipe(Project project,
long id,
HashMap<String,String> ht,
HashMap<Displayable,String> ht_links)
Construct a Pipe from an XML entry.
|
Pipe(Project project,
long id,
String title,
float width,
float height,
float alpha,
boolean visible,
Color color,
boolean locked,
AffineTransform at)
Construct an unloaded Pipe from the database.
|
Pipe(Project project,
String title,
double x,
double y) |
Modifier and Type | Method and Description |
---|---|
protected int |
addPoint(int x_p,
int y_p,
double magnification,
double bezier_finess,
long layer_id)
Add a point either at the end or between two existing points, with accuracy depending on magnification.
|
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) |
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)
Test whether the Pipe contains the given point at the given layer.
|
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.
|
static double |
distance(double x1,
double y1,
double x2,
double y2)
Calculate distance from one point to another.
|
protected void |
dragControlPoint(int index,
int x_d,
int y_d,
double[][] p_dragged,
double[][] p_adjusted,
boolean symmetric)
Drag a control point and adjust the other, dependent one, in a symmetric way or not.
|
protected void |
dragPoint(int index,
int dx,
int dy)
Move backbone point by the given deltas.
|
static void |
exportDTD(StringBuilder sb_header,
HashSet<String> hs,
String indent) |
void |
exportSVG(StringBuffer data,
double z_scale,
String indent)
Does nothing unless overriden.
|
void |
exportXML(StringBuilder sb_body,
String indent,
XMLOptions options)
Exports data, the tag is not opened nor closed.
|
protected int |
findClosestPoint(int x_p,
int y_p,
double magnification,
double bezier_finess)
Find the closest point to an interpolated point with precision depending upon magnification.
|
protected int |
findPoint(double[][] a,
long[] p_layer,
int x_p,
int y_p,
long lid,
double magnification)
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()
|
protected void |
generateInterpolatedPoints(double bezier_finess) |
double[][][] |
generateMesh(double scale) |
static List<Point3f> |
generateTriangles(double[][][] all_points,
double scale)
Accepts an arrays as that returned from methods generateJoints and makeTube: first dimension is the list of points, second dimension is the number of vertices defining the circular cross section of the tube, and third dimension is the x,y,z of each vertex.
|
List<Point3f> |
generateTriangles(double scale,
int parallels,
int resample)
Calibrated.
|
Area |
getAreaAt(Layer layer)
This area is meant to represent the entire area where a Displayable paints to in the @param layer.
|
double[][] |
getBackbone()
Returns a [p_i[0].length][4] array, with x,y,z,radius on the second part.
|
Rectangle |
getBounds(Rectangle r,
Layer layer)
Returns the bounds of this object as it shows in the given layer, set into @param r.
|
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 pipe, in integer precision.
|
String[] |
getPointsForSQL()
Return the list of query statements needed to insert all the points in the database.
|
String |
getUpdatePointForSQL(int index) |
boolean |
intersects(Area area,
double z_first,
double z_last) |
boolean |
intersects(Layer layer,
Area area)
Expects Area in world coords.
|
boolean |
intersects(Layer layer,
Rectangle r)
Expects Rectangle in world coords.
|
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 clicked, backbone points in this pipe.
|
boolean |
linkPatches()
Scan the Display and link Patch objects that lay under this Pipe's bounding box.
|
static double[][][] |
makeTube(double[] px,
double[] py,
double[] pz,
double[] p_width_i,
int resample,
int parallels,
ij.measure.Calibration cal) |
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.
|
protected void |
resetControlPoints(int index)
Set the control points to the same value as the backbone point which they control.
|
void |
reverse()
Reverses the order of the points in the arrays.
|
void |
snapTo(int cx,
int cy,
int x_p,
int y_p)
x,y is the cursor position in offscreen coordinates.
|
void |
toShapesFile(StringBuffer data,
String group,
String color,
double z_scale)
Writes the data of this object as a Pipe object in the .shapes file represented by the 'data' StringBuffer.
|
exportDTD, getBucketable, getLayerSet, paintsAt, remove, remove2, setColor, setLayer, setLayerSet, setLayerSet, setVisible, softRemove, transformPoints, updateBucket, updateBucket
adjustProperties, areThereLayerCrossLinks, canSendTo, clone, clone, commonDTDChildren, contains, deselect, displacePoints, findById, findNearestPoint, findNearestPoint, getAffineTransform, getAffineTransformCopy, getAlpha, getAnnotation, getArea, getAreaForBucket, getBoundingBox, getBoundingBox, getBoundingBox, 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, 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, toString, transform, transformPoint, transformPoint, transformPoints, transformPoints, transformPoints, transformPoints, transformPoints, transformPoints, transformPoints, transformPoints, transformPoints, transformRectangle, translate, translate, unlink, unlink, unlinkAll, updateInDatabase, xmlError, xmlError
addToDatabase, getId, getProject, getUniqueIdentifier, removeFromDatabase, updateInDatabase
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getColor, getId, getLayerSet, getProject, toString
protected int n_points
protected double[][] p
protected double[][] p_l
protected double[][] p_r
protected double[][] p_i
protected long[] p_layer
protected double[] p_width
protected double[] p_width_i
public Pipe(Project project, long id, String title, float width, float height, float alpha, boolean visible, Color color, boolean locked, AffineTransform at)
protected int findPoint(double[][] a, long[] p_layer, int x_p, int y_p, long lid, double magnification)
protected void removePoint(int index)
public static double distance(double x1, double y1, double x2, double y2)
protected void dragPoint(int index, int dx, int dy)
protected void resetControlPoints(int index)
protected void dragControlPoint(int index, int x_d, int y_d, double[][] p_dragged, double[][] p_adjusted, boolean symmetric)
protected int addPoint(int x_p, int y_p, double magnification, double bezier_finess, long layer_id)
protected int findClosestPoint(int x_p, int y_p, double magnification, double bezier_finess)
protected void generateInterpolatedPoints(double bezier_finess)
public void paint(Graphics2D g, Rectangle srcRect, double magnification, boolean active, int channels, Layer active_layer, List<Layer> layers)
paint
in interface Paintable
paint
in class Displayable
public void keyPressed(KeyEvent ke)
keyPressed
in class Displayable
public void mousePressed(MouseEvent me, Layer layer, int x_p, int y_p, double mag)
mousePressed
in class Displayable
public 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 Displayable
public 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 Displayable
protected boolean calculateBoundingBox(Layer la)
calculateBoundingBox
in class ZDisplayable
protected boolean calculateBoundingBox(boolean adjust_position, Layer la)
public void destroy()
destroy
in class Displayable
public void flush()
public void repaint(boolean repaint_navigator, Layer la)
public Polygon getPerimeter()
getPerimeter
in class Displayable
public void toShapesFile(StringBuffer data, String group, String color, double z_scale)
public String[] getPointsForSQL()
public String getUpdatePointForSQL(int index)
public boolean isDeletable()
isDeletable
in class Displayable
public int length()
public boolean contains(Layer layer, double x, double y)
contains
in class Displayable
public boolean linkPatches()
linkPatches
in class ZDisplayable
public Layer getFirstLayer()
getFirstLayer
in class ZDisplayable
public void exportSVG(StringBuffer data, double z_scale, String indent)
Displayable
exportSVG
in class Displayable
public double[][] getBackbone()
public void snapTo(int cx, int cy, int x_p, int y_p)
snapTo
in class Displayable
public void exportXML(StringBuilder sb_body, String indent, XMLOptions options)
exportXML
in class ZDisplayable
public static void exportDTD(StringBuilder sb_header, HashSet<String> hs, String indent)
public double[][][] generateMesh(double scale)
public Displayable clone(Project pr, boolean copy_id)
clone
in class Displayable
public List<Point3f> generateTriangles(double scale, int parallels, int resample)
generateTriangles
in interface Line3D
public static List<Point3f> generateTriangles(double[][][] all_points, double scale)
public static double[][][] makeTube(double[] px, double[] py, double[] pz, double[] p_width_i, int resample, int parallels, ij.measure.Calibration cal)
public VectorString3D asVectorString3D()
asVectorString3D
in interface Line3D
public String getInfo()
DBObject
public boolean intersects(Area area, double z_first, double z_last)
intersects
in class ZDisplayable
area
- is expected in world coordinates.public boolean intersects(Layer layer, Rectangle r)
intersects
in class Displayable
public boolean intersects(Layer layer, Area area)
intersects
in class Displayable
public Rectangle getBounds(Rectangle r, Layer layer)
getBounds
in class Displayable
public ij.measure.ResultsTable measure(ij.measure.ResultsTable rt)
Displayable
measure
in class Displayable
public void reverse()
public boolean crop(List<Layer> range)
crop
in class ZDisplayable
protected boolean layerRemoved(Layer la)
ZDisplayable
layerRemoved
in class ZDisplayable
public boolean apply(Layer la, Area roi, CoordinateTransform ict) throws Exception
VectorData
apply
in interface VectorData
la
- 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.Exception
public boolean apply(VectorDataTransform vdt) throws Exception
apply
in interface VectorData
Exception
public Collection<Long> getLayerIds()
ZDisplayable
getLayerIds
in class ZDisplayable
public Area getAreaAt(Layer layer)
Displayable
getAreaAt
in class Displayable
public boolean isRoughlyInside(Layer layer, Rectangle r)
Displayable
isRoughlyInside
in class Displayable
Copyright © 2015–2021 Fiji. All rights reserved.