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 2017/08/21 01:03:13 UTC
svn commit: r1805590 [1/3] - in /sis/branches/JDK9: ./
application/sis-console/src/main/artifact/ core/
core/sis-feature/src/main/java/org/apache/sis/feature/
core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/
core/sis-metadata/src/...
Author: desruisseaux
Date: Mon Aug 21 01:03:12 2017
New Revision: 1805590
URL: http://svn.apache.org/viewvc?rev=1805590&view=rev
Log:
Merge from JDK8 branch.
Added:
sis/branches/JDK9/core/sis-raster/
- copied from r1805589, sis/branches/JDK8/core/sis-raster/
sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/measure/AngularVelocity.java
- copied unchanged from r1805589, sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/AngularVelocity.java
sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/measure/Salinity.java
- copied unchanged from r1805589, sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/Salinity.java
sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/measure/ScaleRateOfChange.java
- copied unchanged from r1805589, sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/ScaleRateOfChange.java
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/AbstractFeatureSet.java
- copied unchanged from r1805589, sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/AbstractFeatureSet.java
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/AbstractResource.java
- copied unchanged from r1805589, sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/AbstractResource.java
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/FeatureAccess.java
- copied unchanged from r1805589, sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/FeatureAccess.java
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/storage/Aggregate.java
- copied unchanged from r1805589, sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/Aggregate.java
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/storage/DataSet.java
- copied unchanged from r1805589, sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataSet.java
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/storage/FeatureSet.java
- copied unchanged from r1805589, sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/FeatureSet.java
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/storage/Resource.java
- copied unchanged from r1805589, sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/Resource.java
sis/branches/JDK9/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/FeatureAccess.java
- copied unchanged from r1805589, sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/FeatureAccess.java
Removed:
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/FeatureStore.java
Modified:
sis/branches/JDK9/ (props changed)
sis/branches/JDK9/README
sis/branches/JDK9/application/sis-console/src/main/artifact/README
sis/branches/JDK9/core/pom.xml
sis/branches/JDK9/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java
sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_FeatureTypeList.java
sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameToIdentifier.java
sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultFeatureTypeList.java
sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultSampleDimension.java
sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/package-info.java
sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java
sis/branches/JDK9/core/sis-raster/pom.xml
sis/branches/JDK9/core/sis-referencing-by-identifiers/src/test/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystemTest.java
sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Codes.java
sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/IdentifiedObjectFinder.java
sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationContext.java
sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java
sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/CylindricalEqualArea.java
sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/EqualAreaProjection.java
sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Initializer.java
sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/LambertConicConformal.java
sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Mercator.java
sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/NormalizedProjection.java
sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java
sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearInterpolator1D.java
sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationRegistryTest.java
sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/InitializerTest.java
sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/ObliqueStereographicTest.java
sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/LinearInterpolator1DTest.java
sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateReferenceSystems.java
sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/DateAdapter.java
sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/Measure.java
sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/UniversalTimeAdapter.java
sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmx/Anchor.java
sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/internal/system/Modules.java
sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/internal/util/Utilities.java
sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/measure/UnitRegistry.java
sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java
sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/Locales.java
sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultRecord.java
sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultRecordType.java
sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/xml/Namespaces.java
sis/branches/JDK9/core/sis-utility/src/main/resources/org/apache/sis/measure/UnitNames.properties
sis/branches/JDK9/core/sis-utility/src/main/resources/org/apache/sis/measure/UnitNames_fr.properties
sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/measure/ConventionalUnitTest.java
sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/measure/UnitFormatTest.java
sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/util/LocalesTest.java
sis/branches/JDK9/ide-project/NetBeans/build.xml
sis/branches/JDK9/ide-project/NetBeans/nbproject/build-impl.xml
sis/branches/JDK9/ide-project/NetBeans/nbproject/cfg_hints.xml (props changed)
sis/branches/JDK9/ide-project/NetBeans/nbproject/genfiles.properties
sis/branches/JDK9/ide-project/NetBeans/nbproject/project.properties
sis/branches/JDK9/ide-project/NetBeans/nbproject/project.xml
sis/branches/JDK9/pom.xml
sis/branches/JDK9/src/main/javadoc/overview.html
sis/branches/JDK9/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStore.java
sis/branches/JDK9/storage/sis-gdal/pom.xml (props changed)
sis/branches/JDK9/storage/sis-gdal/src/main/c/org_apache_sis_storage_gdal_PJ.c
sis/branches/JDK9/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/PJ.java
sis/branches/JDK9/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4.java
sis/branches/JDK9/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4Factory.java
sis/branches/JDK9/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Transform.java
sis/branches/JDK9/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/package-info.java
sis/branches/JDK9/storage/sis-gdal/src/main/resources/native/darwin/libproj-binding.so
sis/branches/JDK9/storage/sis-gdal/src/test/java/org/apache/sis/storage/gdal/PJTest.java
sis/branches/JDK9/storage/sis-gdal/src/test/java/org/apache/sis/storage/gdal/Proj4FactoryTest.java
sis/branches/JDK9/storage/sis-gdal/src/test/java/org/apache/sis/storage/gdal/TransformTest.java
sis/branches/JDK9/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/CRSBuilder.java
sis/branches/JDK9/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTIFF.java
sis/branches/JDK9/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java
sis/branches/JDK9/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/ImageFileDirectory.java
sis/branches/JDK9/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/Reader.java
sis/branches/JDK9/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStore.java
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/FeatureCatalogBuilder.java
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/MetadataBuilder.java
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources.java
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources.properties
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources_fr.properties
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/Store.java
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/Store.java
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStore.java
sis/branches/JDK9/storage/sis-storage/src/test/java/org/apache/sis/storage/DataStoreMock.java
sis/branches/JDK9/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Store.java
sis/branches/JDK9/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Types.java
sis/branches/JDK9/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxDataStore.java
sis/branches/JDK9/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/storage/gpx/ReaderTest.java
Propchange: sis/branches/JDK9/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Aug 21 01:03:12 2017
@@ -1,4 +1,4 @@
/sis/branches/Android:1430670-1480699
/sis/branches/JDK6:1394913-1508480
-/sis/branches/JDK8:1773327-1803065
+/sis/branches/JDK8:1773327-1805589
/sis/trunk:1394364-1508466,1519089-1519674
Modified: sis/branches/JDK9/README
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/README?rev=1805590&r1=1805589&r2=1805590&view=diff
==============================================================================
--- sis/branches/JDK9/README (original)
+++ sis/branches/JDK9/README Mon Aug 21 01:03:12 2017
@@ -26,7 +26,7 @@ project logo are trademarks of The Apach
Getting Started
===============
-SIS requires Java 6 and uses the Maven 3 <http://maven.apache.org/>
+SIS requires Java 7 and uses the Maven 3 <http://maven.apache.org/>
build system. To build SIS, use the following command in this directory:
mvn clean install
Modified: sis/branches/JDK9/application/sis-console/src/main/artifact/README
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/application/sis-console/src/main/artifact/README?rev=1805590&r1=1805589&r2=1805590&view=diff
==============================================================================
--- sis/branches/JDK9/application/sis-console/src/main/artifact/README [UTF-8] (original)
+++ sis/branches/JDK9/application/sis-console/src/main/artifact/README [UTF-8] Mon Aug 21 01:03:12 2017
@@ -13,7 +13,7 @@ project logo are trademarks of The Apach
Installation
============
-SIS is based on Java 6 and provided as a unique standalone JAR file.
+SIS is based on Java 7 and provided as a unique standalone JAR file.
Unix
----
Modified: sis/branches/JDK9/core/pom.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/pom.xml?rev=1805590&r1=1805589&r2=1805590&view=diff
==============================================================================
--- sis/branches/JDK9/core/pom.xml (original)
+++ sis/branches/JDK9/core/pom.xml Mon Aug 21 01:03:12 2017
@@ -192,6 +192,7 @@
<module>sis-referencing</module>
<module>sis-referencing-by-identifiers</module>
<module>sis-feature</module>
+ <module>sis-raster</module>
</modules>
</project>
Modified: sis/branches/JDK9/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java?rev=1805590&r1=1805589&r2=1805590&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java [UTF-8] Mon Aug 21 01:03:12 2017
@@ -39,9 +39,11 @@ import org.apache.sis.util.Deprecable;
import org.apache.sis.util.Characters;
import org.apache.sis.util.CharSequences;
import org.apache.sis.util.ArgumentChecks;
+import org.apache.sis.util.logging.Logging;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.resources.Vocabulary;
import org.apache.sis.internal.util.CollectionsExt;
+import org.apache.sis.internal.system.Modules;
import org.apache.sis.referencing.IdentifiedObjects;
import org.apache.sis.math.MathFunctions;
@@ -122,6 +124,12 @@ public class FeatureFormat extends Tabul
private static final int MAXIMAL_VALUE_LENGTH = 40;
/**
+ * The bit patterns of the last {@link Float#NaN} value for which {@link MathFunctions#toNanOrdinal(float)} could
+ * not get the ordinal value. We use this information for avoiding flooding the logger with the same message.
+ */
+ private transient int illegalNaN;
+
+ /**
* Creates a new formatter for the default locale and timezone.
*/
public FeatureFormat() {
@@ -525,8 +533,17 @@ public class FeatureFormat extends Tabul
t.setLength(0);
t.append("NaN");
}
- final int n = MathFunctions.toNanOrdinal(f);
- if (n > 0) buffer.append(" #").append(n);
+ try {
+ final int n = MathFunctions.toNanOrdinal(f);
+ if (n > 0) t.append(" #").append(n);
+ } catch (IllegalArgumentException e) {
+ // May happen if the NaN is a signaling NaN instead than a quiet NaN.
+ final int bits = Float.floatToRawIntBits(f);
+ if (bits != illegalNaN) {
+ illegalNaN = bits;
+ Logging.recoverableException(Logging.getLogger(Modules.FEATURE), FeatureFormat.class, "format", e);
+ }
+ }
}
}
value = t;
Modified: sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_FeatureTypeList.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_FeatureTypeList.java?rev=1805590&r1=1805589&r2=1805590&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_FeatureTypeList.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_FeatureTypeList.java [UTF-8] Mon Aug 21 01:03:12 2017
@@ -31,7 +31,10 @@ import org.apache.sis.internal.jaxb.gco.
* @version 0.3
* @since 0.3
* @module
+ *
+ * @deprecated Not anymore part of ISO 19115.
*/
+@Deprecated
public final class MD_FeatureTypeList extends PropertyType<MD_FeatureTypeList, FeatureTypeList> {
/**
* Empty constructor for JAXB only.
Modified: sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameToIdentifier.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameToIdentifier.java?rev=1805590&r1=1805589&r2=1805590&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameToIdentifier.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameToIdentifier.java [UTF-8] Mon Aug 21 01:03:12 2017
@@ -217,9 +217,17 @@ public final class NameToIdentifier impl
*/
public static boolean isHeuristicMatchForIdentifier(final Iterable<? extends Identifier> identifiers, final String toSearch) {
if (toSearch != null && identifiers != null) {
- for (int s = toSearch.indexOf(DefaultNameSpace.DEFAULT_SEPARATOR); s >= 0;
- s = toSearch.indexOf(DefaultNameSpace.DEFAULT_SEPARATOR, s))
- {
+ int s = toSearch.indexOf(DefaultNameSpace.DEFAULT_SEPARATOR);
+ if (s < 0) {
+ // no codespace in searched name
+ for (final Identifier id : identifiers) {
+ if (toSearch.equalsIgnoreCase(id.getCode())) {
+ return true;
+ }
+ }
+ return false;
+ }
+ do {
final String codespace = toSearch.substring(0, s).trim();
final String code = toSearch.substring(++s).trim();
for (final Identifier id : identifiers) {
@@ -227,7 +235,8 @@ public final class NameToIdentifier impl
return true;
}
}
- }
+ s = toSearch.indexOf(DefaultNameSpace.DEFAULT_SEPARATOR, s);
+ } while (s >= 0);
}
return false;
}
Modified: sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultFeatureTypeList.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultFeatureTypeList.java?rev=1805590&r1=1805589&r2=1805590&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultFeatureTypeList.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultFeatureTypeList.java [UTF-8] Mon Aug 21 01:03:12 2017
@@ -45,7 +45,10 @@ import org.opengis.metadata.FeatureTypeL
* @version 0.3
* @since 0.3
* @module
+ *
+ * @deprecated Not anymore part of ISO 19115.
*/
+@Deprecated // TODO: after deletion, search "FeatureTypeList" on the whole code base.
@SuppressWarnings("CloneableClassWithoutClone") // ModifiableMetadata needs shallow clones.
@XmlType(propOrder = {
"spatialObject",
Modified: sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultSampleDimension.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultSampleDimension.java?rev=1805590&r1=1805589&r2=1805590&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultSampleDimension.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultSampleDimension.java [UTF-8] Mon Aug 21 01:03:12 2017
@@ -49,7 +49,7 @@ import static org.apache.sis.internal.me
* same version of Apache SIS. For long term storage, use {@link org.apache.sis.xml.XML} instead.</li>
* </ul>
*
- * @author Remi Marechal (geomatys)
+ * @author Rémi Maréchal (Geomatys)
* @author Martin Desruisseaux (Geomatys)
* @version 0.5
* @since 0.5
Modified: sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/package-info.java?rev=1805590&r1=1805589&r2=1805590&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/package-info.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/package-info.java [UTF-8] Mon Aug 21 01:03:12 2017
@@ -39,7 +39,6 @@
* {@code ├─} {@linkplain org.apache.sis.metadata.iso.DefaultApplicationSchemaInformation Application schema information}<br>
* {@code ├─} {@linkplain org.apache.sis.metadata.iso.DefaultMetadataExtensionInformation Metadata extension information}<br>
* {@code ├─} {@linkplain org.apache.sis.metadata.iso.DefaultExtendedElementInformation Extended element information}<br>
- * {@code ├─} {@linkplain org.apache.sis.metadata.iso.DefaultFeatureTypeList Feature type list}<br>
* {@code └─} {@linkplain org.apache.sis.metadata.iso.DefaultIdentifier Identifier}<br>
* {@linkplain org.opengis.util.CodeList Code list}<br>
* {@code ├─} {@linkplain org.opengis.metadata.Datatype Data type}<br>
@@ -53,7 +52,6 @@
* {@code │ └─} {@linkplain org.apache.sis.metadata.iso.DefaultExtendedElementInformation Extended element information}<br>
* {@code │ ├─} {@linkplain org.opengis.metadata.Datatype Data type} «code list»<br>
* {@code │ └─} {@linkplain org.opengis.annotation.Obligation Obligation} «code list»<br>
- * {@code ├─} {@linkplain org.apache.sis.metadata.iso.DefaultFeatureTypeList Feature type list}<br>
* {@code └─} {@linkplain org.apache.sis.metadata.iso.DefaultIdentifier Identifier}<br>
* </td></tr></table>
*
Modified: sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java?rev=1805590&r1=1805589&r2=1805590&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java [UTF-8] Mon Aug 21 01:03:12 2017
@@ -60,7 +60,6 @@ public final strictfp class AllMetadataT
org.opengis.metadata.ApplicationSchemaInformation.class,
org.opengis.metadata.Datatype.class,
org.opengis.metadata.ExtendedElementInformation.class,
- org.opengis.metadata.FeatureTypeList.class,
org.opengis.metadata.Identifier.class,
org.opengis.metadata.Metadata.class,
org.opengis.metadata.MetadataExtensionInformation.class,
@@ -288,10 +287,6 @@ public final strictfp class AllMetadataT
protected String getExpectedXmlTypeForElement(final Class<?> type, final Class<?> impl) {
final String rootName = type.getAnnotation(UML.class).identifier();
switch (rootName) {
- // We don't know yet what is the type of this one.
- case "MD_FeatureTypeList": {
- return null;
- }
// Following prefix was changed in ISO 19115 corrigendum,
// but ISO 19139 still use the old prefix.
case "SV_ServiceIdentification": {
Modified: sis/branches/JDK9/core/sis-raster/pom.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-raster/pom.xml?rev=1805590&r1=1805589&r2=1805590&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-raster/pom.xml (original)
+++ sis/branches/JDK9/core/sis-raster/pom.xml Mon Aug 21 01:03:12 2017
@@ -28,7 +28,7 @@
<parent>
<groupId>org.apache.sis</groupId>
<artifactId>core</artifactId>
- <version>0.8-jdk8-SNAPSHOT</version>
+ <version>0.8-jdk9-SNAPSHOT</version>
</parent>
Modified: sis/branches/JDK9/core/sis-referencing-by-identifiers/src/test/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystemTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing-by-identifiers/src/test/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystemTest.java?rev=1805590&r1=1805589&r2=1805590&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing-by-identifiers/src/test/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystemTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing-by-identifiers/src/test/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystemTest.java [UTF-8] Mon Aug 21 01:03:12 2017
@@ -175,9 +175,9 @@ public final strictfp class MilitaryGrid
* The lowest 4 bits are the number of the row cycle (a cycle of 2000 km). The remaining bits tell which
* rows are valid in that latitude band.
*/
- final int rowCycle = (int) Math.floor(ymin / (MilitaryGridReferenceSystem.GRID_SQUARE_SIZE * MilitaryGridReferenceSystem.GRID_ROW_COUNT));
- final int lowerRow = (int) Math.floor(ymin / MilitaryGridReferenceSystem.GRID_SQUARE_SIZE); // Inclusive
- final int upperRow = (int) Math.ceil (ymax / MilitaryGridReferenceSystem.GRID_SQUARE_SIZE); // Exclusive
+ final int rowCycle = (int) StrictMath.floor(ymin / (MilitaryGridReferenceSystem.GRID_SQUARE_SIZE * MilitaryGridReferenceSystem.GRID_ROW_COUNT));
+ final int lowerRow = (int) StrictMath.floor(ymin / MilitaryGridReferenceSystem.GRID_SQUARE_SIZE); // Inclusive
+ final int upperRow = (int) StrictMath.ceil (ymax / MilitaryGridReferenceSystem.GRID_SQUARE_SIZE); // Exclusive
assertTrue("rowCycle", rowCycle >= 0 && rowCycle <= MilitaryGridReferenceSystem.Decoder.NORTHING_BITS_MASK);
assertTrue("lowerRow", lowerRow >= 0);
assertTrue("upperRow", upperRow >= 0);
Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java?rev=1805590&r1=1805589&r2=1805590&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java [UTF-8] Mon Aug 21 01:03:12 2017
@@ -554,6 +554,9 @@ public final class CRS extends Static {
* Finds a mathematical operation that transforms or converts coordinates from the given source to the
* given target coordinate reference system. If an estimation of the geographic area containing the points
* to transform is known, it can be specified for helping this method to find a better suited operation.
+ * If no area of interest is specified, then the current default is the widest
+ * {@linkplain AbstractCoordinateOperation#getDomainOfValidity() domain of validity}.
+ * A future Apache SIS version may also take the country of current locale in account.
*
* <div class="note"><b>Note:</b>
* the area of interest is just one aspect that may affect the coordinate operation.
@@ -667,6 +670,10 @@ public final class CRS extends Static {
* associated with the given operation. If more than one geographic bounding box is found, then this method
* computes their {@linkplain DefaultGeographicBoundingBox#add(GeographicBoundingBox) union}.
*
+ * <p><b>Fallback:</b> if the given operation does not declare explicitely a domain of validity, then this
+ * method computes the intersection of the domain of validity declared by source and target CRS. If no CRS
+ * declare a domain of validity, then this method returns {@code null}.</p>
+ *
* @param operation the coordinate operation for which to get the domain of validity, or {@code null}.
* @return the geographic area where the operation is valid, or {@code null} if unspecified.
*
@@ -678,7 +685,15 @@ public final class CRS extends Static {
* @since 0.7
*/
public static GeographicBoundingBox getGeographicBoundingBox(final CoordinateOperation operation) {
- return (operation != null) ? Extents.getGeographicBoundingBox(operation.getDomainOfValidity()) : null;
+ if (operation == null) {
+ return null;
+ }
+ GeographicBoundingBox bbox = Extents.getGeographicBoundingBox(operation.getDomainOfValidity());
+ if (bbox == null) {
+ bbox = Extents.intersection(getGeographicBoundingBox(operation.getSourceCRS()),
+ getGeographicBoundingBox(operation.getTargetCRS()));
+ }
+ return bbox;
}
/**
Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Codes.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Codes.java?rev=1805590&r1=1805589&r2=1805590&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Codes.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Codes.java [UTF-8] Mon Aug 21 01:03:12 2017
@@ -33,7 +33,7 @@ import static org.apache.sis.internal.ut
* objects defined in the EPSG database.
* Current version uses hard-coded mapping.
*
- * @author Rémi Marechal (Geomatys)
+ * @author Rémi Maréchal (Geomatys)
* @author Martin Desruisseaux (Geomatys)
* @version 0.8
* @since 0.8
Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/IdentifiedObjectFinder.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/IdentifiedObjectFinder.java?rev=1805590&r1=1805589&r2=1805590&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/IdentifiedObjectFinder.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/IdentifiedObjectFinder.java [UTF-8] Mon Aug 21 01:03:12 2017
@@ -58,7 +58,7 @@ import org.apache.sis.util.Utilities;
* is thread-safe. If concurrent searches are desired, then a new instance should be created for each thread.
*
* @author Martin Desruisseaux (IRD, Geomatys)
- * @version 0.7
+ * @version 0.8
*
* @see GeodeticAuthorityFactory#newIdentifiedObjectFinder()
* @see IdentifiedObjects#newFinder(String)
@@ -302,7 +302,7 @@ public class IdentifiedObjectFinder {
final AuthorityFactoryProxy<?> previous = proxy;
proxy = AuthorityFactoryProxy.getInstance(object.getClass());
try {
- if (!ignoreIdentifiers) {
+ if (!ignoreIdentifiers && !ignoreAxes) {
/*
* First check if one of the identifiers can be used to find directly an identified object.
* Verify that the object that we found is actually equal to given one; we do not blindly
Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationContext.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationContext.java?rev=1805590&r1=1805589&r2=1805590&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationContext.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationContext.java [UTF-8] Mon Aug 21 01:03:12 2017
@@ -57,6 +57,9 @@ import java.util.function.Predicate;
* @version 0.7
* @since 0.7
* @module
+ *
+ * @todo Should also take the country of a {@link java.util.Locale}. The EPSG database contains ISO2 and ISO3
+ * identifiers that we can use.
*/
public class CoordinateOperationContext implements Serializable {
/**
Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java?rev=1805590&r1=1805589&r2=1805590&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java [UTF-8] Mon Aug 21 01:03:12 2017
@@ -257,19 +257,27 @@ class CoordinateOperationRegistry {
}
/**
- * Finds the authority code for the given coordinate reference system.
+ * Finds the authority codes for the given coordinate reference system.
* This method does not trust the code given by the user in its CRS - we verify it.
- * This method may return a code even if the axis order does not match;
+ * This method may return codes even if the axis order does not match;
* it will be caller's responsibility to make necessary adjustments.
*/
- private String findCode(final CoordinateReferenceSystem crs) throws FactoryException {
+ private List<String> findCode(final CoordinateReferenceSystem crs) throws FactoryException {
+ final List<String> codes = new ArrayList<>();
if (codeFinder != null) {
- final Identifier identifier = IdentifiedObjects.getIdentifier(codeFinder.findSingleton(crs), null);
- if (identifier != null) {
- return identifier.getCode();
+ for (final IdentifiedObject candidate : codeFinder.find(crs)) {
+ final Identifier identifier = IdentifiedObjects.getIdentifier(candidate, registry.getAuthority());
+ if (identifier != null) {
+ final String code = identifier.getCode();
+ if (Utilities.deepEquals(candidate, crs, ComparisonMode.APPROXIMATIVE)) {
+ codes.add(0, code); // If axis order match, give precedence to that CRS.
+ } else {
+ codes.add(code);
+ }
+ }
}
}
- return null;
+ return codes;
}
/**
@@ -366,56 +374,58 @@ class CoordinateOperationRegistry {
final CoordinateReferenceSystem targetCRS)
throws IllegalArgumentException, IncommensurableException, FactoryException
{
- final String sourceID = findCode(sourceCRS);
- if (sourceID == null) {
- return null;
- }
- final String targetID = findCode(targetCRS);
- if (targetID == null) {
- return null;
- }
- if (sourceID.equals(targetID)) {
- /*
- * Above check is necessary because this method may be invoked in some situations where the code
- * are equal while the CRS are not. Such situation should be illegal, but unfortunately it still
- * happen because many softwares are not compliant with EPSG definition of axis order. In such
- * cases we will need to compute a transform from sourceCRS to targetCRS ignoring the source and
- * target codes. The CoordinateOperationFinder class can do that, providing that we prevent this
- * CoordinateOperationRegistry to (legitimately) claims that the operation from sourceCode to
- * targetCode is the identity transform.
- */
- return null;
- }
- final boolean inverse;
- Collection<CoordinateOperation> operations;
- boolean mdOnly = Semaphores.queryAndSet(Semaphores.METADATA_ONLY); // See comment for the same call inside the loop.
- try {
- try {
- operations = registry.createFromCoordinateReferenceSystemCodes(sourceID, targetID);
- inverse = Containers.isNullOrEmpty(operations);
- if (inverse) {
+ final List<String> sources = findCode(sourceCRS); if (sources.isEmpty()) return null;
+ final List<String> targets = findCode(targetCRS); if (targets.isEmpty()) return null;
+ Collection<CoordinateOperation> operations = null;
+ boolean inverse = false;
+ for (final String sourceID : sources) {
+ for (final String targetID : targets) {
+ if (sourceID.equals(targetID)) {
/*
- * No operation from 'source' to 'target' available. But maybe there is an inverse operation.
- * This is typically the case when the user wants to convert from a projected to a geographic CRS.
- * The EPSG database usually contains transformation paths for geographic to projected CRS only.
+ * Above check is necessary because this method may be invoked in some situations where the code
+ * are equal while the CRS are not. Such situation should be illegal, but unfortunately it still
+ * happen because many softwares are not compliant with EPSG definition of axis order. In such
+ * cases we will need to compute a transform from sourceCRS to targetCRS ignoring the source and
+ * target codes. The CoordinateOperationFinder class can do that, providing that we prevent this
+ * CoordinateOperationRegistry to (legitimately) claims that the operation from sourceCode to
+ * targetCode is the identity transform.
*/
- operations = registry.createFromCoordinateReferenceSystemCodes(targetID, sourceID);
- if (Containers.isNullOrEmpty(operations)) {
- return null;
- }
+ return null;
}
- } finally {
- if (!mdOnly) {
- Semaphores.clear(Semaphores.METADATA_ONLY);
+ final boolean mdOnly = Semaphores.queryAndSet(Semaphores.METADATA_ONLY);
+ try {
+ try {
+ operations = registry.createFromCoordinateReferenceSystemCodes(sourceID, targetID);
+ inverse = Containers.isNullOrEmpty(operations);
+ if (inverse) {
+ /*
+ * No operation from 'source' to 'target' available. But maybe there is an inverse operation.
+ * This is typically the case when the user wants to convert from a projected to a geographic CRS.
+ * The EPSG database usually contains transformation paths for geographic to projected CRS only.
+ */
+ operations = registry.createFromCoordinateReferenceSystemCodes(targetID, sourceID);
+ if (Containers.isNullOrEmpty(operations)) {
+ continue;
+ }
+ }
+ } finally {
+ if (!mdOnly) {
+ Semaphores.clear(Semaphores.METADATA_ONLY);
+ }
+ }
+ } catch (NoSuchAuthorityCodeException | MissingFactoryResourceException e) {
+ /*
+ * sourceCode or targetCode is unknown to the underlying authority factory.
+ * Ignores the exception and fallback on the generic algorithm provided by
+ * CoordinateOperationFinder.
+ */
+ log(null, e);
+ continue;
}
+ break; // Stop on the first non-empty set of operations that we find.
}
- } catch (NoSuchAuthorityCodeException | MissingFactoryResourceException e) {
- /*
- * sourceCode or targetCode is unknown to the underlying authority factory.
- * Ignores the exception and fallback on the generic algorithm provided by
- * CoordinateOperationFinder.
- */
- log(null, e);
+ }
+ if (operations == null) {
return null;
}
/*
@@ -443,7 +453,7 @@ class CoordinateOperationRegistry {
* The non-public Semaphores.METADATA_ONLY mechanism instructs EPSGDataAccess to
* instantiate DeferredCoordinateOperation instead of full coordinate operations.
*/
- mdOnly = Semaphores.queryAndSet(Semaphores.METADATA_ONLY);
+ final boolean mdOnly = Semaphores.queryAndSet(Semaphores.METADATA_ONLY);
try {
try {
if (!it.hasNext()) break;
Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/CylindricalEqualArea.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/CylindricalEqualArea.java?rev=1805590&r1=1805589&r2=1805590&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/CylindricalEqualArea.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/CylindricalEqualArea.java [UTF-8] Mon Aug 21 01:03:12 2017
@@ -228,26 +228,26 @@ public class CylindricalEqualArea extend
}
/**
- * Converts a list of coordinate point ordinal values.
- *
- * <div class="note"><b>Note:</b>
- * We override the super-class method only as an optimization in the special case where the target coordinates
- * are written at the same locations than the source coordinates. In such case, we can take advantage of the
- * fact that the λ values are not modified by the normalized Cylindrical Equal Area projection.</div>
+ * Converts a list of coordinate points. This method performs the same calculation than above
+ * {@link #transform(double[], int, double[], int, boolean)} method, but is overridden for efficiency.
*
* @throws TransformException if a point can not be converted.
*/
@Override
public void transform(final double[] srcPts, int srcOff,
- final double[] dstPts, int dstOff, int numPts)
- throws TransformException
+ final double[] dstPts, int dstOff, int numPts) throws TransformException
{
- if (srcPts != dstPts || srcOff != dstOff) {
+ if (srcPts != dstPts || srcOff != dstOff || getClass() != CylindricalEqualArea.class) {
super.transform(srcPts, srcOff, dstPts, dstOff, numPts);
} else {
+ /*
+ * Override the super-class method only as an optimization in the special case where the target coordinates
+ * are written at the same locations than the source coordinates. In such case, we can take advantage of
+ * the fact that the λ values are not modified by the normalized Cylindrical Equal Area projection.
+ */
dstOff--;
while (--numPts >= 0) {
- final double φ = dstPts[dstOff += 2]; // Same as srcPts[srcOff + 1].
+ final double φ = dstPts[dstOff += DIMENSION]; // Same as srcPts[srcOff + 1].
dstPts[dstOff] = qm_ellipsoid(sin(φ)); // Part of Synder equation (10-15)
}
}
@@ -299,7 +299,7 @@ public class CylindricalEqualArea extend
*/
Spherical(final CylindricalEqualArea other) {
super(other);
- context.getMatrix(ContextualParameters.MatrixRole.DENORMALIZATION).convertAfter(1, 2, null);
+ context.getMatrix(ContextualParameters.MatrixRole.DENORMALIZATION).convertAfter(1, DIMENSION, null);
}
/**
@@ -322,8 +322,8 @@ public class CylindricalEqualArea extend
* {@inheritDoc}
*
* <div class="note"><b>Note:</b>
- * This method must be overridden because the {@link Mercator} class overrides the {@link NormalizedProjection}
- * default implementation.</div>
+ * This method must be overridden because the {@link CylindricalEqualArea} class
+ * overrides the {@link NormalizedProjection} default implementation.</div>
*/
@Override
public void transform(final double[] srcPts, int srcOff,
@@ -335,7 +335,7 @@ public class CylindricalEqualArea extend
} else {
dstOff--;
while (--numPts >= 0) {
- final double φ = dstPts[dstOff += 2]; // Same as srcPts[srcOff + 1].
+ final double φ = dstPts[dstOff += DIMENSION]; // Same as srcPts[srcOff + 1].
dstPts[dstOff] = sin(φ);
}
}
Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/EqualAreaProjection.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/EqualAreaProjection.java?rev=1805590&r1=1805589&r2=1805590&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/EqualAreaProjection.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/EqualAreaProjection.java [UTF-8] Mon Aug 21 01:03:12 2017
@@ -54,13 +54,15 @@ abstract class EqualAreaProjection exten
*
*
* <p><b>BENCHMARK AND ANALYSIS:</b>
- * as of July 2016, benchmarking shows no benefit in using trigonometric identities for {@code EqualAreaProjection}
- * (contrarily to {@link ConformalProjection} where we did measured a benefit). This may be because in this class,
+ * as of July 2016, benchmarking shows small benefit in using trigonometric identities for {@code EqualAreaProjection}
+ * (contrarily to {@link ConformalProjection} where we measured a greater benefit). This may be because in this class,
* the series expansion is unconditionally followed by iterative method in order to reach the centimetric precision.
* We observe that the original series expansion allows convergence in only one iteration, while the formulas using
- * trigonometric identifies often requires two iterations. Consequently we disallow those modifications for now.</p>
+ * trigonometric identifies often requires two iterations.</p>
+ *
+ * @todo Redo the benchmark with JDK9, since {@code sin} seems much faster.
*/
- private static final boolean ALLOW_TRIGONOMETRIC_IDENTITIES = false;
+ private static final boolean ALLOW_TRIGONOMETRIC_IDENTITIES = true;
/**
* Coefficients in the series expansion of the inverse projection,
Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Initializer.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Initializer.java?rev=1805590&r1=1805589&r2=1805590&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Initializer.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Initializer.java [UTF-8] Mon Aug 21 01:03:12 2017
@@ -56,7 +56,7 @@ import static org.apache.sis.internal.ut
* in some relatively rare scenarios like 1 ± x where <var>x</var> is much smaller than 1.</p>
*
* @author Martin Desruisseaux (Geomatys)
- * @author Rémi Marechal (Geomatys)
+ * @author Rémi Maréchal (Geomatys)
* @version 0.7
* @since 0.6
* @module
Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/LambertConicConformal.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/LambertConicConformal.java?rev=1805590&r1=1805589&r2=1805590&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/LambertConicConformal.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/LambertConicConformal.java [UTF-8] Mon Aug 21 01:03:12 2017
@@ -58,7 +58,7 @@ import static org.apache.sis.internal.ut
* @author André Gosselin (MPO)
* @author Rueben Schulz (UBC)
* @author Rémi Maréchal (Geomatys)
- * @version 0.6
+ * @version 0.8
* @since 0.6
* @module
*/
Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Mercator.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Mercator.java?rev=1805590&r1=1805589&r2=1805590&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Mercator.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Mercator.java [UTF-8] Mon Aug 21 01:03:12 2017
@@ -32,6 +32,7 @@ import org.apache.sis.internal.referenci
import org.apache.sis.internal.util.DoubleDouble;
import org.apache.sis.referencing.operation.matrix.Matrix2;
import org.apache.sis.referencing.operation.matrix.MatrixSIS;
+import org.apache.sis.referencing.operation.transform.MathTransforms;
import org.apache.sis.referencing.operation.transform.ContextualParameters;
import org.apache.sis.parameter.Parameters;
import org.apache.sis.util.Workaround;
@@ -69,7 +70,7 @@ import static org.apache.sis.internal.ut
* @author Rueben Schulz (UBC)
* @author Simon Reynard (Geomatys)
* @author Rémi Maréchal (Geomatys)
- * @version 0.6
+ * @version 0.8
*
* @see TransverseMercator
*
@@ -372,12 +373,8 @@ public class Mercator extends ConformalP
}
/**
- * Converts a list of coordinate point ordinal values.
- *
- * <div class="note"><b>Note:</b>
- * We override the super-class method only as an optimization in the special case where the target coordinates
- * are written at the same locations than the source coordinates. In such case, we can take advantage of the
- * fact that the λ values are not modified by the normalized Mercator projection.</div>
+ * Converts a list of coordinate points. This method performs the same calculation than above
+ * {@link #transform(double[], int, double[], int, boolean)} method, but is overridden for efficiency.
*
* @throws TransformException if a point can not be converted.
*/
@@ -386,12 +383,17 @@ public class Mercator extends ConformalP
final double[] dstPts, int dstOff, int numPts)
throws TransformException
{
- if (srcPts != dstPts || srcOff != dstOff) {
+ if (srcPts != dstPts || srcOff != dstOff || getClass() != Mercator.class) {
super.transform(srcPts, srcOff, dstPts, dstOff, numPts);
} else {
+ /*
+ * Override the super-class method only as an optimization in the special case where the target coordinates
+ * are written at the same locations than the source coordinates. In such case, we can take advantage of
+ * the fact that the λ values are not modified by the normalized Mercator projection.
+ */
dstOff--;
while (--numPts >= 0) {
- final double φ = dstPts[dstOff += 2]; // Same as srcPts[srcOff + 1].
+ final double φ = dstPts[dstOff += DIMENSION]; // Same as srcPts[srcOff + 1].
if (φ != 0) {
/*
* See the javadoc of the Spherical inner class for a note
@@ -521,7 +523,7 @@ public class Mercator extends ConformalP
} else {
dstOff--;
while (--numPts >= 0) {
- final double φ = dstPts[dstOff += 2]; // Same as srcPts[srcOff + 1].
+ final double φ = dstPts[dstOff += DIMENSION]; // Same as srcPts[srcOff + 1].
if (φ != 0) {
// See class javadoc for a note about explicit check for poles.
final double a = abs(φ);
@@ -552,4 +554,27 @@ public class Mercator extends ConformalP
dstPts[dstOff+1] = PI/2 - 2*atan(exp(-y)); // Part of Snyder (7-4);
}
}
+
+ /**
+ * Invoked when {@link #tryConcatenate(boolean, MathTransform, MathTransformFactory)} detected a
+ * (inverse) → (affine) → (this) transforms sequence.
+ */
+ @Override
+ final MathTransform tryConcatenate(boolean projectedSpace, Matrix affine, MathTransformFactory factory)
+ throws FactoryException
+ {
+ /*
+ * Verify that the latitude row is an identity conversion except for the sign which is allowed to change
+ * (but no scale and no translation are allowed). Ignore the longitude row because it just pass through
+ * this Mercator projection with no impact on any calculation.
+ */
+ if (affine.getElement(1,0) == 0 && affine.getElement(1, DIMENSION) == 0 && Math.abs(affine.getElement(1,1)) == 1) {
+ if (factory != null) {
+ return factory.createAffineTransform(affine);
+ } else {
+ return MathTransforms.linear(affine);
+ }
+ }
+ return super.tryConcatenate(projectedSpace, affine, factory);
+ }
}
Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/NormalizedProjection.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/NormalizedProjection.java?rev=1805590&r1=1805589&r2=1805590&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/NormalizedProjection.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/NormalizedProjection.java [UTF-8] Mon Aug 21 01:03:12 2017
@@ -16,6 +16,7 @@
*/
package org.apache.sis.referencing.operation.projection;
+import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.util.Objects;
@@ -32,6 +33,7 @@ import org.opengis.referencing.operation
import org.opengis.referencing.operation.OperationMethod;
import org.opengis.referencing.operation.TransformException;
import org.opengis.referencing.operation.MathTransformFactory;
+import org.opengis.referencing.operation.NoninvertibleTransformException;
import org.opengis.util.FactoryException;
import org.apache.sis.util.Debug;
import org.apache.sis.util.CharSequences;
@@ -41,6 +43,8 @@ import org.apache.sis.parameter.Paramete
import org.apache.sis.metadata.iso.citation.Citations;
import org.apache.sis.referencing.operation.matrix.Matrices;
import org.apache.sis.referencing.operation.matrix.MatrixSIS;
+import org.apache.sis.referencing.operation.transform.MathTransforms;
+import org.apache.sis.referencing.operation.transform.AbstractMathTransform;
import org.apache.sis.referencing.operation.transform.AbstractMathTransform2D;
import org.apache.sis.referencing.operation.transform.ContextualParameters;
import org.apache.sis.referencing.operation.transform.DefaultMathTransformFactory;
@@ -49,9 +53,11 @@ import org.apache.sis.internal.referenci
import org.apache.sis.internal.metadata.ReferencingServices;
import org.apache.sis.internal.referencing.Formulas;
import org.apache.sis.internal.system.Modules;
+import org.apache.sis.internal.system.Loggers;
import org.apache.sis.internal.util.Constants;
import org.apache.sis.internal.util.Numerics;
import org.apache.sis.util.resources.Errors;
+import org.apache.sis.util.logging.Logging;
import static java.lang.Math.*;
@@ -117,7 +123,7 @@ import static java.lang.Math.*;
* @author André Gosselin (MPO)
* @author Rueben Schulz (UBC)
* @author Rémi Maréchal (Geomatys)
- * @version 0.7
+ * @version 0.8
*
* @see ContextualParameters
* @see <a href="http://mathworld.wolfram.com/MapProjection.html">Map projections on MathWorld</a>
@@ -132,6 +138,15 @@ public abstract class NormalizedProjecti
private static final long serialVersionUID = -4010883312927645853L;
/**
+ * Number of input and output dimensions of all {@code NormalizedProjection}.
+ * We define this constant for clarity only; its value shall not be modified.
+ *
+ * @see #getSourceDimensions()
+ * @see #getTargetDimensions()
+ */
+ static final int DIMENSION = 2;
+
+ /**
* Maximum difference allowed when comparing longitudes or latitudes in radians.
* The current value takes the system-wide angular tolerance value (equivalent to
* about 1 cm on Earth) converted to radians.
@@ -710,7 +725,7 @@ public abstract class NormalizedProjecti
* Inverse of a normalized map projection.
*
* @author Martin Desruisseaux (Geomatys)
- * @version 0.6
+ * @version 0.8
* @since 0.6
* @module
*/
@@ -741,13 +756,131 @@ public abstract class NormalizedProjecti
return null;
} else {
if (dstPts == null) {
- dstPts = new double[2];
+ dstPts = new double[DIMENSION];
dstOff = 0;
}
inverseTransform(srcPts, srcOff, dstPts, dstOff);
return Matrices.inverse(NormalizedProjection.this.transform(dstPts, dstOff, null, 0, true));
}
}
+
+ /**
+ * Inverse transforms an arbitrary amount of coordinates. This method optimizes the
+ * case where conversions can be applied by a loop with indices in increasing order.
+ */
+ @Override
+ public void transform(final double[] srcPts, int srcOff,
+ final double[] dstPts, int dstOff, int numPts) throws TransformException
+ {
+ if (srcPts == dstPts && srcOff < dstOff) {
+ super.transform(srcPts, srcOff, dstPts, dstOff, numPts);
+ } else while (--numPts >= 0) {
+ inverseTransform(srcPts, srcOff, dstPts, dstOff);
+ srcOff += DIMENSION;
+ dstOff += DIMENSION;
+ }
+ }
+
+ /**
+ * Concatenates or pre-concatenates in an optimized way this projection with the given transform, if possible.
+ * If no optimization is available, returns {@code null}.
+ */
+ @Override
+ protected MathTransform tryConcatenate(final boolean applyOtherFirst, final MathTransform other,
+ final MathTransformFactory factory) throws FactoryException
+ {
+ final Matrix m = getMiddleMatrix(this, other, applyOtherFirst);
+ if (m != null) {
+ /*
+ * 'projectedSpace' values:
+ * - false if applyOtherFirst == false since we have (inverse projection) → (affine) → (projection).
+ * - true if applyOtherFirst == true since we have (projection) → (affine) → (inverse projection).
+ */
+ return NormalizedProjection.this.tryConcatenate(applyOtherFirst, m, factory);
+ }
+ return super.tryConcatenate(applyOtherFirst, other, factory);
+ }
+ }
+
+ /**
+ * Concatenates or pre-concatenates in an optimized way this projection with the given transform, if possible.
+ * If transforms are concatenated in an (inverse projection) → (affine) → (projection) sequence where the
+ * (projection) and (inverse projection) steps are the {@linkplain #inverse() inverse} of each other,
+ * then in some particular case the sequence can be replaced by a single affine transform.
+ * If no such simplification is possible, this method returns {@code null}.
+ *
+ * @return the simplified (usually affine) transform, or {@code null} if no such optimization is available.
+ * @throws FactoryException if an error occurred while combining the transforms.
+ *
+ * @since 0.8
+ */
+ @Override
+ protected MathTransform tryConcatenate(final boolean applyOtherFirst, final MathTransform other,
+ final MathTransformFactory factory) throws FactoryException
+ {
+ final Matrix m = getMiddleMatrix(this, other, applyOtherFirst);
+ if (m != null) {
+ /*
+ * 'projectedSpace' values:
+ * - false if applyOtherFirst == true since we have (inverse projection) → (affine) → (projection).
+ * - true if applyOtherFirst == false since we have (projection) → (affine) → (inverse projection).
+ */
+ return tryConcatenate(!applyOtherFirst, m, factory);
+ }
+ return super.tryConcatenate(applyOtherFirst, other, factory);
+ }
+
+ /**
+ * Returns the concatenation of (inverse) → (affine) → (this) transforms, or {@code null} if none.
+ * The affine transform is applied in the geographic space with angular values in radians.
+ *
+ * <p>Above description is for the usual case where {@code projectedSpace} is {@code false}.
+ * If {@code true} (should be unusual), then the affine transform is rather applied in the
+ * projected space and the sequence to concatenate is (this) → (affine) → (inverse).</p>
+ *
+ * <p>Default implementation returns {@code null}. Subclasses should override if applicable.</p>
+ *
+ * @param projectedSpace {@code true} if affine transform is applied in projected instead than geographic space.
+ * @param affine the affine transform in the middle of (inverse) → (affine) → (this) transform sequence.
+ * @param factory the factory to use for creating new transform, or {@code null}.
+ * @return the optimized concatenation, or {@code null} if none.
+ */
+ MathTransform tryConcatenate(boolean projectedSpace, Matrix affine, MathTransformFactory factory)
+ throws FactoryException
+ {
+ return null;
+ }
+
+ /**
+ * If a sequence of 3 transforms are (inverse projection) → (affine) → (projection) where
+ * the (projection) and (inverse projection) steps are the inverse of each other, returns
+ * the matrix of the affine transform step. Otherwise returns {@code null}. This method
+ * accepts also (projection) → (affine) → (inverse projection) sequence, but such sequences
+ * should be much more unusual.
+ *
+ * @param projection either {@link NormalizedProjection} or {@link Inverse}.
+ * @param other the arbitrary transforms to be concatenated with the given projection.
+ * @param applyOtherFirst whether {@code other} is concatenated before {@code projection} or the converse.
+ * @return the 3×3 matrix of the affine transform step, or {@code null} if none.
+ */
+ static Matrix getMiddleMatrix(final AbstractMathTransform projection, final MathTransform other,
+ final boolean applyOtherFirst)
+ {
+ final List<MathTransform> steps = MathTransforms.getSteps(other);
+ if (steps.size() == 2) try {
+ final int oi = applyOtherFirst ? 0 : 1;
+ if (projection.equals(steps.get(oi).inverse(), ComparisonMode.IGNORE_METADATA)) {
+ final Matrix m = MathTransforms.getMatrix(steps.get(oi ^ 1));
+ if (Matrices.isAffine(m) && m.getNumRow() == DIMENSION+1 && m.getNumCol() == DIMENSION+1) {
+ return m;
+ }
+ }
+ } catch (NoninvertibleTransformException e) {
+ Logging.recoverableException(Logging.getLogger(Loggers.COORDINATE_OPERATION),
+ (projection instanceof NormalizedProjection) ? NormalizedProjection.class : projection.getClass(),
+ "tryConcatenate", e);
+ }
+ return null;
}
/**
Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java?rev=1805590&r1=1805589&r2=1805590&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java [UTF-8] Mon Aug 21 01:03:12 2017
@@ -357,8 +357,8 @@ public abstract class AbstractMathTransf
throws TransformException;
/**
- * Transforms a list of coordinate point ordinal values. This method is provided for efficiently
- * transforming many points. The supplied array of ordinal values will contain packed ordinal values.
+ * Transforms a list of coordinate points. This method is provided for efficiently transforming many points.
+ * The supplied array of coordinate values will contain packed coordinate values.
*
* <div class="note"><b>Example:</b> if the source dimension is 3, then the ordinates will be packed in this order:
* (<var>x₀</var>,<var>y₀</var>,<var>z₀</var>,
@@ -443,8 +443,8 @@ public abstract class AbstractMathTransf
throw failure;
}
/*
- * Otherwise fills the ordinate values to NaN and count the number of exceptions,
- * so we known when to give up if there is too much of them. The first exception
+ * Otherwise set the ordinate values to NaN and count the number of exceptions,
+ * so we know when to give up if there is too much of them. The first exception
* will be propagated at the end of this method.
*/
Arrays.fill(dstPts, dstOff, dstOff + Math.abs(dstInc), Double.NaN);
@@ -477,7 +477,7 @@ public abstract class AbstractMathTransf
}
/**
- * Transforms a list of coordinate point ordinal values. The default implementation delegates
+ * Transforms a list of coordinate points. The default implementation delegates
* to {@link #transform(double[], int, double[], int, int)} using a temporary array of doubles.
*
* <div class="note"><b>Implementation note:</b> see {@link IterationStrategy} javadoc for a method skeleton.</div>
@@ -607,7 +607,7 @@ public abstract class AbstractMathTransf
}
/**
- * Transforms a list of coordinate point ordinal values. The default implementation delegates
+ * Transforms a list of coordinate points. The default implementation delegates
* to {@link #transform(double[], int, double[], int, int)} using a temporary array of doubles.
*
* @param srcPts the array containing the source point coordinates.
@@ -670,7 +670,7 @@ public abstract class AbstractMathTransf
}
/**
- * Transforms a list of coordinate point ordinal values. The default implementation delegates
+ * Transforms a list of coordinate points. The default implementation delegates
* to {@link #transform(double[], int, double[], int, int)} using a temporary array of doubles
* if necessary.
*
@@ -792,7 +792,7 @@ public abstract class AbstractMathTransf
}
/**
- * Concatenates or pre-concatenates in an optimized way this math transform with the given one.
+ * Concatenates or pre-concatenates in an optimized way this math transform with the given one, if possible.
* A new math transform is created to perform the combined transformation.
* The {@code applyOtherFirst} value determines the transformation order as bellow:
*
@@ -807,7 +807,7 @@ public abstract class AbstractMathTransf
*
* If no special optimization is available for the combined transform, then this method returns {@code null}.
* In the later case, the concatenation will be prepared by {@link DefaultMathTransformFactory} using a generic
- * {@link ConcatenatedTransform}.
+ * implementation.
*
* <p>The default implementation always returns {@code null}. This method is ought to be overridden
* by subclasses capable of concatenating some combination of transforms in a special way.</p>
@@ -816,7 +816,7 @@ public abstract class AbstractMathTransf
* {@code false} if the transformation order is {@code this} followed by {@code other}.
* @param other the other math transform to (pre-)concatenate with this transform.
* @param factory the factory which is (indirectly) invoking this method, or {@code null} if none.
- * @return the combined math transform, or {@code null} if no optimized combined transform is available.
+ * @return the math transforms combined in an optimized way, or {@code null} if no such optimization is available.
* @throws FactoryException if an error occurred while combining the transforms.
*
* @see DefaultMathTransformFactory#createConcatenatedTransform(MathTransform, MathTransform)
Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearInterpolator1D.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearInterpolator1D.java?rev=1805590&r1=1805589&r2=1805590&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearInterpolator1D.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearInterpolator1D.java [UTF-8] Mon Aug 21 01:03:12 2017
@@ -40,7 +40,7 @@ import org.apache.sis.util.resources.Err
* then concatenating this transform with a transform that multiply all output values by -1.</p>
*
* @author Johann Sorel (Geomatys)
- * @author Remi Marechal (Geomatys)
+ * @author Rémi Maréchal (Geomatys)
* @author Martin Desruisseaux (Geomatys)
* @version 0.7
* @since 0.7
Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationRegistryTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationRegistryTest.java?rev=1805590&r1=1805589&r2=1805590&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationRegistryTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationRegistryTest.java [UTF-8] Mon Aug 21 01:03:12 2017
@@ -57,12 +57,16 @@ import static org.junit.Assume.*;
* <ul>
* <li><cite>"NTF (Paris) to WGS 84 (1)"</cite> operation (EPSG:8094), which implies a longitude rotation
* followed by a geocentric translation in the geographic domain.</li>
+ * <li><cite>"Martinique 1938 to RGAF09 (1)"</cite> operation (EPSG:5491), which implies a datum shift
+ * that does not go through WGS84. Furthermore since the EPSG database defines (λ,φ) axis order in
+ * addition to the usual (φ,λ) order for the target CRS, this tests allows us to verify we can find
+ * this operation despite different axis order.</li>
* </ul>
*
* The operations are tested with various axis order and dimension in source and target CRS.
*
* @author Martin Desruisseaux (Geomatys)
- * @version 0.7
+ * @version 0.8
* @since 0.7
* @module
*/
@@ -94,6 +98,11 @@ public final strictfp class CoordinateOp
private static WKTFormat parser;
/**
+ * The EPSG authority factory for CRS objects. Can be used as an alternative to {@link #parser}.
+ */
+ private final CRSAuthorityFactory crsFactory;
+
+ /**
* The instance on which to execute the tests.
*/
private final CoordinateOperationRegistry registry;
@@ -104,7 +113,7 @@ public final strictfp class CoordinateOp
* @throws FactoryException if an error occurred while creating the factory to be tested.
*/
public CoordinateOperationRegistryTest() throws FactoryException {
- final CRSAuthorityFactory crsFactory = CRS.getAuthorityFactory("EPSG");
+ crsFactory = CRS.getAuthorityFactory("EPSG");
assumeTrue("EPSG factory required.", crsFactory instanceof CoordinateOperationAuthorityFactory);
registry = new CoordinateOperationRegistry((CoordinateOperationAuthorityFactory) crsFactory, factory, null);
}
@@ -363,4 +372,39 @@ public final strictfp class CoordinateOp
assertFalse("EPSG identifier not allowed for modified objects.", "EPSG".equalsIgnoreCase(id.getCodeSpace()));
}
}
+
+ /**
+ * Tests <cite>"Martinique 1938 to RGAF09 (1)"</cite> operation with a target CRS fixed to EPSG:7086
+ * instead of EPSG:5489. Both are <cite>"RGAF09"</cite>, but the former use (longitude, latitude) axis
+ * order instead than the usual (latitude, longitude) order. The source CRS stay fixed to EPSG:4625.
+ *
+ * @throws FactoryException if an error occurred while creating a CRS or operation.
+ */
+ @Test
+ public void testFindDespiteDifferentAxisOrder() throws FactoryException {
+ CoordinateReferenceSystem sourceCRS = crsFactory.createGeographicCRS("EPSG:4625");
+ CoordinateReferenceSystem targetCRS = crsFactory.createGeographicCRS("EPSG:5489");
+ CoordinateOperation operation = registry.createOperation(sourceCRS, targetCRS);
+ assertEpsgNameAndIdentifierEqual("Martinique 1938 to RGAF09 (1)", 5491, operation);
+ /*
+ * Above was only a verification using the source and target CRS expected by EPSG dataset.
+ * Now the interesting test: use a target CRS with different axis order.
+ */
+ targetCRS = crsFactory.createGeographicCRS("EPSG:7086");
+ operation = registry.createOperation(sourceCRS, targetCRS);
+ assertEpsgNameWithoutIdentifierEqual("Martinique 1938 to RGAF09 (1)", operation);
+ final ParameterValueGroup p = ((SingleOperation) operation).getParameterValues();
+ /*
+ * Values below are copied from EPSG geodetic dataset 9.1. They may need
+ * to be adjusted if a future version of EPSG dataset modify those values.
+ */
+ assertEquals("X-axis translation", 127.744, p.parameter("X-axis translation").doubleValue(), STRICT);
+ assertEquals("Y-axis translation", 547.069, p.parameter("Y-axis translation").doubleValue(), STRICT);
+ assertEquals("Z-axis translation", 118.359, p.parameter("Z-axis translation").doubleValue(), STRICT);
+ assertEquals("X-axis rotation", -3.1116, p.parameter("X-axis rotation") .doubleValue(), STRICT);
+ assertEquals("Y-axis rotation", 4.9509, p.parameter("Y-axis rotation") .doubleValue(), STRICT);
+ assertEquals("Z-axis rotation", -0.8837, p.parameter("Z-axis rotation") .doubleValue(), STRICT);
+ assertEquals("Scale difference", 14.1012, p.parameter("Scale difference") .doubleValue(), STRICT);
+ assertEquals("linearAccuracy", 0.1, CRS.getLinearAccuracy(operation), STRICT);
+ }
}
Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/InitializerTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/InitializerTest.java?rev=1805590&r1=1805589&r2=1805590&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/InitializerTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/InitializerTest.java [UTF-8] Mon Aug 21 01:03:12 2017
@@ -33,7 +33,7 @@ import static org.opengis.test.Assert.*;
/**
* Tests the {@link Initializer} class.
*
- * @author Rémi Marechal (Geomatys)
+ * @author Rémi Maréchal (Geomatys)
* @author Martin Desruisseaux (Geomatys)
* @version 0.7
* @since 0.7
Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/ObliqueStereographicTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/ObliqueStereographicTest.java?rev=1805590&r1=1805589&r2=1805590&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/ObliqueStereographicTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/ObliqueStereographicTest.java [UTF-8] Mon Aug 21 01:03:12 2017
@@ -39,7 +39,7 @@ import static org.junit.Assert.*;
/**
* Tests the {@link ObliqueStereographic} class.
*
- * @author Rémi Marechal (Geomatys)
+ * @author Rémi Maréchal (Geomatys)
* @author Martin Desruisseaux (Geomatys)
* @version 0.8
* @since 0.7
Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/LinearInterpolator1DTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/LinearInterpolator1DTest.java?rev=1805590&r1=1805589&r2=1805590&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/LinearInterpolator1DTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/LinearInterpolator1DTest.java [UTF-8] Mon Aug 21 01:03:12 2017
@@ -29,7 +29,7 @@ import static org.opengis.test.Assert.*;
/**
* Test {@link LinearInterpolator1D} class.
*
- * @author Remi Marechal (Geomatys).
+ * @author Rémi Maréchal (Geomatys)
* @author Martin Desruisseaux (Geomatys).
* @version 0.7
* @since 0.7