Class Polyline2D.Double

  • All Implemented Interfaces:
    java.awt.Shape
    Enclosing class:
    Polyline2D

    public static class Polyline2D.Double
    extends Polyline2D
    The concrete Polyline class that stores coordinates internally as doubles.
    • Constructor Summary

      Constructors 
      Constructor Description
      Double()
      Create a new polyline with no coordinates
      Double​(double x1, double y1, double x2, double y2)
      Create a new polyline with two vertices.
      Double​(int initSize)
      Create a new polyline with "initSize" number of vertices.
      Double​(Polyline2D in)
      Copy constructor for efficient copying of Polyline2D.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.awt.geom.Rectangle2D getBounds2D()
      Get the floating-point bounds of the polyline.
      double getX​(int index)
      Get the given X-coordinate
      double getY​(int index)
      Get the given Y-coordinate
      void lineTo​(double x, double y)
      Add a new vertex to the end of the line.
      void moveTo​(double x, double y)
      Move the start point of the vertex to the given position.
      void setX​(int index, double x)
      Set the given X-coordinate.
      void setY​(int index, double y)
      Set the given Y-coordinate
      void transform​(java.awt.geom.AffineTransform at)
      Transform the polyline with the given transform.
      void translate​(double x, double y)
      Translate the polyline the given distance.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Double

        public Double()
        Create a new polyline with no coordinates
      • Double

        public Double​(int initSize)
        Create a new polyline with "initSize" number of vertices.
      • Double

        public Double​(double x1,
                      double y1,
                      double x2,
                      double y2)
        Create a new polyline with two vertices.
      • Double

        public Double​(Polyline2D in)
        Copy constructor for efficient copying of Polyline2D.
    • Method Detail

      • getBounds2D

        public java.awt.geom.Rectangle2D getBounds2D()
        Get the floating-point bounds of the polyline.
        Specified by:
        getBounds2D in interface java.awt.Shape
        Specified by:
        getBounds2D in class Polyline2D
      • getX

        public double getX​(int index)
        Get the given X-coordinate
        Specified by:
        getX in class Polyline2D
        Throws:
        java.lang.IndexOutOfBoundsException - The index is out of bounds.
      • getY

        public double getY​(int index)
        Get the given Y-coordinate
        Specified by:
        getY in class Polyline2D
        Throws:
        java.lang.IndexOutOfBoundsException - The index is out of bounds.
      • lineTo

        public void lineTo​(double x,
                           double y)
        Add a new vertex to the end of the line.
        Specified by:
        lineTo in class Polyline2D
      • moveTo

        public void moveTo​(double x,
                           double y)
        Move the start point of the vertex to the given position.
        Specified by:
        moveTo in class Polyline2D
        Throws:
        java.lang.UnsupportedOperationException - The polyline already has vertices
      • setX

        public void setX​(int index,
                         double x)
        Set the given X-coordinate.
        Specified by:
        setX in class Polyline2D
        Throws:
        java.lang.IndexOutOfBoundsException - The index is out of bounds.
      • setY

        public void setY​(int index,
                         double y)
        Set the given Y-coordinate
        Specified by:
        setY in class Polyline2D
        Throws:
        java.lang.IndexOutOfBoundsException - The index is out of bounds.
      • transform

        public void transform​(java.awt.geom.AffineTransform at)
        Transform the polyline with the given transform.
        Specified by:
        transform in class Polyline2D
      • translate

        public void translate​(double x,
                              double y)
        Translate the polyline the given distance.
        Specified by:
        translate in class Polyline2D