Package org.apache.sis.feature
Class EnvelopeOperation
java.lang.Object
org.apache.sis.feature.AbstractIdentifiedType
org.apache.sis.feature.AbstractOperation
org.apache.sis.feature.EnvelopeOperation
- All Implemented Interfaces:
Serializable
,BiFunction<AbstractFeature,
,org.opengis.parameter.ParameterValueGroup, Object> Deprecable
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:
- the CRS specified at construction time,
- the CRS of the default geometry, or
- 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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate final class
The attributes that contains the result of union of all envelope extracted from other attributes. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final String[]
The names of all properties containing a geometry object.private final org.opengis.referencing.operation.CoordinateOperation[]
The coordinate conversions or transformations from the CRS used by the geometries to the CRS requested by the user, ornull
if there is no operation to apply.The property names as an unmodifiable set, created when first needed.private static final org.opengis.parameter.ParameterDescriptorGroup
The parameter descriptor for the "Envelope" operation, which does not take any parameter.private final DefaultAttributeType
<org.opengis.geometry.Envelope> The type of the result returned by the envelope operation.private static final long
For cross-version compatibility.(package private) final org.opengis.referencing.crs.CoordinateReferenceSystem
The coordinate reference system of the envelope to compute, ornull
for using the CRS of the default geometry or the first non-empty geometry.Fields inherited from class org.apache.sis.feature.AbstractOperation
RESULT_PREFIX
Fields inherited from class org.apache.sis.feature.AbstractIdentifiedType
DEFINITION_KEY, deprecated, DEPRECATED_KEY, DESCRIPTION_KEY, DESIGNATION_KEY, NAME_KEY
-
Constructor Summary
ConstructorsConstructorDescriptionEnvelopeOperation
(Map<String, ?> identification, org.opengis.referencing.crs.CoordinateReferenceSystem targetCRS, AbstractIdentifiedType[] geometryAttributes) Creates a new operation computing the envelope of features of the given type. -
Method Summary
Modifier and TypeMethodDescriptionapply
(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.boolean
Compares this operation with the given object for equality.Returns the names of feature properties that this operation needs for performing its task.org.opengis.parameter.ParameterDescriptorGroup
Returns an empty group of parameters since this operation does not require any parameter.Returns the type of results computed by this operation, which isAttributeType<Envelope>
.int
hashCode()
Computes a hash-code value for this operation.Methods inherited from class org.apache.sis.feature.AbstractOperation
defaultFormula, formatResultFormula, resultIdentification, toString
Methods inherited from class org.apache.sis.feature.AbstractIdentifiedType
createName, getDefinition, getDescription, getDesignation, getName, getRemarks, isDeprecated, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.function.BiFunction
andThen
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor cross-version compatibility.- See Also:
-
EMPTY_PARAMS
private static final org.opengis.parameter.ParameterDescriptorGroup EMPTY_PARAMSThe parameter descriptor for the "Envelope" operation, which does not take any parameter. -
attributeNames
The names of all properties containing a geometry object. -
targetCRS
final org.opengis.referencing.crs.CoordinateReferenceSystem targetCRSThe coordinate reference system of the envelope to compute, ornull
for using the CRS of the default geometry or the first non-empty geometry. Note that this is the CRS desired by user of thisEnvelopeOperation
; it may be unrelated to the CRS of stored geometries. -
attributeToCRS
private final org.opengis.referencing.operation.CoordinateOperation[] attributeToCRSThe coordinate conversions or transformations from the CRS used by the geometries to the CRS requested by the user, ornull
if there is no operation to apply. If non-null, the length of this array shall be equal to the length of theattributeNames
array and element at index i is the operation from theattributeNames[i]
geometry CRS to thetargetCRS
. It may be the identity operation, and may also benull
if the property at index i does not declare a default CRS.Performance note
If this array isnull
, thenAbstractFeature.getProperty(String)
does not need to be invoked at all. A null array is a signal that invoking only the cheaperAbstractFeature.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 ofDenseFeature
andSparseFeature
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
The property names as an unmodifiable set, created when first needed. -
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.FactoryExceptionCreates 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, ornull
.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 classAbstractOperation
- Returns:
- empty parameter group.
-
getResult
Returns the type of results computed by this operation, which isAttributeType<Envelope>
. The attribute type name depends on the value of"result.*"
properties (if any) given at construction time.- Specified by:
getResult
in classAbstractOperation
- Returns:
- an
AttributeType<Envelope>
.
-
getDependencies
Returns the names of feature properties that this operation needs for performing its task.- Overrides:
getDependencies
in classAbstractOperation
- 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 interfaceBiFunction<AbstractFeature,
org.opengis.parameter.ParameterValueGroup, Object> - Specified by:
apply
in classAbstractOperation
- Parameters:
feature
- the feature on which to execute the operation.parameters
- ignored (can benull
).- Returns:
- the envelope of geometries in feature property values.
-
hashCode
public int hashCode()Computes a hash-code value for this operation.- Overrides:
hashCode
in classAbstractOperation
- Returns:
- the hash code for this type.
-
equals
Compares this operation with the given object for equality.- Overrides:
equals
in classAbstractOperation
- Parameters:
obj
- the object to compare with this type.- Returns:
true
if the given object is equal to this type.
-