Class ParameterAccessor
java.lang.Object
org.locationtech.proj4j.geoapi.Wrapper
org.locationtech.proj4j.geoapi.ParameterAccessor
- All Implemented Interfaces:
Serializable, org.opengis.metadata.Identifier, org.opengis.parameter.GeneralParameterDescriptor, org.opengis.parameter.ParameterDescriptor<Double>, org.opengis.referencing.IdentifiedObject, org.opengis.referencing.ReferenceIdentifier
final class ParameterAccessor
extends Wrapper
implements org.opengis.parameter.ParameterDescriptor<Double>, Serializable
Description of a PROJ4J parameter, together with method for getting and setting the value.
This implementation is restricted to values of the
double primitive type.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final ParameterAccessor[]Parameters that we can extract from aProjectionobject.private final booleanWhether the unit of measurement is angular (true) or linear (false).private final ToDoubleFunction<Projection> The method to invoke for getting the parameter value.private final booleanWhether this parameter is the scale factor.private final StringThe parameter name.private final ObjDoubleConsumer<Projection> The method to invoke for setting the parameter value.Fields inherited from class Wrapper
BIDIMENSIONAL, TRIDIMENSIONALFields inherited from interface org.opengis.referencing.IdentifiedObject
ALIAS_KEY, IDENTIFIERS_KEY, NAME_KEY, REMARKS_KEYFields inherited from interface org.opengis.metadata.Identifier
AUTHORITY_KEY, CODE_KEYFields inherited from interface org.opengis.referencing.ReferenceIdentifier
CODESPACE_KEY, VERSION_KEY -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateParameterAccessor(String name, ToDoubleFunction<Projection> getter, ObjDoubleConsumer<Projection> setter, boolean isScale, boolean angular) Creates a new parameter descriptor. -
Method Summary
Modifier and TypeMethodDescriptionorg.opengis.parameter.ParameterValue<Double> Creates a new parameter value.private doubleReturns the default value as a primitive type.(package private) static ParameterAccessorReturns the parameter descriptor of the given name.(package private) final doubleget(Projection proj) Gets the value of this parameter from the given projection.getCode()Returns the parameter name.Returns the default value as initialized in the PROJ4 projection class.intReturns the maximum number of times that values for this parameter are required.Unspecified.intReturns the minimum number of times that values for this parameter are required.Unspecified.javax.measure.Unit<?> getUnit()Returns the unit of measurement.Returns null as this parameter is not restricted to a limited set of values.Returns the class that describe the type of the parameter.(package private) ObjectReturns an identification of the parameter.(package private) static ParameterAccessor[]nonDefault(Projection proj) Returns all descriptors having a non-default values for the given PROJ4J projection.(package private) static voidreset(Projection proj) Resets all parameters to their default value.(package private) final voidset(Projection proj, double value) Sets the value of this parameter in the given projection.Methods inherited from class Wrapper
equals, getAlias, getAuthority, getCodeSpace, getDomainOfValidity, getIdentifiers, getName, getRemarks, getScope, getVersion, hashCode, toString, toWKTMethods inherited from interface org.opengis.referencing.IdentifiedObject
getAlias, getIdentifiers, getName, getRemarks, toWKT
-
Field Details
-
ACCESSORS
Parameters that we can extract from aProjectionobject. Does not include the ellipsoid axis length of flattening factors. -
name
The parameter name. Should be OGC names if possible. This name may not be correct in all cases, because some names depend on the projection method. For example, "latitude of origin" may be "latitude of center" in some projections. -
getter
The method to invoke for getting the parameter value. -
setter
The method to invoke for setting the parameter value. -
isScale
private final boolean isScaleWhether this parameter is the scale factor. That parameter has a different default value. -
angular
private final boolean angularWhether the unit of measurement is angular (true) or linear (false).
-
-
Constructor Details
-
ParameterAccessor
private ParameterAccessor(String name, ToDoubleFunction<Projection> getter, ObjDoubleConsumer<Projection> setter, boolean isScale, boolean angular) Creates a new parameter descriptor.- Parameters:
name- the parameter namegetter- the method to invoke for getting the parameter valuesetter- the method to invoke for setting the parameter valueisScale- whether this parameter is the scale factorangular- whether the unit of measurement is angular (true) or linear (false)
-
-
Method Details
-
forName
Returns the parameter descriptor of the given name.- Parameters:
name- name of the desired parameter- Returns:
- parameter descriptor for the given name
- Throws:
org.opengis.parameter.ParameterNotFoundException- if the given name is unknown
-
nonDefault
Returns all descriptors having a non-default values for the given PROJ4J projection. We do not have a formal list of parameters that are valid for each projection. Therefore, checking for non-default values is workaround. -
reset
Resets all parameters to their default value. -
implementation
Object implementation()Returns an identification of the parameter..- Specified by:
implementationin classWrapper- Returns:
- an identification of the parameter
-
getCode
-
getValueClass
-
getValidValues
-
getDefaultValue
-
defaultValue
private double defaultValue()Returns the default value as a primitive type..- Returns:
- the default value as a primitive type
-
getMinimumValue
Unspecified.- Specified by:
getMinimumValuein interfaceorg.opengis.parameter.ParameterDescriptor<Double>
-
getMaximumValue
Unspecified.- Specified by:
getMaximumValuein interfaceorg.opengis.parameter.ParameterDescriptor<Double>
-
getMinimumOccurs
public int getMinimumOccurs()Returns the minimum number of times that values for this parameter are required.. The value should be 1 for mandatory parameters and 0 for optional parameters. We consider all parameters as optional, because we don't know for sure which parameters are used by a particular PROJ4JProjectioninstance.- Specified by:
getMinimumOccursin interfaceorg.opengis.parameter.GeneralParameterDescriptor- Returns:
- the minimum number of times that values for this parameter are required
-
getMaximumOccurs
public int getMaximumOccurs()Returns the maximum number of times that values for this parameter are required.. Values greater than 1 should happen only with parameter groups, which are not used in this implementation.- Specified by:
getMaximumOccursin interfaceorg.opengis.parameter.GeneralParameterDescriptor- Returns:
- the maximum number of times that values for this parameter are required
-
getUnit
public javax.measure.Unit<?> getUnit()Returns the unit of measurement..- Specified by:
getUnitin interfaceorg.opengis.parameter.ParameterDescriptor<Double>- Returns:
- the unit of measurement
-
get
Gets the value of this parameter from the given projection. -
set
Sets the value of this parameter in the given projection. -
createValue
Creates a new parameter value. Note that this method is inefficient as it creates a fullProjectionobject for each individual parameter value.- Specified by:
createValuein interfaceorg.opengis.parameter.GeneralParameterDescriptor- Specified by:
createValuein interfaceorg.opengis.parameter.ParameterDescriptor<Double>- Returns:
- a new parameter value
-