ini.trakem2.display
Class Connector

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.lang.Float>
                  extended by ini.trakem2.display.Treeline
                      extended by ini.trakem2.display.Connector
All Implemented Interfaces:
Paintable, VectorData

public class Connector
extends Treeline

A one-to-many connection, represented by one source point and one or more target points. The connector is drawn by click+drag+release, defining the origin at click and the target at release. By clicking anywhere else, the connector can be given another target. Points can be dragged and removed. Connectors are meant to represent synapses, in particular polyadic synapses.


Nested Class Summary
static class Connector.ConnectorNode
           
 
Nested classes/interfaces inherited from class ini.trakem2.display.Treeline
Treeline.RadiusNode
 
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.Treeline
last_radius
 
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
Connector(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.
Connector(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)
           
Connector(Project project, java.lang.String title)
           
 
Method Summary
 int addTarget(double x, double y, long layer_id, double r)
           
 int addTarget(float x, float y, long layer_id, float r)
           
 Connector 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.
 boolean crop(java.util.List<Layer> range)
          If the root node (the origin) does not remain within the range, this Connector is left empty.
static void exportDTD(java.lang.StringBuilder sb_header, java.util.HashSet<java.lang.String> hs, java.lang.String indent)
           
protected  java.awt.Rectangle getBounds(java.util.Collection<Node<java.lang.Float>> nodes)
           
 Coordinate<Node<java.lang.Float>> getCoordinate(int i)
          Get a coordinate for target i.
 Coordinate<Node<java.lang.Float>> getCoordinateAtOrigin()
           
 java.lang.String getInfo()
          Returns id and project name; this method is meant to be overriden by any of the subclasses.
 java.util.Set<Displayable> getOrigins()
          Returns the set of Displayable objects under the origin point, or an empty set if none.
 java.util.Set<Displayable> getOrigins(java.lang.Class<?> c)
          Returns the set of Displayable objects under the origin point, or an empty set if none.
 java.util.Set<Displayable> getOrigins(java.lang.Class<?> c, boolean instance_of)
           
 int getTargetCount()
           
 java.util.List<javax.vecmath.Point3f> getTargetPoints(boolean calibrated)
           
 java.util.List<java.util.Set<Displayable>> getTargets()
          Returns the list of sets of visible Displayable objects under each target, or an empty list if none.
 java.util.List<java.util.Set<Displayable>> getTargets(java.lang.Class<?> c)
          Returns the list of sets of visible Displayable objects under each target, or an empty list if none.
 java.util.List<java.util.Set<Displayable>> getTargets(java.lang.Class<?> c, boolean instance_of)
           
 boolean intersectsOrigin(java.awt.geom.Area area, Layer la)
           
protected  boolean layerRemoved(Layer la)
          If the root node is in Layer @param la, then all nodes are removed.
 ij.measure.ResultsTable measure(ij.measure.ResultsTable rt)
          Measures number of branch points and end points, and total cable length.
static Connector merge(java.util.List<Connector> col)
          Takes the List of Connector instances and adds the targets of all to the first one.
protected  void mergeTargets(Connector c)
           
 void mousePressed(java.awt.event.MouseEvent me, Layer layer, int x_p, int y_p, double mag)
          Add a root or child nodes to root.
 Tree<java.lang.Float> newInstance()
          Create a new instance, intialized with same ZDisplayable-level parameters (affine, color, title, etc.).
 Node<java.lang.Float> newNode(float lx, float ly, Layer la, Node<?> modelNode)
           
 Node<java.lang.Float> newNode(java.util.HashMap<java.lang.String,java.lang.String> ht_attr)
          To reconstruct from XML.
 void readLegacyXML(LayerSet ls, java.util.HashMap<java.lang.String,java.lang.String> ht_attr, java.util.HashMap<Displayable,java.lang.String> ht_links)
           
protected  boolean requireAltDownToEditRadius()
           
 
Methods inherited from class ini.trakem2.display.Treeline
adjustNodeRadius, exportXMLNodeAttributes, exportXMLNodeData, generateMesh, keyPressed, mouseDragged, mouseReleased, mouseWheelMoved
 
Methods inherited from class ini.trakem2.display.Tree
addNode, addToLinkLater, adjustEdgeConfidence, apply, apply, asVertices, cacheSubtree, calculateBoundingBox, canJoin, clearCache, clearState, computeAllDegrees, computeCentrality, contains, copyAs, createCoordinate, createMultiTableView, createNewNode, createReviewStack, 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, isAnyNear, isDeletable, isRoughlyInside, isTagging, join, linkPatches, markNear, measurePathDistance, measurePathDistance, 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, getProject, getUniqueIdentifier, removeFromDatabase, updateInDatabase
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Connector

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

Connector

public Connector(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)

Connector

public Connector(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.

Method Detail

newInstance

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

Overrides:
newInstance in class Treeline

newNode

public Node<java.lang.Float> newNode(float lx,
                                     float ly,
                                     Layer la,
                                     Node<?> modelNode)
Overrides:
newNode in class Treeline

newNode

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

Overrides:
newNode in class Treeline

readLegacyXML

public void readLegacyXML(LayerSet ls,
                          java.util.HashMap<java.lang.String,java.lang.String> ht_attr,
                          java.util.HashMap<Displayable,java.lang.String> ht_links)

addTarget

public int addTarget(float x,
                     float y,
                     long layer_id,
                     float r)

addTarget

public int addTarget(double x,
                     double y,
                     long layer_id,
                     double r)

mergeTargets

protected void mergeTargets(Connector c)
                     throws java.awt.geom.NoninvertibleTransformException
Throws:
java.awt.geom.NoninvertibleTransformException

intersectsOrigin

public boolean intersectsOrigin(java.awt.geom.Area area,
                                Layer la)

getOrigins

public java.util.Set<Displayable> getOrigins(java.lang.Class<?> c)
Returns the set of Displayable objects under the origin point, or an empty set if none.


getOrigins

public java.util.Set<Displayable> getOrigins(java.lang.Class<?> c,
                                             boolean instance_of)

getOrigins

public java.util.Set<Displayable> getOrigins()
Returns the set of Displayable objects under the origin point, or an empty set if none.


getTargets

public java.util.List<java.util.Set<Displayable>> getTargets(java.lang.Class<?> c,
                                                             boolean instance_of)

getTargets

public java.util.List<java.util.Set<Displayable>> getTargets(java.lang.Class<?> c)
Returns the list of sets of visible Displayable objects under each target, or an empty list if none.


getTargets

public java.util.List<java.util.Set<Displayable>> getTargets()
Returns the list of sets of visible Displayable objects under each target, or an empty list if none.


getTargetCount

public int getTargetCount()

exportDTD

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

clone

public Connector 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.

Overrides:
clone in class Treeline

measure

public ij.measure.ResultsTable measure(ij.measure.ResultsTable rt)
Description copied from class: Tree
Measures number of branch points and end points, and total cable length. Cable length is measured as: Cable length: the sum of all distances between all consecutive pairs of nodes. Lower-bound cable length: the sum of all distances between all end points to branch points, branch points to other branch points, and first branch point to root.

Overrides:
measure in class Tree<java.lang.Float>

getTargetPoints

public java.util.List<javax.vecmath.Point3f> getTargetPoints(boolean calibrated)

getCoordinateAtOrigin

public Coordinate<Node<java.lang.Float>> getCoordinateAtOrigin()

getCoordinate

public Coordinate<Node<java.lang.Float>> getCoordinate(int i)
Get a coordinate for target i.


getInfo

public java.lang.String getInfo()
Description copied from class: DBObject
Returns id and project name; this method is meant to be overriden by any of the subclasses.

Overrides:
getInfo in class DBObject

layerRemoved

protected boolean layerRemoved(Layer la)
If the root node is in Layer @param la, then all nodes are removed.

Overrides:
layerRemoved in class Tree<java.lang.Float>

merge

public static Connector merge(java.util.List<Connector> col)
                       throws java.awt.geom.NoninvertibleTransformException
Takes the List of Connector instances and adds the targets of all to the first one. Removes the others from the LayerSet and from the Project. If any of the Connector instances cannot be removed, returns null.

Throws:
java.awt.geom.NoninvertibleTransformException

mousePressed

public void mousePressed(java.awt.event.MouseEvent me,
                         Layer layer,
                         int x_p,
                         int y_p,
                         double mag)
Add a root or child nodes to root.

Overrides:
mousePressed in class Treeline

requireAltDownToEditRadius

protected boolean requireAltDownToEditRadius()
Overrides:
requireAltDownToEditRadius in class Treeline

getBounds

protected java.awt.Rectangle getBounds(java.util.Collection<Node<java.lang.Float>> nodes)
Overrides:
getBounds in class Treeline

crop

public boolean crop(java.util.List<Layer> range)
If the root node (the origin) does not remain within the range, this Connector is left empty.

Overrides:
crop in class Tree<java.lang.Float>