Class PointBuilder


  • public final class PointBuilder
    extends GeometryBuilder
    Helper class for building immutable Point geometries. Points are the most straightforward geometries to define, and therefore Point class constructors provide the same options as available on this builder. This builder class is provided mainly for consistency with other immutable geometries.

    Use the constructors to define x,y coordinates, z and m values, and a SpatialReference. Once set, the SpatialReference cannot be changed. Each other value can also be set individually or later modified by using the setter methods. Call the toGeometry() method to create a new immutable Point from the current values of this builder.

    Since:
    100.0.0
    See Also:
    Point
    • Constructor Summary

      Constructors 
      Constructor Description
      PointBuilder​(double x, double y)
      Creates a new empty PointBuilder with the given x,y coordinates.
      PointBuilder​(double x, double y, double z)
      Creates a new point builder with the given x,y coordinates and z value.
      PointBuilder​(double x, double y, double z, double m)
      Creates a new point builder with the given x,y coordinates and z- and m values.
      PointBuilder​(double x, double y, double z, double m, SpatialReference spatialReference)
      Creates a new point builder with the given x,y coordinates, z- and m values, and SpatialReference.
      PointBuilder​(double x, double y, double z, SpatialReference spatialReference)
      Creates a new point builder with the given x,y coordinates, z value, and SpatialReference.
      PointBuilder​(double x, double y, SpatialReference spatialReference)
      Creates a new point builder with the given x,y coordinates and SpatialReference.
      PointBuilder​(Point point)
      Creates a new empty PointBuilder from the given Point.
      PointBuilder​(SpatialReference spatialReference)
      Creates a new empty PointBuilder with the given SpatialReference.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double getM()
      Gets the current m value of the point being constructed.
      double getX()
      Gets the current x coordinate of the point being constructed.
      double getY()
      Gets the current y coordinate of the point being constructed.
      double getZ()
      Gets the current z value of the point being constructed.
      void setM​(double m)
      Sets a new m value for the point being constructed.
      void setX​(double x)
      Sets a new x coordinate for the point being constructed.
      void setXY​(double x, double y)
      Sets new x,y coordinates for the point being constructed.
      void setY​(double y)
      Sets a new y coordinate for the point being constructed.
      void setZ​(double z)
      Sets a new z value for the point being constructed.
      Point toGeometry()
      Returns a new Point based on the current state of this builder.
      • Methods inherited from class java.lang.Object

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

      • PointBuilder

        public PointBuilder​(SpatialReference spatialReference)
        Creates a new empty PointBuilder with the given SpatialReference.
        Parameters:
        spatialReference - the SpatialReference of the new builder
        Since:
        100.0.0
      • PointBuilder

        public PointBuilder​(Point point)
        Creates a new empty PointBuilder from the given Point. The SpatialReference of the new builder will match that of the given Point.
        Parameters:
        point - the point to initialize the new builder from
        Since:
        100.0.0
      • PointBuilder

        public PointBuilder​(double x,
                            double y)
        Creates a new empty PointBuilder with the given x,y coordinates. The SpatialReference of the new builder will be null.
        Parameters:
        x - the x coordinate of the point being constructed
        y - the y coordinate of the point being constructed
        Since:
        100.0.0
      • PointBuilder

        public PointBuilder​(double x,
                            double y,
                            SpatialReference spatialReference)
        Creates a new point builder with the given x,y coordinates and SpatialReference.
        Parameters:
        x - the x coordinate of the point being constructed
        y - the y coordinate of the point being constructed
        spatialReference - the SpatialReference of the point being constructed
        Since:
        100.0.0
      • PointBuilder

        public PointBuilder​(double x,
                            double y,
                            double z)
        Creates a new point builder with the given x,y coordinates and z value. The SpatialReference of the new builder will be null.
        Parameters:
        x - the x coordinate of the point being constructed
        y - the y coordinate of the point being constructed
        z - the z value of the point being constructed
        Since:
        100.0.0
      • PointBuilder

        public PointBuilder​(double x,
                            double y,
                            double z,
                            SpatialReference spatialReference)
        Creates a new point builder with the given x,y coordinates, z value, and SpatialReference.
        Parameters:
        x - the x coordinate of the point being constructed
        y - the y coordinate of the point being constructed
        z - the z value of the point being constructed
        spatialReference - the SpatialReference of the point being constructed
        Since:
        100.0.0
      • PointBuilder

        public PointBuilder​(double x,
                            double y,
                            double z,
                            double m)
        Creates a new point builder with the given x,y coordinates and z- and m values. The SpatialReference of the new builder will be null.
        Parameters:
        x - the x coordinate of the point being constructed
        y - the y coordinate of the point being constructed
        z - the z value of the point being constructed
        m - the m value of the point being constructed
        Since:
        100.0.0
      • PointBuilder

        public PointBuilder​(double x,
                            double y,
                            double z,
                            double m,
                            SpatialReference spatialReference)
        Creates a new point builder with the given x,y coordinates, z- and m values, and SpatialReference.
        Parameters:
        x - the x coordinate of the point being constructed
        y - the y coordinate of the point being constructed
        z - the z value of the point being constructed
        m - the m value of the point being constructed
        spatialReference - the SpatialReference of the point being constructed
        Since:
        100.0.0
    • Method Detail

      • getM

        public double getM()
        Gets the current m value of the point being constructed.
        Returns:
        the current m value
        Since:
        100.0.0
      • setM

        public void setM​(double m)
        Sets a new m value for the point being constructed.
        Parameters:
        m - the new m value
        Since:
        100.0.0
      • getX

        public double getX()
        Gets the current x coordinate of the point being constructed.
        Returns:
        the current x coordinate
        Since:
        100.0.0
      • setX

        public void setX​(double x)
        Sets a new x coordinate for the point being constructed.
        Parameters:
        x - the new x coordinate
        Since:
        100.0.0
      • getY

        public double getY()
        Gets the current y coordinate of the point being constructed.
        Returns:
        the current y coordinate
        Since:
        100.0.0
      • setY

        public void setY​(double y)
        Sets a new y coordinate for the point being constructed.
        Parameters:
        y - the new y coordinate
        Since:
        100.0.0
      • getZ

        public double getZ()
        Gets the current z value of the point being constructed.
        Returns:
        the current z value
        Since:
        100.0.0
        See Also:
        setZ(double)
      • setZ

        public void setZ​(double z)
        Sets a new z value for the point being constructed.

        The minimum z value is -6,356,752 meters, which is the approximate radius of the earth (the WGS 84 datum semi-minor axis). The maximum z value is 55,000,000 meters. Will return NAN if an error occurs.

        Parameters:
        z - the new z value
        Since:
        100.0.0
        See Also:
        getZ()
      • setXY

        public void setXY​(double x,
                          double y)
        Sets new x,y coordinates for the point being constructed.
        Parameters:
        x - the x coordinate of the point being constructed
        y - the y coordinate of the point being constructed
        Since:
        100.0.0
      • toGeometry

        public Point toGeometry()
        Returns a new Point based on the current state of this builder. This method can be called as many times as required for any specific instance; it does not affect the state of the builder, and returns a new Point each time.
        Specified by:
        toGeometry in class GeometryBuilder
        Returns:
        a new Point based on the current state of this builder
        Since:
        100.0.0