/** * Returns the parameter values for this math transform. * * @return A copy of the parameter values for this math transform. */ @Override public ParameterValueGroup getParameterValues() { return new org.geotools.parameter.ParameterGroup( getParameterDescriptors(), new ParameterValue[] { new FloatParameter(Provider.BASE, base), new FloatParameter(Provider.SCALE, scale) }); }
/** * Wraps the value in an array of length 1. * * @param unit The unit of measure for the value to be returned. * @return The sequence of values represented by this parameter after conversion to type {@code * double} and conversion to {@code unit}. * @throws IllegalArgumentException if the specified unit is invalid for this parameter. */ public double[] doubleValueList(final Unit<?> unit) throws IllegalArgumentException { return new double[] {doubleValue(unit)}; }
/** * Wraps the value in an array of length 1. * * @return The sequence of values represented by this parameter. */ public int[] intValueList() { return new int[] {intValue()}; }
/** * Returns the numeric value of the coordinate operation parameter in the specified unit of * measure. This convenience method apply unit conversion on the fly as needed. * * @param unit The unit of measure for the value to be returned. * @return The numeric value represented by this parameter after conversion to type {@code * double} and conversion to {@code unit}. * @throws IllegalArgumentException if the specified unit is invalid for this parameter. */ public double doubleValue(final Unit<?> unit) throws IllegalArgumentException { ensureNonNull("unit", unit); final Unit<?> thisUnit = getUnit(); if (thisUnit == null) { throw unitlessParameter(descriptor); } final int expectedID = Parameter.getUnitMessageID(thisUnit); if (Parameter.getUnitMessageID(unit) != expectedID) { throw new IllegalArgumentException(Errors.format(expectedID, unit)); } return Units.getConverterToAny(thisUnit, unit).convert(value); }
/** * Set the parameter value as a floating point and its associated unit. * * @param value The parameter value. * @param unit The unit for the specified value. * @throws InvalidParameterValueException if the value is illegal for some reason (for example a * value out of range). */ public void setValue(double value, final Unit<?> unit) throws InvalidParameterValueException { ensureNonNull("unit", unit); @SuppressWarnings("unchecked") // Checked by constructor. final ParameterDescriptor<Double> descriptor = (ParameterDescriptor) this.descriptor; final Unit<?> thisUnit = descriptor.getUnit(); if (thisUnit == null) { throw unitlessParameter(descriptor); } final int expectedID = Parameter.getUnitMessageID(thisUnit); if (Parameter.getUnitMessageID(unit) != expectedID) { throw new IllegalArgumentException(Errors.format(expectedID, unit)); } value = Units.getConverterToAny(unit, thisUnit).convert(value); this.value = Parameter.ensureValidValue(descriptor, Double.valueOf(value)); }
/** * Set the parameter value as an integer. * * @param value The parameter value. * @throws InvalidParameterValueException if the value is illegal for some reason (for example a * value out of range). */ public void setValue(final int value) throws InvalidParameterValueException { setValue((double) value); }
/** * Always throws an exception, since this parameter is not an URI. * * @return Never return. * @throws InvalidParameterTypeException The value is not a reference to a file or an URI. */ public URI valueFile() throws InvalidParameterTypeException { throw new InvalidParameterTypeException(getClassTypeError(), Parameter.getName(descriptor)); }
/** * Set the parameter value as a boolean. * * @param value The parameter value. * @throws InvalidParameterValueException if the boolean type is inappropriate for this * parameter. */ public void setValue(final boolean value) throws InvalidParameterValueException { setValue(value ? 1.0 : 0.0); }
/** Always throws an exception, since this parameter is not an array. */ public void setValue(double[] values, final Unit<?> unit) throws InvalidParameterValueException { throw new InvalidParameterTypeException(getClassTypeError(), Parameter.getName(descriptor)); }
/** * Returns the parameter values for this math transform. * * @return A copy of the parameter values for this math transform. */ @Override public ParameterValueGroup getParameterValues() { return new org.geotools.parameter.ParameterGroup( getParameterDescriptors(), new ParameterValue[] { new FloatParameter(Provider.BASE, base), new FloatParameter(Provider.OFFSET, offset) }); }
/** * Constructs a parameter from the specified descriptor and value. This convenience constructor * is equivalents to the one-argument constructor followed by a call to {@link * #setValue(double)}. * * @param descriptor The abstract definition of this parameter. * @param value The parameter value. * @throws IllegalArgumentException if the value class is not {@code Double.class}. */ public FloatParameter(final ParameterDescriptor<Double> descriptor, final double value) { this(descriptor); setValue(value); }
/** * Wraps the value in an array of length 1. * * @return The sequence of values represented by this parameter. */ public double[] doubleValueList() { return new double[] {doubleValue()}; }
/** * Returns the parameters for this math transform. * * @return The parameters for this math transform. */ @Override public ParameterValueGroup getParameterValues() { final ParameterValue<Integer> dim = new Parameter<Integer>(Provider.DIM); dim.setValue(getSourceDimensions()); return new ParameterGroup( getParameterDescriptors(), new ParameterValue[] { dim, new FloatParameter(Provider.DX, dx), new FloatParameter(Provider.DY, dy), new FloatParameter(Provider.DZ, dz), new FloatParameter(Provider.SRC_SEMI_MAJOR, a), new FloatParameter(Provider.SRC_SEMI_MINOR, b), new FloatParameter(Provider.TGT_SEMI_MAJOR, a + da), new FloatParameter(Provider.TGT_SEMI_MINOR, b + db) }); }
/** * Creates a new instance of {@linkplain org.geotools.parameter.Parameter parameter value} * initialized with the {@linkplain #getDefaultValue default value}. The {@linkplain * org.geotools.parameter.Parameter#getDescriptor parameter value descriptor} for the created * parameter value will be {@code this} object. * * @return A parameter initialized to the default value. */ @SuppressWarnings("unchecked") public ParameterValue<T> createValue() { if (Double.class.equals(valueClass) && unit == null) { return (ParameterValue) new FloatParameter((ParameterDescriptor) this); } return new Parameter<T>(this); }
/** Returns the parameters for this math transform. */ @Override public ParameterValueGroup getParameterValues() { final BursaWolfParameters parameters = new BursaWolfParameters(null); parameters.setAffineTransform(getMatrix(), Double.POSITIVE_INFINITY); if (ProviderFrameRotation.PARAMETERS.equals(descriptor)) { parameters.ex = -parameters.ex; parameters.ey = -parameters.ey; parameters.ez = -parameters.ez; } final boolean isTranslation = Provider.PARAMETERS.equals(descriptor); final FloatParameter[] param = new FloatParameter[isTranslation ? 3 : 7]; param[0] = new FloatParameter(Provider.DX, parameters.dx); param[1] = new FloatParameter(Provider.DY, parameters.dy); param[2] = new FloatParameter(Provider.DZ, parameters.dz); if (!isTranslation) { param[3] = new FloatParameter(ProviderSevenParam.EX, parameters.ex); param[4] = new FloatParameter(ProviderSevenParam.EY, parameters.ey); param[5] = new FloatParameter(ProviderSevenParam.EZ, parameters.ez); param[6] = new FloatParameter(ProviderSevenParam.PPM, parameters.ppm); } return new ParameterGroup(getParameterDescriptors(), param); }
/** * Returns the parameter values using the specified descriptor. * * @param descriptor The parameter descriptor. * @return A copy of the parameter values for this math transform. */ private ParameterValueGroup getParameterValues(final ParameterDescriptorGroup descriptor) { final ParameterValue[] parameters = new ParameterValue[hasHeight ? 2 : 3]; int index = 0; if (!hasHeight) { final ParameterValue p = new org.geotools.parameter.Parameter(Provider.DIM); p.setValue(2); parameters[index++] = p; } parameters[index++] = new FloatParameter(Provider.SEMI_MAJOR, a); parameters[index++] = new FloatParameter(Provider.SEMI_MINOR, b); return new org.geotools.parameter.ParameterGroup(descriptor, parameters); }
matrixValues[row] = new ParameterValue[numCol]; matrixValues[row][col] = new FloatParameter(descriptor, element);
rowValues[column] = param = new FloatParameter( ((MatrixParameterDescriptors) descriptor) .descriptor(row, column, numRow, numCol));