Class MultipointBuilder


  • public final class MultipointBuilder
    extends GeometryBuilder
    Helper class for building immutable Multipoint geometries. Use the constructors to initialize the builder with a set of Points, and a SpatialReference. Once set, the SpatialReference cannot be changed.

    Use the mutable PointCollection returned from getPoints() to iterate through the contents of the builder, and also call the methods on the PointCollection to add, insert, or remove points from the builder. Call toGeometry() to create a new immutable Multipoint from the current values of this builder.

    Since:
    100.0.0
    See Also:
    GeometryBuilder, PointCollection, Multipoint
    • Constructor Detail

      • MultipointBuilder

        public MultipointBuilder​(SpatialReference spatialReference)
        Creates a new empty MultipointBuilder with the given SpatialReference. SpatialReference cannot be changed after instantiation.
        Parameters:
        spatialReference - the SpatialReference of the new builder. May be null.
        Since:
        100.0.0
      • MultipointBuilder

        public MultipointBuilder​(Multipoint multipoint)
        Creates a new MultipointBuilder containing the points from the given Multipoint. The SpatialReference of the new builder will match that of the given Multipoint. Use this constructor in workflows that create a modified version of an existing geometry, for example feature or graphic editing workflows.
        Parameters:
        multipoint - the Multipoint used to initialize this builder
        Since:
        100.0.0
      • MultipointBuilder

        public MultipointBuilder​(java.lang.Iterable<Point> points)
        Creates a new multipoint builder containing a copy of the given iterable of Points. The SpatialReference of the new builder will match that of the given Points. If the SpatialReference of any Point is null then it is assumed to have the the same SpatialReference as the first point. If the SpatialReference of all the Points is null, then the SpatialReference of the new MultipointBuilder will also be null.
        Parameters:
        points - the set of points used to initialize this builder
        Throws:
        ArcGISRuntimeException - if points contains Points with different SpatialReferences.
        Since:
        100.0.0
      • MultipointBuilder

        public MultipointBuilder​(java.lang.Iterable<Point> points,
                                 SpatialReference spatialReference)
        Creates a new multipoint builder containing a copy of the given iterable of Points, with the given SpatialReference. If the SpatialReference of any Point is null then it is assumed to match the spatialReference parameter.

        Use this constructor when you have a set of existing points from which to create a Multipoint, but which may not already have a SpatialReference assigned.

        Parameters:
        points - the points used to initialize this builder
        spatialReference - the SpatialReference of the new builder
        Throws:
        ArcGISRuntimeException - if points contains Points with different SpatialReferences.
        Since:
        100.0.0
    • Method Detail

      • getPoints

        public PointCollection getPoints()
        Gets the PointCollection used by this builder to create a new Multipoint. Use this mutable PointCollection to iterate through the contents of the builder. Also use this to change the state of the builder, calling the methods on this PointCollection to add or remove points from the builder. This method always returns a valid collection object; the collection will be empty if the builder GeometryBuilder.isEmpty().
        Returns:
        the collection of points in this builder, that will be used by toGeometry() to create a Multipoint
        Since:
        100.0.0
        See Also:
        PointCollection.add(Point), PointCollection.remove(int)
      • toGeometry

        public Multipoint toGeometry()
        Returns a new Multipoint 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 Multipoint each time.
        Specified by:
        toGeometry in class GeometryBuilder
        Returns:
        a new Multipoint based on the current state of this builder
        Since:
        100.0.0
      • hasZ

        public boolean hasZ()
        Description copied from class: GeometryBuilder
        Indicates if this builder has z values. Z values are generally used as a z coordinate, indicating height or elevation. NaN is a valid z value.

        If true, z values are stored for each vertex of the constructed Geometry. Geometries with z values are created by using setters or constructors that take a z value as a parameter.

        Overrides:
        hasZ in class GeometryBuilder
        Returns:
        true if this builder contains z values, false otherwise
        See Also:
        Geometry.hasZ()
      • hasM

        public boolean hasM()
        Description copied from class: GeometryBuilder
        Indicates if this builder has m values. M values are often referred to as measures, and are used in linear referencing workflows on linear datasets. NaN is a valid m value.

        If true, m values are stored for each vertex of the constructed Geometry. Geometries with m values are created by using setters or constructors that take an m value as a parameter.

        Overrides:
        hasM in class GeometryBuilder
        Returns:
        true if this builder has m values, false otherwise
        See Also:
        Geometry.hasM()