You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2016/11/01 21:03:08 UTC
svn commit: r1767577 [7/15] - in /sis/trunk: ./ application/
application/sis-console/src/main/java/org/apache/sis/console/
application/sis-openoffice/
application/sis-openoffice/src/main/java/org/apache/sis/openoffice/ core/
core/sis-feature/src/main/j...
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/MatrixSIS.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/MatrixSIS.java?rev=1767577&r1=1767576&r2=1767577&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/MatrixSIS.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/MatrixSIS.java [UTF-8] Tue Nov 1 21:03:06 2016
@@ -77,7 +77,7 @@ public abstract class MatrixSIS implemen
* Ensures that the given array is non-null and has the expected length.
* This is a convenience method for subclasses constructors.
*
- * @throws IllegalArgumentException If the given array does not have the expected length.
+ * @throws IllegalArgumentException if the given array does not have the expected length.
*/
static void ensureLengthMatch(final int expected, final double[] elements) throws IllegalArgumentException {
ArgumentChecks.ensureNonNull("elements", elements);
@@ -106,10 +106,10 @@ public abstract class MatrixSIS implemen
* Ensures that the number of rows of a given matrix matches the given value.
* This is a convenience method for {@link #multiply(Matrix)} implementations.
*
- * @param expected The expected number of rows.
- * @param actual The actual number of rows in the matrix to verify.
- * @param numCol The number of columns to report in case of errors. This is an arbitrary
- * value and have no incidence on the verification performed by this method.
+ * @param expected the expected number of rows.
+ * @param actual the actual number of rows in the matrix to verify.
+ * @param numCol the number of columns to report in case of errors. This is an arbitrary
+ * value and have no incidence on the verification performed by this method.
*/
static void ensureNumRowMatch(final int expected, final int actual, final int numCol) {
if (actual != expected) {
@@ -130,8 +130,8 @@ public abstract class MatrixSIS implemen
* an instance of {@code MatrixSIS}, then it is returned unchanged. Otherwise all elements
* are copied in a new {@code MatrixSIS} object.
*
- * @param matrix The matrix to cast or copy, or {@code null}.
- * @return The matrix argument if it can be safely casted (including {@code null} argument),
+ * @param matrix the matrix to cast or copy, or {@code null}.
+ * @return the matrix argument if it can be safely casted (including {@code null} argument),
* or a copy of the given matrix otherwise.
*
* @see Matrices#copy(Matrix)
@@ -166,20 +166,42 @@ public abstract class MatrixSIS implemen
* Retrieves the value at the specified row and column of this matrix, wrapped in a {@code Number}.
* The {@code Number} type depends on the matrix accuracy.
*
- * @param row The row index, from 0 inclusive to {@link #getNumRow()} exclusive.
- * @param column The column index, from 0 inclusive to {@link #getNumCol()} exclusive.
- * @return The current value at the given row and column.
+ * @param row the row index, from 0 inclusive to {@link #getNumRow()} exclusive.
+ * @param column the column index, from 0 inclusive to {@link #getNumCol()} exclusive.
+ * @return the current value at the given row and column.
*/
public Number getNumber(int row, int column) {
return getElement(row, column);
}
/**
+ * Modifies the value at the specified row and column of this matrix.
+ * This method is the converses of {@link #getNumber(int, int)}.
+ *
+ * @param row the row index, from 0 inclusive to {@link #getNumRow()} exclusive.
+ * @param column the column index, from 0 inclusive to {@link #getNumCol()} exclusive.
+ * @param value the new matrix element value.
+ *
+ * @since 0.8
+ *
+ * @see #setElement(int, int, double)
+ */
+ public void setNumber(int row, int column, final Number value) {
+ if (value instanceof DoubleDouble) {
+ set(row, column, (DoubleDouble) value);
+ } else if (DoubleDouble.shouldConvert(value)) {
+ set(row, column, new DoubleDouble(value));
+ } else {
+ setElement(row, column, value.doubleValue());
+ }
+ }
+
+ /**
* Retrieves the value at the specified row and column of this matrix.
*
- * @param row The row index, from 0 inclusive to {@link #getNumRow()} exclusive.
- * @param column The column index, from 0 inclusive to {@link #getNumCol()} exclusive.
- * @return The current value at the given row and column.
+ * @param row the row index, from 0 inclusive to {@link #getNumRow()} exclusive.
+ * @param column the column index, from 0 inclusive to {@link #getNumCol()} exclusive.
+ * @return the current value at the given row and column.
*/
@Override
public abstract double getElement(int row, int column);
@@ -188,7 +210,7 @@ public abstract class MatrixSIS implemen
* Returns a copy of all matrix elements in a flat, row-major (column indices vary fastest) array.
* The array length is <code>{@linkplain #getNumRow()} * {@linkplain #getNumCol()}</code>.
*
- * @return A copy of all current matrix elements in a row-major array.
+ * @return a copy of all current matrix elements in a row-major array.
*/
public double[] getElements() {
final int numRow = getNumRow();
@@ -207,8 +229,8 @@ public abstract class MatrixSIS implemen
* All subclasses in this {@code org.apache.sis.referencing.operation.matrix} package override this
* method with a more efficient implementation.
*
- * @param dest The destination array. May be longer than necessary (this happen when the caller needs to
- * append {@link org.apache.sis.internal.util.DoubleDouble#error} values after the elements).
+ * @param dest the destination array. May be longer than necessary (this happen when the caller needs to
+ * append {@link org.apache.sis.internal.util.DoubleDouble#error} values after the elements).
*/
void getElements(final double[] dest) {
final double[] elements = getElements();
@@ -219,10 +241,10 @@ public abstract class MatrixSIS implemen
* Copies the elements of the given matrix in the given array.
* This method ignores the error terms, if any.
*
- * @param matrix The matrix to copy.
- * @param numRow {@code matrix.getNumRow()}.
- * @param numCol {@code matrix.getNumCol()}.
- * @param elements Where to copy the elements.
+ * @param matrix the matrix to copy.
+ * @param numRow {@code matrix.getNumRow()}.
+ * @param numCol {@code matrix.getNumCol()}.
+ * @param elements where to copy the elements.
*/
static void getElements(final Matrix matrix, final int numRow, final int numCol, final double[] elements) {
if (matrix instanceof MatrixSIS) {
@@ -251,17 +273,17 @@ public abstract class MatrixSIS implemen
/**
* Sets elements in a sub-region of this matrix, optionally including error terms.
*
- * @param source Row-major values as given by {@link ExtendedPrecisionMatrix#getExtendedElements()}.
- * @param length Number of elements ({@code numRow} � {@code numCol}) in the source matrix, not including error terms.
- * @param stride Number of columns in the source matrix, used for computing indices in {@code source} array.
- * @param srcRow Index of the first row from the {@code source} to copy in {@code this}.
- * @param srcCol Index of the first column from the {@code source} to copy in {@code this}.
- * @param dstRow Index of the first row in {@code this} where to copy the {@code source} values.
- * @param dstCol Index of the first column in {@code this} where to copy the {@code source} values.
- * @param numRow Number of rows to copy.
- * @param numCol Number of columns to copy.
- * @param transfer If both {@code source} and {@code this} use extended precision,
- * the temporary object to use for transferring values. Otherwise {@code null}.
+ * @param source row-major values as given by {@link ExtendedPrecisionMatrix#getExtendedElements()}.
+ * @param length number of elements ({@code numRow} � {@code numCol}) in the source matrix, not including error terms.
+ * @param stride number of columns in the source matrix, used for computing indices in {@code source} array.
+ * @param srcRow index of the first row from the {@code source} to copy in {@code this}.
+ * @param srcCol index of the first column from the {@code source} to copy in {@code this}.
+ * @param dstRow index of the first row in {@code this} where to copy the {@code source} values.
+ * @param dstCol index of the first column in {@code this} where to copy the {@code source} values.
+ * @param numRow number of rows to copy.
+ * @param numCol number of columns to copy.
+ * @param transfer if both {@code source} and {@code this} use extended precision,
+ * the temporary object to use for transferring values. Otherwise {@code null}.
*/
final void setElements(final double[] source, final int length, final int stride, final DoubleDouble transfer,
int srcRow, final int srcCol,
@@ -287,7 +309,7 @@ public abstract class MatrixSIS implemen
* Sets this matrix to the values of another matrix.
* The given matrix must have the same size.
*
- * @param matrix The matrix to copy.
+ * @param matrix the matrix to copy.
* @throws MismatchedMatrixSizeException if the given matrix has a different size than this matrix.
*
* @since 0.7
@@ -448,9 +470,9 @@ public abstract class MatrixSIS implemen
* </tr>
* </table>
*
- * @param srcDim The dimension of the ordinate to rescale in the source coordinates.
- * @param scale The amount by which to multiply the source ordinate value before to apply the transform, or {@code null} if none.
- * @param offset The amount by which to translate the source ordinate value before to apply the transform, or {@code null} if none.
+ * @param srcDim the dimension of the ordinate to rescale in the source coordinates.
+ * @param scale the amount by which to multiply the source ordinate value before to apply the transform, or {@code null} if none.
+ * @param offset the amount by which to translate the source ordinate value before to apply the transform, or {@code null} if none.
* @throws UnsupportedOperationException if this matrix is unmodifiable.
*
* @see AffineTransform#concatenate(AffineTransform)
@@ -483,9 +505,9 @@ public abstract class MatrixSIS implemen
* given dimension. Converting a point with the resulting matrix is equivalent to first convert the point with
* the original matrix, then convert the result with {@code ordinates[tgtDim] = ordinates[tgtDim] * scale + offset}.
*
- * @param tgtDim The dimension of the ordinate to rescale in the target coordinates.
- * @param scale The amount by which to multiply the target ordinate value after this transform, or {@code null} if none.
- * @param offset The amount by which to translate the target ordinate value after this transform, or {@code null} if none.
+ * @param tgtDim the dimension of the ordinate to rescale in the target coordinates.
+ * @param scale the amount by which to multiply the target ordinate value after this transform, or {@code null} if none.
+ * @param offset the amount by which to translate the target ordinate value after this transform, or {@code null} if none.
* @throws UnsupportedOperationException if this matrix is unmodifiable.
*
* @see AffineTransform#preConcatenate(AffineTransform)
@@ -520,8 +542,8 @@ public abstract class MatrixSIS implemen
* <code>{@linkplain AffineTransform#concatenate AffineTransform.concatenate}(other)</code>:
* first transforms by the supplied transform and then transform the result by the original transform.
*
- * @param matrix The matrix to multiply to this matrix.
- * @return The result of {@code this} � {@code matrix}.
+ * @param matrix the matrix to multiply to this matrix.
+ * @return the result of {@code this} � {@code matrix}.
* @throws MismatchedMatrixSizeException if the number of rows in the given matrix is not equals to the
* number of columns in this matrix.
*/
@@ -538,8 +560,8 @@ public abstract class MatrixSIS implemen
* This is equivalent to first computing the inverse of {@code this}, then multiplying the result
* by the given matrix.
*
- * @param matrix The matrix to solve.
- * @return The <var>U</var> matrix that satisfies {@code this} � <var>U</var> = {@code matrix}.
+ * @param matrix the matrix to solve.
+ * @return the <var>U</var> matrix that satisfies {@code this} � <var>U</var> = {@code matrix}.
* @throws MismatchedMatrixSizeException if the number of rows in the given matrix is not equals
* to the number of columns in this matrix.
* @throws NoninvertibleMatrixException if this matrix is not invertible.
@@ -551,7 +573,7 @@ public abstract class MatrixSIS implemen
/**
* Returns the inverse of this matrix.
*
- * @return The inverse of this matrix.
+ * @return the inverse of this matrix.
* @throws NoninvertibleMatrixException if this matrix is not invertible.
*
* @see AffineTransform#createInverse()
@@ -564,9 +586,9 @@ public abstract class MatrixSIS implemen
* Returns a new matrix with the same elements than this matrix except for the specified rows.
* This method is useful for removing a range of <em>target</em> dimensions in an affine transform.
*
- * @param lower Index of the first row to remove (inclusive).
- * @param upper Index after the last row to remove (exclusive).
- * @return A copy of this matrix with the specified rows removed.
+ * @param lower index of the first row to remove (inclusive).
+ * @param upper index after the last row to remove (exclusive).
+ * @return a copy of this matrix with the specified rows removed.
*
* @since 0.7
*/
@@ -600,9 +622,9 @@ public abstract class MatrixSIS implemen
* This method is useful for removing a range of <em>source</em> dimensions in an affine transform.
* Coordinates will be converted as if the values in the removed dimensions were zeros.
*
- * @param lower Index of the first column to remove (inclusive).
- * @param upper Index after the last column to remove (exclusive).
- * @return A copy of this matrix with the specified columns removed.
+ * @param lower index of the first column to remove (inclusive).
+ * @param upper index after the last column to remove (exclusive).
+ * @return a copy of this matrix with the specified columns removed.
*
* @since 0.7
*/
@@ -634,7 +656,7 @@ public abstract class MatrixSIS implemen
/**
* Returns a hash code value based on the data values in this matrix.
*
- * @return A hash code value for this matrix.
+ * @return a hash code value for this matrix.
*/
@Override
public int hashCode() {
@@ -645,7 +667,7 @@ public abstract class MatrixSIS implemen
* Returns {@code true} if the specified object is of the same class than this matrix and
* all of the data members are equal to the corresponding data members in this matrix.
*
- * @param object The object to compare with this matrix for equality.
+ * @param object the object to compare with this matrix for equality.
* @return {@code true} if the given object is equal to this matrix.
*/
@Override
@@ -680,8 +702,8 @@ public abstract class MatrixSIS implemen
* smaller than or equals to the given threshold.</li>
* </ul>
*
- * @param matrix The matrix to compare.
- * @param tolerance The tolerance value.
+ * @param matrix the matrix to compare.
+ * @param tolerance the tolerance value.
* @return {@code true} if this matrix is close enough to the given matrix given the tolerance value.
*
* @see Matrices#equals(Matrix, Matrix, double, boolean)
@@ -706,8 +728,8 @@ public abstract class MatrixSIS implemen
* The threshold value is determined empirically and may change in any future SIS versions.</li>
* </ul>
*
- * @param object The object to compare to {@code this}.
- * @param mode The strictness level of the comparison.
+ * @param object the object to compare to {@code this}.
+ * @param mode the strictness level of the comparison.
* @return {@code true} if both objects are equal.
*
* @see Matrices#equals(Matrix, Matrix, ComparisonMode)
@@ -720,7 +742,7 @@ public abstract class MatrixSIS implemen
/**
* Returns a clone of this matrix.
*
- * @return A new matrix of the same class and with the same values than this matrix.
+ * @return a new matrix of the same class and with the same values than this matrix.
*
* @see Matrices#copy(Matrix)
*/
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java?rev=1767577&r1=1767576&r2=1767577&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java [UTF-8] Tue Nov 1 21:03:06 2016
@@ -19,8 +19,6 @@ package org.apache.sis.referencing.opera
import java.util.List;
import java.util.Arrays;
import java.io.Serializable;
-import javax.measure.unit.SI;
-import javax.measure.unit.NonSI;
import org.opengis.util.FactoryException;
import org.opengis.geometry.DirectPosition;
import org.opengis.geometry.MismatchedDimensionException;
@@ -82,7 +80,7 @@ import static org.apache.sis.util.Argume
*
* @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.5
- * @version 0.7
+ * @version 0.8
* @module
*
* @see DefaultMathTransformFactory
@@ -158,7 +156,7 @@ public abstract class AbstractMathTransf
* <div class="note"><b>Relationship with ISO 19111:</b>
* This method is similar to {@link OperationMethod#getParameters()}, except that typical
* {@link MathTransform} implementations return parameters in standard units (usually
- * {@linkplain SI#METRE metres} or {@linkplain NonSI#DEGREE_ANGLE decimal degrees}).
+ * {@linkplain Units#METRE metres} or {@linkplain Units#DEGREE decimal degrees}).
* </div>
*
* @return The parameter descriptors for this math transform, or {@code null} if unspecified.
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ContextualParameter.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ContextualParameter.java?rev=1767577&r1=1767576&r2=1767577&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ContextualParameter.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ContextualParameter.java [UTF-8] Tue Nov 1 21:03:06 2016
@@ -16,7 +16,7 @@
*/
package org.apache.sis.referencing.operation.transform;
-import javax.measure.unit.Unit;
+import javax.measure.Unit;
import org.opengis.parameter.ParameterDescriptor;
import org.apache.sis.parameter.DefaultParameterValue;
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/CoordinateSystemTransform.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/CoordinateSystemTransform.java?rev=1767577&r1=1767576&r2=1767577&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/CoordinateSystemTransform.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/CoordinateSystemTransform.java [UTF-8] Tue Nov 1 21:03:06 2016
@@ -18,7 +18,7 @@ package org.apache.sis.referencing.opera
import java.util.Map;
import java.util.Collections;
-import javax.measure.converter.ConversionException;
+import javax.measure.IncommensurableException;
import org.opengis.util.FactoryException;
import org.opengis.parameter.ParameterValueGroup;
import org.opengis.referencing.cs.CartesianCS;
@@ -47,7 +47,7 @@ import org.apache.sis.referencing.operat
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.7
- * @version 0.7
+ * @version 0.8
* @module
*/
abstract class CoordinateSystemTransform extends AbstractMathTransform {
@@ -204,7 +204,7 @@ abstract class CoordinateSystemTransform
return factory.createConcatenatedTransform(before,
factory.createConcatenatedTransform(tr, after));
}
- } catch (IllegalArgumentException | ConversionException e) {
+ } catch (IllegalArgumentException | IncommensurableException e) {
cause = e;
}
throw new OperationNotFoundException(Resources.format(Resources.Keys.CoordinateOperationNotFound_2,
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DatumShiftTransform.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DatumShiftTransform.java?rev=1767577&r1=1767576&r2=1767577&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DatumShiftTransform.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DatumShiftTransform.java [UTF-8] Tue Nov 1 21:03:06 2016
@@ -17,9 +17,9 @@
package org.apache.sis.referencing.operation.transform;
import java.io.Serializable;
-import javax.measure.unit.Unit;
+import javax.measure.Unit;
import javax.measure.quantity.Length;
-import javax.measure.converter.UnitConverter;
+import javax.measure.UnitConverter;
import org.opengis.referencing.datum.Ellipsoid;
import org.opengis.parameter.ParameterValueGroup;
import org.opengis.parameter.ParameterDescriptorGroup;
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java?rev=1767577&r1=1767576&r2=1767577&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java [UTF-8] Tue Nov 1 21:03:06 2016
@@ -30,9 +30,8 @@ import java.security.AccessController;
import java.security.PrivilegedAction;
import java.io.Serializable;
import javax.measure.quantity.Length;
-import javax.measure.unit.SI;
-import javax.measure.unit.Unit;
-import javax.measure.converter.ConversionException;
+import javax.measure.Unit;
+import javax.measure.IncommensurableException;
import org.opengis.parameter.ParameterValue;
import org.opengis.parameter.ParameterValueGroup;
@@ -73,6 +72,7 @@ import org.apache.sis.referencing.cs.Coo
import org.apache.sis.referencing.factory.InvalidGeodeticParameterException;
import org.apache.sis.referencing.operation.DefaultOperationMethod;
import org.apache.sis.referencing.operation.matrix.Matrices;
+import org.apache.sis.measure.Units;
import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.util.CharSequences;
import org.apache.sis.util.Classes;
@@ -164,7 +164,7 @@ import org.apache.sis.internal.jdk8.JDK8
*
* @author Martin Desruisseaux (Geomatys, IRD)
* @since 0.6
- * @version 0.7
+ * @version 0.8
* @module
*
* @see MathTransformProvider
@@ -662,7 +662,7 @@ public class DefaultMathTransformFactory
} else {
return CoordinateSystems.swapAndScaleAxes(specified, normalized);
}
- } catch (IllegalArgumentException | ConversionException cause) {
+ } catch (IllegalArgumentException | IncommensurableException cause) {
throw new InvalidGeodeticParameterException(cause.getLocalizedMessage(), cause);
}
}
@@ -787,7 +787,7 @@ public class DefaultMathTransformFactory
*/
final double a = getValue(ap, unit);
final double b = getValue(bp, unit);
- final double tol = SI.METRE.getConverterTo(unit).convert(ELLIPSOID_PRECISION);
+ final double tol = Units.METRE.getConverterTo(unit).convert(ELLIPSOID_PRECISION);
if (ensureSet(ap, a, ellipsoid.getSemiMajorAxis(), unit, tol)) {
mismatchedParam = ap;
mismatchedValue = a;
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/EllipsoidToCentricTransform.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/EllipsoidToCentricTransform.java?rev=1767577&r1=1767576&r2=1767577&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/EllipsoidToCentricTransform.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/EllipsoidToCentricTransform.java [UTF-8] Tue Nov 1 21:03:06 2016
@@ -22,7 +22,7 @@ import java.util.Collections;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.Serializable;
-import javax.measure.unit.Unit;
+import javax.measure.Unit;
import javax.measure.quantity.Length;
import org.opengis.util.FactoryException;
import org.opengis.geometry.DirectPosition;
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/InterpolatedGeocentricTransform.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/InterpolatedGeocentricTransform.java?rev=1767577&r1=1767576&r2=1767577&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/InterpolatedGeocentricTransform.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/InterpolatedGeocentricTransform.java [UTF-8] Tue Nov 1 21:03:06 2016
@@ -16,7 +16,7 @@
*/
package org.apache.sis.referencing.operation.transform;
-import javax.measure.unit.Unit;
+import javax.measure.Unit;
import javax.measure.quantity.Angle;
import javax.measure.quantity.Length;
import org.opengis.util.FactoryException;
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/InterpolatedMolodenskyTransform.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/InterpolatedMolodenskyTransform.java?rev=1767577&r1=1767576&r2=1767577&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/InterpolatedMolodenskyTransform.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/InterpolatedMolodenskyTransform.java [UTF-8] Tue Nov 1 21:03:06 2016
@@ -17,7 +17,7 @@
package org.apache.sis.referencing.operation.transform;
import java.util.Arrays;
-import javax.measure.unit.Unit;
+import javax.measure.Unit;
import javax.measure.quantity.Angle;
import javax.measure.quantity.Length;
import org.opengis.util.FactoryException;
@@ -36,6 +36,7 @@ import org.apache.sis.metadata.iso.citat
import org.apache.sis.parameter.Parameters;
import org.apache.sis.parameter.ParameterBuilder;
import org.apache.sis.referencing.datum.DatumShiftGrid;
+import org.apache.sis.measure.Units;
import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.util.Debug;
@@ -61,7 +62,7 @@ import org.apache.sis.util.Debug;
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.7
- * @version 0.7
+ * @version 0.8
* @module
*
* @see InterpolatedGeocentricTransform
@@ -219,7 +220,7 @@ public class InterpolatedMolodenskyTrans
if (pg != context) {
\u0394f = \u0394fmod / semiMinor;
pg.getOrCreate(Molodensky.AXIS_LENGTH_DIFFERENCE).setValue(\u0394a, unit);
- pg.getOrCreate(Molodensky.FLATTENING_DIFFERENCE) .setValue(\u0394f, Unit.ONE);
+ pg.getOrCreate(Molodensky.FLATTENING_DIFFERENCE) .setValue(\u0394f, Units.UNITY);
}
if (grid instanceof DatumShiftGridFile<?,?>) {
((DatumShiftGridFile<?,?>) grid).setFileParameters(pg);
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/InterpolatedTransform.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/InterpolatedTransform.java?rev=1767577&r1=1767576&r2=1767577&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/InterpolatedTransform.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/InterpolatedTransform.java [UTF-8] Tue Nov 1 21:03:06 2016
@@ -17,11 +17,9 @@
package org.apache.sis.referencing.operation.transform;
import java.util.Arrays;
-import javax.measure.unit.Unit;
-import javax.measure.unit.NonSI;
-import javax.measure.quantity.Quantity;
-import javax.measure.converter.UnitConverter;
-import javax.measure.converter.LinearConverter;
+import java.util.Objects;
+import javax.measure.Unit;
+import javax.measure.Quantity;
import org.opengis.util.FactoryException;
import org.opengis.referencing.operation.Matrix;
import org.opengis.referencing.operation.MathTransform;
@@ -41,9 +39,6 @@ import org.apache.sis.internal.referenci
import org.apache.sis.internal.referencing.provider.NTv2;
import org.apache.sis.internal.referencing.provider.DatumShiftGridFile;
-// Branch-specific imports
-import java.util.Objects;
-
/**
* Transforms between two CRS by performing translations interpolated from a grid file.
@@ -75,7 +70,7 @@ import java.util.Objects;
* @author Simon Reynard (Geomatys)
* @author Rueben Schulz (UBC)
* @since 0.7
- * @version 0.7
+ * @version 0.8
* @module
*/
public class InterpolatedTransform extends DatumShiftTransform {
@@ -124,15 +119,15 @@ public class InterpolatedTransform exten
* <code>{@linkplain #getContextualParameters()}.{@linkplain ContextualParameters#completeTransform
* completeTransform}(factory, this)}</code>.
*
- * @param <T> Dimension of the coordinate and the translation unit.
- * @param grid The grid of datum shifts from source to target datum.
+ * @param <T> dimension of the coordinate and the translation unit.
+ * @param grid the grid of datum shifts from source to target datum.
* @throws NoninvertibleMatrixException if the conversion from geodetic coordinates
* to grid indices can not be inverted.
*
* @see #createGeodeticTransformation(MathTransformFactory, DatumShiftGrid)
*/
- @SuppressWarnings("OverridableMethodCallDuringObjectConstruction")
- protected <T extends Quantity> InterpolatedTransform(final DatumShiftGrid<T,T> grid)
+ @SuppressWarnings( {"OverridableMethodCallDuringObjectConstruction", "fallthrough"})
+ protected <T extends Quantity<T>> InterpolatedTransform(final DatumShiftGrid<T,T> grid)
throws NoninvertibleMatrixException
{
/*
@@ -166,14 +161,17 @@ public class InterpolatedTransform exten
* We concatenate the unit conversion with above "coordinate to grid" conversion.
*/
@SuppressWarnings("unchecked")
- final Unit<T> normalized = Units.isAngular(unit) ? (Unit<T>) NonSI.DEGREE_ANGLE : unit.toSI();
+ final Unit<T> normalized = Units.isAngular(unit) ? (Unit<T>) Units.DEGREE : unit.getSystemUnit();
if (!unit.equals(normalized)) {
- final UnitConverter converter = normalized.getConverterTo(unit);
- if (!(converter instanceof LinearConverter)) {
- throw new IllegalArgumentException(Resources.format(Resources.Keys.NonLinearUnitConversion_2, normalized, unit));
+ Number scale = 1.0;
+ Number offset = 0.0;
+ final Number[] coefficients = Units.coefficients(normalized.getConverterTo(unit));
+ switch (coefficients != null ? coefficients.length : -1) {
+ case 2: scale = coefficients[1]; // Fall through
+ case 1: offset = coefficients[0]; // Fall through
+ case 0: break;
+ default: throw new IllegalArgumentException(Resources.format(Resources.Keys.NonLinearUnitConversion_2, normalized, unit));
}
- final Double offset = converter.convert(0);
- final Double scale = Units.derivative(converter, 0);
for (int j=0; j<dimension; j++) {
normalize.convertBefore(j, scale, offset);
}
@@ -203,16 +201,16 @@ public class InterpolatedTransform exten
* coordinates in the unit given by {@link Unit#toSI()}.</li>
* </ul>
*
- * @param <T> Dimension of the coordinate and the translation unit.
- * @param factory The factory to use for creating the transform.
- * @param grid The grid of datum shifts from source to target datum.
- * The {@link DatumShiftGrid#interpolateInCell DatumShiftGrid.interpolateInCell(\u2026)}
- * method shall compute translations from <em>source</em> to <em>target</em> as
- * {@linkplain DatumShiftGrid#isCellValueRatio() ratio of offsets divided by cell sizes}.
- * @return The transformation between geodetic coordinates.
+ * @param <T> dimension of the coordinate and the translation unit.
+ * @param factory the factory to use for creating the transform.
+ * @param grid the grid of datum shifts from source to target datum.
+ * The {@link DatumShiftGrid#interpolateInCell DatumShiftGrid.interpolateInCell(\u2026)}
+ * method shall compute translations from <em>source</em> to <em>target</em> as
+ * {@linkplain DatumShiftGrid#isCellValueRatio() ratio of offsets divided by cell sizes}.
+ * @return the transformation between geodetic coordinates.
* @throws FactoryException if an error occurred while creating a transform.
*/
- public static <T extends Quantity> MathTransform createGeodeticTransformation(
+ public static <T extends Quantity<T>> MathTransform createGeodeticTransformation(
final MathTransformFactory factory, final DatumShiftGrid<T,T> grid) throws FactoryException
{
ArgumentChecks.ensureNonNull("grid", grid);
@@ -233,7 +231,7 @@ public class InterpolatedTransform exten
* Returns the number of input dimensions.
* This fixed to {@link DatumShiftGrid#getTranslationDimensions()}.
*
- * @return The dimension of input points.
+ * @return the dimension of input points.
*/
@Override
public final int getSourceDimensions() {
@@ -244,7 +242,7 @@ public class InterpolatedTransform exten
* Returns the number of target dimensions.
* This fixed to {@link DatumShiftGrid#getTranslationDimensions()}.
*
- * @return The dimension of output points.
+ * @return the dimension of output points.
*/
@Override
public final int getTargetDimensions() {
@@ -357,7 +355,7 @@ public class InterpolatedTransform exten
* Returns the inverse of this interpolated transform.
* The source ellipsoid of the returned transform will be the target ellipsoid of this transform, and conversely.
*
- * @return A transform from the target ellipsoid to the source ellipsoid of this transform.
+ * @return a transform from the target ellipsoid to the source ellipsoid of this transform.
*/
@Override
public MathTransform inverse() {
@@ -433,7 +431,7 @@ public class InterpolatedTransform exten
* Transforms a single coordinate in a list of ordinal values,
* and optionally returns the derivative at that location.
*
- * @throws TransformException If there is no convergence.
+ * @throws TransformException if there is no convergence.
*/
@Override
public final Matrix transform(final double[] srcPts, final int srcOff, double[] dstPts, int dstOff,
@@ -454,7 +452,7 @@ public class InterpolatedTransform exten
final double oy = yi;
xi = x - vector[0];
yi = y - vector[1];
- if (!(Math.abs(xi - ox) > tolerance || // Use '!' for catching NaN.
+ if (!(Math.abs(xi - ox) > tolerance || // Use '!' for catching NaN.
Math.abs(yi - oy) > tolerance))
{
if (dimension > GRID_DIMENSION) {
@@ -523,7 +521,7 @@ nextPoint: while (--numPts >= 0) {
final double oy = yi;
xi = x - vector[0];
yi = y - vector[1];
- if (!(Math.abs(xi - ox) > tolerance || // Use '!' for catching NaN.
+ if (!(Math.abs(xi - ox) > tolerance || // Use '!' for catching NaN.
Math.abs(yi - oy) > tolerance))
{
if (dimension > GRID_DIMENSION) {
@@ -540,7 +538,7 @@ nextPoint: while (--numPts >= 0) {
do dstPts[dstOff + --i] += vector[i];
while (i > GRID_DIMENSION);
}
- dstPts[dstOff ] = xi; // Shall not be done before above loop.
+ dstPts[dstOff ] = xi; // Shall not be done before above loop.
dstPts[dstOff+1] = yi;
dstOff += inc;
srcOff += inc;
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/InterpolatedTransform2D.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/InterpolatedTransform2D.java?rev=1767577&r1=1767576&r2=1767577&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/InterpolatedTransform2D.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/InterpolatedTransform2D.java [UTF-8] Tue Nov 1 21:03:06 2016
@@ -18,7 +18,7 @@ package org.apache.sis.referencing.opera
import java.awt.Shape;
import java.awt.geom.Point2D;
-import javax.measure.quantity.Quantity;
+import javax.measure.Quantity;
import org.opengis.referencing.operation.Matrix;
import org.opengis.referencing.operation.MathTransform2D;
import org.opengis.referencing.operation.TransformException;
@@ -31,7 +31,7 @@ import org.apache.sis.referencing.operat
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.7
- * @version 0.7
+ * @version 0.8
* @module
*/
final class InterpolatedTransform2D extends InterpolatedTransform implements MathTransform2D {
@@ -43,7 +43,7 @@ final class InterpolatedTransform2D exte
/**
* Constructs a 2D transform.
*/
- <T extends Quantity> InterpolatedTransform2D(final DatumShiftGrid<T,T> grid) throws NoninvertibleMatrixException {
+ <T extends Quantity<T>> InterpolatedTransform2D(final DatumShiftGrid<T,T> grid) throws NoninvertibleMatrixException {
super(grid);
}
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MathTransformProvider.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MathTransformProvider.java?rev=1767577&r1=1767576&r2=1767577&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MathTransformProvider.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MathTransformProvider.java [UTF-8] Tue Nov 1 21:03:06 2016
@@ -60,8 +60,8 @@ import org.opengis.referencing.operation
*
* @Override
* public MathTransform createMathTransform(MathTransformFactory factory, ParameterValueGroup parameters) {
- * double semiMajor = values.parameter("semi_major").doubleValue(SI.METRE);
- * double semiMinor = values.parameter("semi_minor").doubleValue(SI.METRE);
+ * double semiMajor = values.parameter("semi_major").doubleValue(Units.METRE);
+ * double semiMinor = values.parameter("semi_minor").doubleValue(Units.METRE);
* // etc...
* return new MyProjection(semiMajor, semiMinor, ...);
* }
@@ -94,8 +94,8 @@ public interface MathTransformProvider {
*
* {@preformat java
* public MathTransform createMathTransform(MathTransformFactory factory, ParameterValueGroup parameters) {
- * double semiMajor = values.parameter("semi_major").doubleValue(SI.METRE);
- * double semiMinor = values.parameter("semi_minor").doubleValue(SI.METRE);
+ * double semiMajor = values.parameter("semi_major").doubleValue(Units.METRE);
+ * double semiMinor = values.parameter("semi_minor").doubleValue(Units.METRE);
* // etc...
* return new MyProjection(semiMajor, semiMinor, ...);
* }
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MolodenskyFormula.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MolodenskyFormula.java?rev=1767577&r1=1767576&r2=1767577&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MolodenskyFormula.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MolodenskyFormula.java [UTF-8] Tue Nov 1 21:03:06 2016
@@ -16,7 +16,7 @@
*/
package org.apache.sis.referencing.operation.transform;
-import javax.measure.unit.Unit;
+import javax.measure.Unit;
import javax.measure.quantity.Length;
import org.opengis.parameter.ParameterValueGroup;
import org.opengis.parameter.ParameterDescriptorGroup;
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MolodenskyTransform.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MolodenskyTransform.java?rev=1767577&r1=1767576&r2=1767577&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MolodenskyTransform.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MolodenskyTransform.java [UTF-8] Tue Nov 1 21:03:06 2016
@@ -17,7 +17,7 @@
package org.apache.sis.referencing.operation.transform;
import java.util.Arrays;
-import javax.measure.unit.Unit;
+import javax.measure.Unit;
import org.opengis.util.FactoryException;
import org.opengis.parameter.ParameterDescriptorGroup;
import org.opengis.referencing.datum.Ellipsoid;
@@ -28,6 +28,7 @@ import org.opengis.referencing.operation
import org.apache.sis.internal.referencing.provider.Molodensky;
import org.apache.sis.internal.referencing.provider.AbridgedMolodensky;
import org.apache.sis.parameter.Parameters;
+import org.apache.sis.measure.Units;
import org.apache.sis.util.Debug;
import static java.lang.Math.*;
@@ -82,7 +83,7 @@ import static java.lang.Math.*;
* @author Martin Desruisseaux (IRD, Geomatys)
* @author R�mi Mar�chal (Geomatys)
* @since 0.7
- * @version 0.7
+ * @version 0.8
* @module
*/
public class MolodenskyTransform extends MolodenskyFormula {
@@ -188,7 +189,7 @@ public class MolodenskyTransform extends
pg.getOrCreate(Molodensky.TY) .setValue(tY, unit);
pg.getOrCreate(Molodensky.TZ) .setValue(tZ, unit);
pg.getOrCreate(Molodensky.AXIS_LENGTH_DIFFERENCE).setValue(\u0394a, unit);
- pg.getOrCreate(Molodensky.FLATTENING_DIFFERENCE) .setValue(\u0394f, Unit.ONE);
+ pg.getOrCreate(Molodensky.FLATTENING_DIFFERENCE) .setValue(\u0394f, Units.UNITY);
if (pg != context) {
pg.parameter("abridged").setValue(isAbridged); // Only in internal parameters.
}
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/package-info.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/package-info.java?rev=1767577&r1=1767576&r2=1767577&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/package-info.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/package-info.java [UTF-8] Tue Nov 1 21:03:06 2016
@@ -89,7 +89,7 @@
* @author Martin Desruisseaux (IRD, Geomatys)
* @author Guilhem Legal (Geomatys)
* @since 0.4
- * @version 0.7
+ * @version 0.8
* @module
*/
@XmlSchema(location = "http://schemas.opengis.net/gml/3.2.1/referenceSystems.xsd",
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/jaxb/referencing/CC_OperationParameterGroupTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/jaxb/referencing/CC_OperationParameterGroupTest.java?rev=1767577&r1=1767576&r2=1767577&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/jaxb/referencing/CC_OperationParameterGroupTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/jaxb/referencing/CC_OperationParameterGroupTest.java [UTF-8] Tue Nov 1 21:03:06 2016
@@ -21,7 +21,6 @@ import java.util.Map;
import java.util.IdentityHashMap;
import java.util.Collections;
import javax.xml.bind.JAXBException;
-import javax.measure.unit.NonSI;
import org.opengis.metadata.Identifier;
import org.opengis.parameter.ParameterDescriptor;
import org.opengis.parameter.ParameterDescriptorGroup;
@@ -31,6 +30,7 @@ import org.apache.sis.parameter.DefaultP
import org.apache.sis.parameter.ParameterBuilder;
import org.apache.sis.internal.referencing.provider.Mercator1SP;
import org.apache.sis.internal.util.UnmodifiableArrayList;
+import org.apache.sis.measure.Units;
import org.apache.sis.test.XMLTestCase;
import org.apache.sis.test.DependsOn;
import org.apache.sis.test.DependsOnMethod;
@@ -48,7 +48,7 @@ import static org.junit.Assert.*;
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.6
- * @version 0.6
+ * @version 0.8
* @module
*
* @see <a href="http://issues.apache.org/jira/browse/SIS-290">SIS-290</a>
@@ -98,8 +98,8 @@ public final strictfp class CC_Operation
final ParameterBuilder builder = new ParameterBuilder();
builder.setCodeSpace(EPSG, "EPSG").setRequired(true);
return new ParameterDescriptor<?>[] {
- builder.addIdentifier("8801").addName("Latitude of natural origin") .setRemarks(remarks).create(0, NonSI.DEGREE_ANGLE),
- builder.addIdentifier("8802").addName("Longitude of natural origin").create(0, NonSI.DEGREE_ANGLE),
+ builder.addIdentifier("8801").addName("Latitude of natural origin") .setRemarks(remarks).create(0, Units.DEGREE),
+ builder.addIdentifier("8802").addName("Longitude of natural origin").create(0, Units.DEGREE),
};
}
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/jaxb/referencing/SecondDefiningParameterTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/jaxb/referencing/SecondDefiningParameterTest.java?rev=1767577&r1=1767576&r2=1767577&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/jaxb/referencing/SecondDefiningParameterTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/jaxb/referencing/SecondDefiningParameterTest.java [UTF-8] Tue Nov 1 21:03:06 2016
@@ -17,8 +17,8 @@
package org.apache.sis.internal.jaxb.referencing;
import java.util.Collections;
-import javax.measure.unit.SI;
import javax.xml.bind.JAXBException;
+import org.apache.sis.measure.Units;
import org.apache.sis.referencing.datum.DefaultEllipsoid;
import org.apache.sis.test.XMLTestCase;
import org.junit.Test;
@@ -31,7 +31,7 @@ import static org.apache.sis.test.Assert
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.4
- * @version 0.4
+ * @version 0.8
* @module
*/
public final strictfp class SecondDefiningParameterTest extends XMLTestCase {
@@ -52,7 +52,7 @@ public final strictfp class SecondDefini
@Test
public void testMarshalling() throws JAXBException {
final DefaultEllipsoid ellipsoid = DefaultEllipsoid.createEllipsoid(Collections.singletonMap(
- DefaultEllipsoid.NAME_KEY, "Sphere"), 6371000, 6371000, SI.METRE);
+ DefaultEllipsoid.NAME_KEY, "Sphere"), 6371000, 6371000, Units.METRE);
final SecondDefiningParameter sdp = new SecondDefiningParameter(ellipsoid, false);
assertXmlEquals(
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" +
@@ -71,6 +71,6 @@ public final strictfp class SecondDefini
public void testUnmarshalling() throws JAXBException {
final SecondDefiningParameter sdp = unmarshal(SecondDefiningParameter.class, XML);
assertEquals(6371000.0, sdp.measure.value, 0);
- assertEquals(SI.METRE, sdp.measure.unit);
+ assertEquals(Units.METRE, sdp.measure.unit);
}
}
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/metadata/AxisDirectionsTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/metadata/AxisDirectionsTest.java?rev=1767577&r1=1767576&r2=1767577&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/metadata/AxisDirectionsTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/metadata/AxisDirectionsTest.java [UTF-8] Tue Nov 1 21:03:06 2016
@@ -17,14 +17,13 @@
package org.apache.sis.internal.metadata;
import java.lang.reflect.Field;
-import javax.measure.unit.SI;
-import javax.measure.unit.NonSI;
-import javax.measure.unit.Unit;
+import javax.measure.Unit;
import org.opengis.referencing.cs.AxisDirection;
import org.opengis.referencing.cs.CoordinateSystem;
import org.opengis.referencing.cs.CoordinateSystemAxis;
import org.apache.sis.referencing.cs.HardCodedAxes;
import org.apache.sis.referencing.cs.HardCodedCS;
+import org.apache.sis.measure.Units;
import org.apache.sis.test.DependsOnMethod;
import org.apache.sis.test.TestCase;
import org.junit.Test;
@@ -45,7 +44,7 @@ import static org.apache.sis.internal.me
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.4
- * @version 0.6
+ * @version 0.8
* @module
*/
public final strictfp class AxisDirectionsTest extends TestCase {
@@ -383,37 +382,37 @@ public final strictfp class AxisDirectio
*/
@Test
public void testSuggestAbbreviation() {
- assertEquals("x", AxisDirections.suggestAbbreviation("x", EAST, SI.METRE));
- assertEquals("\u03bb", AxisDirections.suggestAbbreviation("Geodetic longitude", EAST, NonSI.DEGREE_ANGLE));
- assertEquals("\u03c6", AxisDirections.suggestAbbreviation("Geodetic latitude", NORTH, NonSI.DEGREE_ANGLE));
- assertEquals("\u03b8", AxisDirections.suggestAbbreviation("Spherical longitude", EAST, NonSI.DEGREE_ANGLE));
- assertEquals("\u03c6\u2032", AxisDirections.suggestAbbreviation("Spherical latitude", NORTH, NonSI.DEGREE_ANGLE));
- assertEquals("h", AxisDirections.suggestAbbreviation("Ellipsoidal height", UP, SI.METRE));
- assertEquals("H", AxisDirections.suggestAbbreviation("Gravity-related height", UP, SI.METRE));
- assertEquals("\u03c6", AxisDirections.suggestAbbreviation("Elevation", UP, SI.METRE));
- assertEquals("R", AxisDirections.suggestAbbreviation("Geocentric radius", UP, SI.METRE));
- assertEquals("r", AxisDirections.suggestAbbreviation("Distance", AWAY_FROM, SI.METRE));
- assertEquals("\u03b8", AxisDirections.suggestAbbreviation("Bearing", CLOCKWISE, NonSI.DEGREE_ANGLE));
- assertEquals("X", AxisDirections.suggestAbbreviation("not needed", GEOCENTRIC_X, SI.METRE));
- assertEquals("Y", AxisDirections.suggestAbbreviation("not needed", GEOCENTRIC_Y, SI.METRE));
- assertEquals("Z", AxisDirections.suggestAbbreviation("not needed", GEOCENTRIC_Z, SI.METRE));
- assertEquals("D", AxisDirections.suggestAbbreviation("not needed", DOWN, SI.METRE));
- assertEquals("t", AxisDirections.suggestAbbreviation("not needed", FUTURE, NonSI.DAY));
- assertEquals("i", AxisDirections.suggestAbbreviation("not needed", COLUMN_NEGATIVE, Unit.ONE));
- assertEquals("j", AxisDirections.suggestAbbreviation("not needed", ROW_NEGATIVE, Unit.ONE));
- assertEquals("x", AxisDirections.suggestAbbreviation("not needed", DISPLAY_RIGHT, Unit.ONE));
- assertEquals("y", AxisDirections.suggestAbbreviation("not needed", DISPLAY_DOWN, Unit.ONE));
- assertEquals("N", AxisDirections.suggestAbbreviation("not needed", NORTH, SI.METRE));
- assertEquals("S", AxisDirections.suggestAbbreviation("not needed", SOUTH, SI.METRE));
- assertEquals("E", AxisDirections.suggestAbbreviation("not needed", EAST, SI.METRE));
- assertEquals("W", AxisDirections.suggestAbbreviation("not needed", WEST, SI.METRE));
- assertEquals("NE", AxisDirections.suggestAbbreviation("not needed", NORTH_EAST, SI.METRE));
- assertEquals("NW", AxisDirections.suggestAbbreviation("not needed", NORTH_WEST, SI.METRE));
- assertEquals("SE", AxisDirections.suggestAbbreviation("not needed", SOUTH_EAST, SI.METRE));
- assertEquals("SW", AxisDirections.suggestAbbreviation("not needed", SOUTH_WEST, SI.METRE));
- assertEquals("SSE", AxisDirections.suggestAbbreviation("not needed", SOUTH_SOUTH_EAST, SI.METRE));
- assertEquals("NNW", AxisDirections.suggestAbbreviation("not needed", NORTH_NORTH_WEST, SI.METRE));
- assertEquals("ENE", AxisDirections.suggestAbbreviation("not needed", EAST_NORTH_EAST, SI.METRE));
+ assertEquals("x", AxisDirections.suggestAbbreviation("x", EAST, Units.METRE));
+ assertEquals("\u03bb", AxisDirections.suggestAbbreviation("Geodetic longitude", EAST, Units.DEGREE));
+ assertEquals("\u03c6", AxisDirections.suggestAbbreviation("Geodetic latitude", NORTH, Units.DEGREE));
+ assertEquals("\u03b8", AxisDirections.suggestAbbreviation("Spherical longitude", EAST, Units.DEGREE));
+ assertEquals("\u03c6\u2032", AxisDirections.suggestAbbreviation("Spherical latitude", NORTH, Units.DEGREE));
+ assertEquals("h", AxisDirections.suggestAbbreviation("Ellipsoidal height", UP, Units.METRE));
+ assertEquals("H", AxisDirections.suggestAbbreviation("Gravity-related height", UP, Units.METRE));
+ assertEquals("\u03c6", AxisDirections.suggestAbbreviation("Elevation", UP, Units.METRE));
+ assertEquals("R", AxisDirections.suggestAbbreviation("Geocentric radius", UP, Units.METRE));
+ assertEquals("r", AxisDirections.suggestAbbreviation("Distance", AWAY_FROM, Units.METRE));
+ assertEquals("\u03b8", AxisDirections.suggestAbbreviation("Bearing", CLOCKWISE, Units.DEGREE));
+ assertEquals("X", AxisDirections.suggestAbbreviation("not needed", GEOCENTRIC_X, Units.METRE));
+ assertEquals("Y", AxisDirections.suggestAbbreviation("not needed", GEOCENTRIC_Y, Units.METRE));
+ assertEquals("Z", AxisDirections.suggestAbbreviation("not needed", GEOCENTRIC_Z, Units.METRE));
+ assertEquals("D", AxisDirections.suggestAbbreviation("not needed", DOWN, Units.METRE));
+ assertEquals("t", AxisDirections.suggestAbbreviation("not needed", FUTURE, Units.DAY));
+ assertEquals("i", AxisDirections.suggestAbbreviation("not needed", COLUMN_NEGATIVE, Units.UNITY));
+ assertEquals("j", AxisDirections.suggestAbbreviation("not needed", ROW_NEGATIVE, Units.UNITY));
+ assertEquals("x", AxisDirections.suggestAbbreviation("not needed", DISPLAY_RIGHT, Units.UNITY));
+ assertEquals("y", AxisDirections.suggestAbbreviation("not needed", DISPLAY_DOWN, Units.UNITY));
+ assertEquals("N", AxisDirections.suggestAbbreviation("not needed", NORTH, Units.METRE));
+ assertEquals("S", AxisDirections.suggestAbbreviation("not needed", SOUTH, Units.METRE));
+ assertEquals("E", AxisDirections.suggestAbbreviation("not needed", EAST, Units.METRE));
+ assertEquals("W", AxisDirections.suggestAbbreviation("not needed", WEST, Units.METRE));
+ assertEquals("NE", AxisDirections.suggestAbbreviation("not needed", NORTH_EAST, Units.METRE));
+ assertEquals("NW", AxisDirections.suggestAbbreviation("not needed", NORTH_WEST, Units.METRE));
+ assertEquals("SE", AxisDirections.suggestAbbreviation("not needed", SOUTH_EAST, Units.METRE));
+ assertEquals("SW", AxisDirections.suggestAbbreviation("not needed", SOUTH_WEST, Units.METRE));
+ assertEquals("SSE", AxisDirections.suggestAbbreviation("not needed", SOUTH_SOUTH_EAST, Units.METRE));
+ assertEquals("NNW", AxisDirections.suggestAbbreviation("not needed", NORTH_NORTH_WEST, Units.METRE));
+ assertEquals("ENE", AxisDirections.suggestAbbreviation("not needed", EAST_NORTH_EAST, Units.METRE));
}
/**
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/ReferencingUtilitiesTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/ReferencingUtilitiesTest.java?rev=1767577&r1=1767576&r2=1767577&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/ReferencingUtilitiesTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/ReferencingUtilitiesTest.java [UTF-8] Tue Nov 1 21:03:06 2016
@@ -16,8 +16,7 @@
*/
package org.apache.sis.internal.referencing;
-import javax.measure.unit.Unit;
-import javax.measure.unit.NonSI;
+import javax.measure.Unit;
import org.opengis.referencing.cs.*;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.opengis.referencing.crs.GeographicCRS;
@@ -26,6 +25,7 @@ import org.opengis.referencing.Identifie
import org.apache.sis.referencing.datum.HardCodedDatum;
import org.apache.sis.referencing.crs.HardCodedCRS;
import org.apache.sis.util.Utilities;
+import org.apache.sis.measure.Units;
import org.apache.sis.test.TestCase;
import org.junit.Test;
@@ -38,7 +38,7 @@ import static org.apache.sis.internal.re
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.5 (derived from 0.4)
- * @version 0.7
+ * @version 0.8
* @module
*/
public final strictfp class ReferencingUtilitiesTest extends TestCase {
@@ -47,12 +47,12 @@ public final strictfp class ReferencingU
*/
@Test
public void testGetGreenwichLongitude() {
- assertEquals(0, getGreenwichLongitude(HardCodedDatum.GREENWICH, NonSI.DEGREE_ANGLE), STRICT);
- assertEquals(0, getGreenwichLongitude(HardCodedDatum.GREENWICH, NonSI.GRADE), STRICT);
- assertEquals(2.5969213, getGreenwichLongitude(HardCodedDatum.PARIS, NonSI.GRADE), STRICT);
- assertEquals(2.33722917, getGreenwichLongitude(HardCodedDatum.PARIS, NonSI.DEGREE_ANGLE), 1E-12);
- assertEquals(2.33720833, getGreenwichLongitude(HardCodedDatum.PARIS_RGS, NonSI.DEGREE_ANGLE), 1E-8);
- assertEquals(2.596898, getGreenwichLongitude(HardCodedDatum.PARIS_RGS, NonSI.GRADE), 1E-6);
+ assertEquals(0, getGreenwichLongitude(HardCodedDatum.GREENWICH, Units.DEGREE), STRICT);
+ assertEquals(0, getGreenwichLongitude(HardCodedDatum.GREENWICH, Units.GRAD), STRICT);
+ assertEquals(2.5969213, getGreenwichLongitude(HardCodedDatum.PARIS, Units.GRAD), STRICT);
+ assertEquals(2.33722917, getGreenwichLongitude(HardCodedDatum.PARIS, Units.DEGREE), 1E-12);
+ assertEquals(2.33720833, getGreenwichLongitude(HardCodedDatum.PARIS_RGS, Units.DEGREE), 1E-8);
+ assertEquals(2.596898, getGreenwichLongitude(HardCodedDatum.PARIS_RGS, Units.GRAD), 1E-6);
}
/**
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/GeographicOffsetsTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/GeographicOffsetsTest.java?rev=1767577&r1=1767576&r2=1767577&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/GeographicOffsetsTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/GeographicOffsetsTest.java [UTF-8] Tue Nov 1 21:03:06 2016
@@ -16,7 +16,6 @@
*/
package org.apache.sis.internal.referencing.provider;
-import javax.measure.unit.NonSI;
import org.opengis.util.FactoryException;
import org.opengis.parameter.ParameterValueGroup;
import org.opengis.referencing.operation.MathTransformFactory;
@@ -24,6 +23,7 @@ import org.opengis.referencing.operation
import org.apache.sis.internal.referencing.Formulas;
import org.apache.sis.internal.system.DefaultFactories;
import org.apache.sis.referencing.operation.transform.DefaultMathTransformFactory;
+import org.apache.sis.measure.Units;
// Test dependencies
import org.opengis.test.referencing.TransformTestCase;
@@ -37,7 +37,7 @@ import org.junit.Test;
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.7
- * @version 0.7
+ * @version 0.8
* @module
*/
@DependsOn(AffineTest.class)
@@ -101,7 +101,7 @@ public final strictfp class GeographicOf
public void testVerticalOffset() throws FactoryException, TransformException {
final VerticalOffset provider = new VerticalOffset();
final ParameterValueGroup pv = provider.getParameters().createValue();
- pv.parameter("Vertical Offset").setValue(15.55, NonSI.FOOT);
+ pv.parameter("Vertical Offset").setValue(15.55, Units.FOOT);
transform = provider.createMathTransform(null, pv);
tolerance = Formulas.LINEAR_TOLERANCE;
final double[] source = new double[transform.getSourceDimensions()];
@@ -124,7 +124,7 @@ public final strictfp class GeographicOf
final DefaultMathTransformFactory factory = DefaultFactories.forBuildin(
MathTransformFactory.class, DefaultMathTransformFactory.class);
final ParameterValueGroup pv = factory.getDefaultParameters("Vertical Offset");
- pv.parameter("Vertical Offset").setValue(15.55, NonSI.FOOT);
+ pv.parameter("Vertical Offset").setValue(15.55, Units.FOOT);
/*
* Now create the MathTransform. But at the difference of the above testVerticalOffset() method,
* we supply information about axis directions. The operation parameter shall have the same sign
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/LongitudeRotationTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/LongitudeRotationTest.java?rev=1767577&r1=1767576&r2=1767577&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/LongitudeRotationTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/LongitudeRotationTest.java [UTF-8] Tue Nov 1 21:03:06 2016
@@ -16,11 +16,11 @@
*/
package org.apache.sis.internal.referencing.provider;
-import javax.measure.unit.NonSI;
import org.opengis.parameter.ParameterValueGroup;
import org.opengis.referencing.operation.MathTransform;
import org.apache.sis.referencing.operation.transform.LinearTransform;
import org.apache.sis.referencing.operation.matrix.Matrix3;
+import org.apache.sis.measure.Units;
import org.apache.sis.test.DependsOnMethod;
import org.apache.sis.test.DependsOn;
import org.apache.sis.test.TestCase;
@@ -34,7 +34,7 @@ import static org.apache.sis.test.Metada
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.6
- * @version 0.6
+ * @version 0.8
* @module
*/
@DependsOn(AffineTest.class)
@@ -46,7 +46,7 @@ public final strictfp class LongitudeRot
public void testCreateMathTransform() {
final LongitudeRotation provider = new LongitudeRotation();
ParameterValueGroup p = provider.getParameters().createValue();
- p.parameter("Longitude offset").setValue(2.5969213, NonSI.GRADE); // Paris meridian
+ p.parameter("Longitude offset").setValue(2.5969213, Units.GRAD); // Paris meridian
final MathTransform mt = provider.createMathTransform(null, p);
/*
* Verify the full matrix. Note that the longitude offset is expected to be in degrees.
@@ -69,7 +69,7 @@ public final strictfp class LongitudeRot
public void testWKT() {
final LongitudeRotation provider = new LongitudeRotation();
final ParameterValueGroup p = provider.getParameters().createValue();
- p.parameter("Longitude offset").setValue(2.5969213, NonSI.GRADE);
+ p.parameter("Longitude offset").setValue(2.5969213, Units.GRAD);
assertWktEquals(
"PARAM_MT[\u201cAffine parametric transformation\u201d,\n" +
" PARAMETER[\u201cA2\u201d, 2.33722917, ID[\u201cEPSG\u201d, 8625]]]", provider.createMathTransform(null, p));
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/NADCONTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/NADCONTest.java?rev=1767577&r1=1767576&r2=1767577&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/NADCONTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/NADCONTest.java [UTF-8] Tue Nov 1 21:03:06 2016
@@ -21,7 +21,6 @@ import java.io.BufferedWriter;
import java.io.IOException;
import java.net.URL;
import java.net.URISyntaxException;
-import javax.measure.unit.NonSI;
import javax.measure.quantity.Angle;
import org.opengis.geometry.Envelope;
import org.opengis.util.FactoryException;
@@ -29,6 +28,7 @@ import org.opengis.referencing.operation
import org.apache.sis.referencing.operation.matrix.Matrix3;
import org.apache.sis.geometry.Envelope2D;
import org.apache.sis.geometry.Envelopes;
+import org.apache.sis.measure.Units;
import org.apache.sis.test.TestCase;
import org.junit.Test;
@@ -46,7 +46,7 @@ import org.apache.sis.internal.jdk8.JDK8
* @author Martin Desruisseaux (Geomatys)
* @author Simon Reynard (Geomatys)
* @since 0.7
- * @version 0.7
+ * @version 0.8
* @module
*/
public final strictfp class NADCONTest extends TestCase {
@@ -145,8 +145,8 @@ public final strictfp class NADCONTest e
{
final DatumShiftGridFile<Angle,Angle> grid = NADCON.getOrLoad(latitudeShifts, longitudeShifts);
assertInstanceOf("Should not be compressed.", DatumShiftGridFile.Float.class, grid);
- assertEquals("coordinateUnit", NonSI.DEGREE_ANGLE, grid.getCoordinateUnit());
- assertEquals("translationUnit", NonSI.DEGREE_ANGLE, grid.getTranslationUnit());
+ assertEquals("coordinateUnit", Units.DEGREE, grid.getCoordinateUnit());
+ assertEquals("translationUnit", Units.DEGREE, grid.getTranslationUnit());
assertEquals("translationDimensions", 2, grid.getTranslationDimensions());
assertTrue ("isCellValueRatio", grid.isCellValueRatio());
assertTrue ("cellPrecision", grid.getCellPrecision() > 0);
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/NTv2Test.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/NTv2Test.java?rev=1767577&r1=1767576&r2=1767577&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/NTv2Test.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/NTv2Test.java [UTF-8] Tue Nov 1 21:03:06 2016
@@ -23,7 +23,6 @@ import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.channels.WritableByteChannel;
import java.nio.charset.StandardCharsets;
-import javax.measure.unit.NonSI;
import javax.measure.quantity.Angle;
import org.opengis.geometry.Envelope;
import org.opengis.util.FactoryException;
@@ -31,6 +30,7 @@ import org.opengis.referencing.operation
import org.apache.sis.referencing.operation.matrix.Matrix3;
import org.apache.sis.geometry.Envelope2D;
import org.apache.sis.geometry.Envelopes;
+import org.apache.sis.measure.Units;
import org.apache.sis.test.TestCase;
import org.junit.Test;
@@ -48,7 +48,7 @@ import java.nio.file.StandardOpenOption;
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.7
- * @version 0.7
+ * @version 0.8
* @module
*
* @see GeocentricTranslationTest#testFranceGeocentricInterpolationPoint()
@@ -92,7 +92,7 @@ public final strictfp class NTv2Test ext
* because Apache SIS does not redistribute the {@code "NTF_R93.gsb"}. But developers can invoke this method
* explicitely if they can provide a path to the {@code "NTF_R93.gsb"} file.
*
- * @param file Path to the official {@code "NTF_R93.gsb"} file.
+ * @param file path to the official {@code "NTF_R93.gsb"} file.
* @throws IOException if an error occurred while loading the grid.
* @throws FactoryException if an error occurred while computing the grid.
* @throws TransformException if an error occurred while computing the envelope or testing the point.
@@ -104,10 +104,10 @@ public final strictfp class NTv2Test ext
/**
* Implementation of {@link #testLoader()} and {@link #testRGF93(Path)}.
*
- * @param xmin Negative of value of {@code "W_LONG"} record.
- * @param xmax Negative of value of {@code "E_LONG"} record.
- * @param ymin Value of the {@code "S_LAT"} record.
- * @param ymax Value of the {@code "N_LAT"} record.
+ * @param xmin negative of value of {@code "W_LONG"} record.
+ * @param xmax negative of value of {@code "E_LONG"} record.
+ * @param ymin value of the {@code "S_LAT"} record.
+ * @param ymax value of the {@code "N_LAT"} record.
*/
private static void testRGF93(final Path file, final double xmin, final double xmax,
final double ymin, final double ymax) throws IOException, FactoryException, TransformException
@@ -115,8 +115,8 @@ public final strictfp class NTv2Test ext
final double cellSize = 360;
final DatumShiftGridFile<Angle,Angle> grid = NTv2.getOrLoad(file);
assertInstanceOf("Should not be compressed.", DatumShiftGridFile.Float.class, grid);
- assertEquals("coordinateUnit", NonSI.SECOND_ANGLE, grid.getCoordinateUnit());
- assertEquals("translationUnit", NonSI.SECOND_ANGLE, grid.getTranslationUnit());
+ assertEquals("coordinateUnit", Units.ARC_SECOND, grid.getCoordinateUnit());
+ assertEquals("translationUnit", Units.ARC_SECOND, grid.getTranslationUnit());
assertEquals("translationDimensions", 2, grid.getTranslationDimensions());
assertTrue ("isCellValueRatio", grid.isCellValueRatio());
assertEquals("cellPrecision", (ACCURACY / 10) / cellSize, grid.getCellPrecision(), 0.5E-6 / cellSize);
@@ -198,12 +198,12 @@ public final strictfp class NTv2Test ext
* is rounding errors. This is usually the case when using the {@code "SECONDS"} unit of measurement.
* This assumption does not apply to the shift values.
*
- * @param grid The full grid from which to extract a few values.
- * @param out Where to write the test file.
- * @param gridX Index along the longitude axis of the first cell to write.
- * @param gridY Index along the latitude axis of the first cell to write.
- * @param nx Number of cells to write along the longitude axis.
- * @param ny Number of cells to write along the latitude axis.
+ * @param grid the full grid from which to extract a few values.
+ * @param out where to write the test file.
+ * @param gridX index along the longitude axis of the first cell to write.
+ * @param gridY index along the latitude axis of the first cell to write.
+ * @param nx number of cells to write along the longitude axis.
+ * @param ny number of cells to write along the latitude axis.
* @throws TransformException if an error occurred while computing the envelope.
* @throws IOException if an error occurred while writing the test file.
*/
@@ -219,12 +219,12 @@ public final strictfp class NTv2Test ext
writeString(buffer, "NUM_FILE"); buffer.putInt(1); nextRecord(buffer);
writeString(buffer, "GS_TYPE"); writeString(buffer, "SECONDS");
writeString(buffer, "VERSION"); writeString(buffer, "SIS_TEST"); // Last overview record.
- writeString(buffer, "S_LAT"); buffer.putDouble(Math.rint( envelope.getMinimum(1)));
- writeString(buffer, "N_LAT"); buffer.putDouble(Math.rint( envelope.getMaximum(1)));
- writeString(buffer, "E_LONG"); buffer.putDouble(Math.rint(-envelope.getMaximum(0))); // Sign reversed.
- writeString(buffer, "W_LONG"); buffer.putDouble(Math.rint(-envelope.getMinimum(0)));
- writeString(buffer, "LAT_INC"); buffer.putDouble(Math.rint( envelope.getSpan(1) / (ny - 1)));
- writeString(buffer, "LONG_INC"); buffer.putDouble(Math.rint( envelope.getSpan(0) / (nx - 1)));
+ writeString(buffer, "S_LAT"); buffer.putDouble(StrictMath.rint( envelope.getMinimum(1)));
+ writeString(buffer, "N_LAT"); buffer.putDouble(StrictMath.rint( envelope.getMaximum(1)));
+ writeString(buffer, "E_LONG"); buffer.putDouble(StrictMath.rint(-envelope.getMaximum(0))); // Sign reversed.
+ writeString(buffer, "W_LONG"); buffer.putDouble(StrictMath.rint(-envelope.getMinimum(0)));
+ writeString(buffer, "LAT_INC"); buffer.putDouble(StrictMath.rint( envelope.getSpan(1) / (ny - 1)));
+ writeString(buffer, "LONG_INC"); buffer.putDouble(StrictMath.rint( envelope.getSpan(0) / (nx - 1)));
writeString(buffer, "GS_COUNT"); buffer.putInt(nx * ny); nextRecord(buffer);
for (int y=0; y<ny; y++) {
for (int x=0; x<nx; x++) {
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/PoleRotationMock.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/PoleRotationMock.java?rev=1767577&r1=1767576&r2=1767577&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/PoleRotationMock.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/PoleRotationMock.java [UTF-8] Tue Nov 1 21:03:06 2016
@@ -16,10 +16,10 @@
*/
package org.apache.sis.internal.referencing.provider;
-import javax.measure.unit.NonSI;
import org.opengis.parameter.ParameterDescriptor;
import org.opengis.parameter.ParameterDescriptorGroup;
import org.apache.sis.parameter.ParameterBuilder;
+import org.apache.sis.measure.Units;
/**
@@ -32,7 +32,7 @@ import org.apache.sis.parameter.Paramete
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.6
- * @version 0.6
+ * @version 0.8
* @module
*/
@SuppressWarnings("serial")
@@ -46,7 +46,7 @@ public final strictfp class PoleRotation
final ParameterDescriptor<?>[] parameters = {
createLatitude (builder.addName("Latitude of rotated pole"), true),
createLongitude(builder.addName("Longitude of rotated pole")),
- builder.addName("Axis rotation").create(Double.NaN, NonSI.DEGREE_ANGLE)
+ builder.addName("Axis rotation").create(Double.NaN, Units.DEGREE)
};
PARAMETERS = builder.addName("Pole rotation").createGroup(parameters);
}
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/SeismicBinGridMock.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/SeismicBinGridMock.java?rev=1767577&r1=1767576&r2=1767577&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/SeismicBinGridMock.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/SeismicBinGridMock.java [UTF-8] Tue Nov 1 21:03:06 2016
@@ -16,12 +16,10 @@
*/
package org.apache.sis.internal.referencing.provider;
-import javax.measure.unit.SI;
-import javax.measure.unit.NonSI;
-import javax.measure.unit.Unit;
import org.opengis.parameter.ParameterDescriptor;
import org.opengis.parameter.ParameterDescriptorGroup;
import org.apache.sis.parameter.ParameterBuilder;
+import org.apache.sis.measure.Units;
/**
@@ -34,7 +32,7 @@ import org.apache.sis.parameter.Paramete
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.6
- * @version 0.6
+ * @version 0.8
* @module
*/
@SuppressWarnings("serial")
@@ -46,16 +44,16 @@ public final strictfp class SeismicBinGr
static {
final ParameterBuilder builder = builder();
final ParameterDescriptor<?>[] parameters = {
- builder.addIdentifier("8733").addName("Bin grid origin I").create(Double.NaN, Unit.ONE),
- builder.addIdentifier("8734").addName("Bin grid origin J").create(Double.NaN, Unit.ONE),
- builder.addIdentifier("8735").addName("Bin grid origin Easting").create(Double.NaN, SI.METRE),
- builder.addIdentifier("8736").addName("Bin grid origin Northing").create(Double.NaN, SI.METRE),
- builder.addIdentifier("8737").addName("Scale factor of bin grid").create(Double.NaN, Unit.ONE),
- builder.addIdentifier("8738").addName("Bin width on I-axis").create(Double.NaN, SI.METRE),
- builder.addIdentifier("8739").addName("Bin width on J-axis").create(Double.NaN, SI.METRE),
- builder.addIdentifier("8740").addName("Map grid bearing of bin grid J-axis").create(Double.NaN, NonSI.DEGREE_ANGLE),
- builder.addIdentifier("8741").addName("Bin node increment on I-axis").create(Double.NaN, Unit.ONE),
- builder.addIdentifier("8742").addName("Bin node increment on J-axis").create(Double.NaN, Unit.ONE)
+ builder.addIdentifier("8733").addName("Bin grid origin I") .create(Double.NaN, Units.UNITY),
+ builder.addIdentifier("8734").addName("Bin grid origin J") .create(Double.NaN, Units.UNITY),
+ builder.addIdentifier("8735").addName("Bin grid origin Easting") .create(Double.NaN, Units.METRE),
+ builder.addIdentifier("8736").addName("Bin grid origin Northing") .create(Double.NaN, Units.METRE),
+ builder.addIdentifier("8737").addName("Scale factor of bin grid") .create(Double.NaN, Units.UNITY),
+ builder.addIdentifier("8738").addName("Bin width on I-axis") .create(Double.NaN, Units.METRE),
+ builder.addIdentifier("8739").addName("Bin width on J-axis") .create(Double.NaN, Units.METRE),
+ builder.addIdentifier("8740").addName("Map grid bearing of bin grid J-axis").create(Double.NaN, Units.DEGREE),
+ builder.addIdentifier("8741").addName("Bin node increment on I-axis") .create(Double.NaN, Units.UNITY),
+ builder.addIdentifier("8742").addName("Bin node increment on J-axis") .create(Double.NaN, Units.UNITY)
};
PARAMETERS = builder
.addIdentifier("1049")
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/TopocentricConversionMock.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/TopocentricConversionMock.java?rev=1767577&r1=1767576&r2=1767577&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/TopocentricConversionMock.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/TopocentricConversionMock.java [UTF-8] Tue Nov 1 21:03:06 2016
@@ -16,10 +16,10 @@
*/
package org.apache.sis.internal.referencing.provider;
-import javax.measure.unit.SI;
import org.opengis.parameter.ParameterDescriptor;
import org.opengis.parameter.ParameterDescriptorGroup;
import org.apache.sis.parameter.ParameterBuilder;
+import org.apache.sis.measure.Units;
/**
@@ -32,7 +32,7 @@ import org.apache.sis.parameter.Paramete
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.6
- * @version 0.6
+ * @version 0.8
* @module
*/
@SuppressWarnings("serial")
@@ -46,7 +46,7 @@ public final strictfp class TopocentricC
final ParameterDescriptor<?>[] parameters = {
createLatitude (builder.addIdentifier("8834").addName("Latitude of topocentric origin"), true),
createLongitude(builder.addIdentifier("8835").addName("Longitude of topocentric origin")),
- builder.addIdentifier("8836").addName("Ellipsoidal height of topocentric origin").create(0, SI.METRE)
+ builder.addIdentifier("8836").addName("Ellipsoidal height of topocentric origin").create(0, Units.METRE)
};
PARAMETERS = builder
.addIdentifier("9837")