Class Geometry

java.lang.Object
com.esri.core.geometry.Geometry
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
Envelope, MultiVertexGeometry, Point, Segment

public abstract class Geometry extends Object implements Serializable
Common properties and methods shared by all geometric objects. Geometries are objects that define a spatial location and and associated geometric shape.
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    Describes the degree of acceleration of the geometry.
    static interface 
    Geometry types
    static enum 
    The type of this geometry.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) VertexDescription
     
    (package private) int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected abstract void
     
    (package private) static Geometry
     
    protected Object
     
    (package private) void
     
    void
    addAttribute(int semantics)
    Adds a new attribute to the Geometry.
    void
    Adds the ID attribute to this Geometry
    void
    Adds the M attribute to this Geometry
    (package private) void
    Adds the Z attribute to this Geometry
    abstract void
    Applies 2D affine transformation in XY plane.
    (package private) abstract void
    Applies 3D affine transformation.
    void
    Assigns the new VertexDescription by adding or dropping attributes.
    double
    Calculates the area of the geometry.
    double
    Calculates the length of the geometry.
    Creates a copy of the geometry.
    abstract void
    Copies this geometry to another geometry of the same type.
    abstract Geometry
    Creates an instance of an empty geometry of the same type.
    void
    Drops all attributes from the Geometry with exception of POSITON.
    void
    dropAttribute(int semantics)
    Drops an attribute from the Geometry.
    abstract long
    Returns an estimate of this object size in bytes.
    protected static long
    estimateMemorySize(double[] attributes)
     
    abstract Geometry
    Returns boundary of this geometry.
    Returns the VertexDescription of this geometry.
    abstract int
    Returns the topological dimension of the geometry object based on the geometry's type.
    static int
    Returns this geometry's dimension.
    int
    The stateFlag value changes with changes applied to this geometry.
    abstract Geometry.Type
    Returns the geometry type.
    boolean
    hasAttribute(int semantics)
    A shortcut for getDescription().hasAttribute()
    boolean
    Returns true if this Geometry has an ID attribute
    boolean
    Returns true if this Geometry has an M attribute
    boolean
    Returns true if this Geometry has the Z attribute
    static boolean
    isArea(int type)
    Indicates if the integer value of the enumeration is an area (dimension 2).
    abstract boolean
    IsEmpty returns TRUE when the Geometry object does not contain geometric information beyond its original initialization state.
    static boolean
    isLinear(int type)
    Indicates if the integer value of the enumeration is linear (dimension 1).
    static boolean
    isMultiPath(int type)
    Indicates if the integer value of the enumeration is a multipath (ie, line or area).
    static boolean
    isMultiVertex(int type)
    Indicates if the integer value of the enumeration is a multivertex (ie, multipoint, line, or area).
    static boolean
    isPoint(int type)
    Indicates if the integer value of the enumeration is a point type (dimension 0).
    static boolean
    isSegment(int type)
    Indicates if the integer value of the enumeration is a segment.
    void
    Merges the new VertexDescription by adding missing attributes from the src.
    abstract void
    Returns the axis aligned bounding box of the geometry.
    abstract void
    Returns tight bbox of the Geometry in X, Y plane.
    (package private) abstract void
    Returns tight bbox of the Geometry in 3D.
    abstract Envelope1D
    queryInterval(int semantics, int ordinate)
    Returns the min and max attribute values at the ordinate of the Geometry.
    void
    Returns the conservative bbox of the Geometry in X, Y plane.
    (package private) void
    Returns tight conservative box of the Geometry in 3D.
    abstract void
    replaceNaNs(int semantics, double value)
    Replaces NaNs in the attribute with the given value.
    abstract void
    Returns the geometry to its original initialization state by releasing all data referenced by the geometry.
    The output of this method can be only used for debugging.
    static int
    Returns count of geometry vertices: 1 for Point, 4 for Envelope, get_point_count for MultiVertexGeometry types, 2 for segment types Returns 0 if geometry is empty.
    (package private) Object
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • m_description

      VertexDescription m_description
    • m_touchFlag

      volatile int m_touchFlag
  • Constructor Details

    • Geometry

      Geometry()
  • Method Details

    • getType

      public abstract Geometry.Type getType()
      Returns the geometry type.
      Returns:
      Returns the geometry type.
    • getDimension

      public abstract int getDimension()
      Returns the topological dimension of the geometry object based on the geometry's type.

      Returns 0 for point and multipoint.

      Returns 1 for lines and polylines.

      Returns 2 for polygons and envelopes

      Returns 3 for objects with volume

      Returns:
      Returns the integer value of the dimension of geometry.
    • estimateMemorySize

      public abstract long estimateMemorySize()
      Returns an estimate of this object size in bytes.

      This estimate doesn't include the size of the VertexDescription object because instances of VertexDescription are shared among geometry objects.

      Returns:
      Returns an estimate of this object size in bytes.
    • estimateMemorySize

      protected static long estimateMemorySize(double[] attributes)
    • getDescription

      public VertexDescription getDescription()
      Returns the VertexDescription of this geometry.
      Returns:
      VertexDescription
    • assignVertexDescription

      public void assignVertexDescription(VertexDescription src)
      Assigns the new VertexDescription by adding or dropping attributes. The Geometry will have the src description as a result.
      Parameters:
      src - VertexDescription to assign.
    • _assignVertexDescriptionImpl

      protected abstract void _assignVertexDescriptionImpl(VertexDescription src)
    • mergeVertexDescription

      public void mergeVertexDescription(VertexDescription src)
      Merges the new VertexDescription by adding missing attributes from the src. The Geometry will have a union of the current and the src descriptions.
      Parameters:
      src - VertexDescription to merge.
    • hasAttribute

      public boolean hasAttribute(int semantics)
      A shortcut for getDescription().hasAttribute()
      Parameters:
      semantics - The VertexDescription.Semantics to check.
      Returns:
      Return true if the attribute is present.
    • addAttribute

      public void addAttribute(int semantics)
      Adds a new attribute to the Geometry.
      Parameters:
      semantics - The VertexDescription.Semantics to add.
    • dropAttribute

      public void dropAttribute(int semantics)
      Drops an attribute from the Geometry. Dropping the attribute is equivalent to setting the attribute to the default value for each vertex, However, it is faster and the result Geometry has smaller memory footprint and smaller size when persisted.
      Parameters:
      semantics - The VertexDescription.Semantics to drop.
    • dropAllAttributes

      public void dropAllAttributes()
      Drops all attributes from the Geometry with exception of POSITON.
    • queryInterval

      public abstract Envelope1D queryInterval(int semantics, int ordinate)
      Returns the min and max attribute values at the ordinate of the Geometry.
      Parameters:
      semantics - The semantics of the interval.
      ordinate - The ordinate of the interval.
      Returns:
      The interval.
    • queryEnvelope

      public abstract void queryEnvelope(Envelope env)
      Returns the axis aligned bounding box of the geometry.
      Parameters:
      env - The envelope to return the result in.
    • queryEnvelope2D

      public abstract void queryEnvelope2D(Envelope2D env)
      Returns tight bbox of the Geometry in X, Y plane.
      Parameters:
      env - The envelope to return the result in.
    • queryEnvelope3D

      abstract void queryEnvelope3D(Envelope3D env)
      Returns tight bbox of the Geometry in 3D.
      Parameters:
      env - The envelope to return the result in.
    • queryLooseEnvelope2D

      public void queryLooseEnvelope2D(Envelope2D env)
      Returns the conservative bbox of the Geometry in X, Y plane. This is a faster method than QueryEnvelope2D. However, the bbox could be larger than the tight box.
      Parameters:
      env - The envelope to return the result in.
    • queryLooseEnvelope3D

      void queryLooseEnvelope3D(Envelope3D env)
      Returns tight conservative box of the Geometry in 3D. This is a faster method than the QueryEnvelope3D. However, the box could be larger than the tight box.
      Parameters:
      env - The envelope to return the result in.
    • isEmpty

      public abstract boolean isEmpty()
      IsEmpty returns TRUE when the Geometry object does not contain geometric information beyond its original initialization state.
      Returns:
      boolean Returns TRUE if this geometry is empty.
    • setEmpty

      public abstract void setEmpty()
      Returns the geometry to its original initialization state by releasing all data referenced by the geometry.
    • applyTransformation

      public abstract void applyTransformation(Transformation2D transform)
      Applies 2D affine transformation in XY plane.
      Parameters:
      transform - The affine transformation to be applied to this geometry.
    • applyTransformation

      abstract void applyTransformation(Transformation3D transform)
      Applies 3D affine transformation. Adds Z attribute if it is missing.
      Parameters:
      transform - The affine transformation to be applied to this geometry.
    • createInstance

      public abstract Geometry createInstance()
      Creates an instance of an empty geometry of the same type.
      Returns:
      The new instance.
    • copyTo

      public abstract void copyTo(Geometry dst)
      Copies this geometry to another geometry of the same type. The result geometry is an exact copy.
      Parameters:
      dst - The geometry instance to copy to.
      Throws:
      GeometryException - invalid_argument if the geometry is of different type.
    • calculateArea2D

      public double calculateArea2D()
      Calculates the area of the geometry. If the spatial reference is a Geographic Coordinate System (WGS84) then the 2D area calculation is defined in angular units.
      Returns:
      A double value representing the 2D area of the geometry.
    • calculateLength2D

      public double calculateLength2D()
      Calculates the length of the geometry. If the spatial reference is a Geographic Coordinate System (a system where coordinates are defined using angular units such as longitude and latitude) then the 2D distance calculation is returned in angular units. In cases where length must be calculated on a Geographic Coordinate System consider the using the geodeticLength method on the GeometryEngine
      Returns:
      A double value representing the 2D length of the geometry.
    • _getImpl

      protected Object _getImpl()
    • addZ

      void addZ()
      Adds the Z attribute to this Geometry
    • hasZ

      public boolean hasZ()
      Returns true if this Geometry has the Z attribute
      Returns:
      true if this Geometry has the Z attribute
    • addM

      public void addM()
      Adds the M attribute to this Geometry
    • hasM

      public boolean hasM()
      Returns true if this Geometry has an M attribute
      Returns:
      true if this Geometry has an M attribute
    • addID

      public void addID()
      Adds the ID attribute to this Geometry
    • hasID

      public boolean hasID()
      Returns true if this Geometry has an ID attribute
      Returns:
      true if this Geometry has an ID attribute
    • getDimensionFromType

      public static int getDimensionFromType(int type)
      Returns this geometry's dimension.

      Returns 0 for point and multipoint.

      Returns 1 for lines and polylines.

      Returns 2 for polygons and envelopes

      Returns 3 for objects with volume

      Parameters:
      type - The integer value from geometry enumeration. You can use the method Geometry.Type.value() to get at the integer value.
      Returns:
      The integer dimension of this geometry.
    • isPoint

      public static boolean isPoint(int type)
      Indicates if the integer value of the enumeration is a point type (dimension 0).
      Parameters:
      type - The integer value from geometry enumeration. You can use the method Geometry.Type.value() to get at the integer value.
      Returns:
      TRUE if the geometry is a point (a Point or a Multipoint).
    • isLinear

      public static boolean isLinear(int type)
      Indicates if the integer value of the enumeration is linear (dimension 1).
      Parameters:
      type - The integer value from geometry enumeration. You can use the method Geometry.Type.value() to get at the integer value.
      Returns:
      TRUE if the geometry is a line.
    • isArea

      public static boolean isArea(int type)
      Indicates if the integer value of the enumeration is an area (dimension 2).
      Parameters:
      type - The integer value from geometry enumeration. You can use the method Geometry.Type.value() to get at the integer value.
      Returns:
      TRUE if the geometry is a polygon.
    • isSegment

      public static boolean isSegment(int type)
      Indicates if the integer value of the enumeration is a segment.
      Parameters:
      type - The integer value from geometry enumeration. You can use the method Geometry.Type.value() to get at the integer value.
      Returns:
      TRUE if the geometry is a segment.
    • isMultiVertex

      public static boolean isMultiVertex(int type)
      Indicates if the integer value of the enumeration is a multivertex (ie, multipoint, line, or area).
      Parameters:
      type - The integer value from geometry enumeration. You can use the method Geometry.Type.value() to get at the integer value.
      Returns:
      TRUE if the geometry has multiple vertices.
    • isMultiPath

      public static boolean isMultiPath(int type)
      Indicates if the integer value of the enumeration is a multipath (ie, line or area).
      Parameters:
      type - The integer value from geometry enumeration. You can use the method Geometry.Type.value() to get at the integer value.
      Returns:
      TRUE if the geometry is a multipath.
    • copy

      public Geometry copy()
      Creates a copy of the geometry.
      Returns:
      Returns a copy of this geometry.
    • getBoundary

      public abstract Geometry getBoundary()
      Returns boundary of this geometry. Polygon and Envelope boundary is a Polyline. For Polyline and Line, the boundary is a Multi_point consisting of path end points. For Multi_point and Point null is returned.
      Returns:
      The boundary geometry.
    • replaceNaNs

      public abstract void replaceNaNs(int semantics, double value)
      Replaces NaNs in the attribute with the given value. If the geometry is not empty, it adds the attribute if geometry does not have it yet, and replaces the values. If the geometry is empty, it adds the attribute and does not set any values.
      Parameters:
      semantics - The semantics for which to replace the NaNs.
      value - The value to replace NaNs with.
    • _clone

      static Geometry _clone(Geometry src)
    • getStateFlag

      public int getStateFlag()
      The stateFlag value changes with changes applied to this geometry. This allows the user to keep track of the geometry's state.
      Returns:
      The state of the geometry.
    • _touch

      void _touch()
    • writeReplace

      Object writeReplace() throws ObjectStreamException
      Throws:
      ObjectStreamException
    • toString

      public String toString()
      The output of this method can be only used for debugging. It is subject to change without notice.
      Overrides:
      toString in class Object
    • vertex_count

      public static int vertex_count(Geometry geom)
      Returns count of geometry vertices: 1 for Point, 4 for Envelope, get_point_count for MultiVertexGeometry types, 2 for segment types Returns 0 if geometry is empty.
      Parameters:
      geom - The geometry to get the vertex count for.
      Returns:
      The vertex count.