Module org.arakhne.afc.gis.giscore
Package org.arakhne.afc.gis.tree
Class AbstractGISTreeSetNode<P extends GISPrimitive,N extends AbstractGISTreeSetNode<P,N>>
- java.lang.Object
-
- org.arakhne.afc.math.tree.node.AbstractParentlessTreeNode<D,N>
-
- org.arakhne.afc.math.tree.node.AbstractTreeNode<D,N>
-
- org.arakhne.afc.math.tree.node.QuadTreeNode<D,N>
-
- org.arakhne.afc.math.tree.node.IcosepQuadTreeNode<P,N>
-
- org.arakhne.afc.gis.tree.AbstractGISTreeSetNode<P,N>
-
- Type Parameters:
P- is the type of the user data inside the node.N- is the type of node.
- All Implemented Interfaces:
Serializable,Comparable<N>,GISTreeBoundedArea,GISTreeNode<P,N>,IcosepTreeNodeContainer<N>,IterableNode<N>,TreeNode<P,N>,JsonableObject
- Direct Known Subclasses:
GISTreeSetNode,WeakGISTreeSetNode
class AbstractGISTreeSetNode<P extends GISPrimitive,N extends AbstractGISTreeSetNode<P,N>> extends IcosepQuadTreeNode<P,N> implements GISTreeNode<P,N>
A node inside aStandardGISTreeSet.- Since:
- 14.0
- Version:
- 17.0 2020-01-04 14:41:53
- Author:
- Stéphane GALLAND
- Maven Group Id:
- org.arakhne.afc.gis
- Maven Artifact Id:
- giscore
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.arakhne.afc.math.tree.node.IcosepQuadTreeNode
IcosepQuadTreeNode.DefaultIcosepQuadTreeNode<D>, IcosepQuadTreeNode.IcosepQuadTreeZone
-
Nested classes/interfaces inherited from class org.arakhne.afc.math.tree.node.QuadTreeNode
QuadTreeNode.DefaultQuadTreeNode<D>, QuadTreeNode.QuadTreeZone
-
-
Field Summary
Fields Modifier and Type Field Description (package private) doublehorizontalSplitSplit line.(package private) doublenodeHeightSize of the child's boxes.(package private) doublenodeWidthSize of the child's boxes.(package private) doubleverticalSplitSplit line.-
Fields inherited from class org.arakhne.afc.math.tree.node.AbstractParentlessTreeNode
DEFAULT_COPY_USER_DATA, DEFAULT_LINK_LIST_USE, nodeListeners, notNullChildCount
-
-
Constructor Summary
Constructors Modifier Constructor Description (package private)AbstractGISTreeSetNode(IcosepQuadTreeNode.IcosepQuadTreeZone zone, double boundsX, double boundsY, double boundsWidth, double boundsHeight)Constructor.protectedAbstractGISTreeSetNode(IcosepQuadTreeNode.IcosepQuadTreeZone zone, List<P> elements, double boundsX, double boundsY, double boundsWidth, double boundsHeight)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddUserData(Collection<? extends P> data)Add a user data associated to this node.protected Rectangle2dcalcBounds()Compute and replies the bounds for this node.(package private) voidclearBounds()Clear buffered variables.protected voidclearBuffers()Clear buffered variables.booleancontains(Point2D<?,?> point)Replies if the specified points is inside the bounds of the area covered by this node.doubledistance(double x, double y)Replies the distance between the specified point and the area covered by this node.Rectangle2dgetAreaBounds()Replies the bounds covered by the area.(package private) Rectangle2afp<?,?,?,?,?,?>getBounds()Replies the bounds of this node.Rectangle2dgetObjectBounds()Replies the bounds covered by the objects.intgetRegion()Replies the region covered by this node.IcosepQuadTreeNode.IcosepQuadTreeZonegetZone()Replies the region covered by this node.booleanintersects(GeoLocation location)Replies if the specified rectangle intersects the bounds of the area covered by this node.booleanintersects(Rectangle2afp<?,?,?,?,?,?> rect)Replies if the specified rectangle intersects the bounds of the area covered by this node.booleanisIcosepHeuristicArea()Replies if the area is marked as an icosep-heuristic area.voidremoveAllUserData()Remove all the user data associated to this node.booleanremoveUserData(Collection<P> data)Remove a user data associated to this node.booleansetFirstChild(N newChild)Set the first child of this node.booleansetFourthChild(N newChild)Set the Fourth child of this node.booleansetIcosepChild(N newChild)Set the icosep child of this node.booleansetSecondChild(N newChild)Set the second child of this node.booleansetThirdChild(N newChild)Set the third child of this node.booleansetUserData(Collection<P> data)Set the user data associated to this node.booleansetUserDataAt(int index, P data)Set the user data associated to this node at the specified index.voidtoJson(JsonBuffer buffer)Replies the Json representation of this node.-
Methods inherited from class org.arakhne.afc.math.tree.node.IcosepQuadTreeNode
clear, getChildAt, getChildAt, getChildCount, getChildren, getHeights, getIcosepChild, getMaxHeight, getMinHeight, getPartitionEnumeration, indexOf, isLeaf, removeChild, setChildAt, setChildAtWithoutEventFiring
-
Methods inherited from class org.arakhne.afc.math.tree.node.QuadTreeNode
getChildAt, getFirstChild, getFourthChild, getNotNullChildCount, getSecondChild, getThirdChild, moveTo, moveTo, setChildAt, zoneOf
-
Methods inherited from class org.arakhne.afc.math.tree.node.AbstractTreeNode
children, firePropertyChildAdded, firePropertyChildRemoved, firePropertyParentChanged, getChildren, getDepth, getParentNode, isRoot, moveTo, removeDeeplyFromParent, removeFromParent
-
Methods inherited from class org.arakhne.afc.math.tree.node.AbstractParentlessTreeNode
addTreeNodeListener, addUserData, addUserData, addUserData, compareTo, firePropertyDataChanged, firePropertyDataChanged, getAllUserData, getAllUserData, getDeepNodeCount, getDeepUserDataCount, getHeights, getInternalDataStructureForUserData, getUserData, getUserDataAt, getUserDataCount, isEmpty, isValid, removeTreeNodeListener, removeUserData, removeUserData, setUserData, toN, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Comparable
compareTo
-
Methods inherited from interface org.arakhne.afc.math.tree.IterableNode
getChildAt, getChildCount, getNotNullChildCount, isLeaf, removeFromParent
-
Methods inherited from interface org.arakhne.afc.math.tree.TreeNode
addTreeNodeListener, addUserData, addUserData, addUserData, children, clear, getAllUserData, getAllUserData, getChildren, getChildren, getDeepNodeCount, getDeepUserDataCount, getDepth, getHeights, getMaxHeight, getMinHeight, getParentNode, getPartitionEnumeration, getUserData, getUserDataAt, getUserDataCount, indexOf, isEmpty, isRoot, isValid, moveTo, removeChild, removeDeeplyFromParent, removeTreeNodeListener, removeUserData, removeUserData, setChildAt, setUserData
-
-
-
-
Constructor Detail
-
AbstractGISTreeSetNode
AbstractGISTreeSetNode(IcosepQuadTreeNode.IcosepQuadTreeZone zone, double boundsX, double boundsY, double boundsWidth, double boundsHeight)
Constructor.- Parameters:
zone- is the zone enclosed by this node.boundsX- is the bounds of the node.boundsY- is the bounds of the node.boundsWidth- is the bounds of the node.boundsHeight- is the bounds of the node.
-
AbstractGISTreeSetNode
protected AbstractGISTreeSetNode(IcosepQuadTreeNode.IcosepQuadTreeZone zone, List<P> elements, double boundsX, double boundsY, double boundsWidth, double boundsHeight)
Constructor.- Parameters:
zone- is the zone enclosed by this node.elements- is the list of elements inside this node. The given list instance is directly used by the node.boundsX- is the bounds of the node.boundsY- is the bounds of the node.boundsWidth- is the bounds of the node.boundsHeight- is the bounds of the node.
-
-
Method Detail
-
setIcosepChild
public boolean setIcosepChild(N newChild)
Description copied from interface:IcosepTreeNodeContainerSet the icosep child of this node.- Specified by:
setIcosepChildin interfaceIcosepTreeNodeContainer<P extends GISPrimitive>- Overrides:
setIcosepChildin classIcosepQuadTreeNode<P extends GISPrimitive,N extends AbstractGISTreeSetNode<P,N>>- Parameters:
newChild- is the new child used as the icosep branch- Returns:
trueon success, otherwisefalse
-
setFirstChild
public boolean setFirstChild(N newChild)
Description copied from class:QuadTreeNodeSet the first child of this node.- Overrides:
setFirstChildin classQuadTreeNode<P extends GISPrimitive,N extends AbstractGISTreeSetNode<P,N>>- Parameters:
newChild- is the new child for the first zone- Returns:
trueon success, otherwhisefalse
-
setFourthChild
public boolean setFourthChild(N newChild)
Description copied from class:QuadTreeNodeSet the Fourth child of this node.- Overrides:
setFourthChildin classQuadTreeNode<P extends GISPrimitive,N extends AbstractGISTreeSetNode<P,N>>- Parameters:
newChild- is the new child for the fourth zone- Returns:
trueon success, otherwhisefalse
-
setSecondChild
public boolean setSecondChild(N newChild)
Description copied from class:QuadTreeNodeSet the second child of this node.- Overrides:
setSecondChildin classQuadTreeNode<P extends GISPrimitive,N extends AbstractGISTreeSetNode<P,N>>- Parameters:
newChild- is the new child for the second zone- Returns:
trueon success, otherwhisefalse
-
setThirdChild
public boolean setThirdChild(N newChild)
Description copied from class:QuadTreeNodeSet the third child of this node.- Overrides:
setThirdChildin classQuadTreeNode<P extends GISPrimitive,N extends AbstractGISTreeSetNode<P,N>>- Parameters:
newChild- is the new child for the third zone- Returns:
trueon success, otherwhisefalse
-
addUserData
public boolean addUserData(Collection<? extends P> data)
Description copied from interface:TreeNodeAdd a user data associated to this node.- Specified by:
addUserDatain interfaceTreeNode<P extends GISPrimitive,N extends AbstractGISTreeSetNode<P,N>>- Overrides:
addUserDatain classAbstractParentlessTreeNode<P extends GISPrimitive,N extends AbstractGISTreeSetNode<P,N>>- Parameters:
data- the data to add.- Returns:
trueif the the list of user data has changed, otherwisefalse.
-
removeAllUserData
public void removeAllUserData()
Description copied from interface:TreeNodeRemove all the user data associated to this node.- Specified by:
removeAllUserDatain interfaceTreeNode<P extends GISPrimitive,N extends AbstractGISTreeSetNode<P,N>>- Overrides:
removeAllUserDatain classAbstractParentlessTreeNode<P extends GISPrimitive,N extends AbstractGISTreeSetNode<P,N>>
-
removeUserData
public boolean removeUserData(Collection<P> data)
Description copied from interface:TreeNodeRemove a user data associated to this node.- Specified by:
removeUserDatain interfaceTreeNode<P extends GISPrimitive,N extends AbstractGISTreeSetNode<P,N>>- Overrides:
removeUserDatain classAbstractParentlessTreeNode<P extends GISPrimitive,N extends AbstractGISTreeSetNode<P,N>>- Parameters:
data- the data to remove.- Returns:
trueif the data was successfully removed, otherwhisefalse
-
setUserData
public boolean setUserData(Collection<P> data)
Description copied from interface:TreeNodeSet the user data associated to this node.- Specified by:
setUserDatain interfaceTreeNode<P extends GISPrimitive,N extends AbstractGISTreeSetNode<P,N>>- Overrides:
setUserDatain classAbstractParentlessTreeNode<P extends GISPrimitive,N extends AbstractGISTreeSetNode<P,N>>- Parameters:
data- the data to put inside.- Returns:
trueif the data was successfully set, otherwhisefalse
-
setUserDataAt
public boolean setUserDataAt(int index, P data) throws IndexOutOfBoundsExceptionDescription copied from interface:TreeNodeSet the user data associated to this node at the specified index.- Specified by:
setUserDataAtin interfaceTreeNode<P extends GISPrimitive,N extends AbstractGISTreeSetNode<P,N>>- Overrides:
setUserDataAtin classAbstractParentlessTreeNode<P extends GISPrimitive,N extends AbstractGISTreeSetNode<P,N>>- Parameters:
index- the index at which the data must be set.data- the data to put inside.- Returns:
trueif the data was successfully set, otherwhisefalse- Throws:
IndexOutOfBoundsException- if the given index was invalid
-
getRegion
@Pure public int getRegion()
Description copied from interface:GISTreeNodeReplies the region covered by this node.- Specified by:
getRegionin interfaceGISTreeNode<P extends GISPrimitive,N extends AbstractGISTreeSetNode<P,N>>- Returns:
- the region covered by this node
-
getZone
@Pure public IcosepQuadTreeNode.IcosepQuadTreeZone getZone()
Replies the region covered by this node.- Returns:
- the region covered by this node
- See Also:
getRegion()
-
clearBuffers
protected void clearBuffers()
Clear buffered variables.
-
clearBounds
@Pure void clearBounds()
Clear buffered variables.
-
getBounds
@Pure Rectangle2afp<?,?,?,?,?,?> getBounds()
Replies the bounds of this node.Caution: This function does not replies a copy of the bounds, but the bounding object itself. See
getObjectBounds()to obtain a copy.- Returns:
- the bounds, never
null - See Also:
getObjectBounds()
-
calcBounds
@Pure protected Rectangle2d calcBounds()
Compute and replies the bounds for this node.- Returns:
- bounds
-
intersects
@Pure public boolean intersects(Rectangle2afp<?,?,?,?,?,?> rect)
Description copied from interface:GISTreeNodeReplies if the specified rectangle intersects the bounds of the area covered by this node.- Specified by:
intersectsin interfaceGISTreeNode<P extends GISPrimitive,N extends AbstractGISTreeSetNode<P,N>>- Parameters:
rect- the shape- Returns:
trueif this node intersects the given rectangle, otherwisefalse
-
intersects
@Pure public final boolean intersects(GeoLocation location)
Description copied from interface:GISTreeNodeReplies if the specified rectangle intersects the bounds of the area covered by this node.- Specified by:
intersectsin interfaceGISTreeNode<P extends GISPrimitive,N extends AbstractGISTreeSetNode<P,N>>- Parameters:
location- the position- Returns:
trueif this node intersects the given rectangle, otherwisefalse
-
contains
@Pure public boolean contains(Point2D<?,?> point)
Description copied from interface:GISTreeNodeReplies if the specified points is inside the bounds of the area covered by this node.- Specified by:
containsin interfaceGISTreeNode<P extends GISPrimitive,N extends AbstractGISTreeSetNode<P,N>>- Parameters:
point- the point.- Returns:
trueif this node encloses the given point, otherwisefalse
-
distance
@Pure public double distance(double x, double y)Description copied from interface:GISTreeNodeReplies the distance between the specified point and the area covered by this node. If the point is inside the area, the distance is zero.This this node has no parent, then this function is assuming that the node encloses the entire system area. It means that the distance to the point is always zero in this case.
- Specified by:
distancein interfaceGISTreeNode<P extends GISPrimitive,N extends AbstractGISTreeSetNode<P,N>>- Parameters:
x- x coordinate.y- y coordinate.- Returns:
- the distance between the given point and the bounds of this node.
-
getAreaBounds
@Pure public Rectangle2d getAreaBounds()
Description copied from interface:GISTreeBoundedAreaReplies the bounds covered by the area.- Specified by:
getAreaBoundsin interfaceGISTreeBoundedArea- Returns:
- the bounds covered by the area.
-
getObjectBounds
@Pure public Rectangle2d getObjectBounds()
Replies the bounds covered by the objects.Caution: This function does not replies the bounding object itself, but a copy of it. See
getBounds()to obtain the object itself.- Specified by:
getObjectBoundsin interfaceGISTreeBoundedArea- Returns:
- the bounds covered by the objects.
- See Also:
getBounds()
-
isIcosepHeuristicArea
@Pure public boolean isIcosepHeuristicArea()
Description copied from interface:GISTreeBoundedAreaReplies if the area is marked as an icosep-heuristic area.- Specified by:
isIcosepHeuristicAreain interfaceGISTreeBoundedArea- Returns:
trueif the area has been marked as icosep, otherwisefalse.
-
toJson
@Pure public void toJson(JsonBuffer buffer)
Description copied from class:AbstractParentlessTreeNodeReplies the Json representation of this node.- Specified by:
toJsonin interfaceJsonableObject- Overrides:
toJsonin classAbstractParentlessTreeNode<P extends GISPrimitive,N extends AbstractGISTreeSetNode<P,N>>- Parameters:
buffer- the Json buffer.
-
-