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/07/21 22:34:29 UTC
svn commit: r1802647 [1/2] - in /sis/branches/JDK8:
core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/
core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/
core/sis-referencing/src/main/java/org/apache/sis/ref...
Author: desruisseaux
Date: Fri Jul 21 22:34:29 2017
New Revision: 1802647
URL: http://svn.apache.org/viewvc?rev=1802647&view=rev
Log:
Make PJ wrapper serializable (by serializing the Proj.4 definition string).
Partial implementation of MathTransformFactory and CoordinateOperationFactory.
More tests, and consequently fix an erroneous Proj.4 parameter name in LambertConformal2SP.
Added:
sis/branches/JDK8/storage/sis-gdal/src/test/java/org/apache/sis/storage/gdal/MTFactory.java (with props)
sis/branches/JDK8/storage/sis-gdal/src/test/java/org/apache/sis/storage/gdal/TransformTest.java (with props)
Modified:
sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertConformal2SP.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactory.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformFactoryBase.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformFactoryMock.java
sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/CollectionsExt.java
sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/LazySet.java
sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/internal/util/CollectionsExtTest.java
sis/branches/JDK8/ide-project/NetBeans/nbproject/build-impl.xml
sis/branches/JDK8/ide-project/NetBeans/nbproject/genfiles.properties
sis/branches/JDK8/ide-project/NetBeans/nbproject/project.xml
sis/branches/JDK8/storage/sis-gdal/src/main/c/org_apache_sis_storage_gdal_PJ.c
sis/branches/JDK8/storage/sis-gdal/src/main/c/org_apache_sis_storage_gdal_PJ.h
sis/branches/JDK8/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/PJ.java
sis/branches/JDK8/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4.java
sis/branches/JDK8/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4Factory.java
sis/branches/JDK8/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4Parser.java
sis/branches/JDK8/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Transform.java
sis/branches/JDK8/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/package-info.java
sis/branches/JDK8/storage/sis-gdal/src/test/java/org/apache/sis/storage/gdal/PJTest.java
sis/branches/JDK8/storage/sis-gdal/src/test/java/org/apache/sis/storage/gdal/Proj4FactoryTest.java
sis/branches/JDK8/storage/sis-gdal/src/test/java/org/apache/sis/test/suite/GDALTestSuite.java
Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java?rev=1802647&r1=1802646&r2=1802647&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java [UTF-8] Fri Jul 21 22:34:29 2017
@@ -39,6 +39,7 @@ import org.opengis.referencing.cs.Cartes
import org.opengis.referencing.cs.CoordinateSystem;
import org.opengis.referencing.cs.CoordinateSystemAxis;
import org.opengis.referencing.cs.EllipsoidalCS;
+import org.opengis.referencing.datum.DatumFactory;
import org.opengis.referencing.datum.PrimeMeridian;
import org.opengis.referencing.datum.VerticalDatum;
import org.opengis.referencing.operation.MathTransform;
@@ -129,6 +130,11 @@ public class ReferencingServices extends
public static final String CS_FACTORY = "csFactory";
/**
+ * The key for specifying a {@link DatumFactory} instance to use for geodetic object constructions.
+ */
+ public static final String DATUM_FACTORY = "datumFactory";
+
+ /**
* The services, fetched when first needed.
*/
private static volatile ReferencingServices instance;
Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertConformal2SP.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertConformal2SP.java?rev=1802647&r1=1802646&r2=1802647&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertConformal2SP.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertConformal2SP.java [UTF-8] Fri Jul 21 22:34:29 2017
@@ -125,7 +125,8 @@ public final class LambertConformal2SP e
* Special case: default value shall be the value of LATITUDE_OF_FALSE_ORIGIN.
*/
STANDARD_PARALLEL_1 = createMandatoryLatitude(builder
- .addNamesAndIdentifiers(Mercator2SP.STANDARD_PARALLEL));
+ .addNamesAndIdentifiers(Mercator2SP.STANDARD_PARALLEL)
+ .rename(Citations.PROJ4, "lat_1"));
/*
* EPSG: Latitude of 2nd standard parallel
* OGC: standard_parallel_2
Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactory.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactory.java?rev=1802647&r1=1802646&r2=1802647&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactory.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactory.java [UTF-8] Fri Jul 21 22:34:29 2017
@@ -147,8 +147,8 @@ public class DefaultCoordinateOperationF
/**
* Constructs a factory with the given default properties.
- * {@code DefaultCoordinateOperationFactory} will fallback on the map given to this constructor
- * for any property not present in the map provided to a {@code createFoo(Map<String,?>, …)} method.
+ * The new factory will fallback on the map given to this constructor
+ * for any property not present in the map given to a {@code createFoo(Map<String,?>, …)} method.
*
* @param properties the default properties, or {@code null} if none.
* @param factory the factory to use for creating {@linkplain AbstractMathTransform math transforms},
@@ -174,6 +174,7 @@ public class DefaultCoordinateOperationF
throw new IllegalArgumentException(Errors.getResources(properties)
.getString(Errors.Keys.IllegalPropertyValueClass_2, key, Classes.getClass(value)));
}
+ properties.remove(ReferencingServices.DATUM_FACTORY);
properties = CollectionsExt.compact(properties);
}
defaultProperties = properties;
@@ -513,7 +514,7 @@ next: for (int i=components.size(); --
if (parameters == null) {
throw new NullArgumentException(Errors.format(Errors.Keys.NullArgument_1, "transform"));
}
- transform = mtFactory.createBaseToDerived(sourceCRS, parameters, targetCRS.getCoordinateSystem());
+ transform = getMathTransformFactory().createBaseToDerived(sourceCRS, parameters, targetCRS.getCoordinateSystem());
}
/*
* The "operationType" property is currently undocumented. The intend is to help this factory method in
Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformFactoryBase.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformFactoryBase.java?rev=1802647&r1=1802646&r2=1802647&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformFactoryBase.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformFactoryBase.java [UTF-8] Fri Jul 21 22:34:29 2017
@@ -111,6 +111,7 @@ strictfp class MathTransformFactoryBase
/** Default implementation throws an exception. */
@Override
+ @Deprecated
public MathTransform createFromXML(String xml) throws FactoryException {
throw new FactoryException(MESSAGE);
}
Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformFactoryMock.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformFactoryMock.java?rev=1802647&r1=1802646&r2=1802647&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformFactoryMock.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformFactoryMock.java [UTF-8] Fri Jul 21 22:34:29 2017
@@ -163,6 +163,7 @@ public final strictfp class MathTransfor
* @return never returned.
*/
@Override
+ @Deprecated
public MathTransform createFromXML(String xml) {
throw new UnsupportedOperationException();
}
Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/CollectionsExt.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/CollectionsExt.java?rev=1802647&r1=1802646&r2=1802647&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/CollectionsExt.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/CollectionsExt.java [UTF-8] Fri Jul 21 22:34:29 2017
@@ -28,6 +28,9 @@ import org.opengis.parameter.InvalidPara
import static org.apache.sis.util.collection.Containers.hashMapCapacity;
+// Branch-dependent imports
+import java.util.function.Predicate;
+
/**
* Static methods working on {@link Collection} objects.
@@ -862,6 +865,57 @@ public final class CollectionsExt extend
}
/**
+ * Returns an iterator over the elements of the given iterator where the predicate returns {@code true}.
+ * The iterator may return {@code null} elements.
+ *
+ * @param <E> type of elements in the iterator to return.
+ * @param it the iterator to filter.
+ * @param filter the predicate to use for filtering elements.
+ * @return an iterator over filtered elements.
+ */
+ public static <E> Iterator<E> filter(final Iterator<E> it, final Predicate<? super E> filter) {
+ return new Iterator<E>() {
+ /** Whether the {@code next} element has been verified as valid. */
+ private boolean valid;
+
+ /** The next element to return. */
+ private E next;
+
+ /** Tests whether there is more elements to return. */
+ @Override public boolean hasNext() {
+ if (!valid) {
+ do {
+ if (!it.hasNext()) {
+ return false;
+ }
+ next = it.next();
+ } while (!filter.test(next));
+ valid = true;
+ }
+ return true;
+ }
+
+ /**
+ * Returns the next element. If there is no more elements,
+ * the exception will be thrown by the wrapped iterator.
+ */
+ @Override public E next() {
+ if (!valid) {
+ do next = it.next();
+ while (!filter.test(next));
+ }
+ valid = false;
+ return next;
+ }
+
+ /** Remove the last element returned by the iterator. */
+ @Override public void remove() {
+ it.remove();
+ }
+ };
+ }
+
+ /**
* Returns {@code true} if the next elements returned by the given iterators are the same.
* This method compares using the identity operation ({@code ==}), not {@code equals(Object)}.
*
Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/LazySet.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/LazySet.java?rev=1802647&r1=1802646&r2=1802647&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/LazySet.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/LazySet.java [UTF-8] Fri Jul 21 22:34:29 2017
@@ -22,7 +22,6 @@ import java.util.Objects;
import java.util.Iterator;
import java.util.ServiceLoader;
import java.util.NoSuchElementException;
-import org.apache.sis.util.Workaround;
import org.apache.sis.internal.system.DefaultFactories;
@@ -37,7 +36,8 @@ import org.apache.sis.internal.system.De
* {@link org.apache.sis.referencing.operation.transform.DefaultMathTransformFactory#DefaultMathTransformFactory()}.</p>
*
* <p>Some usages for this class are to prepend some values before the elements given by the source {@code Iterable},
- * or to replace some values when they are loaded.</p>
+ * or to replace some values when they are loaded. It may also be used for creating filtered sets when used together
+ * with {@link CollectionsExt#filter CollectionsExt.filter(…)}.</p>
*
* <p>This class is not thread-safe. Synchronization, if desired, shall be done by the caller.</p>
*
@@ -49,7 +49,6 @@ import org.apache.sis.internal.system.De
* @since 0.6
* @module
*/
-@Workaround(library="JDK", version="1.8.0_31-b13")
public class LazySet<E> extends SetOfUnknownSize<E> {
/**
* The type of service to request with {@link ServiceLoader}, or {@code null} if unknown.
Modified: sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/internal/util/CollectionsExtTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/internal/util/CollectionsExtTest.java?rev=1802647&r1=1802646&r2=1802647&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/internal/util/CollectionsExtTest.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/internal/util/CollectionsExtTest.java [UTF-8] Fri Jul 21 22:34:29 2017
@@ -36,6 +36,9 @@ import org.junit.Test;
import static org.apache.sis.test.Assert.*;
+// Branch-dependent imports
+import java.util.function.Predicate;
+
/**
* Tests the {@link CollectionsExt} class.
@@ -151,6 +154,21 @@ public final strictfp class CollectionsE
}
/**
+ * Tests {@link CollectionsExt#filter(Iterator, Predicate)}.
+ */
+ @Test
+ public void testFilter() {
+ final Iterator<Integer> it = CollectionsExt.filter(Arrays.asList(2, 5, 7, 4, 8).iterator(), (Integer n) -> (n & 1) == 0);
+ assertTrue ( it.hasNext());
+ assertEquals(2, it.next().intValue());
+ assertEquals(4, it.next().intValue());
+ assertTrue ( it.hasNext());
+ assertTrue ( it.hasNext());
+ assertEquals(8, it.next().intValue());
+ assertFalse ( it.hasNext());
+ }
+
+ /**
* Tests {@link CollectionsExt#identityEquals(Iterator, Iterator)}.
*/
@Test
Modified: sis/branches/JDK8/ide-project/NetBeans/nbproject/build-impl.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/ide-project/NetBeans/nbproject/build-impl.xml?rev=1802647&r1=1802646&r2=1802647&view=diff
==============================================================================
--- sis/branches/JDK8/ide-project/NetBeans/nbproject/build-impl.xml (original)
+++ sis/branches/JDK8/ide-project/NetBeans/nbproject/build-impl.xml Fri Jul 21 22:34:29 2017
@@ -129,7 +129,6 @@ is divided into following sections:
<available file="${test.netcdf.dir}"/>
<available file="${test.shapefile.dir}"/>
<available file="${test.xmlstore.dir}"/>
- <available file="${test.gdal.dir}"/>
<available file="${test.storage.dir}"/>
<available file="${test.feature.dir}"/>
<available file="${test.referencing.dir}"/>
@@ -137,6 +136,7 @@ is divided into following sections:
<available file="${test.metadata.dir}"/>
<available file="${test.utility.dir}"/>
<available file="${test.fra-profile.dir}"/>
+ <available file="${test.gdal.dir}"/>
</or>
</condition>
<condition property="have.sources">
@@ -149,8 +149,6 @@ is divided into following sections:
<available file="${src.netcdf.dir}"/>
<available file="${src.shapefile.dir}"/>
<available file="${src.xmlstore.dir}"/>
- <available file="${src.gdal.dir}"/>
- <available file="${src.c.gdal.dir}"/>
<available file="${src.storage.dir}"/>
<available file="${src.feature.dir}"/>
<available file="${src.referencing.dir}"/>
@@ -158,6 +156,8 @@ is divided into following sections:
<available file="${src.metadata.dir}"/>
<available file="${src.utility.dir}"/>
<available file="${src.fra-profile.dir}"/>
+ <available file="${src.gdal.dir}"/>
+ <available file="${src.c.gdal.dir}"/>
</or>
</condition>
<condition property="netbeans.home+have.tests">
@@ -268,8 +268,6 @@ is divided into following sections:
<fail unless="src.netcdf.dir">Must set src.netcdf.dir</fail>
<fail unless="src.shapefile.dir">Must set src.shapefile.dir</fail>
<fail unless="src.xmlstore.dir">Must set src.xmlstore.dir</fail>
- <fail unless="src.gdal.dir">Must set src.gdal.dir</fail>
- <fail unless="src.c.gdal.dir">Must set src.c.gdal.dir</fail>
<fail unless="src.storage.dir">Must set src.storage.dir</fail>
<fail unless="src.feature.dir">Must set src.feature.dir</fail>
<fail unless="src.referencing.dir">Must set src.referencing.dir</fail>
@@ -277,6 +275,8 @@ is divided into following sections:
<fail unless="src.metadata.dir">Must set src.metadata.dir</fail>
<fail unless="src.utility.dir">Must set src.utility.dir</fail>
<fail unless="src.fra-profile.dir">Must set src.fra-profile.dir</fail>
+ <fail unless="src.gdal.dir">Must set src.gdal.dir</fail>
+ <fail unless="src.c.gdal.dir">Must set src.c.gdal.dir</fail>
<fail unless="test.webapp.dir">Must set test.webapp.dir</fail>
<fail unless="test.console.dir">Must set test.console.dir</fail>
<fail unless="test.earth-obs.dir">Must set test.earth-obs.dir</fail>
@@ -284,7 +284,6 @@ is divided into following sections:
<fail unless="test.netcdf.dir">Must set test.netcdf.dir</fail>
<fail unless="test.shapefile.dir">Must set test.shapefile.dir</fail>
<fail unless="test.xmlstore.dir">Must set test.xmlstore.dir</fail>
- <fail unless="test.gdal.dir">Must set test.gdal.dir</fail>
<fail unless="test.storage.dir">Must set test.storage.dir</fail>
<fail unless="test.feature.dir">Must set test.feature.dir</fail>
<fail unless="test.referencing.dir">Must set test.referencing.dir</fail>
@@ -292,6 +291,7 @@ is divided into following sections:
<fail unless="test.metadata.dir">Must set test.metadata.dir</fail>
<fail unless="test.utility.dir">Must set test.utility.dir</fail>
<fail unless="test.fra-profile.dir">Must set test.fra-profile.dir</fail>
+ <fail unless="test.gdal.dir">Must set test.gdal.dir</fail>
<fail unless="build.dir">Must set build.dir</fail>
<fail unless="dist.dir">Must set dist.dir</fail>
<fail unless="build.classes.dir">Must set build.classes.dir</fail>
@@ -312,7 +312,7 @@ is divided into following sections:
</target>
<target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors">
<macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
- <attribute default="${src.local-src.dir}:${src.webapp.dir}:${src.console.dir}:${src.earth-obs.dir}:${src.geotiff.dir}:${src.netcdf.dir}:${src.shapefile.dir}:${src.xmlstore.dir}:${src.gdal.dir}:${src.c.gdal.dir}:${src.storage.dir}:${src.feature.dir}:${src.referencing.dir}:${src.ref-by-id.dir}:${src.metadata.dir}:${src.utility.dir}:${src.fra-profile.dir}" name="srcdir"/>
+ <attribute default="${src.local-src.dir}:${src.webapp.dir}:${src.console.dir}:${src.earth-obs.dir}:${src.geotiff.dir}:${src.netcdf.dir}:${src.shapefile.dir}:${src.xmlstore.dir}:${src.storage.dir}:${src.feature.dir}:${src.referencing.dir}:${src.ref-by-id.dir}:${src.metadata.dir}:${src.utility.dir}:${src.fra-profile.dir}:${src.gdal.dir}:${src.c.gdal.dir}" name="srcdir"/>
<attribute default="${build.classes.dir}" name="destdir"/>
<attribute default="${javac.classpath}" name="classpath"/>
<attribute default="${javac.processorpath}" name="processorpath"/>
@@ -353,7 +353,7 @@ is divided into following sections:
</target>
<target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal">
<macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
- <attribute default="${src.local-src.dir}:${src.webapp.dir}:${src.console.dir}:${src.earth-obs.dir}:${src.geotiff.dir}:${src.netcdf.dir}:${src.shapefile.dir}:${src.xmlstore.dir}:${src.gdal.dir}:${src.c.gdal.dir}:${src.storage.dir}:${src.feature.dir}:${src.referencing.dir}:${src.ref-by-id.dir}:${src.metadata.dir}:${src.utility.dir}:${src.fra-profile.dir}" name="srcdir"/>
+ <attribute default="${src.local-src.dir}:${src.webapp.dir}:${src.console.dir}:${src.earth-obs.dir}:${src.geotiff.dir}:${src.netcdf.dir}:${src.shapefile.dir}:${src.xmlstore.dir}:${src.storage.dir}:${src.feature.dir}:${src.referencing.dir}:${src.ref-by-id.dir}:${src.metadata.dir}:${src.utility.dir}:${src.fra-profile.dir}:${src.gdal.dir}:${src.c.gdal.dir}" name="srcdir"/>
<attribute default="${build.classes.dir}" name="destdir"/>
<attribute default="${javac.classpath}" name="classpath"/>
<attribute default="${javac.processorpath}" name="processorpath"/>
@@ -386,7 +386,7 @@ is divided into following sections:
</target>
<target depends="-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac">
<macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
- <attribute default="${src.local-src.dir}:${src.webapp.dir}:${src.console.dir}:${src.earth-obs.dir}:${src.geotiff.dir}:${src.netcdf.dir}:${src.shapefile.dir}:${src.xmlstore.dir}:${src.gdal.dir}:${src.c.gdal.dir}:${src.storage.dir}:${src.feature.dir}:${src.referencing.dir}:${src.ref-by-id.dir}:${src.metadata.dir}:${src.utility.dir}:${src.fra-profile.dir}" name="srcdir"/>
+ <attribute default="${src.local-src.dir}:${src.webapp.dir}:${src.console.dir}:${src.earth-obs.dir}:${src.geotiff.dir}:${src.netcdf.dir}:${src.shapefile.dir}:${src.xmlstore.dir}:${src.storage.dir}:${src.feature.dir}:${src.referencing.dir}:${src.ref-by-id.dir}:${src.metadata.dir}:${src.utility.dir}:${src.fra-profile.dir}:${src.gdal.dir}:${src.c.gdal.dir}" name="srcdir"/>
<attribute default="${build.classes.dir}" name="destdir"/>
<attribute default="${javac.classpath}" name="classpath"/>
<sequential>
@@ -494,9 +494,6 @@ is divided into following sections:
<fileset dir="${test.xmlstore.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
<filename name="@{testincludes}"/>
</fileset>
- <fileset dir="${test.gdal.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
- <filename name="@{testincludes}"/>
- </fileset>
<fileset dir="${test.storage.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
<filename name="@{testincludes}"/>
</fileset>
@@ -518,6 +515,9 @@ is divided into following sections:
<fileset dir="${test.fra-profile.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
<filename name="@{testincludes}"/>
</fileset>
+ <fileset dir="${test.gdal.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
+ <filename name="@{testincludes}"/>
+ </fileset>
<fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}">
<filename name="${test.binarytestincludes}"/>
</fileset>
@@ -568,9 +568,6 @@ is divided into following sections:
<fileset dir="${test.xmlstore.dir}" excludes="@{excludes},**/*.xml,${excludes}" includes="@{includes}">
<filename name="@{testincludes}"/>
</fileset>
- <fileset dir="${test.gdal.dir}" excludes="@{excludes},**/*.xml,${excludes}" includes="@{includes}">
- <filename name="@{testincludes}"/>
- </fileset>
<fileset dir="${test.storage.dir}" excludes="@{excludes},**/*.xml,${excludes}" includes="@{includes}">
<filename name="@{testincludes}"/>
</fileset>
@@ -592,6 +589,9 @@ is divided into following sections:
<fileset dir="${test.fra-profile.dir}" excludes="@{excludes},**/*.xml,${excludes}" includes="@{includes}">
<filename name="@{testincludes}"/>
</fileset>
+ <fileset dir="${test.gdal.dir}" excludes="@{excludes},**/*.xml,${excludes}" includes="@{includes}">
+ <filename name="@{testincludes}"/>
+ </fileset>
</union>
<taskdef classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}" name="testng"/>
<testng classfilesetref="test.set" failureProperty="tests.failed" listeners="org.testng.reporters.VerboseReporter" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="Apache_SIS_for_JDK8" testname="TestNG tests" workingDir="${work.dir}">
@@ -722,9 +722,6 @@ is divided into following sections:
<fileset dir="${test.xmlstore.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
<filename name="@{testincludes}"/>
</fileset>
- <fileset dir="${test.gdal.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
- <filename name="@{testincludes}"/>
- </fileset>
<fileset dir="${test.storage.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
<filename name="@{testincludes}"/>
</fileset>
@@ -746,6 +743,9 @@ is divided into following sections:
<fileset dir="${test.fra-profile.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
<filename name="@{testincludes}"/>
</fileset>
+ <fileset dir="${test.gdal.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
+ <filename name="@{testincludes}"/>
+ </fileset>
<fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}">
<filename name="${test.binarytestincludes}"/>
</fileset>
@@ -1118,7 +1118,7 @@ is divided into following sections:
<include name="*"/>
</dirset>
</pathconvert>
- <j2seproject3:depend srcdir="${src.local-src.dir}:${src.webapp.dir}:${src.console.dir}:${src.earth-obs.dir}:${src.geotiff.dir}:${src.netcdf.dir}:${src.shapefile.dir}:${src.xmlstore.dir}:${src.gdal.dir}:${src.c.gdal.dir}:${src.storage.dir}:${src.feature.dir}:${src.referencing.dir}:${src.ref-by-id.dir}:${src.metadata.dir}:${src.utility.dir}:${src.fra-profile.dir}:${build.generated.subdirs}"/>
+ <j2seproject3:depend srcdir="${src.local-src.dir}:${src.webapp.dir}:${src.console.dir}:${src.earth-obs.dir}:${src.geotiff.dir}:${src.netcdf.dir}:${src.shapefile.dir}:${src.xmlstore.dir}:${src.storage.dir}:${src.feature.dir}:${src.referencing.dir}:${src.ref-by-id.dir}:${src.metadata.dir}:${src.utility.dir}:${src.fra-profile.dir}:${src.gdal.dir}:${src.c.gdal.dir}:${build.generated.subdirs}"/>
</target>
<target depends="init,deps-jar,-pre-pre-compile,-pre-compile, -copy-persistence-xml,-compile-depend" if="have.sources" name="-do-compile">
<j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/>
@@ -1131,8 +1131,6 @@ is divided into following sections:
<fileset dir="${src.netcdf.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${src.shapefile.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${src.xmlstore.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
- <fileset dir="${src.gdal.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
- <fileset dir="${src.c.gdal.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${src.storage.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${src.feature.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${src.referencing.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
@@ -1140,6 +1138,8 @@ is divided into following sections:
<fileset dir="${src.metadata.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${src.utility.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${src.fra-profile.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+ <fileset dir="${src.gdal.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+ <fileset dir="${src.c.gdal.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
</copy>
</target>
<target if="has.persistence.xml" name="-copy-persistence-xml">
@@ -1160,7 +1160,7 @@ is divided into following sections:
<target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
<fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
<j2seproject3:force-recompile/>
- <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.local-src.dir}:${src.webapp.dir}:${src.console.dir}:${src.earth-obs.dir}:${src.geotiff.dir}:${src.netcdf.dir}:${src.shapefile.dir}:${src.xmlstore.dir}:${src.gdal.dir}:${src.c.gdal.dir}:${src.storage.dir}:${src.feature.dir}:${src.referencing.dir}:${src.ref-by-id.dir}:${src.metadata.dir}:${src.utility.dir}:${src.fra-profile.dir}"/>
+ <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.local-src.dir}:${src.webapp.dir}:${src.console.dir}:${src.earth-obs.dir}:${src.geotiff.dir}:${src.netcdf.dir}:${src.shapefile.dir}:${src.xmlstore.dir}:${src.storage.dir}:${src.feature.dir}:${src.referencing.dir}:${src.ref-by-id.dir}:${src.metadata.dir}:${src.utility.dir}:${src.fra-profile.dir}:${src.gdal.dir}:${src.c.gdal.dir}"/>
</target>
<target name="-post-compile-single">
<!-- Empty placeholder for easier customization. -->
@@ -1450,12 +1450,6 @@ is divided into following sections:
<fileset dir="${src.xmlstore.dir}" excludes="${bug5101868workaround},${excludes}" includes="${includes}">
<filename name="**/*.java"/>
</fileset>
- <fileset dir="${src.gdal.dir}" excludes="${bug5101868workaround},${excludes}" includes="${includes}">
- <filename name="**/*.java"/>
- </fileset>
- <fileset dir="${src.c.gdal.dir}" excludes="${bug5101868workaround},${excludes}" includes="${includes}">
- <filename name="**/*.java"/>
- </fileset>
<fileset dir="${src.storage.dir}" excludes="${bug5101868workaround},${excludes}" includes="${includes}">
<filename name="**/*.java"/>
</fileset>
@@ -1477,6 +1471,12 @@ is divided into following sections:
<fileset dir="${src.fra-profile.dir}" excludes="${bug5101868workaround},${excludes}" includes="${includes}">
<filename name="**/*.java"/>
</fileset>
+ <fileset dir="${src.gdal.dir}" excludes="${bug5101868workaround},${excludes}" includes="${includes}">
+ <filename name="**/*.java"/>
+ </fileset>
+ <fileset dir="${src.c.gdal.dir}" excludes="${bug5101868workaround},${excludes}" includes="${includes}">
+ <filename name="**/*.java"/>
+ </fileset>
<fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
<include name="**/*.java"/>
<exclude name="*.java"/>
@@ -1508,12 +1508,6 @@ is divided into following sections:
<fileset dir="${src.xmlstore.dir}" excludes="${excludes}" includes="${includes}">
<filename name="**/doc-files/**"/>
</fileset>
- <fileset dir="${src.gdal.dir}" excludes="${excludes}" includes="${includes}">
- <filename name="**/doc-files/**"/>
- </fileset>
- <fileset dir="${src.c.gdal.dir}" excludes="${excludes}" includes="${includes}">
- <filename name="**/doc-files/**"/>
- </fileset>
<fileset dir="${src.storage.dir}" excludes="${excludes}" includes="${includes}">
<filename name="**/doc-files/**"/>
</fileset>
@@ -1535,6 +1529,12 @@ is divided into following sections:
<fileset dir="${src.fra-profile.dir}" excludes="${excludes}" includes="${includes}">
<filename name="**/doc-files/**"/>
</fileset>
+ <fileset dir="${src.gdal.dir}" excludes="${excludes}" includes="${includes}">
+ <filename name="**/doc-files/**"/>
+ </fileset>
+ <fileset dir="${src.c.gdal.dir}" excludes="${excludes}" includes="${includes}">
+ <filename name="**/doc-files/**"/>
+ </fileset>
<fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
<include name="**/doc-files/**"/>
</fileset>
@@ -1557,10 +1557,10 @@ is divided into following sections:
<!-- You can override this target in the ../build.xml file. -->
</target>
<target if="do.depend.true" name="-compile-test-depend">
- <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.webapp.dir}:${test.console.dir}:${test.earth-obs.dir}:${test.geotiff.dir}:${test.netcdf.dir}:${test.shapefile.dir}:${test.xmlstore.dir}:${test.gdal.dir}:${test.storage.dir}:${test.feature.dir}:${test.referencing.dir}:${test.ref-by-id.dir}:${test.metadata.dir}:${test.utility.dir}:${test.fra-profile.dir}"/>
+ <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.webapp.dir}:${test.console.dir}:${test.earth-obs.dir}:${test.geotiff.dir}:${test.netcdf.dir}:${test.shapefile.dir}:${test.xmlstore.dir}:${test.storage.dir}:${test.feature.dir}:${test.referencing.dir}:${test.ref-by-id.dir}:${test.metadata.dir}:${test.utility.dir}:${test.fra-profile.dir}:${test.gdal.dir}"/>
</target>
<target depends="init,deps-jar,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
- <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" processorpath="${javac.test.processorpath}" srcdir="${test.webapp.dir}:${test.console.dir}:${test.earth-obs.dir}:${test.geotiff.dir}:${test.netcdf.dir}:${test.shapefile.dir}:${test.xmlstore.dir}:${test.gdal.dir}:${test.storage.dir}:${test.feature.dir}:${test.referencing.dir}:${test.ref-by-id.dir}:${test.metadata.dir}:${test.utility.dir}:${test.fra-profile.dir}"/>
+ <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" processorpath="${javac.test.processorpath}" srcdir="${test.webapp.dir}:${test.console.dir}:${test.earth-obs.dir}:${test.geotiff.dir}:${test.netcdf.dir}:${test.shapefile.dir}:${test.xmlstore.dir}:${test.storage.dir}:${test.feature.dir}:${test.referencing.dir}:${test.ref-by-id.dir}:${test.metadata.dir}:${test.utility.dir}:${test.fra-profile.dir}:${test.gdal.dir}"/>
<copy todir="${build.test.classes.dir}">
<fileset dir="${test.webapp.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${test.console.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
@@ -1569,7 +1569,6 @@ is divided into following sections:
<fileset dir="${test.netcdf.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${test.shapefile.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${test.xmlstore.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
- <fileset dir="${test.gdal.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${test.storage.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${test.feature.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${test.referencing.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
@@ -1577,6 +1576,7 @@ is divided into following sections:
<fileset dir="${test.metadata.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${test.utility.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${test.fra-profile.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+ <fileset dir="${test.gdal.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
</copy>
</target>
<target name="-post-compile-test">
@@ -1591,7 +1591,7 @@ is divided into following sections:
<target depends="init,deps-jar,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
<fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
<j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
- <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" processorpath="${javac.test.processorpath}" sourcepath="${test.webapp.dir}:${test.console.dir}:${test.earth-obs.dir}:${test.geotiff.dir}:${test.netcdf.dir}:${test.shapefile.dir}:${test.xmlstore.dir}:${test.gdal.dir}:${test.storage.dir}:${test.feature.dir}:${test.referencing.dir}:${test.ref-by-id.dir}:${test.metadata.dir}:${test.utility.dir}:${test.fra-profile.dir}" srcdir="${test.webapp.dir}:${test.console.dir}:${test.earth-obs.dir}:${test.geotiff.dir}:${test.netcdf.dir}:${test.shapefile.dir}:${test.xmlstore.dir}:${test.gdal.dir}:${test.storage.dir}:${test.feature.dir}:${test.referencing.dir}:${test.ref-by-id.dir}:${test.metadata.dir}:${test.utility.dir}:${test.fra-profile.dir}"/>
+ <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" processorpath="${javac.test.processorpath}" sourcepath="${test.webapp.dir}:${test.console.dir}:${test.earth-obs.dir}:${test.geotiff.dir}:${test.netcdf.dir}:${test.shapefile.dir}:${test.xmlstore.dir}:${test.storage.dir}:${test.feature.dir}:${test.referencing.dir}:${test.ref-by-id.dir}:${test.metadata.dir}:${test.utility.dir}:${test.fra-profile.dir}:${test.gdal.dir}" srcdir="${test.webapp.dir}:${test.console.dir}:${test.earth-obs.dir}:${test.geotiff.dir}:${test.netcdf.dir}:${test.shapefile.dir}:${test.xmlstore.dir}:${test.storage.dir}:${test.feature.dir}:${test.referencing.dir}:${test.ref-by-id.dir}:${test.metadata.dir}:${test.utility.dir}:${test.fra-profile.dir}:${test.gdal.dir}"/>
<copy todir="${build.test.classes.dir}">
<fileset dir="${test.webapp.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${test.console.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
@@ -1600,7 +1600,6 @@ is divided into following sections:
<fileset dir="${test.netcdf.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${test.shapefile.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${test.xmlstore.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
- <fileset dir="${test.gdal.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${test.storage.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${test.feature.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${test.referencing.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
@@ -1608,6 +1607,7 @@ is divided into following sections:
<fileset dir="${test.metadata.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${test.utility.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${test.fra-profile.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+ <fileset dir="${test.gdal.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
</copy>
</target>
<target name="-post-compile-test-single">
Modified: sis/branches/JDK8/ide-project/NetBeans/nbproject/genfiles.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/ide-project/NetBeans/nbproject/genfiles.properties?rev=1802647&r1=1802646&r2=1802647&view=diff
==============================================================================
--- sis/branches/JDK8/ide-project/NetBeans/nbproject/genfiles.properties [ISO-8859-1] (original)
+++ sis/branches/JDK8/ide-project/NetBeans/nbproject/genfiles.properties [ISO-8859-1] Fri Jul 21 22:34:29 2017
@@ -3,6 +3,6 @@
build.xml.data.CRC32=58e6b21c
build.xml.script.CRC32=462eaba0
build.xml.stylesheet.CRC32=28e38971@1.53.1.46
-nbproject/build-impl.xml.data.CRC32=2845adb3
-nbproject/build-impl.xml.script.CRC32=e0d2517f
+nbproject/build-impl.xml.data.CRC32=e074304a
+nbproject/build-impl.xml.script.CRC32=d7262da6
nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48
Modified: sis/branches/JDK8/ide-project/NetBeans/nbproject/project.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/ide-project/NetBeans/nbproject/project.xml?rev=1802647&r1=1802646&r2=1802647&view=diff
==============================================================================
--- sis/branches/JDK8/ide-project/NetBeans/nbproject/project.xml (original)
+++ sis/branches/JDK8/ide-project/NetBeans/nbproject/project.xml Fri Jul 21 22:34:29 2017
@@ -31,8 +31,6 @@
<root id="src.netcdf.dir" name="NetCDF"/>
<root id="src.shapefile.dir" name="Shapefile"/>
<root id="src.xmlstore.dir" name="XMLStore"/>
- <root id="src.gdal.dir" name="GDAL/Proj4"/>
- <root id="src.c.gdal.dir" name="GDAL/Proj4 JNI"/>
<root id="src.storage.dir" name="Storage"/>
<root id="src.feature.dir" name="Feature"/>
<root id="src.referencing.dir" name="Referencing"/>
@@ -40,6 +38,8 @@
<root id="src.metadata.dir" name="Metadata"/>
<root id="src.utility.dir" name="Utility"/>
<root id="src.fra-profile.dir" name="French profile"/>
+ <root id="src.gdal.dir" name="GDAL/Proj4"/>
+ <root id="src.c.gdal.dir" name="GDAL/Proj4 JNI"/>
</source-roots>
<test-roots>
<root id="test.webapp.dir" name="Test web application"/>
@@ -49,7 +49,6 @@
<root id="test.netcdf.dir" name="Test NetCDF"/>
<root id="test.shapefile.dir" name="Test Shapefile"/>
<root id="test.xmlstore.dir" name="Test XMLStore"/>
- <root id="test.gdal.dir" name="Test GDAL/Proj4"/>
<root id="test.storage.dir" name="Test Storage"/>
<root id="test.feature.dir" name="Test Feature"/>
<root id="test.referencing.dir" name="Test Referencing"/>
@@ -57,6 +56,7 @@
<root id="test.metadata.dir" name="Test Metadata"/>
<root id="test.utility.dir" name="Test Utility"/>
<root id="test.fra-profile.dir" name="Test French profile"/>
+ <root id="test.gdal.dir" name="Test GDAL/Proj4"/>
</test-roots>
</data>
<references xmlns="http://www.netbeans.org/ns/ant-project-references/1">
Modified: sis/branches/JDK8/storage/sis-gdal/src/main/c/org_apache_sis_storage_gdal_PJ.c
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-gdal/src/main/c/org_apache_sis_storage_gdal_PJ.c?rev=1802647&r1=1802646&r2=1802647&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-gdal/src/main/c/org_apache_sis_storage_gdal_PJ.c [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-gdal/src/main/c/org_apache_sis_storage_gdal_PJ.c [UTF-8] Fri Jul 21 22:34:29 2017
@@ -339,7 +339,7 @@ JNIEXPORT void JNICALL Java_org_apache_s
if (c) (*env)->ThrowNew(env, c, "The target CRS and the coordinates array can not be null.");
return;
}
- if (dimension < 2 || dimension > 100) { // Arbitrary upper value for catching potential misuse.
+ if (dimension < 2 || dimension > 100) { // Arbitrary upper value for catching potential misuse.
jclass c = (*env)->FindClass(env, "java/lang/IllegalArgumentException");
if (c) (*env)->ThrowNew(env, c, "Illegal dimension. Must be in the [2-100] range.");
return;
Modified: sis/branches/JDK8/storage/sis-gdal/src/main/c/org_apache_sis_storage_gdal_PJ.h
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-gdal/src/main/c/org_apache_sis_storage_gdal_PJ.h?rev=1802647&r1=1802646&r2=1802647&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-gdal/src/main/c/org_apache_sis_storage_gdal_PJ.h [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-gdal/src/main/c/org_apache_sis_storage_gdal_PJ.h [UTF-8] Fri Jul 21 22:34:29 2017
@@ -7,8 +7,6 @@
#ifdef __cplusplus
extern "C" {
#endif
-#undef org_apache_sis_storage_gdal_PJ_DIMENSION_MAX
-#define org_apache_sis_storage_gdal_PJ_DIMENSION_MAX 100L
/*
* Class: org_apache_sis_storage_gdal_PJ
* Method: allocatePJ
Modified: sis/branches/JDK8/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/PJ.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/PJ.java?rev=1802647&r1=1802646&r2=1802647&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/PJ.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/PJ.java [UTF-8] Fri Jul 21 22:34:29 2017
@@ -17,7 +17,9 @@
package org.apache.sis.storage.gdal;
import java.util.Objects;
-import java.lang.annotation.Native;
+import java.io.Serializable;
+import java.io.ObjectStreamException;
+import java.io.InvalidObjectException;
import org.opengis.metadata.Identifier;
import org.opengis.util.FactoryException;
import org.opengis.util.InternationalString;
@@ -52,14 +54,8 @@ import org.apache.sis.internal.system.OS
* @since 0.8
* @module
*/
-final class PJ implements Identifier {
- /**
- * The maximal number of dimension accepted by the {@link #transform(PJ, int, double[], int, int)} method.
- * This upper limit is actually somewhat arbitrary. This limit exists mostly as a safety against potential misuse.
- */
- @Native
- static final int DIMENSION_MAX = 100;
-
+@SuppressWarnings("serial") // serialVersionUID not needed since writeReplace() gives another kind of object.
+final class PJ implements Identifier, Serializable {
/**
* Loads the {@literal Proj.4} library.
* This static initializer may throw a {@link UnsatisfiedLinkError} if the static library can not be loaded.
@@ -71,8 +67,8 @@ final class PJ implements Identifier {
}
/**
- * The pointer to {@code PJ} structure allocated in the C/C++ heap. This value has no
- * meaning in Java code. <strong>Do not modify</strong>, since this value is used by Proj.4.
+ * The pointer to {@code PJ} structure allocated in the C/C++ heap. This value has no meaning in Java code,
+ * except 0 which means no native object. <strong>Do not modify</strong>, since this value is used by Proj.4.
* Do not rename neither, unless you update accordingly the C code in JNI wrappers.
*/
private final long ptr;
@@ -342,7 +338,7 @@ final class PJ implements Identifier {
* </ul>
*
* @param target the target CRS.
- * @param dimension the dimension of each coordinate value. Must be in the [2-{@value #DIMENSION_MAX}] range.
+ * @param dimension the dimension of each coordinate value. Typically 2, 3 or 4.
* @param coordinates the coordinates to transform, as a sequence of (<var>x</var>,<var>y</var>,<<var>z</var>>,…) tuples.
* @param offset offset of the first coordinate in the given array.
* @param numPts number of points to transform.
@@ -397,4 +393,59 @@ final class PJ implements Identifier {
@Override
@SuppressWarnings("FinalizeDeclaration")
protected final native void finalize();
+
+ /**
+ * The object serialized in place of {@literal Proj.4} wrappers.
+ * Deserialization checks for the presence of Proj.4 native library.
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @version 0.8
+ * @since 0.8
+ * @module
+ */
+ private static final class Serialized implements Serializable {
+ /**
+ * For cross-version compatibility.
+ */
+ private static final long serialVersionUID = -5705027681492462823L;
+
+ /**
+ * The {@literal Proj.4} definition string.
+ */
+ private final String definition;
+
+ /**
+ * Creates a new proxy for the given {@literal Proj.4} definition.
+ */
+ Serialized(final String definition) {
+ this.definition = definition;
+ }
+
+ /**
+ * Automatically invoked on deserialization for reconstructing the wrapper
+ * from the {@literal Proj.4} definition string.
+ */
+ protected final Object readResolve() throws ObjectStreamException {
+ final String message;
+ final Throwable cause;
+ try {
+ return new PJ(definition);
+ } catch (UnsatisfiedLinkError | NoClassDefFoundError e) {
+ message = Proj4.unavailable();
+ cause = e;
+ } catch (InvalidGeodeticParameterException e) {
+ message = e.getLocalizedMessage();
+ cause = e;
+ }
+ throw (InvalidObjectException) new InvalidObjectException(message).initCause(cause);
+ }
+ }
+
+ /**
+ * Invoked automatically on serialization.
+ * Replaces this {@literal Proj.4} wrapper by a proxy without native resource.
+ */
+ protected final Object writeReplace() throws ObjectStreamException {
+ return new Serialized(getCode());
+ }
}
Modified: sis/branches/JDK8/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4.java?rev=1802647&r1=1802646&r2=1802647&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4.java [UTF-8] Fri Jul 21 22:34:29 2017
@@ -55,7 +55,7 @@ import org.apache.sis.measure.Units;
*
* <ul>
* <li>{@linkplain #createCRS Create a Coordinate Reference System instance from a Proj.4 definition string}.</li>
- * <li>Conversely, {@link #definition get a Proj.4 definition string from a Coordinate Reference System}.</li>
+ * <li>Conversely, {@linkplain #definition get a Proj.4 definition string from a Coordinate Reference System}.</li>
* <li>{@linkplain #createOperation Create a coordinate operation backed by Proj.4 between two arbitrary CRS}.</li>
* </ul>
*
@@ -80,7 +80,7 @@ public final class Proj4 extends Static
*
* <div class="note"><b>Example:</b> Rel. 4.9.3, 15 August 2016</div>
*
- * @return the Proj.4 release string, or {@code null} if no installation has been found.
+ * @return the Proj.4 release string, or {@code null} if the native library has been found.
*/
public static String version() {
try {
@@ -156,7 +156,7 @@ public final class Proj4 extends Static
* associated to the CRS.
*/
final StringBuilder definition = new StringBuilder(100);
- definition.append("+proj=").append(method);
+ definition.append(Proj4Factory.PROJ_PARAM).append(method);
boolean hasSemiMajor = false;
boolean hasSemiMinor = false;
if (parameters != null) {
@@ -229,18 +229,20 @@ public final class Proj4 extends Static
* @param dimension the number of dimension of the CRS to create (2 or 3).
* @return a CRS created from the given definition string and number of dimensions.
* @throws NullPointerException if the definition string is {@code null}.
- * @throws FactoryException if one of the given argument has an invalid value.
+ * @throws IllegalArgumentException if the definition string is empty or the dimension argument is out of range.
+ * @throws UnavailableFactoryException if the Proj.4 native library is not available.
+ * @throws FactoryException if the CRS creation failed for another reason.
*
* @see Proj4Factory#createCoordinateReferenceSystem(String)
*/
public static CoordinateReferenceSystem createCRS(String definition, final int dimension) throws FactoryException {
- definition = definition.trim();
- ArgumentChecks.ensureNonEmpty(definition, definition);
+ ArgumentChecks.ensureNonEmpty("definition", definition);
ArgumentChecks.ensureBetween("dimension", 2, 3, dimension);
+ definition = definition.trim();
try {
return Proj4Factory.INSTANCE.createCRS(definition, dimension >= 3);
} catch (UnsatisfiedLinkError | NoClassDefFoundError e) {
- throw new UnavailableFactoryException(Errors.format(Errors.Keys.NativeInterfacesNotFound_2, OS.uname(), "libproj"), e);
+ throw new UnavailableFactoryException(unavailable(), e);
}
}
@@ -253,7 +255,8 @@ public final class Proj4 extends Static
* @param sourceCRS the source coordinate reference system.
* @param targetCRS the target coordinate reference system.
* @return a coordinate operation for transforming coordinates from the given source CRS to the given target CRS.
- * @throws FactoryException if an error occurred while creating the coordinate operation.
+ * @throws UnavailableFactoryException if the Proj.4 native library is not available.
+ * @throws FactoryException if the operation creation failed for another reason.
*
* @see Proj4Factory#createOperation(CoordinateReferenceSystem, CoordinateReferenceSystem)
*/
@@ -266,7 +269,14 @@ public final class Proj4 extends Static
try {
return Proj4Factory.INSTANCE.createOperation(sourceCRS, targetCRS);
} catch (UnsatisfiedLinkError | NoClassDefFoundError e) {
- throw new UnavailableFactoryException(Errors.format(Errors.Keys.NativeInterfacesNotFound_2, OS.uname(), "libproj"), e);
+ throw new UnavailableFactoryException(unavailable(), e);
}
}
+
+ /**
+ * Returns the error message for a {@literal Proj.4} not found.
+ */
+ static String unavailable() {
+ return Errors.format(Errors.Keys.NativeInterfacesNotFound_2, OS.uname(), "libproj");
+ }
}
Modified: sis/branches/JDK8/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4Factory.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4Factory.java?rev=1802647&r1=1802646&r2=1802647&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4Factory.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4Factory.java [UTF-8] Fri Jul 21 22:34:29 2017
@@ -23,33 +23,38 @@ import java.util.LinkedHashSet;
import java.util.Collections;
import javax.measure.Unit;
import org.opengis.util.FactoryException;
+import org.opengis.util.NoSuchIdentifierException;
import org.opengis.metadata.Identifier;
import org.opengis.metadata.citation.Citation;
+import org.opengis.parameter.GeneralParameterValue;
+import org.opengis.parameter.ParameterValue;
import org.opengis.parameter.ParameterValueGroup;
import org.opengis.referencing.cs.*;
import org.opengis.referencing.crs.*;
import org.opengis.referencing.datum.*;
+import org.opengis.referencing.operation.*;
import org.opengis.referencing.IdentifiedObject;
-import org.opengis.referencing.operation.OperationMethod;
-import org.opengis.referencing.operation.Conversion;
-import org.opengis.referencing.operation.CoordinateOperation;
-import org.opengis.referencing.operation.CoordinateOperationFactory;
+import org.apache.sis.referencing.IdentifiedObjects;
import org.apache.sis.referencing.operation.DefaultConversion;
import org.apache.sis.referencing.operation.DefaultCoordinateOperationFactory;
+import org.apache.sis.referencing.factory.InvalidGeodeticParameterException;
import org.apache.sis.referencing.factory.GeodeticAuthorityFactory;
import org.apache.sis.referencing.CommonCRS;
import org.apache.sis.internal.util.Constants;
import org.apache.sis.metadata.iso.citation.Citations;
import org.apache.sis.metadata.iso.ImmutableIdentifier;
import org.apache.sis.internal.metadata.AxisDirections;
+import org.apache.sis.internal.metadata.ReferencingServices;
import org.apache.sis.internal.system.DefaultFactories;
import org.apache.sis.internal.system.Modules;
+import org.apache.sis.internal.util.CollectionsExt;
+import org.apache.sis.internal.util.LazySet;
import org.apache.sis.util.collection.WeakValueHashMap;
import org.apache.sis.util.resources.Vocabulary;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.logging.Logging;
-import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.util.CharSequences;
+import org.apache.sis.util.Classes;
import org.apache.sis.measure.Units;
@@ -60,16 +65,11 @@ import org.apache.sis.measure.Units;
* <ul>
* <li>{@link #getAuthority()}</li>
* <li>{@link #createCoordinateReferenceSystem(String)}</li>
+ * <li>{@link #createOperation(CoordinateReferenceSystem, CoordinateReferenceSystem)}</li>
+ * <li>{@link #createParameterizedTransform(ParameterValueGroup)}</li>
* </ul>
*
- * The following methods delegate to {@link #createCoordinateReferenceSystem(String)} and cast
- * the result if possible, or throw a {@link FactoryException} otherwise.
- * <ul>
- * <li>{@link #createGeographicCRS(String)}</li>
- * <li>{@link #createGeocentricCRS(String)}</li>
- * <li>{@link #createProjectedCRS(String)}</li>
- * <li>{@link #createObject(String)}</li>
- * </ul>
+ * Other methods delegate to one of above-cited methods if possible, or throw a {@link FactoryException} otherwise.
*
* @author Martin Desruisseaux (Geomatys)
* @version 0.8
@@ -77,6 +77,19 @@ import org.apache.sis.measure.Units;
* @module
*/
public class Proj4Factory extends GeodeticAuthorityFactory implements CRSAuthorityFactory {
+ /*
+ * NOTE: Proj4Factory could implement CoordinateOperationFactory or MathTransformFactory.
+ * But we don't do that yet because we are not sure about exposing large amount of
+ * methods that are not really supported by Proj.4 wrappers. However this approach
+ * is experimented in the MTFactory class in the test directory. MTFactory methods
+ * could be refactored here if experience shows us that it would be useful.
+ */
+
+ /**
+ * The {@literal Proj.4} parameter used for projection name.
+ */
+ static final String PROJ_PARAM = '+' + Proj4Parser.PROJ + '=';
+
/**
* The {@literal Proj.4} parameter used for declaration of axis order. Proj.4 expects the axis parameter
* to be exactly 3 characters long, but Apache SIS accepts 2 characters as well. We relax the Proj.4 rule
@@ -88,7 +101,14 @@ public class Proj4Factory extends Geodet
/**
* The default factory instance.
*/
- static final Proj4Factory INSTANCE = new Proj4Factory();
+ static final Proj4Factory INSTANCE = new Proj4Factory(null);
+
+ /**
+ * The default properties, or an empty map if none. This map shall not change after construction in
+ * order to allow usage without synchronization in multi-thread context. But we do not need to wrap
+ * in a unmodifiable map since {@code Proj4Factory} does not provide public access to it.
+ */
+ private final Map<String,?> defaultProperties;
/**
* The factory for coordinate reference system objects.
@@ -106,10 +126,18 @@ public class Proj4Factory extends Geodet
private final DatumFactory datumFactory;
/**
- * The factory for coordinate operation objects.
- * Currently restricted to Apache SIS implementation because we use a method not yet available in GeoAPI.
+ * The {@code MathTransform} factory on which to delegate operations that are not supported by {@code Proj4Factory}.
*/
- private final DefaultCoordinateOperationFactory opFactory;
+ private final MathTransformFactory mtFactory;
+
+ /**
+ * The factory for coordinate operation objects, created when first needed.
+ * Currently restricted to Apache SIS implementation because we use a method not yet available in GeoAPI and
+ * because we configure it for using the {@link MathTransformFactory} provided by this {@code Proj4Factory}.
+ *
+ * @see #opFactory()
+ */
+ private volatile DefaultCoordinateOperationFactory opFactory;
/**
* Poll of identifiers created by this factory.
@@ -124,38 +152,55 @@ public class Proj4Factory extends Geodet
private final WeakValueHashMap<String,PJ> pool = new WeakValueHashMap<>(String.class);
/**
- * Creates a new {@literal Proj.4} factory using the default CRS, CS and datum factories.
+ * Creates a new {@literal Proj.4} factory. The {@code properties} argument is an optional map
+ * for specifying common properties shared by the objects to create. Some available properties are
+ * {@linkplain org.apache.sis.referencing.AbstractIdentifiedObject#AbstractIdentifiedObject(Map) listed there}.
+ * Unknown properties, or properties that do not apply, or properties for which {@code Proj4Factory} supplies
+ * itself a value, are ignored.
+ *
+ * @param properties common properties for the objects to create, or {@code null} if none.
*/
- public Proj4Factory() {
- crsFactory = DefaultFactories.forBuildin(CRSFactory.class);
- csFactory = DefaultFactories.forBuildin(CSFactory.class);
- datumFactory = DefaultFactories.forBuildin(DatumFactory.class);
- opFactory = DefaultFactories.forBuildin(CoordinateOperationFactory.class, DefaultCoordinateOperationFactory.class);
+ public Proj4Factory(Map<String,?> properties) {
+ properties = new HashMap<>(properties != null ? properties : Collections.emptyMap());
+ crsFactory = factory(CRSFactory.class, properties, ReferencingServices.CRS_FACTORY);
+ csFactory = factory(CSFactory.class, properties, ReferencingServices.CS_FACTORY);
+ datumFactory = factory(DatumFactory.class, properties, ReferencingServices.DATUM_FACTORY);
+ mtFactory = factory(MathTransformFactory.class, properties, ReferencingServices.MT_FACTORY);
+ defaultProperties = CollectionsExt.compact(properties);
}
/**
- * Creates a new {@literal Proj.4} factory using the specified CRS, CS and datum factories.
- *
- * @param crsFactory the factory to use for creating Coordinate Reference Systems.
- * @param csFactory the factory to use for creating Coordinate Systems.
- * @param datumFactory the factory to use for creating Geodetic Datums.
- * @param opFactory the factory to use for creating Coordinate Operations.
- * Current implementation requires an instance of {@link DefaultCoordinateOperationFactory},
- * but this may be related in a future Apache SIS version.
+ * Returns the factory to use, using the instance specified in the properties map if it exists,
+ * or the system-wide default instance otherwise.
*/
- public Proj4Factory(final CRSFactory crsFactory,
- final CSFactory csFactory,
- final DatumFactory datumFactory,
- final CoordinateOperationFactory opFactory)
- {
- ArgumentChecks.ensureNonNull("crsFactory", crsFactory);
- ArgumentChecks.ensureNonNull("csFactory", csFactory);
- ArgumentChecks.ensureNonNull("datumFactory", datumFactory);
- ArgumentChecks.ensureNonNull("opFactory", opFactory);
- this.crsFactory = crsFactory;
- this.csFactory = csFactory;
- this.datumFactory = datumFactory;
- this.opFactory = (DefaultCoordinateOperationFactory) opFactory;
+ @SuppressWarnings("unchecked")
+ private static <T> T factory(final Class<T> type, final Map<String,?> properties, final String key) {
+ final Object value = properties.remove(key);
+ if (value == null) {
+ return DefaultFactories.forBuildin(type);
+ }
+ if (type.isInstance(value)) {
+ return (T) value;
+ }
+ throw new IllegalArgumentException(Errors.getResources(properties)
+ .getString(Errors.Keys.IllegalPropertyValueClass_2, key, Classes.getClass(value)));
+ }
+
+ /**
+ * Returns the factory for coordinate operation objects.
+ * The factory is backed by this {@code Proj4Factory} as the {@code MathTransformFactory} implementation.
+ */
+ final DefaultCoordinateOperationFactory opFactory() {
+ DefaultCoordinateOperationFactory factory = opFactory;
+ if (factory == null) {
+ final Map<String,Object> properties = new HashMap<>(defaultProperties);
+ properties.put(ReferencingServices.CRS_FACTORY, crsFactory);
+ properties.put(ReferencingServices.CS_FACTORY, csFactory);
+ properties.put(ReferencingServices.DATUM_FACTORY, datumFactory);
+ factory = new DefaultCoordinateOperationFactory(properties, mtFactory);
+ opFactory = factory;
+ }
+ return factory;
}
/**
@@ -211,11 +256,156 @@ public class Proj4Factory extends Geodet
}
final Set<String> codes = new LinkedHashSet<>(4);
codes.add("+init=");
- codes.add("+proj=".concat(method));
+ codes.add(PROJ_PARAM.concat(method));
return codes;
}
/**
+ * Returns some map projection methods supported by {@literal Proj.4}.
+ * Current implementation can not return the complete list of Proj.4 method, but returns the main ones.
+ * For each operation method in the returned set, the Proj.4 projection name can be obtained as below:
+ *
+ * {@preformat java
+ * String proj = IdentifiedObjects.getName(method, Citations.PROJ4);
+ * }
+ *
+ * The {@code proj} names obtained as above can be given in argument to the
+ * {@link #getOperationMethod(String)} and {@link #getDefaultParameters(String)} methods.
+ *
+ * @param type <code>{@linkplain SingleOperation}.class</code> for fetching all operation methods, or
+ * <code>{@linkplain Projection}.class</code> for fetching only map projection methods.
+ * @return methods available in this factory for coordinate operations of the given type.
+ *
+ * @see org.apache.sis.referencing.operation.transform.DefaultMathTransformFactory#getAvailableMethods(Class)
+ */
+ public Set<OperationMethod> getAvailableMethods(final Class<? extends SingleOperation> type) {
+ return new LazySet<>(CollectionsExt.filter(mtFactory.getAvailableMethods(type).iterator(), Proj4Factory::isSupported));
+ }
+
+ /**
+ * Returns the operation method of the given name. The given argument can be a Proj.4 projection name,
+ * but other authorities (OGC, EPSG…) are also accepted. A partial list of supported projection names
+ * can be obtained by {@link #getAvailableMethods(Class)}. Some examples of Proj.4 projection names
+ * are given below (not all of them are supported by this Proj.4 wrapper).
+ *
+ * <table class="sis">
+ * <caption>Some Proj.4 projection names</caption>
+ * <tr><th>Name</th> <th>Meaning</th></tr>
+ * <tr><td>{@code aea}</td> <td>Albers Equal-Area Conic</td></tr>
+ * <tr><td>{@code aeqd}</td> <td>Azimuthal Equidistant</td></tr>
+ * <tr><td>{@code cass}</td> <td>Cassini-Soldner</td></tr>
+ * <tr><td>{@code cea}</td> <td>Cylindrical Equal Area</td></tr>
+ * <tr><td>{@code eck4}</td> <td>Eckert IV</td></tr>
+ * <tr><td>{@code eck6}</td> <td>Eckert VI</td></tr>
+ * <tr><td>{@code eqdc}</td> <td>Equidistant Conic</td></tr>
+ * <tr><td>{@code gall}</td> <td>Gall Stereograpic</td></tr>
+ * <tr><td>{@code geos}</td> <td>Geostationary Satellite View</td></tr>
+ * <tr><td>{@code gnom}</td> <td>Gnomonic</td></tr>
+ * <tr><td>{@code krovak}</td> <td>Krovak Oblique Conic Conformal</td></tr>
+ * <tr><td>{@code laea}</td> <td>Lambert Azimuthal Equal Area</td></tr>
+ * <tr><td>{@code lcc}</td> <td>Lambert Conic Conformal</td></tr>
+ * <tr><td>{@code merc}</td> <td>Mercator</td></tr>
+ * <tr><td>{@code mill}</td> <td>Miller Cylindrical</td></tr>
+ * <tr><td>{@code moll}</td> <td>Mollweide</td></tr>
+ * <tr><td>{@code nzmg}</td> <td>New Zealand Map Grid</td></tr>
+ * <tr><td>{@code omerc}</td> <td>Oblique Mercator</td></tr>
+ * <tr><td>{@code ortho}</td> <td>Orthographic</td></tr>
+ * <tr><td>{@code sterea}</td> <td>Oblique Stereographic</td></tr>
+ * <tr><td>{@code stere}</td> <td>Stereographic</td></tr>
+ * <tr><td>{@code robin}</td> <td>Robinson</td></tr>
+ * <tr><td>{@code sinu}</td> <td>Sinusoidal</td></tr>
+ * <tr><td>{@code tmerc}</td> <td>Transverse Mercator</td></tr>
+ * <tr><td>{@code vandg}</td> <td>VanDerGrinten</td></tr>
+ * </table>
+ *
+ * The default implementation delegates to a {@code DefaultCoordinateOperationFactory} instance.
+ * It works because the Apache SIS operation methods declare the Proj.4 projection names as
+ * {@linkplain org.apache.sis.referencing.AbstractIdentifiedObject#getAlias() aliases}.
+ *
+ * @param name the name of the operation method to fetch.
+ * @return the operation method of the given name.
+ * @throws FactoryException if the requested operation method can not be fetched.
+ *
+ * @see org.apache.sis.referencing.operation.DefaultCoordinateOperationFactory#getOperationMethod(String)
+ */
+ public OperationMethod getOperationMethod(final String name) throws FactoryException {
+ final OperationMethod method = opFactory().getOperationMethod(name);
+ if (isSupported(method)) {
+ return method;
+ }
+ throw new NoSuchIdentifierException(Errors.getResources(defaultProperties)
+ .getString(Errors.Keys.UnsupportedOperation_1, name), name);
+ }
+
+ /**
+ * Returns the default parameter values for a math transform using the given operation method.
+ * The given argument can be a Proj.4 projection name, but other authorities (OGC, EPSG…) are also accepted.
+ * A partial list of supported projection names can be obtained by {@link #getAvailableMethods(Class)}.
+ * The returned parameters can be given to {@link #createParameterizedTransform(ParameterValueGroup)}.
+ *
+ * @param method the case insensitive name of the coordinate operation method to search for.
+ * @return a new group of parameter values for the {@code OperationMethod} identified by the given name.
+ * @throws NoSuchIdentifierException if there is no method registered for the given name or identifier.
+ */
+ public ParameterValueGroup getDefaultParameters(final String method) throws NoSuchIdentifierException {
+ final ParameterValueGroup parameters = mtFactory.getDefaultParameters(method);
+ if (isSupported(parameters.getDescriptor())) {
+ return parameters;
+ }
+ throw new NoSuchIdentifierException(Errors.getResources(defaultProperties)
+ .getString(Errors.Keys.UnsupportedOperation_1, method), method);
+ }
+
+ /**
+ * Creates a transform from a group of parameters. The {@link OperationMethod} name is inferred from
+ * the {@linkplain org.opengis.parameter.ParameterDescriptorGroup#getName() parameter group name}.
+ * Each parameter value is formatted as a Proj.4 parameter in a definition string.
+ *
+ * <div class="note"><b>Example:</b>
+ * {@preformat java
+ * ParameterValueGroup p = factory.getDefaultParameters("Mercator");
+ * p.parameter("semi_major").setValue(6378137.000);
+ * p.parameter("semi_minor").setValue(6356752.314);
+ * MathTransform mt = factory.createParameterizedTransform(p);
+ * }
+ *
+ * The corresponding Proj.4 definition string is:
+ *
+ * {@preformat text
+ * +proj=merc +a=6378137.0 +b=6356752.314
+ * }
+ * </div>
+ *
+ * @param parameters the parameter values.
+ * @return the parameterized transform.
+ * @throws FactoryException if the object creation failed. This exception is thrown
+ * if some required parameter has not been supplied, or has illegal value.
+ *
+ * @see #getDefaultParameters(String)
+ * @see #getAvailableMethods(Class)
+ */
+ public MathTransform createParameterizedTransform(final ParameterValueGroup parameters) throws FactoryException {
+ final String proj = name(parameters.getDescriptor(), Errors.Keys.UnsupportedOperation_1);
+ final StringBuilder buffer = new StringBuilder(100).append(PROJ_PARAM).append(proj);
+ for (final GeneralParameterValue p : parameters.values()) {
+ /*
+ * Unconditionally ask the parameter name in order to throw an exception
+ * with better error message in case of unrecognized parameter.
+ */
+ final String name = name(p.getDescriptor(), Errors.Keys.UnexpectedParameter_1);
+ if (p instanceof ParameterValue) {
+ final Object value = ((ParameterValue) p).getValue();
+ if (value != null) {
+ buffer.append(" +").append(name).append('=').append(value);
+ }
+ }
+ }
+ final PJ pj = unique(new PJ(buffer.toString()));
+ final PJ base = unique(new PJ(pj));
+ return new Transform(base, false, pj, false);
+ }
+
+ /**
* Creates a new geodetic object from the given {@literal Proj.4} definition.
* The default implementation delegates to {@link #createCoordinateReferenceSystem(String)}.
*
@@ -296,7 +486,7 @@ public class Proj4Factory extends Geodet
* @param keyword the parameter name.
* @return the parameter value as an identifier.
*/
- private Map<String,Identifier> identifier(final String definition, final String keyword) {
+ private Map<String,Object> identifier(final String definition, final String keyword) {
String value = "";
if (keyword != null) {
int i = definition.indexOf(keyword);
@@ -316,7 +506,7 @@ public class Proj4Factory extends Geodet
/**
* Returns the identifier for the given code in {@literal Proj.4} namespace.
*/
- private Map<String,Identifier> identifier(final String code) {
+ private Map<String,Object> identifier(final String code) {
Identifier id = identifiers.computeIfAbsent(code, (k) -> {
short i18n = 0;
if (k.equalsIgnoreCase("Unnamed")) i18n = Vocabulary.Keys.Unnamed;
@@ -324,7 +514,9 @@ public class Proj4Factory extends Geodet
return new ImmutableIdentifier(Citations.PROJ4, Constants.PROJ4, k, null,
(i18n != 0) ? Vocabulary.formatInternational(i18n) : null);
});
- return Collections.singletonMap(IdentifiedObject.NAME_KEY, id);
+ final Map<String,Object> properties = new HashMap<>(defaultProperties);
+ properties.put(IdentifiedObject.NAME_KEY, id);
+ return properties;
}
/**
@@ -384,8 +576,8 @@ public class Proj4Factory extends Geodet
* will be stored as the CRS identifier for allowing OperationFactory to get it back before to
* attempt to create a new one for a given CRS.
*/
- final Map<String,Identifier> csName = identifier("Unnamed");
- final Map<String,Identifier> name = new HashMap<>(identifier(String.valueOf(pj.getDescription())));
+ final Map<String,Object> csName = identifier("Unnamed");
+ final Map<String,Object> name = new HashMap<>(identifier(String.valueOf(pj.getDescription())));
name.put(CoordinateReferenceSystem.IDENTIFIERS_KEY, pj);
switch (type) {
case GEOGRAPHIC: {
@@ -412,7 +604,7 @@ public class Proj4Factory extends Geodet
ParameterValueGroup parameters;
try {
final Proj4Parser parser = new Proj4Parser(pj.getCode());
- method = parser.method(opFactory);
+ method = parser.method(opFactory());
parameters = parser.parameters();
} catch (IllegalArgumentException | FactoryException e) {
Logging.recoverableException(Logging.getLogger(Modules.GDAL), Proj4Factory.class, "createProjectedCRS", e);
@@ -425,7 +617,8 @@ public class Proj4Factory extends Geodet
csFactory.createCartesianCS(csName, axes[0], axes[1]));
}
default: {
- throw new FactoryException(Errors.format(Errors.Keys.UnknownEnumValue_2, type, PJ.Type.class));
+ throw new FactoryException(Errors.getResources(defaultProperties)
+ .getString(Errors.Keys.UnknownEnumValue_2, type, PJ.Type.class));
}
}
}
@@ -488,6 +681,7 @@ public class Proj4Factory extends Geodet
* @throws FactoryException if the given CRS are not instances recognized by this class.
*
* @see Proj4#createOperation(CoordinateReferenceSystem, CoordinateReferenceSystem)
+ * @see DefaultCoordinateOperationFactory#createOperation(CoordinateReferenceSystem, CoordinateReferenceSystem)
*/
public CoordinateOperation createOperation(final CoordinateReferenceSystem sourceCRS,
final CoordinateReferenceSystem targetCRS)
@@ -505,19 +699,51 @@ public class Proj4Factory extends Geodet
}
final Transform tr = new Transform(unwrapOrCreate(sourceCRS), is3D("sourceCRS", sourceCRS),
unwrapOrCreate(targetCRS), is3D("targetCRS", targetCRS));
- return opFactory.createSingleOperation(identifier(name), sourceCRS, targetCRS, null, Transform.METHOD, tr);
+ return opFactory().createSingleOperation(identifier(name), sourceCRS, targetCRS, null, Transform.METHOD, tr);
}
/**
* Returns whether the given CRS is three-dimensional.
* Thrown an exception if the number of dimension is unsupported.
*/
- private static boolean is3D(final String arg, final CoordinateReferenceSystem crs) throws FactoryException {
+ private boolean is3D(final String arg, final CoordinateReferenceSystem crs) throws FactoryException {
final int dim = crs.getCoordinateSystem().getDimension();
final boolean is3D = (dim >= 3);
if (dim < 2 || dim > 3) {
- throw new FactoryException(Errors.format(Errors.Keys.MismatchedDimension_3, arg, is3D ? 3 : 2, dim));
+ throw new FactoryException(Errors.getResources(defaultProperties)
+ .getString(Errors.Keys.MismatchedDimension_3, arg, is3D ? 3 : 2, dim));
}
return is3D;
}
+
+ /**
+ * Returns {@code true} if the given coordinate operation method or parameter group is supported.
+ */
+ private static boolean isSupported(final IdentifiedObject method) {
+ return IdentifiedObjects.getName(method, Citations.PROJ4) != null;
+ }
+
+ /**
+ * Returns the {@literal Proj.4} name of the given parameter value or parameter group.
+ *
+ * @param param the parameter value or parameter group for which to get the Proj.4 name.
+ * @param errorKey the resource key of the error message to produce if no Proj.4 name has been found.
+ * The message shall expect exactly one argument. This error key can be
+ * {@link Errors.Keys#UnsupportedOperation_1} or {@link Errors.Keys#UnexpectedParameter_1}.
+ * @return the Proj.4 name of the given object (never null).
+ * @throws FactoryException if the Proj.4 name has not been found.
+ */
+ private String name(final IdentifiedObject param, final short errorKey) throws FactoryException {
+ String name = IdentifiedObjects.getName(param, Citations.PROJ4);
+ if (name == null) {
+ name = param.getName().getCode();
+ final String message = Errors.getResources(defaultProperties).getString(errorKey, name);
+ if (errorKey == Errors.Keys.UnsupportedOperation_1) {
+ throw new NoSuchIdentifierException(message, name);
+ } else {
+ throw new InvalidGeodeticParameterException(message);
+ }
+ }
+ return name;
+ }
}
Modified: sis/branches/JDK8/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4Parser.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4Parser.java?rev=1802647&r1=1802646&r2=1802647&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4Parser.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4Parser.java [UTF-8] Fri Jul 21 22:34:29 2017
@@ -57,6 +57,11 @@ final class Proj4Parser {
}
/**
+ * The {@value} keyword used for projection name in {@literal Proj.4} definition strings.
+ */
+ static final String PROJ = "proj";
+
+ /**
* The values extracted from the {@literal Proj.4} definition strings.
* Keys are Proj.4 keywords like {@code "a"} or {@code "ts"}.
*/
@@ -96,9 +101,9 @@ final class Proj4Parser {
*/
final OperationMethod method(final DefaultCoordinateOperationFactory opFactory) throws FactoryException {
if (method == null) {
- final String name = parameters.remove("proj");
+ final String name = parameters.remove(PROJ);
if (name == null) {
- throw new InvalidGeodeticParameterException(Errors.format(Errors.Keys.ElementNotFound_1, "proj"));
+ throw new InvalidGeodeticParameterException(Errors.format(Errors.Keys.ElementNotFound_1, PROJ));
}
method = opFactory.getOperationMethod(name);
}
Modified: sis/branches/JDK8/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Transform.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Transform.java?rev=1802647&r1=1802646&r2=1802647&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Transform.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Transform.java [UTF-8] Fri Jul 21 22:34:29 2017
@@ -16,6 +16,7 @@
*/
package org.apache.sis.storage.gdal;
+import java.io.Serializable;
import java.util.Collections;
import org.opengis.parameter.ParameterValueGroup;
import org.opengis.parameter.ParameterDescriptor;
@@ -39,7 +40,12 @@ import org.apache.sis.referencing.operat
* @since 0.8
* @module
*/
-final class Transform extends AbstractMathTransform {
+final class Transform extends AbstractMathTransform implements Serializable {
+ /**
+ * For cross-version compatibility.
+ */
+ private static final long serialVersionUID = -8593638007439108805L;
+
/**
* The operation method for a transformation between two {@link PJ} instances.
* The parameter names are taken from