Class FunctionWithSRID<R>
java.lang.Object
org.apache.sis.internal.filter.Node
org.apache.sis.internal.filter.sqlmm.SpatialFunction<R>
org.apache.sis.internal.filter.sqlmm.FunctionWithSRID<R>
- Type Parameters:
R
- the type of resources (e.g.Feature
) used as inputs.
- All Implemented Interfaces:
Serializable
,Function<R,
,Object> Expression<R,
,Object> Optimization.OnExpression<R,
,Object> FeatureExpression<R,
Object>
- Direct Known Subclasses:
GeometryConstructor
,ST_Point
,ST_Transform
A function where the last argument is the identifier of a Coordinate Reference System.
The first argument may be a geometry or data (WKT, WKT, GML…) for creating a geometry.
- Since:
- 1.1
- Version:
- 1.3
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final int
Whether the SRID is present, absent, or may be present or absent depending on the value.private Object
Identifier of the coordinate reference system in which to represent the geometry.(package private) final boolean
Whether thegetTargetCRS(Object)
value is defined by a literal.(package private) static final int
Whether the SRID is present, absent, or may be present or absent depending on the value.(package private) static final int
Whether the SRID is present, absent, or may be present or absent depending on the value.private static final long
For cross-version compatibility.(package private) final Expression
<? super R, ?> The expression giving the spatial reference system identifier, ornull
if none.private org.opengis.referencing.crs.CoordinateReferenceSystem
The coordinate reference system in which to represent the geometry, ornull
if not yet determined.Fields inherited from class org.apache.sis.internal.filter.sqlmm.SpatialFunction
operation
-
Constructor Summary
ConstructorsConstructorDescriptionFunctionWithSRID
(SQLMM operation, Expression<? super R, ?>[] parameters, int hasSRID) Creates a new function for a geometry represented by the given parameter. -
Method Summary
Modifier and TypeMethodDescriptionexpectedType
(DefaultFeatureType valueType, FeatureTypeBuilder addTo) Provides the type of values produced by this expression when a feature of the given type is evaluated.(package private) final org.opengis.referencing.crs.CoordinateReferenceSystem
getTargetCRS
(R input) Gets the coordinate reference system for theinput
resources.private static boolean
Returns whether the given type is a CRS or may be a SRID.private void
Invoked on deserialization for restoring thetargetCRS
field.private void
setTargetCRS
(Object crs) SetstargetCRS
to a coordinate reference system inferred from the given value.Methods inherited from class org.apache.sis.internal.filter.sqlmm.SpatialFunction
getChildren, getFunctionName, getGeometryLibrary, getSyntax, getValueClass, toValueType
Methods inherited from class org.apache.sis.internal.filter.Node
createName, createType, equals, getGeometryLibrary, hashCode, symbol, toGeometryWrapper, toString, unwrap, warning
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.sis.filter.Expression
apply, getParameters
Methods inherited from interface org.apache.sis.filter.Optimization.OnExpression
optimize, recreate
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor cross-version compatibility.- See Also:
-
srid
The expression giving the spatial reference system identifier, ornull
if none. -
lastSRID
Identifier of the coordinate reference system in which to represent the geometry. This identifier is specified by the second expression and is stored in order to avoid computingtargetCRS
many times when the SRID does not change. -
targetCRS
private transient org.opengis.referencing.crs.CoordinateReferenceSystem targetCRSThe coordinate reference system in which to represent the geometry, ornull
if not yet determined. This field is recomputed when thelastSRID
changed. IfliteralCRS
istrue
, thentargetCRS
shall be effectively final. -
literalCRS
final boolean literalCRSWhether thegetTargetCRS(Object)
value is defined by a literal. -
PRESENT
static final int PRESENTWhether the SRID is present, absent, or may be present or absent depending on the value. IfABSENT
then thesrid
field will be null. In all other cases that field will be non-null.- See Also:
-
ABSENT
static final int ABSENTWhether the SRID is present, absent, or may be present or absent depending on the value. IfABSENT
then thesrid
field will be null. In all other cases that field will be non-null.- See Also:
-
MAYBE
static final int MAYBEWhether the SRID is present, absent, or may be present or absent depending on the value. IfABSENT
then thesrid
field will be null. In all other cases that field will be non-null.- See Also:
-
-
Constructor Details
-
FunctionWithSRID
FunctionWithSRID(SQLMM operation, Expression<? super R, ?>[] parameters, int hasSRID) Creates a new function for a geometry represented by the given parameter.
-
-
Method Details
-
readObject
Invoked on deserialization for restoring thetargetCRS
field.- Parameters:
in
- the input stream from which to deserialize an attribute.- Throws:
IOException
- if an I/O error occurred while reading or if the stream contains invalid data.ClassNotFoundException
- if the class serialized on the stream is not on the classpath.
-
isCRS
Returns whether the given type is a CRS or may be a SRID. -
setTargetCRS
SetstargetCRS
to a coordinate reference system inferred from the given value. The CRS argument shall be the result ofparameters.get(1).apply(object)
.- Parameters:
crs
- the object evaluated by thesrid
expression.- Throws:
org.opengis.util.FactoryException
- if no CRS can be created from the given object.
-
getTargetCRS
final org.opengis.referencing.crs.CoordinateReferenceSystem getTargetCRS(R input) throws org.opengis.util.FactoryException Gets the coordinate reference system for theinput
resources. Theinput
argument is used only if the SRID is not a literal (which is rare). If thesrid
parameter is optional, then it is caller's responsibility to verify that it is non-null.- Parameters:
input
- the resource for which to get the CRS. This is often ignored.- Returns:
- the CRS for the given resource.
- Throws:
org.opengis.util.FactoryException
- if the CRS can be created.
-
expectedType
Provides the type of values produced by this expression when a feature of the given type is evaluated.- Specified by:
expectedType
in interfaceFeatureExpression<R,
Object> - Overrides:
expectedType
in classSpatialFunction<R>
- Parameters:
valueType
- the type of features on which to apply this expression.addTo
- where to add the type of properties evaluated by this expression.- Returns:
- builder of type resulting from expression evaluation (never null).
- Throws:
IllegalArgumentException
- if the given feature type does not contain the expected properties.
-