Package org.opentrafficsim.draw
Class PaintPolygons
java.lang.Object
org.opentrafficsim.draw.PaintPolygons
Paint a (series of) filled polygon(s) defined as a Path2D.Double
Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
- Author:
- Peter Knoppers, Wouter Schakel
-
Field Summary
Modifier and TypeFieldDescriptionstatic final org.djutils.draw.point.Point2d
Dummy coordinate that forces the drawing operation to start a new path. -
Method Summary
Modifier and TypeMethodDescriptionstatic Set<Path2D.Float>
Returns drawable paths of a polygon.static Set<Path2D.Float>
getPaths
(org.djutils.draw.point.OrientedPoint2d referencePoint, List<org.djutils.draw.point.Point2d> line) Returns drawable paths of a polygon.static Set<Path2D.Float>
Returns drawable paths of a polygon.static void
paintPaths
(Graphics2D graphics, Color color, Set<Path2D.Float> paths, boolean fill) Paint (fill) a polygon or a series of polygons.
-
Field Details
-
NEWPATH
public static final org.djutils.draw.point.Point2d NEWPATHDummy coordinate that forces the drawing operation to start a new path.
-
-
Method Details
-
getPaths
public static Set<Path2D.Float> getPaths(org.djutils.draw.point.Point2d referencePoint, List<org.djutils.draw.point.Point2d> line) Returns drawable paths of a polygon.- Parameters:
referencePoint
- Point2d; the reference pointline
- List<Point2d>; array of points- Returns:
- Set<Path2D.Float>; drawable paths.
-
getPaths
public static Set<Path2D.Float> getPaths(org.djutils.draw.point.OrientedPoint2d referencePoint, List<org.djutils.draw.point.Point2d> line) Returns drawable paths of a polygon.- Parameters:
referencePoint
- Point2d; the reference pointline
- List<Point2d>; array of points- Returns:
- Set<Path2D.Float>; drawable paths.
-
getPaths
Returns drawable paths of a polygon.- Parameters:
line
- List<Point2d>; array of points- Returns:
- Set<Path2D.Float>; drawable paths.
-
paintPaths
public static void paintPaths(Graphics2D graphics, Color color, Set<Path2D.Float> paths, boolean fill) Paint (fill) a polygon or a series of polygons.- Parameters:
graphics
- Graphics2D; the graphics environmentcolor
- Color; the color to usepaths
- Set<Path2D.Float>; drawable paths.fill
- boolean; fill or just contour
-