Class ParameterWrapper
java.lang.Object
org.locationtech.proj4j.geoapi.Wrapper
org.locationtech.proj4j.geoapi.ParameterWrapper
- All Implemented Interfaces:
Serializable, org.opengis.metadata.Identifier, org.opengis.parameter.GeneralParameterValue, org.opengis.parameter.ParameterValue<Double>, org.opengis.referencing.ReferenceIdentifier
final class ParameterWrapper
extends Wrapper
implements org.opengis.parameter.ParameterValue<Double>, Serializable
Wraps a PROJ4J implementation behind the equivalent GeoAPI interface.
This implementation is restricted to values of the
double primitive type.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ParameterAccessorThe parameter name together with the methods for getting or setting values.private final ProjectionThe wrapped PROJ4 implementation.Fields inherited from class Wrapper
BIDIMENSIONAL, TRIDIMENSIONALFields inherited from interface org.opengis.metadata.Identifier
AUTHORITY_KEY, CODE_KEYFields inherited from interface org.opengis.referencing.ReferenceIdentifier
CODESPACE_KEY, VERSION_KEY -
Constructor Summary
ConstructorsConstructorDescriptionParameterWrapper(Projection impl, ParameterAccessor descriptor) Creates a new wrapper for the given PROJ4J implementation. -
Method Summary
Modifier and TypeMethodDescriptionbooleanorg.opengis.parameter.ParameterValue<Double> clone()Returns a modifiable copy of this parameter.doubleReturns the value in the PROJ4J projection for the parameter described by this object.doubledoubleValue(javax.measure.Unit<?> unit) Returns the value in the PROJ4J projection for the parameter described by this object.double[]double[]doubleValueList(javax.measure.Unit<?> unit) getCode()Returns this parameter name, as specified in the descriptor.org.opengis.parameter.ParameterDescriptor<Double> Returns a description of this parameter.javax.measure.Unit<?> getUnit()Returns the same unit of measurement as declared in the parameter descriptor.getValue()Returns the value as an arbitrary object.private IllegalArgumentExceptionillegalUnit(javax.measure.IncommensurableException e) Returns the exception to throw for an illegal unit of measurement.(package private) ObjectReturns an arbitrary object for equality and hash code.intintValue()int[]private org.opengis.parameter.InvalidParameterValueExceptioninvalidParamType(Object value) Returns the exception to throw for all parameter types other than floating-point.private org.opengis.parameter.InvalidParameterTypeExceptionReturns the exception to throw for all parameter types other than floating-point.voidsetValue(boolean value) voidsetValue(double value) Sets the value of this parameter.voidsetValue(double[] values, javax.measure.Unit<?> unit) voidsetValue(double value, javax.measure.Unit<?> unit) Converts the given value to the unit expected by this parameter, then sets the value.voidsetValue(int value) voidSets the value as an arbitrary object.Methods inherited from class Wrapper
equals, getAlias, getAuthority, getCodeSpace, getDomainOfValidity, getIdentifiers, getName, getRemarks, getScope, getVersion, hashCode, toString, toWKT
-
Field Details
-
impl
The wrapped PROJ4 implementation. -
descriptor
The parameter name together with the methods for getting or setting values.
-
-
Constructor Details
-
ParameterWrapper
ParameterWrapper(Projection impl, ParameterAccessor descriptor) Creates a new wrapper for the given PROJ4J implementation.- Parameters:
impl- the wrapped PROJ4 implementationdescriptor- methods for getting or setting values
-
-
Method Details
-
implementation
Object implementation()Returns an arbitrary object for equality and hash code..- Specified by:
implementationin classWrapper- Returns:
- an arbitrary object for equality and hash code
-
getDescriptor
Returns a description of this parameter..- Specified by:
getDescriptorin interfaceorg.opengis.parameter.GeneralParameterValue- Specified by:
getDescriptorin interfaceorg.opengis.parameter.ParameterValue<Double>- Returns:
- a description of this parameter
-
getCode
-
getUnit
public javax.measure.Unit<?> getUnit()Returns the same unit of measurement as declared in the parameter descriptor..- Specified by:
getUnitin interfaceorg.opengis.parameter.ParameterValue<Double>- Returns:
- the same unit of measurement as declared in the parameter descriptor
-
illegalUnit
Returns the exception to throw for an illegal unit of measurement..- Returns:
- the exception to throw for an illegal unit of measurement
-
invalidReturnType
private org.opengis.parameter.InvalidParameterTypeException invalidReturnType()Returns the exception to throw for all parameter types other than floating-point..- Returns:
- the exception to throw for all parameter types other than floating-point
-
invalidParamType
Returns the exception to throw for all parameter types other than floating-point..- Returns:
- the exception to throw for all parameter types other than floating-point
-
getValue
-
doubleValue
public double doubleValue()Returns the value in the PROJ4J projection for the parameter described by this object..- Specified by:
doubleValuein interfaceorg.opengis.parameter.ParameterValue<Double>- Returns:
- the value in the PROJ4J projection for the parameter described by this object
-
doubleValue
public double doubleValue(javax.measure.Unit<?> unit) Returns the value in the PROJ4J projection for the parameter described by this object.. The value is converted to the given unit of measurement.- Specified by:
doubleValuein interfaceorg.opengis.parameter.ParameterValue<Double>- Parameters:
unit- the unit of measurement of value to get- Returns:
- the value in the PROJ4J projection for the parameter described by this object
- Throws:
IllegalArgumentException- if the given unit is incompatible
-
setValue
Sets the value as an arbitrary object.- Specified by:
setValuein interfaceorg.opengis.parameter.ParameterValue<Double>- Parameters:
value- the value to set- Throws:
org.opengis.parameter.InvalidParameterValueException- if the value type is illegal
-
setValue
public void setValue(double value) Sets the value of this parameter. Note that invoking this method may modify the PROJ4J object wrapped byOperationMethodWrapper. This is generally not recommended.- Specified by:
setValuein interfaceorg.opengis.parameter.ParameterValue<Double>- Parameters:
value- the value to set
-
setValue
public void setValue(double value, javax.measure.Unit<?> unit) Converts the given value to the unit expected by this parameter, then sets the value.- Specified by:
setValuein interfaceorg.opengis.parameter.ParameterValue<Double>- Parameters:
value- the value to setunit- the unit of measurement of the given value- Throws:
UnsupportedOperationException- if this parameter is unmodifiableIllegalArgumentException- if the given unit is incompatible
-
intValue
public int intValue()- Specified by:
intValuein interfaceorg.opengis.parameter.ParameterValue<Double>
-
booleanValue
- Specified by:
booleanValuein interfaceorg.opengis.parameter.ParameterValue<Double>- Throws:
IllegalStateException
-
stringValue
- Specified by:
stringValuein interfaceorg.opengis.parameter.ParameterValue<Double>- Throws:
IllegalStateException
-
valueFile
- Specified by:
valueFilein interfaceorg.opengis.parameter.ParameterValue<Double>- Throws:
IllegalStateException
-
intValueList
- Specified by:
intValueListin interfaceorg.opengis.parameter.ParameterValue<Double>- Throws:
IllegalStateException
-
doubleValueList
- Specified by:
doubleValueListin interfaceorg.opengis.parameter.ParameterValue<Double>- Throws:
IllegalStateException
-
doubleValueList
public double[] doubleValueList(javax.measure.Unit<?> unit) throws IllegalArgumentException, IllegalStateException - Specified by:
doubleValueListin interfaceorg.opengis.parameter.ParameterValue<Double>- Throws:
IllegalArgumentExceptionIllegalStateException
-
setValue
public void setValue(int value) throws org.opengis.parameter.InvalidParameterValueException - Specified by:
setValuein interfaceorg.opengis.parameter.ParameterValue<Double>- Throws:
org.opengis.parameter.InvalidParameterValueException
-
setValue
public void setValue(boolean value) throws org.opengis.parameter.InvalidParameterValueException - Specified by:
setValuein interfaceorg.opengis.parameter.ParameterValue<Double>- Throws:
org.opengis.parameter.InvalidParameterValueException
-
setValue
public void setValue(double[] values, javax.measure.Unit<?> unit) throws org.opengis.parameter.InvalidParameterValueException - Specified by:
setValuein interfaceorg.opengis.parameter.ParameterValue<Double>- Throws:
org.opengis.parameter.InvalidParameterValueException
-
clone
Returns a modifiable copy of this parameter.. Note that this method is inefficient as it creates a fullProjectionobject for each individual parameter value. It is better to invokeOperationMethodWrapper.clone()instead.
-