Class PaintPolygons

java.lang.Object
org.opentrafficsim.draw.PaintPolygons

public final class PaintPolygons extends Object
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 Details

    • NEWPATH

      public static final org.djutils.draw.point.Point2d NEWPATH
      Dummy 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 point
      line - 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 point
      line - List<Point2d>; array of points
      Returns:
      Set<Path2D.Float>; drawable paths.
    • getPaths

      public static Set<Path2D.Float> getPaths(List<org.djutils.draw.point.Point2d> line)
      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 environment
      color - Color; the color to use
      paths - Set<Path2D.Float>; drawable paths.
      fill - boolean; fill or just contour