Copied: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperation.java (from r1677068, sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperation.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperation.java?p2=sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperation.java&p1=sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperation.java&r1=1677068&r2=1677070&rev=1677070&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperation.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperation.java [UTF-8] Thu Apr 30 20:57:36 2015
@@ -104,7 +104,7 @@ public class DefaultConcatenatedOperatio
final MathTransformFactory factory)
throws FactoryException
{
- this(properties, new ArrayList<>(operations.length), operations, factory);
+ this(properties, new ArrayList<SingleOperation>(operations.length), operations, factory);
}
/**
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultFormula.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultFormula.java?rev=1677070&r1=1677069&r2=1677070&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultFormula.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultFormula.java [UTF-8] Thu Apr 30 20:57:36 2015
@@ -180,11 +180,12 @@ public class DefaultFormula extends Form
@Override
protected String formatTo(final Formatter formatter) {
InternationalString text = null;
+ final Citation citation = getCitation(); // Gives to users a chance to override properties.
if (citation != null) {
text = citation.getTitle();
}
if (text == null) {
- text = formula;
+ text = getFormula();
}
if (text != null) {
formatter.append(text.toString(formatter.getLocale()), ElementKind.REMARKS);
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java?rev=1677070&r1=1677069&r2=1677070&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java [UTF-8] Thu Apr 30 20:57:36 2015
@@ -32,11 +32,11 @@ import org.apache.sis.util.Workaround;
import org.apache.sis.util.ComparisonMode;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.resources.Vocabulary;
+import org.apache.sis.internal.util.Citations;
import org.apache.sis.parameter.Parameterized;
import org.apache.sis.referencing.NamedIdentifier;
import org.apache.sis.referencing.IdentifiedObjects;
import org.apache.sis.referencing.AbstractIdentifiedObject;
-import org.apache.sis.internal.referencing.OperationMethods;
import org.apache.sis.io.wkt.Formatter;
import static org.apache.sis.util.ArgumentChecks.*;
@@ -600,7 +600,7 @@ public class DefaultOperationMethod exte
* and parameters.
*/
final OperationMethod that = (OperationMethod) object;
- final Boolean match = OperationMethods.hasCommonIdentifier(getIdentifiers(), that.getIdentifiers());
+ final Boolean match = Citations.hasCommonIdentifier(getIdentifiers(), that.getIdentifiers());
if (match != null) {
if (!match) {
return false;
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrices.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrices.java?rev=1677070&r1=1677069&r2=1677070&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrices.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrices.java [UTF-8] Thu Apr 30 20:57:36 2015
@@ -480,32 +480,12 @@ public final class Matrices extends Stat
{
ArgumentChecks.ensureNonNull("srcEnvelope", srcEnvelope);
ArgumentChecks.ensureNonNull("dstEnvelope", dstEnvelope);
- ensureDimensionMatch("srcEnvelope", srcEnvelope, srcAxes.length);
- ensureDimensionMatch("dstEnvelope", dstEnvelope, dstAxes.length);
+ ArgumentChecks.ensureDimensionMatches("srcEnvelope", srcAxes.length, srcEnvelope);
+ ArgumentChecks.ensureDimensionMatches("dstEnvelope", dstAxes.length, dstEnvelope);
return createTransform(srcEnvelope, srcAxes, dstEnvelope, dstAxes, true);
}
/**
- * Convenience method for checking object dimension validity.
- * This method is invoked for argument checking.
- *
- * @param name The name of the argument to check.
- * @param envelope The envelope to check.
- * @param dimension The expected dimension for the object.
- * @throws MismatchedDimensionException if the envelope doesn't have the expected dimension.
- */
- private static void ensureDimensionMatch(final String name, final Envelope envelope,
- final int dimension) throws MismatchedDimensionException
- {
- ArgumentChecks.ensureNonNull(name, envelope);
- final int dim = envelope.getDimension();
- if (dimension != dim) {
- throw new MismatchedDimensionException(Errors.format(
- Errors.Keys.MismatchedDimension_3, name, dimension, dim));
- }
- }
-
- /**
* Creates a matrix for a transform that keep only a subset of source ordinate values.
* The matrix size will be ({@code selectedDimensions.length}+1) × ({@code sourceDimensions}+1).
* The matrix will contain only zero elements, except for the following cells which will contain 1:
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/package-info.java?rev=1677070&r1=1677069&r2=1677070&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/package-info.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/package-info.java [UTF-8] Thu Apr 30 20:57:36 2015
@@ -16,7 +16,7 @@
*/
/**
- * Relationship between any two {@linkplain org.apache.sis.referencing.crs.AbstractCRS Coordinate Reference Systems}.
+ * Relationship between any two {@linkplain org.apache.sis.referencing.crs.AbstractCRS Coordinate Reference Systems} (CRS).
* An explanation for this package is provided in the {@linkplain org.opengis.referencing.operation OpenGIS® javadoc}.
* The remaining discussion on this page is specific to the Apache SIS implementation.
*
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java?rev=1677070&r1=1677069&r2=1677070&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java [UTF-8] Thu Apr 30 20:57:36 2015
@@ -83,6 +83,7 @@ import static org.apache.sis.util.Argume
* @module
*
* @see DefaultMathTransformFactory
+ * @see org.apache.sis.referencing.operation.AbstractCoordinateOperation
*/
public abstract class AbstractMathTransform extends FormattableObject
implements MathTransform, Parameterized, LenientComparable
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java?rev=1677070&r1=1677069&r2=1677070&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java [UTF-8] Thu Apr 30 20:57:36 2015
@@ -265,6 +265,8 @@ public class PassThroughTransform extend
* array in a future SIS version.</div>
*
* @return Indices of the modified source coordinates.
+ *
+ * @see org.apache.sis.referencing.operation.DefaultPassThroughOperation#getModifiedCoordinates()
*/
public final int[] getModifiedCoordinates() {
final int[] index = new int[subTransform.getSourceDimensions()];
@@ -279,6 +281,8 @@ public class PassThroughTransform extend
* This is often the sub-transform specified at construction time, but not necessarily.
*
* @return The sub-transform.
+ *
+ * @see org.apache.sis.referencing.operation.DefaultPassThroughOperation#getOperation()
*/
public final MathTransform getSubTransform() {
return subTransform;
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractReferenceSystemTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractReferenceSystemTest.java?rev=1677070&r1=1677069&r2=1677070&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractReferenceSystemTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractReferenceSystemTest.java [UTF-8] Thu Apr 30 20:57:36 2015
@@ -19,7 +19,6 @@ package org.apache.sis.referencing;
import java.util.Map;
import java.util.HashMap;
import java.util.Locale;
-import org.opengis.referencing.IdentifiedObject;
import org.opengis.test.Validators;
import org.apache.sis.io.wkt.Convention;
import org.apache.sis.metadata.iso.ImmutableIdentifier;
@@ -42,9 +41,9 @@ import static org.apache.sis.test.Metada
/**
* Tests the {@link AbstractReferenceSystem} class.
*
- * @author Martin Desruisseaux (IRD)
+ * @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.4
- * @version 0.4
+ * @version 0.6
* @module
*/
@DependsOn(AbstractIdentifiedObjectTest.class)
@@ -107,15 +106,18 @@ public final strictfp class AbstractRefe
new DefaultGeographicBoundingBox(2.54, 6.40, 51.43, 55.77),
new DefaultVerticalExtent(10, 1000, VerticalCRSMock.DEPTH),
new DefaultTemporalExtent()))); // TODO: needs sis-temporal module for testing that one.
- final IdentifiedObject object = new AbstractReferenceSystem(properties);
+ final AbstractReferenceSystem object = new AbstractReferenceSystem(properties);
+
+ assertEquals( // Quotes (at least the closing one) conservatively omitted for WKT 1.
+ "ReferenceSystem[\"My object.\", AUTHORITY[\"EPSG\", \"4326\"]]",
+ object.toString(Convention.WKT1));
assertWktEquals(Convention.WKT1,
- // Closing quote conservatively omitted for WKT 1.
- "ReferenceSystem[“My “object.”, AUTHORITY[“EPSG”, “4326”]]",
+ "ReferenceSystem[“My \"object\".”, AUTHORITY[“EPSG”, “4326”]]",
object);
assertWktEquals(Convention.WKT2,
- "ReferenceSystem[“My “object””.”,\n" +
+ "ReferenceSystem[“My \"object\".”,\n" + // Quotes replaced
" Scope[“Large scale topographic mapping and cadastre.”],\n" +
" Area[“Netherlands offshore.”],\n" +
" BBox[51.43, 2.54, 55.77, 6.40],\n" +
@@ -125,7 +127,7 @@ public final strictfp class AbstractRefe
object);
assertWktEquals(Convention.WKT2_SIMPLIFIED,
- "ReferenceSystem[“My “object””.”,\n" +
+ "ReferenceSystem[“My \"object\".”,\n" +
" Scope[“Large scale topographic mapping and cadastre.”],\n" +
" Area[“Netherlands offshore.”],\n" +
" BBox[51.43, 2.54, 55.77, 6.40],\n" +
@@ -133,5 +135,15 @@ public final strictfp class AbstractRefe
" Id[“EPSG”, 4326, “8.2”, Citation[“IOGP”], URI[“urn:ogc:def:referenceSystem:EPSG:8.2:4326”]],\n" +
" Remarks[“注です。”]]",
object);
+
+ assertWktEquals(Convention.INTERNAL,
+ "ReferenceSystem[“My “object””.”,\n" + // Quote doubled
+ " Scope[“Large scale topographic mapping and cadastre.”],\n" +
+ " Area[“Netherlands offshore.”],\n" +
+ " BBox[51.43, 2.54, 55.77, 6.40],\n" +
+ " VerticalExtent[-1000, -10],\n" +
+ " Id[“EPSG”, 4326, “8.2”, Citation[“IOGP”]],\n" +
+ " Remarks[“注です。”]]",
+ object);
}
}
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultCompoundCRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultCompoundCRSTest.java?rev=1677070&r1=1677069&r2=1677070&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultCompoundCRSTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultCompoundCRSTest.java [UTF-8] Thu Apr 30 20:57:36 2015
@@ -181,18 +181,18 @@ public final strictfp class DefaultCompo
" Ellipsoid[“WGS84”, 6378137.0, 298.257223563, LengthUnit[“metre”, 1]]],\n" +
" PrimeMeridian[“Greenwich”, 0.0, AngleUnit[“degree”, 0.017453292519943295]],\n" +
" CS[“ellipsoidal”, 2],\n" +
- " Axis[“Longitude (λ)”, east],\n" +
- " Axis[“Latitude (φ)”, north],\n" +
+ " Axis[“Longitude (L)”, east, Order[1]],\n" +
+ " Axis[“Latitude (B)”, north, Order[2]],\n" +
" AngleUnit[“degree”, 0.017453292519943295]],\n" +
" VerticalCRS[“Gravity-related height”,\n" +
" VerticalDatum[“Mean Sea Level”],\n" +
" CS[“vertical”, 1],\n" +
- " Axis[“Gravity-related height (H)”, up],\n" +
+ " Axis[“Gravity-related height (H)”, up, Order[1]],\n" +
" LengthUnit[“metre”, 1]],\n" +
" TimeCRS[“Time”,\n" +
" TimeDatum[“Modified Julian”, TimeOrigin[1858-11-17T00:00:00.0Z]],\n" +
" CS[“temporal”, 1],\n" +
- " Axis[“Time (t)”, future],\n" +
+ " Axis[“Time (t)”, future, Order[1]],\n" +
" TimeUnit[“day”, 86400]],\n" +
" Area[“World”],\n" +
" BBox[-90.00, -180.00, 90.00, 180.00]]",
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeocentricCRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeocentricCRSTest.java?rev=1677070&r1=1677069&r2=1677070&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeocentricCRSTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeocentricCRSTest.java [UTF-8] Thu Apr 30 20:57:36 2015
@@ -71,10 +71,48 @@ public final strictfp class DefaultGeoce
" Ellipsoid[“WGS84”, 6378137.0, 298.257223563, LengthUnit[“metre”, 1]]],\n" +
" PrimeMeridian[“Greenwich”, 0.0, AngleUnit[“degree”, 0.017453292519943295]],\n" +
" CS[“Cartesian”, 3],\n" +
+ " Axis[“(X)”, geocentricX, Order[1]],\n" +
+ " Axis[“(Y)”, geocentricY, Order[2]],\n" +
+ " Axis[“(Z)”, geocentricZ, Order[3]],\n" +
+ " LengthUnit[“metre”, 1]]",
+ HardCodedCRS.GEOCENTRIC);
+ }
+
+ /**
+ * Tests WKT 2 simplified formatting.
+ */
+ @Test
+ @DependsOnMethod("testWKT2")
+ public void testWKT2_Simplified() {
+ assertWktEquals(Convention.WKT2_SIMPLIFIED,
+ "GeodeticCRS[“Geocentric”,\n" +
+ " Datum[“World Geodetic System 1984”,\n" +
+ " Ellipsoid[“WGS84”, 6378137.0, 298.257223563]],\n" +
+ " CS[“Cartesian”, 3],\n" +
" Axis[“(X)”, geocentricX],\n" +
" Axis[“(Y)”, geocentricY],\n" +
" Axis[“(Z)”, geocentricZ],\n" +
- " LengthUnit[“metre”, 1]]",
+ " Unit[“metre”, 1]]",
+ HardCodedCRS.GEOCENTRIC);
+ }
+
+ /**
+ * Tests WKT 2 internal formatting.
+ */
+ @Test
+ @DependsOnMethod("testWKT2")
+ public void testWKT2_Internal() {
+ assertWktEquals(Convention.INTERNAL,
+ "GeodeticCRS[“Geocentric”,\n" +
+ " Datum[“World Geodetic System 1984”,\n" +
+ " Ellipsoid[“WGS84”, 6378137.0, 298.257223563],\n" +
+ " Id[“EPSG”, 6326]],\n" +
+ " PrimeMeridian[“Greenwich”, 0.0, Id[“EPSG”, 8901]],\n" +
+ " CS[“Cartesian”, 3],\n" +
+ " Axis[“Geocentric X (X)”, geocentricX],\n" +
+ " Axis[“Geocentric Y (Y)”, geocentricY],\n" +
+ " Axis[“Geocentric Z (Z)”, geocentricZ],\n" +
+ " Unit[“metre”, 1]]",
HardCodedCRS.GEOCENTRIC);
}
}
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java?rev=1677070&r1=1677069&r2=1677070&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java [UTF-8] Thu Apr 30 20:57:36 2015
@@ -162,26 +162,39 @@ public final strictfp class DefaultGeogr
" Ellipsoid[“WGS84”, 6378137.0, 298.257223563, LengthUnit[“metre”, 1]]],\n" +
" PrimeMeridian[“Greenwich”, 0.0, AngleUnit[“degree”, 0.017453292519943295]],\n" +
" CS[“ellipsoidal”, 2],\n" +
- " Axis[“Longitude (λ)”, east],\n" +
- " Axis[“Latitude (φ)”, north],\n" +
+ " Axis[“Longitude (L)”, east, Order[1]],\n" +
+ " Axis[“Latitude (B)”, north, Order[2]],\n" +
" AngleUnit[“degree”, 0.017453292519943295],\n" +
" Area[“World”],\n" +
" BBox[-90.00, -180.00, 90.00, 180.00]]",
HardCodedCRS.WGS84);
+ }
+ /**
+ * Tests WKT 2 simplified formatting.
+ */
+ @Test
+ @DependsOnMethod("testWKT2")
+ public void testWKT2_Simplified() {
assertWktEquals(Convention.WKT2_SIMPLIFIED,
"GeodeticCRS[“WGS 84”,\n" +
" Datum[“World Geodetic System 1984”,\n" +
" Ellipsoid[“WGS84”, 6378137.0, 298.257223563]],\n" +
- " PrimeMeridian[“Greenwich”, 0.0],\n" +
" CS[“ellipsoidal”, 2],\n" +
- " Axis[“Longitude (λ)”, east],\n" +
- " Axis[“Latitude (φ)”, north],\n" +
+ " Axis[“Longitude (L)”, east],\n" +
+ " Axis[“Latitude (B)”, north],\n" +
" Unit[“degree”, 0.017453292519943295],\n" +
" Area[“World”],\n" +
" BBox[-90.00, -180.00, 90.00, 180.00]]",
HardCodedCRS.WGS84);
+ }
+ /**
+ * Tests WKT 2 internal formatting.
+ */
+ @Test
+ @DependsOnMethod("testWKT2")
+ public void testWKT2_Internal() {
assertWktEquals(Convention.INTERNAL,
"GeodeticCRS[“WGS 84”,\n" +
" Datum[“World Geodetic System 1984”,\n" +
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultTemporalCRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultTemporalCRSTest.java?rev=1677070&r1=1677069&r2=1677070&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultTemporalCRSTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultTemporalCRSTest.java [UTF-8] Thu Apr 30 20:57:36 2015
@@ -55,7 +55,7 @@ public final strictfp class DefaultTempo
"TimeCRS[“Time”,\n" +
" TimeDatum[“Modified Julian”, TimeOrigin[1858-11-17T00:00:00.0Z]],\n" +
" CS[“temporal”, 1],\n" +
- " Axis[“Time (t)”, future],\n" +
+ " Axis[“Time (t)”, future, Order[1]],\n" +
" TimeUnit[“day”, 86400]]",
HardCodedCRS.TIME);
}
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultVerticalCRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultVerticalCRSTest.java?rev=1677070&r1=1677069&r2=1677070&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultVerticalCRSTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultVerticalCRSTest.java [UTF-8] Thu Apr 30 20:57:36 2015
@@ -56,7 +56,7 @@ public final strictfp class DefaultVerti
"VerticalCRS[“Depth”,\n" +
" VerticalDatum[“Mean Sea Level”],\n" +
" CS[“vertical”, 1],\n" +
- " Axis[“Depth (D)”, down],\n" +
+ " Axis[“Depth (D)”, down, Order[1]],\n" +
" LengthUnit[“metre”, 1]]",
HardCodedCRS.DEPTH);
}
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/HardCodedCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/HardCodedCRS.java?rev=1677070&r1=1677069&r2=1677070&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/HardCodedCRS.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/HardCodedCRS.java [UTF-8] Thu Apr 30 20:57:36 2015
@@ -84,6 +84,8 @@ public final strictfp class HardCodedCRS
* this CRS is to test operations between CRS having different prime meridian.</p>
*
* @since 0.5
+ *
+ * @see DefaultProjectedCRSTest#NTF_ZONE_II
*/
public static final DefaultGeographicCRS NTF = new DefaultGeographicCRS(
properties("NTF (Paris)"), HardCodedDatum.NTF, HardCodedCS.GEODETIC_2D);
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxisTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxisTest.java?rev=1677070&r1=1677069&r2=1677070&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxisTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxisTest.java [UTF-8] Thu Apr 30 20:57:36 2015
@@ -38,9 +38,9 @@ import static org.apache.sis.referencing
/**
* Tests the {@link DefaultCoordinateSystemAxis} class.
*
- * @author Martin Desruisseaux (IRD)
+ * @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.4
- * @version 0.4
+ * @version 0.6
* @module
*/
@DependsOn({
@@ -83,28 +83,32 @@ public final strictfp class DefaultCoord
/**
* Tests WKT formatting of predefined constants.
+ *
+ * Note that this method can not test the replacement of Greek letters by Latin letters in abbreviations,
+ * because those replacements depend on the {@code CoordinateSystem} context, which is not provided by
+ * this test method.
*/
@Test
public void testWKT() {
assertWktEquals("Axis[“x”, east, LengthUnit[“metre”, 1]]", X);
assertWktEquals("Axis[“y”, north, LengthUnit[“metre”, 1]]", Y);
assertWktEquals("Axis[“z”, up, LengthUnit[“metre”, 1]]", Z);
- assertWktEquals("Axis[“Longitude (λ)”, east, AngleUnit[“grade”, 0.015707963267948967]]", LONGITUDE_gon);
- assertWktEquals("Axis[“Latitude (φ)”, north, AngleUnit[“grade”, 0.015707963267948967]]", LATITUDE_gon);
- assertWktEquals("Axis[“Altitude (h)”, up, LengthUnit[“metre”, 1]]", ALTITUDE);
- assertWktEquals("Axis[“Time (t)”, future, TimeUnit[“day”, 86400]]", TIME);
- assertWktEquals("Axis[“Longitude (λ)”, east, AngleUnit[“degree”, 0.017453292519943295]]", GEODETIC_LONGITUDE);
- assertWktEquals("Axis[“Spherical longitude (Ω)”, east, AngleUnit[“degree”, 0.017453292519943295]]", SPHERICAL_LONGITUDE);
- assertWktEquals("Axis[“Latitude (φ)”, north, AngleUnit[“degree”, 0.017453292519943295]]", GEODETIC_LATITUDE);
- assertWktEquals("Axis[“Spherical latitude (Θ)”, north, AngleUnit[“degree”, 0.017453292519943295]]", SPHERICAL_LATITUDE);
+ assertWktEquals("Axis[“Longitude (λ)”, east, AngleUnit[“grade”, 0.015707963267948967]]", LONGITUDE_gon);
+ assertWktEquals("Axis[“Latitude (φ)”, north, AngleUnit[“grade”, 0.015707963267948967]]", LATITUDE_gon);
+ assertWktEquals("Axis[“Altitude (h)”, up, LengthUnit[“metre”, 1]]", ALTITUDE);
+ assertWktEquals("Axis[“Time (t)”, future, TimeUnit[“day”, 86400]]", TIME);
+ assertWktEquals("Axis[“Longitude (λ)”, east, AngleUnit[“degree”, 0.017453292519943295]]", GEODETIC_LONGITUDE);
+ assertWktEquals("Axis[“Spherical longitude (θ)”, east, AngleUnit[“degree”, 0.017453292519943295]]", SPHERICAL_LONGITUDE);
+ assertWktEquals("Axis[“Latitude (φ)”, north, AngleUnit[“degree”, 0.017453292519943295]]", GEODETIC_LATITUDE);
+ assertWktEquals("Axis[“Spherical latitude (φ')”, north, AngleUnit[“degree”, 0.017453292519943295]]", SPHERICAL_LATITUDE);
assertWktEquals(Convention.WKT1, "AXIS[“x”, EAST]", X);
assertWktEquals(Convention.WKT1, "AXIS[“y”, NORTH]", Y);
assertWktEquals(Convention.WKT1, "AXIS[“z”, UP]", Z);
- assertWktEquals(Convention.INTERNAL, "Axis[“Geodetic longitude (λ)”, east, Unit[“degree”, 0.017453292519943295]]", GEODETIC_LONGITUDE);
- assertWktEquals(Convention.INTERNAL, "Axis[“Spherical longitude (Ω)”, east, Unit[“degree”, 0.017453292519943295]]", SPHERICAL_LONGITUDE);
- assertWktEquals(Convention.INTERNAL, "Axis[“Geodetic latitude (φ)”, north, Unit[“degree”, 0.017453292519943295]]", GEODETIC_LATITUDE);
- assertWktEquals(Convention.INTERNAL, "Axis[“Spherical latitude (Θ)”, north, Unit[“degree”, 0.017453292519943295]]", SPHERICAL_LATITUDE);
+ assertWktEquals(Convention.INTERNAL, "Axis[“Geodetic longitude (λ)”, east, Unit[“degree”, 0.017453292519943295]]", GEODETIC_LONGITUDE);
+ assertWktEquals(Convention.INTERNAL, "Axis[“Spherical longitude (θ)”, east, Unit[“degree”, 0.017453292519943295]]", SPHERICAL_LONGITUDE);
+ assertWktEquals(Convention.INTERNAL, "Axis[“Geodetic latitude (φ)”, north, Unit[“degree”, 0.017453292519943295]]", GEODETIC_LATITUDE);
+ assertWktEquals(Convention.INTERNAL, "Axis[“Spherical latitude (φ′)”, north, Unit[“degree”, 0.017453292519943295]]", SPHERICAL_LATITUDE);
}
/**
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedAxes.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedAxes.java?rev=1677070&r1=1677069&r2=1677070&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedAxes.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedAxes.java [UTF-8] Thu Apr 30 20:57:36 2015
@@ -181,7 +181,7 @@ public final strictfp class HardCodedAxe
* using {@linkplain org.apache.sis.referencing.cs.DefaultSphericalCS spherical CS}.
* Increasing ordinates values go {@linkplain AxisDirection#EAST East}
* and units are {@linkplain NonSI#DEGREE_ANGLE degrees}.
- * The ISO 19111 name is <cite>"spherical longitude"</cite> and the abbreviation is "Ω" (omega).
+ * The ISO 19111 name is <cite>"spherical longitude"</cite> and the abbreviation is "θ" (theta).
*
* <p>This axis is usually part of a {@link #SPHERICAL_LONGITUDE}, {@link #SPHERICAL_LATITUDE},
* {@link #GEOCENTRIC_RADIUS} set.</p>
@@ -189,7 +189,7 @@ public final strictfp class HardCodedAxe
* @see #GEODETIC_LONGITUDE
* @see #SPHERICAL_LATITUDE
*/
- public static final DefaultCoordinateSystemAxis SPHERICAL_LONGITUDE = create("Spherical longitude", "Ω",
+ public static final DefaultCoordinateSystemAxis SPHERICAL_LONGITUDE = create("Spherical longitude", "θ",
AxisDirection.EAST, NonSI.DEGREE_ANGLE, -180, 180, RangeMeaning.WRAPAROUND);
/**
@@ -197,7 +197,7 @@ public final strictfp class HardCodedAxe
* using {@linkplain org.apache.sis.referencing.cs.DefaultSphericalCS spherical CS}.
* Increasing ordinates values go {@linkplain AxisDirection#NORTH North}
* and units are {@linkplain NonSI#DEGREE_ANGLE degrees}.
- * The ISO 19111 name is <cite>"spherical latitude"</cite> and the abbreviation is "Θ" (theta).
+ * The ISO 19111 name is <cite>"spherical latitude"</cite> and the abbreviation is "φ′" (phi).
*
* <p>This axis is usually part of a {@link #SPHERICAL_LONGITUDE}, {@link #SPHERICAL_LATITUDE},
* {@link #GEOCENTRIC_RADIUS} set.</p>
@@ -205,7 +205,7 @@ public final strictfp class HardCodedAxe
* @see #GEODETIC_LATITUDE
* @see #SPHERICAL_LONGITUDE
*/
- public static final DefaultCoordinateSystemAxis SPHERICAL_LATITUDE = create("Spherical latitude", "Θ",
+ public static final DefaultCoordinateSystemAxis SPHERICAL_LATITUDE = create("Spherical latitude", "φ′",
AxisDirection.NORTH, NonSI.DEGREE_ANGLE, -90, 90, RangeMeaning.EXACT);
/**
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java?rev=1677070&r1=1677069&r2=1677070&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] Thu Apr 30 20:57:36 2015
@@ -90,8 +90,8 @@ import org.junit.BeforeClass;
// Registration of map projections and other math transforms.
org.apache.sis.referencing.operation.DefaultFormulaTest.class,
org.apache.sis.referencing.operation.DefaultOperationMethodTest.class,
+ org.apache.sis.referencing.operation.AbstractSingleOperationTest.class,
org.apache.sis.referencing.operation.transform.OperationMethodSetTest.class,
- org.apache.sis.internal.referencing.OperationMethodsTest.class,
org.apache.sis.internal.referencing.provider.AffineTest.class,
org.apache.sis.internal.referencing.provider.LongitudeRotationTest.class,
org.apache.sis.internal.referencing.provider.MapProjectionTest.class,
@@ -126,6 +126,7 @@ import org.junit.BeforeClass;
org.apache.sis.referencing.crs.DefaultGeodeticCRSTest.class,
org.apache.sis.referencing.crs.DefaultGeocentricCRSTest.class,
org.apache.sis.referencing.crs.DefaultGeographicCRSTest.class,
+ org.apache.sis.referencing.crs.DefaultProjectedCRSTest.class,
org.apache.sis.referencing.crs.DefaultVerticalCRSTest.class,
org.apache.sis.referencing.crs.DefaultTemporalCRSTest.class,
org.apache.sis.referencing.crs.SubTypesTest.class,
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java?rev=1677070&r1=1677069&r2=1677070&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java [UTF-8] Thu Apr 30 20:57:36 2015
@@ -23,6 +23,8 @@ import org.opengis.metadata.Identifier;
import org.opengis.metadata.citation.Citation;
import org.opengis.util.InternationalString;
import org.apache.sis.xml.IdentifierSpace;
+import org.apache.sis.util.CharSequences;
+import org.apache.sis.util.Characters;
import org.apache.sis.util.Static;
import static org.apache.sis.util.CharSequences.equalsFiltered;
@@ -230,6 +232,71 @@ public final class Citations extends Sta
}
/**
+ * Returns {@code true} if the given identifier authority matches the given {@code authority}.
+ * If one of the authority is null, then the comparison fallback on the given {@code codeSpace}.
+ * If the code spaces are also null, then this method conservatively returns {@code false}.
+ *
+ * @param identifier The identifier to compare.
+ * @param authority The desired authority, or {@code null}.
+ * @param codeSpace The desired code space or {@code null}, used as a fallback if an authority is null.
+ * @return {@code true} if the authority or code space (as a fallback only) matches.
+ */
+ private static boolean authorityMatches(final Identifier identifier, final Citation authority, final String codeSpace) {
+ if (authority != null) {
+ final Citation other = identifier.getAuthority();
+ if (other != null) {
+ return identifierMatches(authority, other);
+ }
+ }
+ if (codeSpace != null) {
+ final String other = identifier.getCodeSpace();
+ if (other != null) {
+ return CharSequences.equalsFiltered(codeSpace, other, Characters.Filter.UNICODE_IDENTIFIER, true);
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Determines whether a match or mismatch is found between the two given collections of identifiers.
+ * If any of the given collections is {@code null} or empty, then this method returns {@code null}.
+ *
+ * <p>According ISO 19162 (<cite>Well known text representation of coordinate reference systems</cite>),
+ * {@linkplain org.apache.sis.referencing.AbstractIdentifiedObject#getIdentifiers() identifiers} should have precedence over
+ * {@linkplain org.apache.sis.referencing.AbstractIdentifiedObject#getName() name} for identifying {@code IdentifiedObject}s,
+ * at least in the case of {@linkplain org.apache.sis.referencing.operation.DefaultOperationMethod operation methods} and
+ * {@linkplain org.apache.sis.parameter.AbstractParameterDescriptor parameters}.</p>
+ *
+ * @param id1 The first collection of identifiers, or {@code null}.
+ * @param id2 The second collection of identifiers, or {@code null}.
+ * @return {@code TRUE} or {@code FALSE} on match or mismatch respectively, or {@code null} if this method
+ * can not determine if there is a match or mismatch.
+ */
+ public static Boolean hasCommonIdentifier(final Iterable<? extends Identifier> id1,
+ final Iterable<? extends Identifier> id2)
+ {
+ if (id1 != null && id2 != null) {
+ boolean hasFound = false;
+ for (final Identifier identifier : id1) {
+ final Citation authority = identifier.getAuthority();
+ final String codeSpace = identifier.getCodeSpace();
+ for (final Identifier other : id2) {
+ if (authorityMatches(identifier, authority, codeSpace)) {
+ if (CharSequences.equalsFiltered(identifier.getCode(), other.getCode(), Characters.Filter.UNICODE_IDENTIFIER, true)) {
+ return Boolean.TRUE;
+ }
+ hasFound = true;
+ }
+ }
+ }
+ if (hasFound) {
+ return Boolean.FALSE;
+ }
+ }
+ return null;
+ }
+
+ /**
* Infers an identifier from the given citation, or returns {@code null} if no identifier has been found.
* This method removes leading and trailing {@linkplain Character#isWhitespace(int) whitespaces}.
* See {@link org.apache.sis.metadata.iso.citation.Citations#getIdentifier(Citation)}
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/CollectionsExt.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/CollectionsExt.java?rev=1677070&r1=1677069&r2=1677070&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/CollectionsExt.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/CollectionsExt.java [UTF-8] Thu Apr 30 20:57:36 2015
@@ -122,6 +122,22 @@ public final class CollectionsExt extend
}
/**
+ * Returns a copy of the given array as a non-empty immutable set.
+ * If the given array is empty, then this method returns {@code null}.
+ *
+ * @param <T> The type of elements.
+ * @param elements The elements to copy in a set.
+ * @return An unmodifiable set which contains all the given elements, or {@code null}.
+ *
+ * @since 0.6
+ */
+ @SafeVarargs
+ public static <T> Set<T> nonEmptySet(final T... elements) {
+ final Set<T> asSet = immutableSet(true, elements);
+ return (asSet != null && asSet.isEmpty()) ? null : asSet;
+ }
+
+ /**
* Returns the given array if non-empty, or {@code null} if the given array is null or empty.
* This method is generally not recommended, since public API should prefer empty array instead of null.
* However this method is occasionally useful for managing private fields.
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/ArgumentChecks.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/ArgumentChecks.java?rev=1677070&r1=1677069&r2=1677070&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/ArgumentChecks.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/ArgumentChecks.java [UTF-8] Thu Apr 30 20:57:36 2015
@@ -81,7 +81,7 @@ import org.apache.sis.util.resources.Err
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.3
- * @version 0.4
+ * @version 0.6
* @module
*/
public final class ArgumentChecks extends Static {
@@ -593,6 +593,30 @@ public final class ArgumentChecks extend
}
}
}
+
+ /**
+ * Ensures that the given coordinate system, if non-null, has the expected number of dimensions.
+ * This method does nothing if the given coordinate system is null.
+ *
+ * @param name The name of the argument to be checked. Used only if an exception is thrown.
+ * @param expected The expected number of dimensions.
+ * @param cs The coordinate system to check for its dimension, or {@code null}.
+ * @throws MismatchedDimensionException if the given coordinate system is non-null
+ * and does not have the expected number of dimensions.
+ *
+ * @since 0.6
+ */
+ public static void ensureDimensionMatches(final String name, final int expected,
+ final CoordinateSystem cs) throws MismatchedDimensionException
+ {
+ if (cs != null) {
+ final int dimension = cs.getDimension();
+ if (dimension != expected) {
+ throw new MismatchedDimensionException(Errors.format(
+ Errors.Keys.MismatchedDimension_3, name, expected, dimension));
+ }
+ }
+ }
/**
* Ensures that the given vector, if non-null, has the expected number of dimensions
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java?rev=1677070&r1=1677069&r2=1677070&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java [UTF-8] Thu Apr 30 20:57:36 2015
@@ -921,8 +921,14 @@ search: for (; fromIndex <= toIndex;
* Replaces some Unicode characters by ASCII characters on a "best effort basis".
* For example the {@code 'é'} character is replaced by {@code 'e'} (without accent).
*
- * <p>The current implementation replaces only the characters in the range {@code 00C0}
- * to {@code 00FF}, inclusive. Other characters are left unchanged.</p>
+ * <p>The current implementation replaces the characters in the range {@code 00C0}
+ * to {@code 00FF} (inclusive) and some space and punctuation characters.</p>
+ *
+ * <div class="note"><b>Note:</b>
+ * the replacement of Greek letters is a more complex task than what this method can do,
+ * since it depends on the context. For example if the Greek letters are abbreviations
+ * for coordinate system axes like φ and λ, then the replacements depend on the enclosing
+ * coordinate system. See {@link org.apache.sis.io.wkt.CharEncoding} for more information.</div>
*
* @param text The text to scan for Unicode characters to replace by ASCII characters,
* or {@code null}.
@@ -930,6 +936,7 @@ search: for (; fromIndex <= toIndex;
* has been applied, or {@code null} if the given text was null.
*
* @see StringBuilders#toASCII(StringBuilder)
+ * @see org.apache.sis.io.wkt.CharEncoding#filter(String)
*/
public static CharSequence toASCII(final CharSequence text) {
return StringBuilders.toASCII(text, null);
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/StringBuilders.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/StringBuilders.java?rev=1677070&r1=1677069&r2=1677070&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/StringBuilders.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/StringBuilders.java [UTF-8] Thu Apr 30 20:57:36 2015
@@ -194,8 +194,8 @@ public final class StringBuilders extend
* Replaces some Unicode characters by ASCII characters on a "best effort basis".
* For example the {@code 'é'} character is replaced by {@code 'e'} (without accent).
*
- * <p>The current implementation replaces only the characters in the range {@code 00C0}
- * to {@code 00FF}, inclusive. Other characters are left unchanged.</p>
+ * <p>The current implementation replaces the characters in the range {@code 00C0}
+ * to {@code 00FF} (inclusive) and some space and punctuation characters.</p>
*
* @param buffer The text to scan for Unicode characters to replace by ASCII characters.
* @throws NullArgumentException If the given {@code buffer} is null.
@@ -227,9 +227,19 @@ public final class StringBuilders extend
cr = ASCII.charAt(r);
} else {
switch (getType(c)) {
- case SPACE_SEPARATOR: cr = ' '; break;
- case PARAGRAPH_SEPARATOR: // Fall through
- case LINE_SEPARATOR: cr = '\n'; break;
+ case PARAGRAPH_SEPARATOR: // Fall through
+ case LINE_SEPARATOR: cr = '\n'; break;
+ case SPACE_SEPARATOR: cr = ' '; break;
+ case INITIAL_QUOTE_PUNCTUATION: cr = (c == '‘') ? '\'' : '"'; break;
+ case FINAL_QUOTE_PUNCTUATION: cr = (c == '’') ? '\'' : '"'; break;
+ case OTHER_PUNCTUATION: {
+ switch (c) {
+ case '′': cr = '\''; break;
+ case '″': cr = '"'; break;
+ default: continue;
+ }
+ break;
+ }
default: continue;
}
}
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java?rev=1677070&r1=1677069&r2=1677070&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java [UTF-8] Thu Apr 30 20:57:36 2015
@@ -525,6 +525,12 @@ public final class Errors extends Indexe
public static final short MissingHorizontalDimension_1 = 169;
/**
+ * Not enough dimension in ‘MathTransform’ input or output coordinates for the interpolation
+ * points.
+ */
+ public static final short MissingInterpolationOrdinates = 184;
+
+ /**
* “{0}” has no namespace.
*/
public static final short MissingNamespace_1 = 163;
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties?rev=1677070&r1=1677069&r2=1677070&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties [ISO-8859-1] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties [ISO-8859-1] Thu Apr 30 20:57:36 2015
@@ -114,6 +114,7 @@ MismatchedPropertyType_1 = Mism
MismatchedTransformDimension_3 = The transform has {2} {0,choice,0#source|1#target} dimension{2,choice,1#|2#s}, while {1} was expected.
MismatchedValueClass_3 = Class of \u201c{0}\u201d values is \u2018{2}\u2019, but the requested type is \u2018{1}\u2019.
MissingAuthority_1 = No authority was specified for code \u201c{0}\u201d. The expected syntax is \u201cAUTHORITY:CODE\u201d.
+MissingInterpolationOrdinates = Not enough dimension in \u2018MathTransform\u2019 input or output coordinates for the interpolation points.
MissingNamespace_1 = \u201c{0}\u201d has no namespace.
MissingRequiredModule_1 = This operation requires the \u201c{0}\u201d module.
MissingSchemeInURI = Missing scheme in URI.
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties?rev=1677070&r1=1677069&r2=1677070&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties [ISO-8859-1] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties [ISO-8859-1] Thu Apr 30 20:57:36 2015
@@ -104,6 +104,7 @@ MismatchedPropertyType_1 = Le t
MismatchedTransformDimension_3 = La {0,choice,0#source|1#destination} de la transformation a {2} dimension{2,choice,1#|2#s}, alors qu\u2019on en attendait {1}.
MismatchedValueClass_3 = Les valeurs de \u00ab\u202f{0}\u202f\u00bb sont de la classe \u2018{2}\u2019, alors que le type demand\u00e9 \u00e9tait \u2018{1}\u2019.
MissingAuthority_1 = Aucune autorit\u00e9 n\u2019a \u00e9t\u00e9 sp\u00e9cifi\u00e9e pour le code \u00ab\u202f{0}\u202f\u00bb. Le format attendu est \u00ab\u202fAUTORIT\u00c9:CODE\u202f\u00bb.
+MissingInterpolationOrdinates = La dimension des coordonn\u00e9es en entr\u00e9 ou en sortie du \u2018MathTransform\u2019 n\u2019est pas suffisante pour contenir les points d\u2019interpolation.
MissingNamespace_1 = \u201c{0}\u201d est d\u00e9fini sans espace de noms.
MissingRequiredModule_1 = Cette op\u00e9ration requiert le module \u00ab\u202f{0}\u202f\u00bb.
MissingSchemeInURI = Il manque le sch\u00e9ma d\u2019URI.
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java?rev=1677070&r1=1677069&r2=1677070&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java [UTF-8] Thu Apr 30 20:57:36 2015
@@ -101,6 +101,11 @@ public final class Vocabulary extends In
public static final short CharacterEncoding = 6;
/**
+ * Characteristics
+ */
+ public static final short Characteristics = 85;
+
+ /**
* Classpath
*/
public static final short Classpath = 7;
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties?rev=1677070&r1=1677069&r2=1677070&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties [ISO-8859-1] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties [ISO-8859-1] Thu Apr 30 20:57:36 2015
@@ -23,6 +23,7 @@ Attributes = Attributes
BarometricAltitude = Barometric altitude
Cardinality = Cardinality
CharacterEncoding = Character encoding
+Characteristics = Characteristics
Classpath = Classpath
Code_1 = {0} code
Commands = Commands
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties?rev=1677070&r1=1677069&r2=1677070&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties [ISO-8859-1] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties [ISO-8859-1] Thu Apr 30 20:57:36 2015
@@ -23,6 +23,7 @@ Attributes = Attributs
BarometricAltitude = Altitude barom\u00e9trique
Cardinality = Cardinalit\u00e9
CharacterEncoding = Encodage des caract\u00e8res
+Characteristics = Caract\u00e9ristiques
Classpath = Chemin de classes
Code_1 = Code {0}
Commands = Commandes
Modified: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/internal/util/CitationsTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/internal/util/CitationsTest.java?rev=1677070&r1=1677069&r2=1677070&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/internal/util/CitationsTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/internal/util/CitationsTest.java [UTF-8] Thu Apr 30 20:57:36 2015
@@ -16,8 +16,12 @@
*/
package org.apache.sis.internal.util;
+import java.util.List;
+import java.util.ArrayList;
+import org.opengis.metadata.Identifier;
import org.opengis.metadata.citation.Citation;
import org.apache.sis.internal.simple.SimpleCitation;
+import org.apache.sis.internal.simple.SimpleIdentifier;
import org.apache.sis.xml.IdentifierSpace;
import org.apache.sis.test.DependsOnMethod;
import org.apache.sis.test.TestCase;
@@ -36,6 +40,48 @@ import static org.junit.Assert.*;
*/
public final strictfp class CitationsTest extends TestCase {
/**
+ * Creates an identifier with a code space.
+ */
+ @SuppressWarnings("serial")
+ private static Identifier identifier(final String codeSpace, final String code) {
+ return new SimpleIdentifier(null, code) {
+ @Override public String getCodeSpace() {
+ return codeSpace;
+ }
+ };
+ }
+
+ /**
+ * Tests {@link Citations#hasCommonIdentifier(Iterable, Iterable)}.
+ */
+ @Test
+ public void testHasCommonIdentifier() {
+ final List<Identifier> id1 = new ArrayList<>(3);
+ final List<Identifier> id2 = new ArrayList<>(2);
+ assertNull(Citations.hasCommonIdentifier(id1, id2));
+ /*
+ * Add codes for two Operation Methods which are implemented in Apache SIS by the same class:
+ *
+ * - EPSG:9804 — "Mercator (variant A)" (formerly known as "Mercator (1SP)").
+ * - EPSG:1026 — "Mercator (Spherical)"
+ * - GeoTIFF:7 — "CT_Mercator"
+ */
+ id1.add(identifier("EPSG", "9804"));
+ id1.add(identifier("EPSG", "1026"));
+ id1.add(identifier("GeoTIFF", "7"));
+ assertNull(Citations.hasCommonIdentifier(id1, id2));
+ /*
+ * EPSG:9841 is a legacy (now deprecated) code for "Mercator (1SP)".
+ * We could have declared it as a deprecated code in the above list,
+ * but for the sake of this test we do not.
+ */
+ id2.add(identifier("EPSG", "9841"));
+ assertEquals(Boolean.FALSE, Citations.hasCommonIdentifier(id1, id2));
+ id2.add(identifier("EPSG", "9804"));
+ assertEquals(Boolean.TRUE, Citations.hasCommonIdentifier(id1, id2));
+ }
+
+ /**
* Tests {@link Citations#getIdentifier(Citation, boolean)}.
*/
@Test
Modified: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/StringBuildersTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/StringBuildersTest.java?rev=1677070&r1=1677069&r2=1677070&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/StringBuildersTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/StringBuildersTest.java [UTF-8] Thu Apr 30 20:57:36 2015
@@ -97,8 +97,10 @@ public final strictfp class StringBuilde
*/
@Test
public void testToASCII() {
- final StringBuilder metre = new StringBuilder("mètres" + Characters.PARAGRAPH_SEPARATOR);
+ final StringBuilder metre = new StringBuilder(
+ "mètres" + Characters.PARAGRAPH_SEPARATOR +
+ " ‘single’, “double”, \"ascii' 30°20′10″.");
toASCII(metre);
- assertEquals("metres\n", metre.toString());
+ assertEquals("metres\n 'single', \"double\", \"ascii' 30°20'10\".", metre.toString());
}
}
|