Class EnvelopeOperation

All Implemented Interfaces:
Serializable, BiFunction<AbstractFeature,org.opengis.parameter.ParameterValueGroup,Object>, Deprecable

final class EnvelopeOperation extends AbstractOperation
An operation computing the envelope that encompass all geometries found in a list of attributes. Geometries can be in different coordinate reference systems; they will be transformed to the first non-null CRS in the following choices:
  1. the CRS specified at construction time,
  2. the CRS of the default geometry, or
  3. the CRS of the first non-empty geometry.

Limitations

If a geometry contains other geometries, this operation queries only the envelope of the root geometry. It is the root geometry responsibility to take in account the envelope of all its children.

This operation is read-only. Calls to Attribute.setValue(Envelope) will result in an IllegalStateException to be thrown.

Since:
0.7
Version:
1.1
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      For cross-version compatibility.
      See Also:
    • EMPTY_PARAMS

      private static final org.opengis.parameter.ParameterDescriptorGroup EMPTY_PARAMS
      The parameter descriptor for the "Envelope" operation, which does not take any parameter.
    • attributeNames

      private final String[] attributeNames
      The names of all properties containing a geometry object.
    • targetCRS

      final org.opengis.referencing.crs.CoordinateReferenceSystem targetCRS
      The coordinate reference system of the envelope to compute, or null for using the CRS of the default geometry or the first non-empty geometry. Note that this is the CRS desired by user of this EnvelopeOperation; it may be unrelated to the CRS of stored geometries.
    • attributeToCRS

      private final org.opengis.referencing.operation.CoordinateOperation[] attributeToCRS
      The coordinate conversions or transformations from the CRS used by the geometries to the CRS requested by the user, or null if there is no operation to apply. If non-null, the length of this array shall be equal to the length of the attributeNames array and element at index i is the operation from the attributeNames[i] geometry CRS to the targetCRS. It may be the identity operation, and may also be null if the property at index i does not declare a default CRS.

      Performance note

      If this array is null, then AbstractFeature.getProperty(String) does not need to be invoked at all. A null array is a signal that invoking only the cheaper AbstractFeature.getPropertyValue(String) method is sufficient. However, this array become non-null as soon as there is at least one CRS characteristic to check. We do not distinguish which particular property may have a CRS characteristic because as of Apache SIS 1.0, implementations of DenseFeature and SparseFeature have a "all of nothing" behavior anyway. So there is no performance gain to expect from a fine-grained knowledge of which properties declare a CRS.
    • dependencies

      private transient Set<String> dependencies
      The property names as an unmodifiable set, created when first needed.
    • resultType

      private final DefaultAttributeType<org.opengis.geometry.Envelope> resultType
      The type of the result returned by the envelope operation.
  • Constructor Details

    • EnvelopeOperation

      EnvelopeOperation(Map<String,?> identification, org.opengis.referencing.crs.CoordinateReferenceSystem targetCRS, AbstractIdentifiedType[] geometryAttributes) throws org.opengis.util.FactoryException
      Creates a new operation computing the envelope of features of the given type.
      Parameters:
      identification - the name and other information to be given to this operation.
      targetCRS - the coordinate reference system of envelopes to computes, or null.
      geometryAttributes - the operation or attribute type from which to get geometry values.
      Throws:
      org.opengis.util.FactoryException
  • Method Details

    • getParameters

      public org.opengis.parameter.ParameterDescriptorGroup getParameters()
      Returns an empty group of parameters since this operation does not require any parameter.
      Specified by:
      getParameters in class AbstractOperation
      Returns:
      empty parameter group.
    • getResult

      public AbstractIdentifiedType getResult()
      Returns the type of results computed by this operation, which is AttributeType<Envelope>. The attribute type name depends on the value of "result.*" properties (if any) given at construction time.
      Specified by:
      getResult in class AbstractOperation
      Returns:
      an AttributeType<Envelope>.
    • getDependencies

      public Set<String> getDependencies()
      Returns the names of feature properties that this operation needs for performing its task.
      Overrides:
      getDependencies in class AbstractOperation
      Returns:
      the names of feature properties needed by this operation for performing its task.
    • apply

      public Property apply(AbstractFeature feature, org.opengis.parameter.ParameterValueGroup parameters)
      Returns an attribute whose value is the union of the envelopes of all geometries in the given feature found in properties specified at construction time.
      Specified by:
      apply in interface BiFunction<AbstractFeature,org.opengis.parameter.ParameterValueGroup,Object>
      Specified by:
      apply in class AbstractOperation
      Parameters:
      feature - the feature on which to execute the operation.
      parameters - ignored (can be null).
      Returns:
      the envelope of geometries in feature property values.
    • hashCode

      public int hashCode()
      Computes a hash-code value for this operation.
      Overrides:
      hashCode in class AbstractOperation
      Returns:
      the hash code for this type.
    • equals

      public boolean equals(Object obj)
      Compares this operation with the given object for equality.
      Overrides:
      equals in class AbstractOperation
      Parameters:
      obj - the object to compare with this type.
      Returns:
      true if the given object is equal to this type.