public class Ball extends ZDisplayable implements 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 long[] |
p_layer
The array of Layers over which each point lives
|
protected double[] |
p_width
The width of each point.
|
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 |
|---|
Ball(Project project,
long id,
HashMap<String,String> ht,
HashMap<Displayable,String> ht_links)
Construct a Ball from an XML entry.
|
Ball(Project project,
long id,
String title,
float width,
float height,
float alpha,
boolean visible,
Color color,
boolean locked,
AffineTransform at)
Construct an unloaded Ball from the database.
|
Ball(Project project,
String title,
double x,
double y) |
| Modifier and Type | Method and Description |
|---|---|
void |
addBall(double x,
double y,
double r,
long layer_id)
Used to add individual ball objects when parsing.
|
protected int |
addPoint(double x_p,
double y_p,
long layer_id,
double radius)
Add a point either at the end or between two existing points, with accuracy depending on magnification.
|
void |
adjustProperties()
Shows a dialog to adjust properties of this object.
|
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) |
List<Point3f> |
asWorldPoints()
Returns a Point3f for every x,y,z ball, in calibrated world space.
|
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 Ball contains the given point at the given layer.
|
boolean |
crop(List<Layer> range)
Retain the data within the layer range, and throw out all the rest.
|
void |
destroy()
Release all memory resources taken by this object.
|
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)
Similar to exportSVG but the layer_id is saved instead of the z.
|
protected int |
findPoint(double[][] a,
int x_p,
int y_p,
double magnification,
long lid)
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 double[][][] |
generateGlobe(int meridians,
int parallels)
Generate a globe of radius 1.0 that can be used for any Ball.
|
List<Point3f> |
generateTriangles(double scale,
double[][][] globe)
Put all balls as a single 'mesh'; the returned list contains all faces as three consecutive Point3f.
|
Area |
getAreaAt(Layer layer)
This area is meant to represent the entire area where a Displayable paints to in the @param layer.
|
double[][] |
getBalls()
Returns a [n_points][4] array, with x,y,z,radius on the second part; not transformed, but local!
To obtain balls in world coordinates, calibrated, use getWorldBalls().
|
int |
getCount()
Return the number of balls.
|
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 information on the number of ball objects per layer.
|
Collection<Long> |
getLayerIds()
Get the list of Layer ids on which this ZDisplayable has data on.
|
Polygon |
getPerimeter()
The exact perimeter of this Ball, in integer precision.
|
String[] |
getPointsForSQL()
Return the list of query statements needed to insert all the points in the database.
|
Map<Layer,double[]> |
getRawBalls()
Returns the raw data for the balls, sorted by Layer ID versus double[]{z,y,r} .
|
double[][] |
getWorldBalls()
Returns a [n_points][4] array, with x,y,z,radius on the second part, in world coordinates (that is, transformed with this AffineTransform and calibrated with the containing LayerSet's calibration).
|
boolean |
intersects(Area area,
double z_first,
double z_last) |
boolean |
isDeletable() |
protected 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.
|
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)
Returns a listing of all balls contained here, one per row with index, x, y, z, and radius, all calibrated.
|
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) |
boolean |
paintsAt(Layer layer)
Check if this instance will paint anything at the level of the given Layer.
|
protected void |
removePoint(int index)
Remove a point.
|
void |
repaint(boolean repaint_navigator,
Layer layer)
Repaints in the given ImageCanvas only the area corresponding to the bounding box of this Profile.
|
void |
set(int i,
double x,
double y,
Layer la,
double radius)
Set the x,y,radius raw pixel values for the ball at index i.
|
void |
setRadius(int i,
double radius)
Set the radius (raw pixel value) for the ball at index i.
|
void |
toShapesFile(StringBuffer data,
String group,
String color,
double z_scale)
Writes the data of this object as a Ball object in the .shapes file represented by the 'data' StringBuffer.
|
exportDTD, getBucketable, getLayerSet, remove, remove2, setColor, setLayer, setLayerSet, setLayerSet, setVisible, softRemove, transformPoints, updateBucket, updateBucketareThereLayerCrossLinks, canSendTo, clone, clone, commonDTDChildren, contains, deselect, displacePoints, 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, updateInDatabaseprotected int n_points
protected double[][] p
protected long[] p_layer
protected double[] p_width
public Ball(Project project, long id, String title, float width, float height, float alpha, boolean visible, Color color, boolean locked, AffineTransform at)
public void addBall(double x,
double y,
double r,
long layer_id)
protected int findPoint(double[][] a,
int x_p,
int y_p,
double magnification,
long lid)
protected void removePoint(int index)
protected int addPoint(double x_p,
double y_p,
long layer_id,
double radius)
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 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 ZDisplayablepublic void destroy()
destroy in class Displayablepublic void repaint(boolean repaint_navigator,
Layer layer)
public void flush()
public Polygon getPerimeter()
getPerimeter in class Displayablepublic void toShapesFile(StringBuffer data, String group, String color, double z_scale)
public String[] getPointsForSQL()
public boolean isDeletable()
isDeletable in class Displayablepublic boolean contains(Layer layer, double x, double y)
contains in class Displayablepublic boolean linkPatches()
ZDisplayablelinkPatches in class ZDisplayablepublic Layer getFirstLayer()
getFirstLayer in class ZDisplayablepublic Map<Layer,double[]> getRawBalls()
public double[][] getBalls()
public double[][] getWorldBalls()
public List<Point3f> asWorldPoints()
public void exportSVG(StringBuffer data, double z_scale, String indent)
DisplayableexportSVG in class Displayablepublic 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 boolean paintsAt(Layer layer)
ZDisplayablepaintsAt in class ZDisplayablepublic String getInfo()
public Displayable clone(Project pr, boolean copy_id)
clone in class Displayablepublic static double[][][] generateGlobe(int meridians,
int parallels)
public List<Point3f> generateTriangles(double scale, double[][][] globe)
public boolean intersects(Area area, double z_first, double z_last)
intersects in class ZDisplayablearea - is expected in world coordinates.public Area getAreaAt(Layer layer)
DisplayablegetAreaAt in class Displayableprotected boolean isRoughlyInside(Layer layer, Rectangle r)
DisplayableisRoughlyInside in class Displayablepublic ij.measure.ResultsTable measure(ij.measure.ResultsTable rt)
measure in class Displayablepublic boolean crop(List<Layer> range)
crop in class ZDisplayableprotected 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 ZDisplayablepublic void adjustProperties()
DisplayableadjustProperties in class Displayablepublic void set(int i,
double x,
double y,
Layer la,
double radius)
IndexOutOfBoundsException - if i < 0 or i >= the number of points.public int getCount()
public void setRadius(int i,
double radius)
IndexOutOfBoundsException - if i < 0 or i >= the number of points.Copyright © 2015–2021 Fiji. All rights reserved.