Package org.djutils.draw
Interface Drawable<P extends Point<P>>
-
- Type Parameters:
P- The point type (2d or 3d)
- All Superinterfaces:
Serializable
- All Known Subinterfaces:
Drawable2d,Drawable3d,LineSegment<P,R>,Point<P>,PolyLine<L,P,R,LS>
- All Known Implementing Classes:
Bounds2d,Bounds3d,LineSegment2d,LineSegment3d,OrientedPoint2d,OrientedPoint3d,Point2d,Point3d,Polygon2d,Polygon3d,PolyLine2d,PolyLine3d,Ray2d,Ray3d,Surface3d
public interface Drawable<P extends Point<P>> extends Serializable
Drawable is an interface to indicate zero or more points can be retrieved to draw the object.Copyright (c) 2020-2023 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See DJUTILS License.- Author:
- Alexander Verbraeck, Peter Knoppers
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description intgetDimensions()Return the number of dimensions.default List<P>getPointList()Create a list of all points that make up this Drawable.Iterator<? extends P>getPoints()Retrieve, or generate all points that make up the object.intsize()Retrieve the number of points that make up the object.StringtoString()Produce a string describing the Drawable using default conversion for the (double) coordinate values.default StringtoString(boolean doNotIncludeClassName)Produce a String describing the Drawable.default StringtoString(String doubleFormat)Produce a String describing the Drawable.StringtoString(String doubleFormat, boolean doNotIncludeClassName)Produce a String describing the Drawable.
-
-
-
Method Detail
-
getPoints
Iterator<? extends P> getPoints()
Retrieve, or generate all points that make up the object.- Returns:
- Iterable<Point2d>; an iterator that generates all points that make up the object
-
getPointList
default List<P> getPointList()
Create a list of all points that make up this Drawable. This method is expensive as a new list is constructed on each invocation.- Returns:
- List<? extends P>; a list containing all points of this Drawable
-
size
int size()
Retrieve the number of points that make up the object.- Returns:
- int; the number of points that make up the object
-
getDimensions
int getDimensions()
Return the number of dimensions.- Returns:
- int; the number of dimensions
-
toString
String toString()
Produce a string describing the Drawable using default conversion for the (double) coordinate values. Regrettably, it is not allowed to provide a default implementation here.
-
toString
String toString(String doubleFormat, boolean doNotIncludeClassName)
Produce a String describing the Drawable.- Parameters:
doubleFormat- String; a format string (something like "%6.3f") which will be used to render every coordinate value)doNotIncludeClassName- boolean; if true; the output of toString is not prefixed by the class name. This is useful for concatenating the textual representation of lots of Drawables (e.g. an array, or a List).- Returns:
- String; textual representation of the Drawable
-
toString
default String toString(String doubleFormat)
Produce a String describing the Drawable.- Parameters:
doubleFormat- String; a format string (something like "%6.3f") which will be used to render every coordinate value)- Returns:
- String; textual representation of the Drawable
-
toString
default String toString(boolean doNotIncludeClassName)
Produce a String describing the Drawable.- Parameters:
doNotIncludeClassName- boolean; if true; the output of toString is not prefixed by the class name. This is useful for concatenating the textual representation of lots of Drawables (e.g. an array, or a List).- Returns:
- String; textual representation of the Drawable
-
-