Class EnvelopeBuilder

java.lang.Object
com.esri.arcgisruntime.geometry.GeometryBuilder
com.esri.arcgisruntime.geometry.EnvelopeBuilder

public final class EnvelopeBuilder extends GeometryBuilder
The envelope builder allows you to create and modify envelope geometries incrementally.

Envelope geometries are immutable and cannot be changed directly once created. Use the constructors to define minimum and maximum x,y coordinates, z and m values, and a SpatialReference. Once set, the SpatialReference cannot be changed. Use GeometryBuilder.toGeometry() to return the new Envelope from the builder.

Since:
100.0.0
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates an envelope builder from the specified Envelope.
    EnvelopeBuilder(Point center, double width, double height)
    Creates a new EnvelopeBuilder with the given center point, width and height.
    EnvelopeBuilder(Point center, double width, double height, double depth)
    Creates a new EnvelopeBuilder with the given center point, width, height and depth.
    Creates a new empty EnvelopeBuilder with the given SpatialReference.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    centerAt(Point point)
    Centers the envelope at the specified point.
    void
    changeAspectRatio(double width, double height)
    Adjust the envelope's aspect ratio to match the ratio of the given width and height.
    void
    expand(double factor)
    Expands the envelope by the given scale factor.
    void
    expand(Point anchorPoint, double factor)
    Expands the envelope at the anchor point by the given factor.
    Gets the center point of the Envelope being constructed.
    double
    Gets the depth of the Envelope being constructed.
    double
    Gets the height of the Envelope being constructed.
    double
    Gets the m maximum value of the Envelope being constructed.
    double
    Gets the m minimum value of the Envelope being constructed.
    double
    Gets the width of the Envelope being constructed.
    double
    Gets the x maximum value of the Envelope being constructed.
    double
    The x minimum value of the Envelope being constructed.
    double
    The y maximum value of the Envelope being constructed.
    double
    The y minimum value of the Envelope being constructed.
    double
    The z maximum value of the Envelope being constructed.
    double
    The z minimum value of the Envelope being constructed.
    void
    offsetBy(double offsetX, double offsetY)
    Moves the builder's envelope geometry by the given offsets in the x and y dimension.
    void
    setM(double mMin, double mMax)
    Sets the new maximum and minimum m values of the Envelope currently being constructed.
    void
    setMMax(double mMax)
    Sets the m maximum value of the Envelope being constructed.
    void
    setMMin(double mMin)
    Sets the m minimum value of the Envelope being constructed.
    void
    setXMax(double xMax)
    Sets the x maximum value of the Envelope being constructed.
    void
    setXMin(double xMin)
    The x minimum value of the Envelope being constructed.
    void
    setXY(double xMin, double yMin, double xMax, double yMax)
    Sets new maximum and minimum x and y coordinates of the Envelope currently being constructed.
    void
    setYMax(double yMax)
    The y maximum value of the Envelope being constructed.
    void
    setYMin(double yMin)
    The y minimum value of the Envelope being constructed.
    void
    setZ(double zMin, double zMax)
    Sets the new maximum and minimum z values of the Envelope currently being constructed.
    void
    setZMax(double zMax)
    The z maximum value of the Envelope being constructed.
    void
    setZMin(double zMin)
    The z minimum value of the Envelope being constructed.
    Returns a new Envelope based on the current state of this builder.
    void
    unionOf(Envelope envelope)
    Finds the union of the builder's envelope and the specified envelope and updates the envelope builder with the result.
    void
    unionOf(Point point)
    Finds the union of the builder's envelope and the specified point and updates the envelope builder with the result.

    Methods inherited from class com.esri.arcgisruntime.geometry.GeometryBuilder

    create, create, getBuilderType, getExtent, getSpatialReference, hasCurves, hasM, hasZ, isEmpty, isSketchValid, replaceGeometry

    Methods inherited from class java.lang.Object

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

    • EnvelopeBuilder

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

      public EnvelopeBuilder(Envelope envelope)
      Creates an envelope builder from the specified Envelope.

      The SpatialReference of the new envelope builder will match that of the given Envelope. Use this constructor in workflows that create a modified version of an existing geometry.

      Parameters:
      envelope - the envelope used to initialize this builder
      Since:
      100.0.0
    • EnvelopeBuilder

      public EnvelopeBuilder(Point center, double width, double height)
      Creates a new EnvelopeBuilder with the given center point, width and height. The SpatialReference of the new builder will match that of the given center point.
      Parameters:
      center - the center point of the Envelope
      width - the width of the Envelope around the center point
      height - the height of the Envelope around the center point
      Throws:
      IllegalArgumentException - if center is null
      Since:
      100.1.0
    • EnvelopeBuilder

      public EnvelopeBuilder(Point center, double width, double height, double depth)
      Creates a new EnvelopeBuilder with the given center point, width, height and depth. The SpatialReference of the new builder will match that of the given center point.
      Parameters:
      center - the center point of the Envelope
      width - the width of the Envelope around the center point
      height - the height of the Envelope around the center point
      depth - the depth of the Envelope around the center point
      Throws:
      IllegalArgumentException - if center is null
      Since:
      100.1.0
  • Method Details

    • getXMin

      public double getXMin()
      The x minimum value of the Envelope being constructed.
      Returns:
      the current minimum x coordinate
      Since:
      100.0.0
    • setXMin

      public void setXMin(double xMin)
      The x minimum value of the Envelope being constructed.
      Parameters:
      xMin - the new minimum x coordinate
      Since:
      100.0.0
    • getYMin

      public double getYMin()
      The y minimum value of the Envelope being constructed.
      Returns:
      the current minimum y coordinate
      Since:
      100.0.0
    • setYMin

      public void setYMin(double yMin)
      The y minimum value of the Envelope being constructed.
      Parameters:
      yMin - the new minimum y coordinate
      Since:
      100.0.0
    • getZMin

      public double getZMin()
      The z minimum value of the Envelope being constructed.
      Returns:
      the current minimum z value
      Since:
      100.0.0
    • setZMin

      public void setZMin(double zMin)
      The z minimum value of the Envelope being constructed.
      Parameters:
      zMin - the new minimum z value
      Since:
      100.0.0
    • getMMin

      public double getMMin()
      Gets the m minimum value of the Envelope being constructed.
      Returns:
      the current minimum m value
      Since:
      100.0.0
    • setMMin

      public void setMMin(double mMin)
      Sets the m minimum value of the Envelope being constructed.
      Parameters:
      mMin - the new minimum m value
      Since:
      100.0.0
    • getXMax

      public double getXMax()
      Gets the x maximum value of the Envelope being constructed.
      Returns:
      the current maximum x coordinate
      Since:
      100.0.0
    • setXMax

      public void setXMax(double xMax)
      Sets the x maximum value of the Envelope being constructed.
      Parameters:
      xMax - the new maximum x coordinate
      Since:
      100.0.0
    • getYMax

      public double getYMax()
      The y maximum value of the Envelope being constructed.
      Returns:
      the current maximum y coordinate
      Since:
      100.0.0
    • setYMax

      public void setYMax(double yMax)
      The y maximum value of the Envelope being constructed.
      Parameters:
      yMax - the new maximum y coordinate
      Since:
      100.0.0
    • getZMax

      public double getZMax()
      The z maximum value of the Envelope being constructed.
      Returns:
      the current maximum z value
      Since:
      100.0.0
    • setZMax

      public void setZMax(double zMax)
      The z maximum value of the Envelope being constructed.
      Parameters:
      zMax - the new maximum z value
      Since:
      100.0.0
    • getMMax

      public double getMMax()
      Gets the m maximum value of the Envelope being constructed.
      Returns:
      the current maximum m value
      Since:
      100.0.0
    • setMMax

      public void setMMax(double mMax)
      Sets the m maximum value of the Envelope being constructed.
      Parameters:
      mMax - the new maximum m value
      Since:
      100.0.0
    • getWidth

      public double getWidth()
      Gets the width of the Envelope being constructed.

      This is the difference between the minimum and maximum x coordinates.

      Returns:
      the width of the Envelope
      Since:
      100.0.0
    • getHeight

      public double getHeight()
      Gets the height of the Envelope being constructed.

      This is the difference between the minimum and maximum y coordinates.

      Returns:
      the height of the Envelope
      Since:
      100.0.0
    • getDepth

      public double getDepth()
      Gets the depth of the Envelope being constructed.

      This is the difference between the minimum and maximum z values. A 2D envelope has zero depth.

      Returns:
      the depth of the Envelope
      Since:
      100.1.0
    • getCenter

      public Point getCenter()
      Gets the center point of the Envelope being constructed.
      Returns:
      the center point
      Since:
      100.0.0
    • setXY

      public void setXY(double xMin, double yMin, double xMax, double yMax)
      Sets new maximum and minimum x and y coordinates of the Envelope currently being constructed. Note that the SpatialReference of a builder cannot be changed after it is initialized.
      Parameters:
      xMin - the new minimum x coordinate
      yMin - the new minimum y coordinate
      xMax - the new maximum x coordinate
      yMax - the new maximum y coordinate
      Since:
      100.0.0
    • setZ

      public void setZ(double zMin, double zMax)
      Sets the new maximum and minimum z values of the Envelope currently being constructed.
      Parameters:
      zMin - the new minimum z value
      zMax - the new maximum z value
      Since:
      100.0.0
    • setM

      public void setM(double mMin, double mMax)
      Sets the new maximum and minimum m values of the Envelope currently being constructed.
      Parameters:
      mMin - the new minimum m value
      mMax - the new maximum m value
      Since:
      100.0.0
    • toGeometry

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

      public void centerAt(Point point)
      Centers the envelope at the specified point.

      The point's spatial reference must be the same as the envelope builder's.

      Parameters:
      point - the point to center at
      Throws:
      IllegalArgumentException - if point is null
      Since:
      100.5.0
    • changeAspectRatio

      public void changeAspectRatio(double width, double height)
      Adjust the envelope's aspect ratio to match the ratio of the given width and height.

      The operation preserves the center of the envelope and only increases either height or width, not both. If the new width would be greater than the old, the width is changed and the height remains the same. If the new width would be less than or equal to the old, the height is changed and the width remains the same.

      Parameters:
      width - a width
      height - a height
      Since:
      100.5.0
    • offsetBy

      public void offsetBy(double offsetX, double offsetY)
      Moves the builder's envelope geometry by the given offsets in the x and y dimension.
      Parameters:
      offsetX - the number of units to move the envelope on the x-axis
      offsetY - the number of units to move the envelope on the y-axis
      Since:
      100.5.0
    • expand

      public void expand(double factor)
      Expands the envelope by the given scale factor.

      A factor of less than 1.0 shrinks the envelope and greater than 1.0 expands it. The envelope's center remains unchanged, but its corners change.

      Parameters:
      factor - the factor to scale the envelope by
      Since:
      100.5.0
    • expand

      public void expand(Point anchorPoint, double factor)
      Expands the envelope at the anchor point by the given factor.

      A factor of less than 1.0 shrinks the envelope and greater than 1.0 expands it.

      Parameters:
      anchorPoint - a point within the envelope to expand from
      factor - the factor to scale the envelope by
      Throws:
      IllegalArgumentException - if anchorPoint is null
      Since:
      100.5.0
    • unionOf

      public void unionOf(Envelope envelope)
      Finds the union of the builder's envelope and the specified envelope and updates the envelope builder with the result.
      Parameters:
      envelope - another Envelope to union with
      Throws:
      IllegalArgumentException - if envelope is null
      Since:
      100.5.0
    • unionOf

      public void unionOf(Point point)
      Finds the union of the builder's envelope and the specified point and updates the envelope builder with the result.
      Parameters:
      point - a point to union with
      Throws:
      IllegalArgumentException - if point is null
      Since:
      100.5.0