public abstract class Node<T> extends Object implements Taggable
Modifier and Type | Class and Description |
---|---|
static class |
Node.BranchAndEndNodeIterator<I> |
static class |
Node.BranchNodeIterator<I> |
static class |
Node.BreadthFirstSubtreeIterator<I>
For a given starting node, iterates over the complete set of children nodes, recursively and breadth-first.
|
static class |
Node.EndNodeIterator<I> |
static class |
Node.FilteredIterator<I> |
static class |
Node.NodeCollection<I>
Read-only Collection with a very expensive size().
|
static class |
Node.NodeIterator<I>
Stateful abstract Node iterator.
|
static interface |
Node.Operation<I>
An operation to be applied to a specific Node.
|
static class |
Node.SlabIterator<I>
For a given starting node, iterates all the way to the next end node or branch node, inclusive.
|
static class |
Node.SubtreeIterator<I> |
Modifier and Type | Field and Description |
---|---|
protected Node<T>[] |
children |
protected Color |
color |
protected byte |
confidence
The confidence value of the edge towards the parent;
in other words, how much this node can be trusted to continue from its parent node.
|
protected Layer |
la |
static byte |
MAX_EDGE_CONFIDENCE
Maximum possible confidence in an edge (ranges from 0 to 5, inclusive).
|
protected Node<T> |
parent |
protected float |
x |
protected float |
y |
DASHED_STROKE, TAG_BACKGROUND
Constructor and Description |
---|
Node(float x,
float y,
Layer la) |
Node(HashMap<String,String> attr)
To reconstruct from XML, without a layer.
|
Modifier and Type | Method and Description |
---|---|
int |
add(Node<T> child,
byte conf)
Returns -1 when not added (e.g.
|
boolean |
addTag(Tag tag) |
boolean |
adjustConfidence(int inc)
Adjust the confidence value of this node with its parent.
|
void |
apply(CoordinateTransform ct,
Area roi) |
protected void |
apply(Node.Operation<T> op,
Iterator<Node<T>> nodes) |
void |
apply(VectorDataTransform vlocal) |
void |
applyToSlab(Node.Operation<T> op)
Apply @param op to this Node and all its subtree nodes until reaching a branch node or end node, inclusive.
|
void |
applyToSubtree(Node.Operation<T> op)
Apply @param op to this Node and all its subtree nodes.
|
Point3f |
asPoint() |
Node<T> |
clone(Project pr)
Returns a recursive copy of this Node subtree, where the copy of this Node is the root.
|
HashMap<Node<T>,Integer> |
computeAllDegrees()
Return a map of node vs degree of that node, for the entire subtree (including this node).
|
int |
computeDegree()
Traverse the tree from this node all the way to the root node,
and count how many nodes apart this node is from the root node:
that is the degree.
|
protected void |
copyProperties(Node<?> nd) |
Collection<Displayable> |
findLinkTargets(AffineTransform to_world)
Returns a list of Patch to link, which lay under the node.
|
Node<T> |
findNextBranchOrEndPoint()
Assumes there aren't any cycles.
|
static <I> List<Node<I>> |
findPath(Node<I> a,
Node<I> b)
Obtain the (only) list from node a to node b,
including both a (the first element) and b (the last element).
|
Node<T> |
findPreviousBranchOrRootPoint() |
Area |
getArea()
Returns area in local coords.
|
Collection<Node<T>> |
getBranchAndEndNodes()
Returns a lazy read-only Collection of all branch and end nodes under this node.
|
Collection<Node<T>> |
getBranchNodes()
Returns a lazy read-only Collection of all branch nodes under this node.
|
Map<Node<T>,Byte> |
getChildren() |
int |
getChildrenCount() |
ArrayList<Node<T>> |
getChildrenNodes() |
Color |
getColor() |
byte |
getConfidence() |
abstract T |
getData() |
abstract T |
getDataCopy() |
List<Byte> |
getEdgeConfidence() |
byte |
getEdgeConfidence(Node<T> child) |
Collection<Node<T>> |
getEndNodes()
Returns a lazy read-only Collection of all end nodes under this node.
|
Layer |
getLayer() |
Node<T> |
getParent() |
Collection<Node<T>> |
getSlabNodes()
Returns a lazy read-only Collection of the nodes from this node up to the next branch node or end node, inclusive.
|
Collection<Node<T>> |
getSubtreeNodes()
Returns a lazy read-only Collection of the nodes belonging to the subtree of this node, including the node itself as the root.
|
Set<Tag> |
getTags() |
float |
getX() |
float |
getY() |
boolean |
hasChildren() |
boolean |
hasSameTags(Node<?> other) |
boolean |
hasTag(Tag t) |
abstract boolean |
intersects(Area a)
Expects Area in local coords.
|
boolean |
isRoughlyInside(Rectangle localbox)
May return a false positive but never a false negative.
|
abstract Node<T> |
newInstance(float x,
float y,
Layer layer) |
abstract void |
paintData(Graphics2D g,
Rectangle srcRect,
Tree<T> tree,
AffineTransform to_screen,
Color cc,
Layer active_layer) |
protected void |
paintHandle(Graphics2D g,
Rectangle srcRect,
double magnification,
Tree<T> t) |
protected void |
paintHandle(Graphics2D g,
Rectangle srcRect,
double magnification,
Tree<T> t,
boolean paint_background)
Paint in the context of offscreen space, without transformations.
|
boolean |
remove(Node<T> child) |
Set<Tag> |
removeAllTags() |
boolean |
removeTag(Tag tag) |
void |
setColor(Color c) |
boolean |
setConfidence(byte conf)
Set the confidence value of this node with its parent.
|
abstract boolean |
setData(T t) |
void |
setLayer(Layer la) |
void |
setPosition(float[] p)
Expects two dimensions.
|
void |
setPosition(float x,
float y) |
String |
toString() |
protected void |
transformData(AffineTransform aff)
Apply @param aff to the data, not to the x,y position.
|
void |
translate(float dx,
float dy)
Only this node, not any of its children.
|
public static final byte MAX_EDGE_CONFIDENCE
protected float x
protected float y
protected Color color
protected byte confidence
protected Layer la
public Node(float x, float y, Layer la)
x
- The X in local coordinates.y
- The Y in local coordinates.la
- The Layer where the point represented by this Node sits.public float getX()
public float getY()
public Color getColor()
public void setColor(Color c)
public void setPosition(float x, float y)
public void setPosition(float[] p)
public byte getConfidence()
public Layer getLayer()
public Map<Node<T>,Byte> getChildren()
public void setLayer(Layer la)
public final int add(Node<T> child, byte conf)
protected void paintHandle(Graphics2D g, Rectangle srcRect, double magnification, Tree<T> t)
protected void paintHandle(Graphics2D g, Rectangle srcRect, double magnification, Tree<T> t, boolean paint_background)
public final Collection<Node<T>> getSubtreeNodes()
public final Collection<Node<T>> getSlabNodes()
public final Collection<Node<T>> getBranchAndEndNodes()
public final Collection<Node<T>> getBranchNodes()
public final Collection<Node<T>> getEndNodes()
public final void translate(float dx, float dy)
public final Node<T> clone(Project pr)
public final boolean hasChildren()
public final int getChildrenCount()
public final int computeDegree()
public static <I> List<Node<I>> findPath(Node<I> a, Node<I> b)
public HashMap<Node<T>,Integer> computeAllDegrees()
public final boolean setConfidence(byte conf)
public final boolean adjustConfidence(int inc)
public final Node<T> findNextBranchOrEndPoint()
public abstract boolean setData(T t)
public abstract T getData()
public abstract T getDataCopy()
public abstract void paintData(Graphics2D g, Rectangle srcRect, Tree<T> tree, AffineTransform to_screen, Color cc, Layer active_layer)
public abstract boolean intersects(Area a)
public boolean isRoughlyInside(Rectangle localbox)
public Area getArea()
public Collection<Displayable> findLinkTargets(AffineTransform to_world)
public boolean addTag(Tag tag)
public boolean removeTag(Tag tag)
protected final void copyProperties(Node<?> nd)
public boolean hasTag(Tag t)
public Set<Tag> removeAllTags()
removeAllTags
in interface Taggable
public void apply(CoordinateTransform ct, Area roi)
public void apply(VectorDataTransform vlocal)
public Point3f asPoint()
protected void transformData(AffineTransform aff)
protected final void apply(Node.Operation<T> op, Iterator<Node<T>> nodes) throws Exception
Exception
public void applyToSubtree(Node.Operation<T> op) throws Exception
Exception
public void applyToSlab(Node.Operation<T> op) throws Exception
Exception
public boolean hasSameTags(Node<?> other)
Copyright © 2015–2021 Fiji. All rights reserved.