ini.trakem2.display
Class AreaTree

java.lang.Object
  extended by ini.trakem2.persistence.DBObject
      extended by ini.trakem2.display.Displayable
          extended by ini.trakem2.display.ZDisplayable
              extended by ini.trakem2.display.Tree<java.awt.geom.Area>
                  extended by ini.trakem2.display.AreaTree
All Implemented Interfaces:
AreaContainer, Paintable, VectorData

public class AreaTree
extends Tree<java.awt.geom.Area>
implements AreaContainer


Nested Class Summary
static class AreaTree.AreaNode
           
 
Nested classes/interfaces inherited from class ini.trakem2.display.Tree
Tree.MeasurePathDistance<I>, Tree.MeshData
 
Nested classes/interfaces inherited from class ini.trakem2.display.Displayable
Displayable.DataPackage, Displayable.DoEdit, Displayable.DoEdits, Displayable.DoTransforms, Displayable.SliderListener
 
Field Summary
 
Fields inherited from class ini.trakem2.display.Tree
end_nodes, node_layer_map, root
 
Fields inherited from class ini.trakem2.display.ZDisplayable
layer_set
 
Fields inherited from class ini.trakem2.display.Displayable
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
 
Fields inherited from class ini.trakem2.persistence.DBObject
id, project
 
Constructor Summary
AreaTree(Project project, long id, java.util.HashMap<java.lang.String,java.lang.String> ht_attr, java.util.HashMap<Displayable,java.lang.String> ht_links)
          Reconstruct from XML.
AreaTree(Project project, long id, java.lang.String title, float width, float height, float alpha, boolean visible, java.awt.Color color, boolean locked, java.awt.geom.AffineTransform at)
          For cloning purposes, does not call addToDatabase()
AreaTree(Project project, java.lang.String title)
           
 
Method Summary
 void addWorldAreaTo(Node<?> nd, java.awt.geom.Area a)
          Assumes is an AreaNode.
 boolean calculateBoundingBox(Layer la)
          May have the side effect of updating the buckets of the containing container of this Displayable.
 AreaTree clone(Project pr, boolean copy_id)
          Performs a deep copy of this object, obtaining its unique id either from the given project or the exact same as this object's id.
 void debug()
           
static void exportDTD(java.lang.StringBuilder sb_header, java.util.HashSet<java.lang.String> hs, java.lang.String indent)
           
protected  boolean exportXMLNodeAttributes(java.lang.StringBuilder indent, java.lang.StringBuilder sb, Node<java.awt.geom.Area> node)
           
protected  boolean exportXMLNodeData(java.lang.StringBuilder indent, java.lang.StringBuilder sb, Node<java.awt.geom.Area> node)
           
 Tree.MeshData generateMesh(double scale, int resample)
           
 java.util.List<java.awt.geom.Area> getAreas(Layer layer, java.awt.Rectangle box)
          Return the list of areas, in world coordinates, at the given layer, that intersect the given bounding box.
protected  java.awt.Rectangle getBounds(java.util.Collection<Node<java.awt.geom.Area>> nodes)
           
 boolean interpolateTowardsParent(Node<java.awt.geom.Area> nd, boolean node_centric, boolean always_use_distance_map)
          Find the nearest parent with a non-null, non-empty Area, and interpolate from to it.
protected  boolean isAnyNear(java.util.Collection<Node<java.awt.geom.Area>> nodes, float lx, float ly, float radius)
          Returns true if the given point falls within a certain distance of any of the treeline segments, where a segment is defined as the line between a clicked point and the next.
 void keyPressed(java.awt.event.KeyEvent ke)
           
 ij.measure.ResultsTable measureAreas(ij.measure.ResultsTable rt)
           
 void mouseDragged(java.awt.event.MouseEvent me, Layer la, int x_p, int y_p, int x_d, int y_d, int x_d_old, int y_d_old)
           
 void mousePressed(java.awt.event.MouseEvent me, Layer la, int x_p, int y_p, double mag)
           
 void mouseReleased(java.awt.event.MouseEvent me, Layer la, int x_p, int y_p, int x_d, int y_d, int x_r, int y_r)
           
 Tree<java.awt.geom.Area> newInstance()
          Create a new instance, intialized with same ZDisplayable-level parameters (affine, color, title, etc.).
 Node<java.awt.geom.Area> newNode(float lx, float ly, Layer la, Node<?> modelNode)
           
 Node<java.awt.geom.Area> newNode(java.util.HashMap<java.lang.String,java.lang.String> ht_attr)
          To reconstruct from XML.
 
Methods inherited from class ini.trakem2.display.Tree
addNode, addToLinkLater, adjustEdgeConfidence, apply, apply, asVertices, cacheSubtree, canJoin, clearCache, clearState, computeAllDegrees, computeCentrality, contains, copyAs, createCoordinate, createMultiTableView, createNewNode, createReviewStack, crop, deselect, destroy, duplicateAs, exportXML, findClosestNode, findClosestNodeW, findClosestNodeW, findConnectors, findFirstIntersectingNode, findIntersecting, findNearAndGetNext, findNearAndGetPrevious, findNearestEdge, findNearestEndNode, findNearestNode, findNextBranchOrEndPoint, findNode, findNodeNear, findNodeNear, findPreviousBranchOrRootPoint, findTags, fireNodeRemoved, fix, flyThrough, flyThroughMarked, generateAllReviewStacks, generateRegions, generateReviewStackForSlab, generateReviewStackForSlab, generateSkeleton, generateSubtreeReviewStacks, generateSubtreeReviewStacks, generateTriangles, getActive, getAreaAt, getBounds, getBranchAndEndNodes, getBranchNodes, getEndNodes, getFirstLayer, getLastAdded, getLastEdited, getLastVisited, getLayerIds, getLayersWithData, getMarked, getNodesToPaint, getNodesToPaint, getOriginPoint, getPaintingBounds, getRoot, getShortTitle, insertNode, intersects, intersects, intersects, isDeletable, isRoughlyInside, isTagging, join, layerRemoved, linkPatches, markNear, measure, measurePathDistance, measurePathDistance, mouseWheelMoved, paint, paint, paintsAt, paintSnapshot, popNode, remove2, removeFromLinkLater, removeNode, removeReviews, repaint, reRoot, reRoot, setActive, setEdgeConfidence, setLastAdded, setLastEdited, setLastMarked, setLastVisited, setRoot, splitAt, splitNear, toClosestPaintedNode, unmark, updateView, updateViewData
 
Methods inherited from class ini.trakem2.display.ZDisplayable
exportDTD, getBucketable, getLayerSet, remove, setColor, setLayer, setLayerSet, setLayerSet, setPosition, setVisible, softRemove, transformPoints, updateBucket, updateBucket
 
Methods inherited from class ini.trakem2.display.Displayable
adjustProperties, areThereLayerCrossLinks, canSendTo, clone, clone, commonDTDChildren, contains, displacePoints, exportSVG, findById, findNearestPoint, findNearestPoint, getAffineTransform, getAffineTransformCopy, getAlpha, getAnnotation, getArea, getAreaForBucket, getBoundingBox, getBoundingBox, getBoundingBox, getBounds, getColor, getComposite, getComposite, getCompositeMode, getHeight, getIntersection, getLayer, getLinked, getLinked, getLinkedBox, getLinkedGroup, getLinkedProperties, getLinkedProperties, getLinkedProperty, getLinkedProperty, getMinimalBoundingBox, getNameId, getPerimeter, getPerimeter, getProperties, getProperty, getProperty, getTitle, getWidth, getX, getXMLSafeValue, getXMLSafeValue, getY, hasLinkedGroupWithinLayer, hasProperties, intersects, intersects, inverseTransformPoint, isLinked, isLinked, isLinked, isLocked, isLocked2, isOnlyLinkedTo, isOnlyLinkedTo, isOutOfRepaintingClip, isOutOfRepaintingClip, isVisible, link, link, makeAdjustPropertiesDialog, paintAsBox, paintOffscreen, 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, xmlError
 
Methods inherited from class ini.trakem2.persistence.DBObject
addToDatabase, getId, getInfo, getProject, getUniqueIdentifier, removeFromDatabase, updateInDatabase
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AreaTree

public AreaTree(Project project,
                java.lang.String title)

AreaTree

public AreaTree(Project project,
                long id,
                java.util.HashMap<java.lang.String,java.lang.String> ht_attr,
                java.util.HashMap<Displayable,java.lang.String> ht_links)
Reconstruct from XML.


AreaTree

public AreaTree(Project project,
                long id,
                java.lang.String title,
                float width,
                float height,
                float alpha,
                boolean visible,
                java.awt.Color color,
                boolean locked,
                java.awt.geom.AffineTransform at)
For cloning purposes, does not call addToDatabase()

Method Detail

newInstance

public Tree<java.awt.geom.Area> newInstance()
Description copied from class: Tree
Create a new instance, intialized with same ZDisplayable-level parameters (affine, color, title, etc.).

Specified by:
newInstance in class Tree<java.awt.geom.Area>

newNode

public Node<java.awt.geom.Area> newNode(float lx,
                                        float ly,
                                        Layer la,
                                        Node<?> modelNode)
Specified by:
newNode in class Tree<java.awt.geom.Area>

newNode

public Node<java.awt.geom.Area> newNode(java.util.HashMap<java.lang.String,java.lang.String> ht_attr)
Description copied from class: Tree
To reconstruct from XML.

Specified by:
newNode in class Tree<java.awt.geom.Area>

clone

public AreaTree clone(Project pr,
                      boolean copy_id)
Description copied from class: Displayable
Performs a deep copy of this object, obtaining its unique id either from the given project or the exact same as this object's id. The visibility, though, is set to true at all times.

Specified by:
clone in class Displayable

getAreas

public java.util.List<java.awt.geom.Area> getAreas(Layer layer,
                                                   java.awt.Rectangle box)
Return the list of areas, in world coordinates, at the given layer, that intersect the given bounding box.

Specified by:
getAreas in interface AreaContainer

exportDTD

public static void exportDTD(java.lang.StringBuilder sb_header,
                             java.util.HashSet<java.lang.String> hs,
                             java.lang.String indent)

exportXMLNodeAttributes

protected boolean exportXMLNodeAttributes(java.lang.StringBuilder indent,
                                          java.lang.StringBuilder sb,
                                          Node<java.awt.geom.Area> node)
Specified by:
exportXMLNodeAttributes in class Tree<java.awt.geom.Area>

exportXMLNodeData

protected boolean exportXMLNodeData(java.lang.StringBuilder indent,
                                    java.lang.StringBuilder sb,
                                    Node<java.awt.geom.Area> node)
Specified by:
exportXMLNodeData in class Tree<java.awt.geom.Area>

calculateBoundingBox

public boolean calculateBoundingBox(Layer la)
Description copied from interface: AreaContainer
May have the side effect of updating the buckets of the containing container of this Displayable.

Specified by:
calculateBoundingBox in interface AreaContainer
Overrides:
calculateBoundingBox in class Tree<java.awt.geom.Area>
Returns:
Whether this Displayable's bounding box was modified.

mousePressed

public void mousePressed(java.awt.event.MouseEvent me,
                         Layer la,
                         int x_p,
                         int y_p,
                         double mag)
Overrides:
mousePressed in class Tree<java.awt.geom.Area>

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent me,
                         Layer la,
                         int x_p,
                         int y_p,
                         int x_d,
                         int y_d,
                         int x_d_old,
                         int y_d_old)
Overrides:
mouseDragged in class Tree<java.awt.geom.Area>

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent me,
                          Layer la,
                          int x_p,
                          int y_p,
                          int x_d,
                          int y_d,
                          int x_r,
                          int y_r)
Overrides:
mouseReleased in class Tree<java.awt.geom.Area>

keyPressed

public void keyPressed(java.awt.event.KeyEvent ke)
Overrides:
keyPressed in class Tree<java.awt.geom.Area>

getBounds

protected java.awt.Rectangle getBounds(java.util.Collection<Node<java.awt.geom.Area>> nodes)
Overrides:
getBounds in class Tree<java.awt.geom.Area>

generateMesh

public Tree.MeshData generateMesh(double scale,
                                  int resample)

debug

public void debug()

isAnyNear

protected boolean isAnyNear(java.util.Collection<Node<java.awt.geom.Area>> nodes,
                            float lx,
                            float ly,
                            float radius)
Returns true if the given point falls within a certain distance of any of the treeline segments, where a segment is defined as the line between a clicked point and the next.

Overrides:
isAnyNear in class Tree<java.awt.geom.Area>

measureAreas

public ij.measure.ResultsTable measureAreas(ij.measure.ResultsTable rt)
Specified by:
measureAreas in interface AreaContainer

interpolateTowardsParent

public boolean interpolateTowardsParent(Node<java.awt.geom.Area> nd,
                                        boolean node_centric,
                                        boolean always_use_distance_map)
                                 throws java.lang.Exception
Find the nearest parent with a non-null, non-empty Area, and interpolate from to it.

Parameters:
nd - The node to start interpolating from, towards its nearest parent with an area.
node_centric - If true, consider areas relative to the node coordinates. If false, relative to the overall AreaTree.
Throws:
java.lang.Exception

addWorldAreaTo

public void addWorldAreaTo(Node<?> nd,
                           java.awt.geom.Area a)
Assumes is an AreaNode. Otherwise fails with ClassCastException.

Parameters:
nd - An AreaNode.