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) double
horizontalSplit
Split line.(package private) double
nodeHeight
Size of the child's boxes.(package private) double
nodeWidth
Size of the child's boxes.(package private) double
verticalSplit
Split 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.protected
AbstractGISTreeSetNode(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 boolean
addUserData(Collection<? extends P> data)
Add a user data associated to this node.protected Rectangle2d
calcBounds()
Compute and replies the bounds for this node.(package private) void
clearBounds()
Clear buffered variables.protected void
clearBuffers()
Clear buffered variables.boolean
contains(Point2D<?,?> point)
Replies if the specified points is inside the bounds of the area covered by this node.double
distance(double x, double y)
Replies the distance between the specified point and the area covered by this node.Rectangle2d
getAreaBounds()
Replies the bounds covered by the area.(package private) Rectangle2afp<?,?,?,?,?,?>
getBounds()
Replies the bounds of this node.Rectangle2d
getObjectBounds()
Replies the bounds covered by the objects.int
getRegion()
Replies the region covered by this node.IcosepQuadTreeNode.IcosepQuadTreeZone
getZone()
Replies the region covered by this node.boolean
intersects(GeoLocation location)
Replies if the specified rectangle intersects the bounds of the area covered by this node.boolean
intersects(Rectangle2afp<?,?,?,?,?,?> rect)
Replies if the specified rectangle intersects the bounds of the area covered by this node.boolean
isIcosepHeuristicArea()
Replies if the area is marked as an icosep-heuristic area.void
removeAllUserData()
Remove all the user data associated to this node.boolean
removeUserData(Collection<P> data)
Remove a user data associated to this node.boolean
setFirstChild(N newChild)
Set the first child of this node.boolean
setFourthChild(N newChild)
Set the Fourth child of this node.boolean
setIcosepChild(N newChild)
Set the icosep child of this node.boolean
setSecondChild(N newChild)
Set the second child of this node.boolean
setThirdChild(N newChild)
Set the third child of this node.boolean
setUserData(Collection<P> data)
Set the user data associated to this node.boolean
setUserDataAt(int index, P data)
Set the user data associated to this node at the specified index.void
toJson(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:IcosepTreeNodeContainer
Set the icosep child of this node.- Specified by:
setIcosepChild
in interfaceIcosepTreeNodeContainer<P extends GISPrimitive>
- Overrides:
setIcosepChild
in classIcosepQuadTreeNode<P extends GISPrimitive,N extends AbstractGISTreeSetNode<P,N>>
- Parameters:
newChild
- is the new child used as the icosep branch- Returns:
true
on success, otherwisefalse
-
setFirstChild
public boolean setFirstChild(N newChild)
Description copied from class:QuadTreeNode
Set the first child of this node.- Overrides:
setFirstChild
in classQuadTreeNode<P extends GISPrimitive,N extends AbstractGISTreeSetNode<P,N>>
- Parameters:
newChild
- is the new child for the first zone- Returns:
true
on success, otherwhisefalse
-
setFourthChild
public boolean setFourthChild(N newChild)
Description copied from class:QuadTreeNode
Set the Fourth child of this node.- Overrides:
setFourthChild
in classQuadTreeNode<P extends GISPrimitive,N extends AbstractGISTreeSetNode<P,N>>
- Parameters:
newChild
- is the new child for the fourth zone- Returns:
true
on success, otherwhisefalse
-
setSecondChild
public boolean setSecondChild(N newChild)
Description copied from class:QuadTreeNode
Set the second child of this node.- Overrides:
setSecondChild
in classQuadTreeNode<P extends GISPrimitive,N extends AbstractGISTreeSetNode<P,N>>
- Parameters:
newChild
- is the new child for the second zone- Returns:
true
on success, otherwhisefalse
-
setThirdChild
public boolean setThirdChild(N newChild)
Description copied from class:QuadTreeNode
Set the third child of this node.- Overrides:
setThirdChild
in classQuadTreeNode<P extends GISPrimitive,N extends AbstractGISTreeSetNode<P,N>>
- Parameters:
newChild
- is the new child for the third zone- Returns:
true
on success, otherwhisefalse
-
addUserData
public boolean addUserData(Collection<? extends P> data)
Description copied from interface:TreeNode
Add a user data associated to this node.- Specified by:
addUserData
in interfaceTreeNode<P extends GISPrimitive,N extends AbstractGISTreeSetNode<P,N>>
- Overrides:
addUserData
in classAbstractParentlessTreeNode<P extends GISPrimitive,N extends AbstractGISTreeSetNode<P,N>>
- Parameters:
data
- the data to add.- Returns:
true
if the the list of user data has changed, otherwisefalse
.
-
removeAllUserData
public void removeAllUserData()
Description copied from interface:TreeNode
Remove all the user data associated to this node.- Specified by:
removeAllUserData
in interfaceTreeNode<P extends GISPrimitive,N extends AbstractGISTreeSetNode<P,N>>
- Overrides:
removeAllUserData
in classAbstractParentlessTreeNode<P extends GISPrimitive,N extends AbstractGISTreeSetNode<P,N>>
-
removeUserData
public boolean removeUserData(Collection<P> data)
Description copied from interface:TreeNode
Remove a user data associated to this node.- Specified by:
removeUserData
in interfaceTreeNode<P extends GISPrimitive,N extends AbstractGISTreeSetNode<P,N>>
- Overrides:
removeUserData
in classAbstractParentlessTreeNode<P extends GISPrimitive,N extends AbstractGISTreeSetNode<P,N>>
- Parameters:
data
- the data to remove.- Returns:
true
if the data was successfully removed, otherwhisefalse
-
setUserData
public boolean setUserData(Collection<P> data)
Description copied from interface:TreeNode
Set the user data associated to this node.- Specified by:
setUserData
in interfaceTreeNode<P extends GISPrimitive,N extends AbstractGISTreeSetNode<P,N>>
- Overrides:
setUserData
in classAbstractParentlessTreeNode<P extends GISPrimitive,N extends AbstractGISTreeSetNode<P,N>>
- Parameters:
data
- the data to put inside.- Returns:
true
if the data was successfully set, otherwhisefalse
-
setUserDataAt
public boolean setUserDataAt(int index, P data) throws IndexOutOfBoundsException
Description copied from interface:TreeNode
Set the user data associated to this node at the specified index.- Specified by:
setUserDataAt
in interfaceTreeNode<P extends GISPrimitive,N extends AbstractGISTreeSetNode<P,N>>
- Overrides:
setUserDataAt
in 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:
true
if the data was successfully set, otherwhisefalse
- Throws:
IndexOutOfBoundsException
- if the given index was invalid
-
getRegion
@Pure public int getRegion()
Description copied from interface:GISTreeNode
Replies the region covered by this node.- Specified by:
getRegion
in 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:GISTreeNode
Replies if the specified rectangle intersects the bounds of the area covered by this node.- Specified by:
intersects
in interfaceGISTreeNode<P extends GISPrimitive,N extends AbstractGISTreeSetNode<P,N>>
- Parameters:
rect
- the shape- Returns:
true
if this node intersects the given rectangle, otherwisefalse
-
intersects
@Pure public final boolean intersects(GeoLocation location)
Description copied from interface:GISTreeNode
Replies if the specified rectangle intersects the bounds of the area covered by this node.- Specified by:
intersects
in interfaceGISTreeNode<P extends GISPrimitive,N extends AbstractGISTreeSetNode<P,N>>
- Parameters:
location
- the position- Returns:
true
if this node intersects the given rectangle, otherwisefalse
-
contains
@Pure public boolean contains(Point2D<?,?> point)
Description copied from interface:GISTreeNode
Replies if the specified points is inside the bounds of the area covered by this node.- Specified by:
contains
in interfaceGISTreeNode<P extends GISPrimitive,N extends AbstractGISTreeSetNode<P,N>>
- Parameters:
point
- the point.- Returns:
true
if this node encloses the given point, otherwisefalse
-
distance
@Pure public double distance(double x, double y)
Description copied from interface:GISTreeNode
Replies 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:
distance
in 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:GISTreeBoundedArea
Replies the bounds covered by the area.- Specified by:
getAreaBounds
in 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:
getObjectBounds
in interfaceGISTreeBoundedArea
- Returns:
- the bounds covered by the objects.
- See Also:
getBounds()
-
isIcosepHeuristicArea
@Pure public boolean isIcosepHeuristicArea()
Description copied from interface:GISTreeBoundedArea
Replies if the area is marked as an icosep-heuristic area.- Specified by:
isIcosepHeuristicArea
in interfaceGISTreeBoundedArea
- Returns:
true
if the area has been marked as icosep, otherwisefalse
.
-
toJson
@Pure public void toJson(JsonBuffer buffer)
Description copied from class:AbstractParentlessTreeNode
Replies the Json representation of this node.- Specified by:
toJson
in interfaceJsonableObject
- Overrides:
toJson
in classAbstractParentlessTreeNode<P extends GISPrimitive,N extends AbstractGISTreeSetNode<P,N>>
- Parameters:
buffer
- the Json buffer.
-
-