Class MultipartBuilder

java.lang.Object
com.esri.arcgisruntime.geometry.GeometryBuilder
com.esri.arcgisruntime.geometry.MultipartBuilder
Direct Known Subclasses:
PolygonBuilder, PolylineBuilder

public abstract class MultipartBuilder extends GeometryBuilder
The multipart builders allow you to create and modify geometries made up of multiple parts, such as Polyline and Polygon.

This is a base class for the geometry multipart builders, such as PolylineBuilder or PolygonBuilder.

Since:
100.0.0
  • Method Details

    • getParts

      public PartCollection getParts()
      Gets the collection of Parts that will be used to create a multipart geometry. Use this mutable PartCollection to iterate through the contents of the builder. Also use this to change the state of the builder, calling the methods on this PartCollection to add, insert, or remove Parts from the builder, or to change the contents of an existing Part. This method always returns a valid collection object; the collection will be empty if the builder GeometryBuilder.isEmpty(). By default, a new MultipartBuilder has one empty Part.
      Returns:
      the collection of Parts that will be used to build a multipart geometry
      Since:
      100.0.0
      See Also:
    • addPart

      public void addPart()
      Adds a new empty Part to the end of the PartCollection of this builder. Subsequent calls to any of the addPoint methods will append the new Point to the last Part in the builder.

      This is a convenience method providing a shortcut alternative to using getParts() and then PartCollection.add(Part).

      Since:
      100.0.0
      See Also:
    • addPart

      public void addPart(Part part)
      Adds the given Part to the end of the PartCollection of this builder. The new Part may already contain members, or alternatively, the Part can be updated after it is added to the builder.

      This is a convenience method providing a shortcut alternative to using getParts() and then PartCollection.add(Part).

      Parameters:
      part - the new Part to add to the builder
      Throws:
      NullPointerException - if part is null
      Since:
      100.0.0
      See Also:
    • addPart

      public void addPart(PointCollection points)
      Creates a new Part at the end of the PartCollection of this builder, and adds the given PointCollection to this new Part.

      This is a convenience method providing a shortcut alternative to using getParts() and then PartCollection.add(PointCollection).

      Parameters:
      points - the new part to add to the builder
      Throws:
      NullPointerException - if points is null
      Since:
      100.0.0
      See Also:
    • addParts

      public void addParts(PartCollection parts)
      Adds the Parts in the given PartCollection to the end of the PartCollection of this builder. The new Parts may already contain members, or alternatively, can be updated after being added to the builder.

      This is a convenience method providing a shortcut alternative to using getParts() and then PartCollection.add(Part).

      Parameters:
      parts - the new PartCollection containing Parts to add to the builder
      Throws:
      NullPointerException - if part is null
      Since:
      100.0.0
      See Also:
    • addPoint

      public void addPoint(double x, double y)
      Adds a new Point with the given x,y coordinates to the end of the last Part of this builders PartCollection.

      This is a point-based helper method, working with a multipart geometry using Points instead of Segments. It is also a convenience method providing a shortcut alternative to using getParts(), and then Part.addPoint(double, double).

      If there are no parts, then an initial part is created and the point added to that. The point will become the endpoint of a line segment in the part.

      Parameters:
      x - the x coordinate of the new Point
      y - the y coordinate of the new Point
      Since:
      100.0.0
      See Also:
    • addPoint

      public void addPoint(double x, double y, double z)
      Adds a new Point with the given x,y coordinates and z value to the end of the last Part of this builders PartCollection.

      This is a point-based helper method, working with a multipart geometry using Points instead of Segments. It is also a convenience method providing a shortcut alternative to using getParts(), and then Part.addPoint(double, double, double).

      If there are no parts, then an initial part is created and the point added to that. The point will become the endpoint of a line segment in the part.

      Parameters:
      x - the x coordinate of the new Point
      y - the y coordinate of the new Point
      z - the z value of the new Point
      Since:
      100.0.0
      See Also:
    • addPoint

      public void addPoint(Point point)
      Adds the given Point to the end of the last Part of this builders PartCollection.

      This is a point-based helper method, working with a multipart geometry using Points instead of Segments. It is also a convenience method providing a shortcut alternative to using getParts(), and then Part.addPoint(Point).

      If there are no parts, then an initial part is created and the point added to that. The point will become the endpoint of a line segment in the part.

      Parameters:
      point - the Point to add to the builder
      Throws:
      NullPointerException - if point is null
      Since:
      100.0.0
      See Also:
    • addPointToPart

      public void addPointToPart(int partIndex, Point point)
      Adds the given Point to the end of the given Part of this builders PartCollection. To insert a Point at an index position other than the end of the Part, use getParts() to get the required Part, and Part.addPoint(int, Point) instead.

      This is a point-based helper method, working with a multipart geometry using Points instead of Segments.

      Parameters:
      partIndex - index of the Part to add the given Point to
      point - the Point to add to the given Part of the builder
      Throws:
      IndexOutOfBoundsException - if partIndex < 0 || partIndex >= size()
      NullPointerException - if point is null
      Since:
      100.0.0
      See Also:
    • addPoints

      public void addPoints(Iterable<Point> points)
      Adds the given set of Points to the end of the last Part of this builders PartCollection. To add Points to a Part other than the last Part, use getParts() to get the required Part, and Part.addAllPoints(int, Collection) instead.

      This is a point-based helper method, working with a multipart geometry using Points instead of Segments.

      Parameters:
      points - the Points to the end of the last Part of the builder
      Throws:
      NullPointerException - if points is null
      Since:
      100.0.0
      See Also:
    • addPointsToPart

      public void addPointsToPart(int partIndex, Iterable<Point> points)
      Adds the given set of Points to the end of the given Part of this builders PartCollection. To insert Points at an index position other than the end of the Part, use getParts() to get the required Part, and Part.addAllPoints(int, Collection) instead.

      This is a point-based helper method, working with a multipart geometry using Points instead of Segments.

      Parameters:
      partIndex - index of the Part to add the given Points to
      points - the Points to the end of the given Part of the builder
      Throws:
      IndexOutOfBoundsException - if partIndex < 0 || partIndex >= size()
      NullPointerException - if points is null
      Since:
      100.0.0
      See Also:
    • replaceGeometry

      public void replaceGeometry(Geometry geometry)
      Description copied from class: GeometryBuilder
      Replaces the geometry currently stored in the geometry builder with the new geometry.

      This method can be used as an alternative to creating a new builder from an existing geometry. Note that this does not update the spatial reference of the builder and the builder geometry is cleared if the geometry is null. Geometries with curves are supported.

      Overrides:
      replaceGeometry in class GeometryBuilder
      Parameters:
      geometry - the new geometry to replace the existing geometry with