Package org.arakhne.afc.math.geometry.d2
Interface MultiShape2D<ST extends Shape2D<?,?,I,P,V,B>,IT extends MultiShape2D<?,?,CT,I,P,V,B>,CT extends Shape2D<?,?,I,P,V,B>,I extends PathIterator2D<?>,P extends Point2D<? super P,? super V>,V extends Vector2D<? super V,? super P>,B extends Shape2D<?,?,I,P,V,B>>
-
- Type Parameters:
ST- is the type of the general implementation.IT- is the type of the implementation of this multishape.CT- is the type of the shapes that are inside this multishape.I- is the type of the iterator used to obtain the elements of the path.P- is the type of the points.V- is the type of the vectors.B- is the type of the bounding boxes.
- All Superinterfaces:
Cloneable,Collection<CT>,Iterable<CT>,JsonableObject,List<CT>,Serializable,Shape2D<ST,IT,I,P,V,B>
- All Known Subinterfaces:
MultiShape2afp<ST,IT,CT,IE,P,V,B>,MultiShape2ai<ST,IT,CT,IE,P,V,B>
- All Known Implementing Classes:
MultiShape2d,MultiShape2dfx,MultiShape2i,MultiShape2ifx
public interface MultiShape2D<ST extends Shape2D<?,?,I,P,V,B>,IT extends MultiShape2D<?,?,CT,I,P,V,B>,CT extends Shape2D<?,?,I,P,V,B>,I extends PathIterator2D<?>,P extends Point2D<? super P,? super V>,V extends Vector2D<? super V,? super P>,B extends Shape2D<?,?,I,P,V,B>> extends Shape2D<ST,IT,I,P,V,B>, List<CT>
Container for grouping of shapes.The coordinates of the shapes inside the multishape are global. They are not relative to the multishape.
- Since:
- 13.0
- Version:
- 17.0 2020-01-04 14:41:43
- Author:
- Thomas PIOTROWSKI, Stéphane GALLAND
- Maven Group Id:
- org.arakhne.afc.core
- Maven Artifact Id:
- mathgeom
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classMultiShape2D.BackendIterator<CT extends Shape2D<?,?,?,?,?,?>>Iterator on elements of a list that is able to notify the backend when the iterator has change the backend data.static classMultiShape2D.BackendList<CT extends Shape2D<?,?,?,?,?,?>>View on a list that is able to notify the backend when the view has change the backend data.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidadd(int index, CT element)default booleanadd(CT element)default booleanaddAll(int index, Collection<? extends CT> collection)default booleanaddAll(Collection<? extends CT> collection)default voidclear()Reset this shape to be equivalent to an just-created instance of this shape type.default booleancontains(Object obj)default booleancontainsAll(Collection<?> collection)default booleanequalsToShape(IT shape)Replies this shape is equal to the given shape.default CTget(int index)List<CT>getBackendDataList()Replies the list that contains the backend data.default PgetClosestPointTo(Point2D<?,?> point)Replies the point on the shape that is closest to the given point.default doublegetDistanceL1(Point2D<?,?> point)Computes the L-1 (Manhattan) distance between this shape and point p1.default doublegetDistanceLinf(Point2D<?,?> point)Computes the L-infinite distance between this shape and point p1.default doublegetDistanceSquared(Point2D<?,?> point)Replies the squared value of the minimal distance from this shape to the given point.default PgetFarthestPointTo(Point2D<?,?> point)Replies the point on the shape that is farthest the given point.default CTgetFirstShapeContaining(Point2D<?,?> point)Get the first shape in this multishape that is containing the given point.CTgetFirstShapeIntersecting(ST shape)Get the first shape in this multishape that is intersecting the given shape.default List<CT>getShapesContaining(Point2D<?,?> point)Get the shapes in this multishape that are containing the given point.List<CT>getShapesIntersecting(ST shape)Get the shapes in this multishape that are intersecting the given shape.default intindexOf(Object obj)default booleanisEmpty()Replies if this shape is empty.default Iterator<CT>iterator()default intlastIndexOf(Object obj)default ListIterator<CT>listIterator()default ListIterator<CT>listIterator(int index)default voidonBackendDataChange()Invoked each time the backend data has changed.default CTremove(int index)default booleanremove(Object element)default booleanremoveAll(Collection<?> collection)default booleanretainAll(Collection<?> collection)default CTset(int index, CT element)default voidset(IT shape)Set this shape with the attributes of the given shape.default intsize()default List<CT>subList(int fromIndex, int toIndex)default Object[]toArray()default <T> T[]toArray(T[] array)-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface org.arakhne.afc.vmutil.json.JsonableObject
toJson
-
Methods inherited from interface java.util.List
equals, hashCode, replaceAll, sort, spliterator
-
Methods inherited from interface org.arakhne.afc.math.geometry.d2.Shape2D
clone, contains, contains, createTransformedShape, equalsToPathIterator, getClosestPointTo, getDistance, getDistance, getDistanceSquared, getGeomFactory, getPathIterator, getPathIterator, intersects, operator_add, operator_and, operator_and, operator_minus, operator_multiply, operator_plus, operator_remove, operator_upTo, toBoundingBox, toBoundingBox, translate
-
-
-
-
Method Detail
-
getFirstShapeContaining
@Pure default CT getFirstShapeContaining(Point2D<?,?> point)
Get the first shape in this multishape that is containing the given point.- Parameters:
point- the point.- Returns:
- the shape, or
nullif no shape contains the given point.
-
getShapesContaining
@Pure default List<CT> getShapesContaining(Point2D<?,?> point)
Get the shapes in this multishape that are containing the given point.- Parameters:
point- the point.- Returns:
- the shapes, or an empty list.
-
getFirstShapeIntersecting
@Pure CT getFirstShapeIntersecting(ST shape)
Get the first shape in this multishape that is intersecting the given shape.- Parameters:
shape- the shape.- Returns:
- the shape, or
nullif no shape intersecting the given shape.
-
getShapesIntersecting
@Pure List<CT> getShapesIntersecting(ST shape)
Get the shapes in this multishape that are intersecting the given shape.- Parameters:
shape- the shape.- Returns:
- the shapes, or an empty list.
-
getBackendDataList
@Pure List<CT> getBackendDataList()
Replies the list that contains the backend data.Use this function with caution. Indeed, any change made in the replied list has no consequence on the internal attributes of this multishape object.
- Returns:
- the backend data list.
-
onBackendDataChange
default void onBackendDataChange()
Invoked each time the backend data has changed.
-
set
default void set(IT shape)
Description copied from interface:Shape2DSet this shape with the attributes of the given shape.- Specified by:
setin interfaceShape2D<ST extends Shape2D<?,?,I,P,V,B>,IT extends MultiShape2D<?,?,CT,I,P,V,B>,CT extends Shape2D<?,?,I,P,V,B>,I extends PathIterator2D<?>,P extends Point2D<? super P,? super V>,V extends Vector2D<? super V,? super P>>- Parameters:
shape- the shape to copy.
-
equalsToShape
@Pure default boolean equalsToShape(IT shape)
Description copied from interface:Shape2DReplies this shape is equal to the given shape.- Specified by:
equalsToShapein interfaceShape2D<ST extends Shape2D<?,?,I,P,V,B>,IT extends MultiShape2D<?,?,CT,I,P,V,B>,CT extends Shape2D<?,?,I,P,V,B>,I extends PathIterator2D<?>,P extends Point2D<? super P,? super V>,V extends Vector2D<? super V,? super P>>- Parameters:
shape- the shape to compare to.- Returns:
trueif this shape is equal is equal to the given path.
-
clear
default void clear()
Description copied from interface:Shape2DReset this shape to be equivalent to an just-created instance of this shape type.- Specified by:
clearin interfaceCollection<ST extends Shape2D<?,?,I,P,V,B>>- Specified by:
clearin interfaceList<ST extends Shape2D<?,?,I,P,V,B>>- Specified by:
clearin interfaceShape2D<ST extends Shape2D<?,?,I,P,V,B>,IT extends MultiShape2D<?,?,CT,I,P,V,B>,CT extends Shape2D<?,?,I,P,V,B>,I extends PathIterator2D<?>,P extends Point2D<? super P,? super V>,V extends Vector2D<? super V,? super P>>
-
isEmpty
@Pure default boolean isEmpty()
Description copied from interface:Shape2DReplies if this shape is empty. The semantic associated to the state "empty" depends on the implemented shape. See the subclasses for details.- Specified by:
isEmptyin interfaceCollection<ST extends Shape2D<?,?,I,P,V,B>>- Specified by:
isEmptyin interfaceList<ST extends Shape2D<?,?,I,P,V,B>>- Specified by:
isEmptyin interfaceShape2D<ST extends Shape2D<?,?,I,P,V,B>,IT extends MultiShape2D<?,?,CT,I,P,V,B>,CT extends Shape2D<?,?,I,P,V,B>,I extends PathIterator2D<?>,P extends Point2D<? super P,? super V>,V extends Vector2D<? super V,? super P>>- Returns:
trueif the shape is empty;falseotherwise.
-
getClosestPointTo
@Pure default P getClosestPointTo(Point2D<?,?> point)
Description copied from interface:Shape2DReplies the point on the shape that is closest to the given point.- Specified by:
getClosestPointToin interfaceShape2D<ST extends Shape2D<?,?,I,P,V,B>,IT extends MultiShape2D<?,?,CT,I,P,V,B>,CT extends Shape2D<?,?,I,P,V,B>,I extends PathIterator2D<?>,P extends Point2D<? super P,? super V>,V extends Vector2D<? super V,? super P>>- Parameters:
point- the point.- Returns:
- the closest point on the shape; or the point itself if it is inside the shape.
-
getFarthestPointTo
@Pure default P getFarthestPointTo(Point2D<?,?> point)
Description copied from interface:Shape2DReplies the point on the shape that is farthest the given point.- Specified by:
getFarthestPointToin interfaceShape2D<ST extends Shape2D<?,?,I,P,V,B>,IT extends MultiShape2D<?,?,CT,I,P,V,B>,CT extends Shape2D<?,?,I,P,V,B>,I extends PathIterator2D<?>,P extends Point2D<? super P,? super V>,V extends Vector2D<? super V,? super P>>- Parameters:
point- the point.- Returns:
- the farthest point on the shape.
-
getDistanceSquared
@Pure default double getDistanceSquared(Point2D<?,?> point)
Description copied from interface:Shape2DReplies the squared value of the minimal distance from this shape to the given point.- Specified by:
getDistanceSquaredin interfaceShape2D<ST extends Shape2D<?,?,I,P,V,B>,IT extends MultiShape2D<?,?,CT,I,P,V,B>,CT extends Shape2D<?,?,I,P,V,B>,I extends PathIterator2D<?>,P extends Point2D<? super P,? super V>,V extends Vector2D<? super V,? super P>>- Parameters:
point- the point.- Returns:
- squared value of the minimal distance between this shape and the point.
-
getDistanceL1
@Pure default double getDistanceL1(Point2D<?,?> point)
Description copied from interface:Shape2DComputes the L-1 (Manhattan) distance between this shape and point p1. The L-1 distance is equal to abs(x1-x2) + abs(y1-y2).- Specified by:
getDistanceL1in interfaceShape2D<ST extends Shape2D<?,?,I,P,V,B>,IT extends MultiShape2D<?,?,CT,I,P,V,B>,CT extends Shape2D<?,?,I,P,V,B>,I extends PathIterator2D<?>,P extends Point2D<? super P,? super V>,V extends Vector2D<? super V,? super P>>- Parameters:
point- the point- Returns:
- the distance.
-
getDistanceLinf
@Pure default double getDistanceLinf(Point2D<?,?> point)
Description copied from interface:Shape2DComputes the L-infinite distance between this shape and point p1. The L-infinite distance is equal to MAX[abs(x1-x2), abs(y1-y2)].- Specified by:
getDistanceLinfin interfaceShape2D<ST extends Shape2D<?,?,I,P,V,B>,IT extends MultiShape2D<?,?,CT,I,P,V,B>,CT extends Shape2D<?,?,I,P,V,B>,I extends PathIterator2D<?>,P extends Point2D<? super P,? super V>,V extends Vector2D<? super V,? super P>>- Parameters:
point- the point- Returns:
- the distance.
-
toArray
@Pure default Object[] toArray()
-
toArray
default <T> T[] toArray(T[] array)
-
size
@Pure default int size()
-
contains
@Pure default boolean contains(Object obj)
-
add
default boolean add(CT element)
-
add
default void add(int index, CT element)
-
remove
default boolean remove(Object element)
-
remove
default CT remove(int index)
-
containsAll
@Pure default boolean containsAll(Collection<?> collection)
-
addAll
default boolean addAll(Collection<? extends CT> collection)
-
addAll
default boolean addAll(int index, Collection<? extends CT> collection)
-
removeAll
default boolean removeAll(Collection<?> collection)
-
retainAll
default boolean retainAll(Collection<?> collection)
-
get
@Pure default CT get(int index)
-
indexOf
@Pure default int indexOf(Object obj)
-
lastIndexOf
@Pure default int lastIndexOf(Object obj)
-
listIterator
@Pure default ListIterator<CT> listIterator()
-
listIterator
@Pure default ListIterator<CT> listIterator(int index)
-
-