Package org.locationtech.proj4j.geoapi
Class ParameterWrapper
- java.lang.Object
-
- org.locationtech.proj4j.geoapi.Wrapper
-
- org.locationtech.proj4j.geoapi.ParameterWrapper
-
- All Implemented Interfaces:
java.io.Serializable,org.opengis.metadata.Identifier,org.opengis.parameter.GeneralParameterValue,org.opengis.parameter.ParameterValue<java.lang.Double>,org.opengis.referencing.ReferenceIdentifier
final class ParameterWrapper extends Wrapper implements org.opengis.parameter.ParameterValue<java.lang.Double>, java.io.Serializable
Wraps a PROJ4J implementation behind the equivalent GeoAPI interface. This implementation is restricted to values of thedoubleprimitive type.
-
-
Field Summary
Fields Modifier and Type Field Description private ParameterAccessordescriptorThe parameter name together with the methods for getting or setting values.private ProjectionimplThe wrapped PROJ4 implementation.-
Fields inherited from class org.locationtech.proj4j.geoapi.Wrapper
BIDIMENSIONAL, TRIDIMENSIONAL
-
-
Constructor Summary
Constructors Constructor Description ParameterWrapper(Projection impl, ParameterAccessor descriptor)Creates a new wrapper for the given PROJ4J implementation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanbooleanValue()org.opengis.parameter.ParameterValue<java.lang.Double>clone(){@return a modifiable copy of this parameter}.doubledoubleValue(){@return the value in the PROJ4J projection for the parameter described by this object}.doubledoubleValue(javax.measure.Unit<?> unit){@return the value in the PROJ4J projection for the parameter described by this object}.double[]doubleValueList()double[]doubleValueList(javax.measure.Unit<?> unit)java.lang.StringgetCode(){@return this parameter name, as specified in the descriptor}.org.opengis.parameter.ParameterDescriptor<java.lang.Double>getDescriptor(){@return a description of this parameter}.javax.measure.Unit<?>getUnit(){@return the same unit of measurement as declared in the parameter descriptor}.java.lang.DoublegetValue(){@return the value as an arbitrary object}.private java.lang.IllegalArgumentExceptionillegalUnit(javax.measure.IncommensurableException e){@return the exception to throw for an illegal unit of measurement}.(package private) java.lang.Objectimplementation(){@return an arbitrary object for equality and hash code}.intintValue()int[]intValueList()private org.opengis.parameter.InvalidParameterValueExceptioninvalidParamType(java.lang.Object value){@return the exception to throw for all parameter types other than floating-point}.private org.opengis.parameter.InvalidParameterTypeExceptioninvalidReturnType(){@return 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)voidsetValue(java.lang.Object value)Sets the value as an arbitrary object.java.lang.StringstringValue()java.net.URIvalueFile()-
Methods inherited from class org.locationtech.proj4j.geoapi.Wrapper
equals, getAlias, getAuthority, getCodeSpace, getDomainOfValidity, getIdentifiers, getName, getRemarks, getScope, getVersion, hashCode, toString, toWKT
-
-
-
-
Field Detail
-
impl
private final Projection impl
The wrapped PROJ4 implementation.
-
descriptor
private final ParameterAccessor descriptor
The parameter name together with the methods for getting or setting values.
-
-
Constructor Detail
-
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 Detail
-
implementation
java.lang.Object implementation()
{@return an arbitrary object for equality and hash code}.- Specified by:
implementationin classWrapper
-
getDescriptor
public org.opengis.parameter.ParameterDescriptor<java.lang.Double> getDescriptor()
{@return a description of this parameter}.- Specified by:
getDescriptorin interfaceorg.opengis.parameter.GeneralParameterValue- Specified by:
getDescriptorin interfaceorg.opengis.parameter.ParameterValue<java.lang.Double>
-
getCode
public java.lang.String getCode()
{@return this parameter name, as specified in the descriptor}.
-
getUnit
public javax.measure.Unit<?> getUnit()
{@return the same unit of measurement as declared in the parameter descriptor}.- Specified by:
getUnitin interfaceorg.opengis.parameter.ParameterValue<java.lang.Double>
-
illegalUnit
private java.lang.IllegalArgumentException illegalUnit(javax.measure.IncommensurableException e)
{@return the exception to throw for an illegal unit of measurement}.
-
invalidReturnType
private org.opengis.parameter.InvalidParameterTypeException invalidReturnType()
{@return the exception to throw for all parameter types other than floating-point}.
-
invalidParamType
private org.opengis.parameter.InvalidParameterValueException invalidParamType(java.lang.Object value)
{@return the exception to throw for all parameter types other than floating-point}.
-
getValue
public java.lang.Double getValue()
{@return the value as an arbitrary object}.- Specified by:
getValuein interfaceorg.opengis.parameter.ParameterValue<java.lang.Double>
-
doubleValue
public double doubleValue()
{@return the value in the PROJ4J projection for the parameter described by this object}.- Specified by:
doubleValuein interfaceorg.opengis.parameter.ParameterValue<java.lang.Double>
-
doubleValue
public double doubleValue(javax.measure.Unit<?> unit)
{@return 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<java.lang.Double>- Parameters:
unit- the unit of measurement of value to get- Throws:
java.lang.IllegalArgumentException- if the given unit is incompatible
-
setValue
public void setValue(java.lang.Object value) throws org.opengis.parameter.InvalidParameterValueExceptionSets the value as an arbitrary object.- Specified by:
setValuein interfaceorg.opengis.parameter.ParameterValue<java.lang.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<java.lang.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<java.lang.Double>- Parameters:
value- the value to setunit- the unit of measurement of the given value- Throws:
java.lang.UnsupportedOperationException- if this parameter is unmodifiablejava.lang.IllegalArgumentException- if the given unit is incompatible
-
intValue
public int intValue()
- Specified by:
intValuein interfaceorg.opengis.parameter.ParameterValue<java.lang.Double>
-
booleanValue
public boolean booleanValue() throws java.lang.IllegalStateException- Specified by:
booleanValuein interfaceorg.opengis.parameter.ParameterValue<java.lang.Double>- Throws:
java.lang.IllegalStateException
-
stringValue
public java.lang.String stringValue() throws java.lang.IllegalStateException- Specified by:
stringValuein interfaceorg.opengis.parameter.ParameterValue<java.lang.Double>- Throws:
java.lang.IllegalStateException
-
valueFile
public java.net.URI valueFile() throws java.lang.IllegalStateException- Specified by:
valueFilein interfaceorg.opengis.parameter.ParameterValue<java.lang.Double>- Throws:
java.lang.IllegalStateException
-
intValueList
public int[] intValueList() throws java.lang.IllegalStateException- Specified by:
intValueListin interfaceorg.opengis.parameter.ParameterValue<java.lang.Double>- Throws:
java.lang.IllegalStateException
-
doubleValueList
public double[] doubleValueList() throws java.lang.IllegalStateException- Specified by:
doubleValueListin interfaceorg.opengis.parameter.ParameterValue<java.lang.Double>- Throws:
java.lang.IllegalStateException
-
doubleValueList
public double[] doubleValueList(javax.measure.Unit<?> unit) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException- Specified by:
doubleValueListin interfaceorg.opengis.parameter.ParameterValue<java.lang.Double>- Throws:
java.lang.IllegalArgumentExceptionjava.lang.IllegalStateException
-
setValue
public void setValue(int value) throws org.opengis.parameter.InvalidParameterValueException- Specified by:
setValuein interfaceorg.opengis.parameter.ParameterValue<java.lang.Double>- Throws:
org.opengis.parameter.InvalidParameterValueException
-
setValue
public void setValue(boolean value) throws org.opengis.parameter.InvalidParameterValueException- Specified by:
setValuein interfaceorg.opengis.parameter.ParameterValue<java.lang.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<java.lang.Double>- Throws:
org.opengis.parameter.InvalidParameterValueException
-
clone
public org.opengis.parameter.ParameterValue<java.lang.Double> clone()
{@return 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.- Specified by:
clonein interfaceorg.opengis.parameter.GeneralParameterValue- Specified by:
clonein interfaceorg.opengis.parameter.ParameterValue<java.lang.Double>- Overrides:
clonein classjava.lang.Object
-
-