Class MultipartBuilder

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addPart()
      Adds a new empty Part to the end of the PartCollection of this builder.
      void addPart​(Part part)
      Adds the given Part to the end of the PartCollection of this builder.
      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.
      void addParts​(PartCollection parts)
      Adds the Parts in the given PartCollection to the end of the PartCollection of this builder.
      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.
      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.
      void addPoint​(Point point)
      Adds the given Point to the end of the last Part of this builders PartCollection.
      void addPoints​(java.lang.Iterable<Point> points)
      Adds the given set of Points to the end of the last Part of this builders PartCollection.
      void addPointsToPart​(int partIndex, java.lang.Iterable<Point> points)
      Adds the given set of Points to the end of the given Part of this builders PartCollection.
      void addPointToPart​(int partIndex, Point point)
      Adds the given Point to the end of the given Part of this builders PartCollection.
      PartCollection getParts()
      Gets the collection of Parts that will be used to create a multipart geometry.
      void replaceGeometry​(Geometry geometry)
      Replaces the geometry currently stored in this builder with the new geometry.
      • Methods inherited from class java.lang.Object

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

      • 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:
        Part, GeometryBuilder.toGeometry()
      • 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:
        Part, getParts()
      • 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:
        java.lang.NullPointerException - if part is null
        Since:
        100.0.0
        See Also:
        getParts()
      • 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:
        java.lang.NullPointerException - if points is null
        Since:
        100.0.0
        See Also:
        getParts()
      • 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:
        java.lang.NullPointerException - if part is null
        Since:
        100.0.0
        See Also:
        getParts()
      • 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:
        getParts(), Part.addPoint(double, double), addPoint(Point)
      • 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:
        getParts(), Part.addPoint(double, double, double), addPoint(Point)
      • 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:
        java.lang.NullPointerException - if point is null
        Since:
        100.0.0
        See Also:
        getParts(), Part.addPoint(Point), addPoint(double, double)
      • 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:
        java.lang.IndexOutOfBoundsException - if partIndex < 0 || partIndex >= size()
        java.lang.NullPointerException - if point is null
        Since:
        100.0.0
        See Also:
        getParts(), Part.addPoint(int, Point)
      • addPoints

        public void addPoints​(java.lang.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:
        java.lang.NullPointerException - if points is null
        Since:
        100.0.0
        See Also:
        getParts(), AbstractCollection.addAll(Collection)
      • addPointsToPart

        public void addPointsToPart​(int partIndex,
                                    java.lang.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:
        java.lang.IndexOutOfBoundsException - if partIndex < 0 || partIndex >= size()
        java.lang.NullPointerException - if points is null
        Since:
        100.0.0
        See Also:
        getParts(), AbstractList.addAll(int, Collection)
      • replaceGeometry

        public void replaceGeometry​(Geometry geometry)
        Description copied from class: GeometryBuilder
        Replaces the geometry currently stored in this builder with the new geometry. This method can be used as an alternative to creating a new builder instance from an existing geometry.

        This does not update the spatial reference of the builder. If the geometry is null, the builder is cleared.

        Prior to v100.12, only geometries without curves could be used; passing in a geometry where Geometry.hasCurves() is true would throw an exception.

        From v100.12, geometries with curves are supported.

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