sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1799891 [1/2] - in /sis/branches/JDK7: ./ application/sis-console/src/main/java/org/apache/sis/console/ core/sis-feature/ core/sis-feature/src/main/java/org/apache/sis/feature/ core/sis-feature/src/main/java/org/apache/sis/feature/builder/...
Date Mon, 26 Jun 2017 12:25:47 GMT
Author: desruisseaux
Date: Mon Jun 26 12:25:46 2017
New Revision: 1799891

URL: http://svn.apache.org/viewvc?rev=1799891&view=rev
Log:
Merge from JDK8 branch.

Added:
    sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/internal/feature/ESRI.java
      - copied unchanged from r1799882, sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/ESRI.java
    sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/internal/feature/JTS.java
      - copied unchanged from r1799882, sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/JTS.java
    sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Java2D.java
      - copied unchanged from r1799882, sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Java2D.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/setup/GeometryLibrary.java
      - copied, changed from r1799882, sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/setup/GeometryLibrary.java
Removed:
    sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/GroupPointsAsPolylineOperation.java
Modified:
    sis/branches/JDK7/   (props changed)
    sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/AboutCommand.java
    sis/branches/JDK7/core/sis-feature/pom.xml
    sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAssociationRole.java
    sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultFeatureType.java
    sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java
    sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/builder/AssociationRoleBuilder.java
    sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/builder/AttributeTypeBuilder.java
    sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/builder/CharacteristicTypeBuilder.java
    sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/builder/FeatureTypeBuilder.java
    sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/builder/OperationWrapper.java
    sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/builder/PropertyTypeBuilder.java
    sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/builder/TypeBuilder.java
    sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/builder/package-info.java
    sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Geometries.java
    sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Resources.java
    sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Resources.properties
    sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Resources_fr.properties
    sis/branches/JDK7/core/sis-feature/src/test/java/org/apache/sis/feature/FeatureMemoryBenchmark.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/geometry/package-info.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGInstaller.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/Benchmark.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MercatorMethodComparison.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/StandardDateFormat.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/math/Vector.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/setup/OptionKey.java
    sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/internal/util/StandardDateFormatTest.java
    sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/collection/CacheTest.java
    sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/collection/RangeSetTest.java
    sis/branches/JDK7/ide-project/NetBeans/nbproject/genfiles.properties
    sis/branches/JDK7/ide-project/NetBeans/nbproject/project.xml
    sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/GridGeometryInfo.java
    sis/branches/JDK7/storage/sis-shapefile/pom.xml
    sis/branches/JDK7/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/MetadataBuilder.java
    sis/branches/JDK7/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/TimeEncoding.java
    sis/branches/JDK7/storage/sis-xmlstore/pom.xml
    sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/GroupAsPolylineOperation.java
    sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Reader.java
    sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Store.java
    sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Types.java
    sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Writer.java

Propchange: sis/branches/JDK7/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Jun 26 12:25:46 2017
@@ -1,5 +1,5 @@
 /sis/branches/Android:1430670-1480699
 /sis/branches/JDK6:1394913-1508480
-/sis/branches/JDK8:1584960-1799451
+/sis/branches/JDK8:1584960-1799886
 /sis/branches/JDK9:1773327-1789983
 /sis/trunk:1394364-1508466,1519089-1519674

Modified: sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/AboutCommand.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/AboutCommand.java?rev=1799891&r1=1799890&r2=1799891&view=diff
==============================================================================
--- sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/AboutCommand.java [UTF-8] (original)
+++ sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/AboutCommand.java [UTF-8] Mon Jun 26 12:25:46 2017
@@ -28,7 +28,6 @@ import javax.management.MBeanServerConne
 import javax.management.remote.JMXServiceURL;
 import javax.management.remote.JMXConnector;
 import javax.management.remote.JMXConnectorFactory;
-import org.apache.sis.internal.system.Loggers;
 import org.apache.sis.setup.About;
 import org.apache.sis.util.Version;
 import org.apache.sis.util.logging.Logging;
@@ -37,8 +36,10 @@ import org.apache.sis.util.resources.Mes
 import org.apache.sis.util.resources.Vocabulary;
 import org.apache.sis.util.collection.TreeTable;
 import org.apache.sis.util.collection.TableColumn;
+import org.apache.sis.internal.system.Loggers;
 import org.apache.sis.internal.system.Supervisor;
 import org.apache.sis.internal.system.SupervisorMBean;
+import org.apache.sis.internal.util.StandardDateFormat;
 import org.apache.sis.internal.util.X364;
 
 
@@ -135,7 +136,7 @@ final class AboutCommand extends Command
                  * Logs a message telling how long it took to receive the reply.
                  * Sometime the delay gives a hint about the server charge.
                  */
-                double delay = (System.nanoTime() - time) / 1E+9;   // In seconds.
+                double delay = (System.nanoTime() - time) / (double) StandardDateFormat.NANOS_PER_SECOND;   // In seconds.
                 if (delay >= 0.1) {
                     final double scale = (delay >= 10) ? 1 : (delay >= 1) ? 10 : 100;
                     delay = Math.rint(delay * scale) / scale;

Modified: sis/branches/JDK7/core/sis-feature/pom.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-feature/pom.xml?rev=1799891&r1=1799890&r2=1799891&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-feature/pom.xml (original)
+++ sis/branches/JDK7/core/sis-feature/pom.xml Mon Jun 26 12:25:46 2017
@@ -122,6 +122,7 @@ Representations of geographic features.
     <dependency>
       <groupId>com.esri.geometry</groupId>
       <artifactId>esri-geometry-api</artifactId>
+      <scope>provided</scope>
     </dependency>
 
     <!-- Test dependencies -->

Modified: sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAssociationRole.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAssociationRole.java?rev=1799891&r1=1799890&r2=1799891&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAssociationRole.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAssociationRole.java [UTF-8] Mon Jun 26 12:25:46 2017
@@ -424,7 +424,7 @@ public class DefaultAssociationRole exte
                 final Class<?> valueClass = pt.getValueClass();
                 if (CharSequence.class.isAssignableFrom(valueClass) ||
                     GenericName .class.isAssignableFrom(valueClass) ||
-                    Identifier.class.isAssignableFrom(valueClass))
+                    Identifier  .class.isAssignableFrom(valueClass))
                 {
                     final String name = pt.getName().toString();
                     if (pt.getMaximumOccurs() != 0) {

Modified: sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultFeatureType.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultFeatureType.java?rev=1799891&r1=1799890&r2=1799891&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultFeatureType.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultFeatureType.java [UTF-8] Mon Jun 26 12:25:46 2017
@@ -806,11 +806,7 @@ public class DefaultFeatureType extends
                             return false;
                         }
                     }
-                    if (r0 instanceof Operation) {
-                        if (!(r1 instanceof Operation) || !isAssignableIgnoreName((Operation) r0, (Operation) r1)) {
-                            return false;
-                        }
-                    }
+                    // No need for explicit AttributeType or Operation checks because they are PropertyType.
                 }
             }
         }

Modified: sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java?rev=1799891&r1=1799890&r2=1799891&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java [UTF-8] Mon Jun 26 12:25:46 2017
@@ -385,8 +385,8 @@ public class FeatureFormat extends Tabul
                 }
                 value = feature.getPropertyValue(propertyType.getName().toString());
                 if (value == null) {
-                    if (propertyType instanceof AttributeType
-                            && ((AttributeType) propertyType).getMinimumOccurs() == 0)
+                    if (propertyType instanceof AttributeType<?>
+                            && ((AttributeType<?>) propertyType).getMinimumOccurs() == 0)
                     {
                         continue;                           // If optional and no value, skip the full row.
                     }

Modified: sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/builder/AssociationRoleBuilder.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/builder/AssociationRoleBuilder.java?rev=1799891&r1=1799890&r2=1799891&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/builder/AssociationRoleBuilder.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/builder/AssociationRoleBuilder.java [UTF-8] Mon Jun 26 12:25:46 2017
@@ -66,7 +66,7 @@ public final class AssociationRoleBuilde
      * @param owner  the builder of the {@code FeatureType} for which to add this property.
      */
     AssociationRoleBuilder(final FeatureTypeBuilder owner, final FeatureType type, final GenericName typeName) {
-        super(owner, null);
+        super(owner);
         this.type     = type;
         this.typeName = typeName;
     }
@@ -77,7 +77,7 @@ public final class AssociationRoleBuilde
      * @param owner  the builder of the {@code FeatureType} for which to add this property.
      */
     AssociationRoleBuilder(final FeatureTypeBuilder owner, final FeatureAssociationRole template) {
-        super(owner, template);
+        super(owner);
         property      = template;
         minimumOccurs = template.getMinimumOccurs();
         maximumOccurs = template.getMaximumOccurs();
@@ -88,6 +88,7 @@ public final class AssociationRoleBuilde
             type     = template.getValueType();
             typeName = type.getName();
         }
+        initialize(template);
     }
 
     /**

Modified: sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/builder/AttributeTypeBuilder.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/builder/AttributeTypeBuilder.java?rev=1799891&r1=1799890&r2=1799891&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/builder/AttributeTypeBuilder.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/builder/AttributeTypeBuilder.java [UTF-8] Mon Jun 26 12:25:46 2017
@@ -129,7 +129,7 @@ public final class AttributeTypeBuilder<
      * @param valueClass  the class of attribute values.
      */
     AttributeTypeBuilder(final FeatureTypeBuilder owner, final Class<V> valueClass) {
-        super(owner, null);
+        super(owner);
         this.valueClass = valueClass;
         characteristics = new ArrayList<>();
     }
@@ -140,7 +140,7 @@ public final class AttributeTypeBuilder<
      * @param owner  the builder of the {@code FeatureType} for which to add the attribute.
      */
     AttributeTypeBuilder(final FeatureTypeBuilder owner, final AttributeType<V> template) {
-        super(owner, template);
+        super(owner);
         property      = template;
         minimumOccurs = template.getMinimumOccurs();
         maximumOccurs = template.getMaximumOccurs();
@@ -151,6 +151,7 @@ public final class AttributeTypeBuilder<
         for (final AttributeType<?> c : tc.values()) {
             characteristics.add(new CharacteristicTypeBuilder<>(this, c));
         }
+        initialize(template);
     }
 
     /**

Modified: sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/builder/CharacteristicTypeBuilder.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/builder/CharacteristicTypeBuilder.java?rev=1799891&r1=1799890&r2=1799891&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/builder/CharacteristicTypeBuilder.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/builder/CharacteristicTypeBuilder.java [UTF-8] Mon Jun 26 12:25:46 2017
@@ -95,7 +95,7 @@ public final class CharacteristicTypeBui
      * @param valueClass  the class of characteristic values.
      */
     CharacteristicTypeBuilder(final AttributeTypeBuilder<?> owner, final Class<V> valueClass) {
-        super(null, owner.getLocale());
+        super(owner.getLocale());
         this.owner = owner;
         this.valueClass = valueClass;
     }
@@ -106,11 +106,12 @@ public final class CharacteristicTypeBui
      * @param owner  the builder of the {@code AttributeType} for which to add this property.
      */
     CharacteristicTypeBuilder(final AttributeTypeBuilder<?> owner, final AttributeType<V> template) {
-        super(template, owner.getLocale());
+        super(owner.getLocale());
         this.owner     = owner;
         characteristic = template;
         valueClass     = template.getValueClass();
         defaultValue   = template.getDefaultValue();
+        initialize(template);
     }
 
     /**

Modified: sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/builder/FeatureTypeBuilder.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/builder/FeatureTypeBuilder.java?rev=1799891&r1=1799890&r2=1799891&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/builder/FeatureTypeBuilder.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/builder/FeatureTypeBuilder.java [UTF-8] Mon Jun 26 12:25:46 2017
@@ -29,11 +29,14 @@ import org.opengis.util.NameSpace;
 import org.opengis.util.GenericName;
 import org.opengis.util.NameFactory;
 import org.opengis.util.FactoryException;
+import org.opengis.metadata.acquisition.GeometryType;
+import org.apache.sis.setup.GeometryLibrary;
 import org.apache.sis.feature.AbstractOperation;
 import org.apache.sis.feature.DefaultFeatureType;
 import org.apache.sis.feature.FeatureOperations;
 import org.apache.sis.internal.system.DefaultFactories;
 import org.apache.sis.internal.feature.AttributeConvention;
+import org.apache.sis.internal.feature.Geometries;
 import org.apache.sis.internal.feature.Resources;
 import org.apache.sis.util.CorruptedObjectException;
 import org.apache.sis.util.resources.Errors;
@@ -89,13 +92,11 @@ import org.opengis.feature.Operation;
  *   ┌────────────┬─────────┬─────────────┬───────────────┐
  *   │ Name       │ Type    │ Cardinality │ Default value │
  *   ├────────────┼─────────┼─────────────┼───────────────┤
- *   │ name       │ String  │ [1 … 1]     │ Utopia        │
- *   │ population │ Integer │ [1 … 1]     │               │
+ *   │ name       │ String  │     [1 … 1] │ Utopia        │
+ *   │ population │ Integer │     [1 … 1] │               │
  *   └────────────┴─────────┴─────────────┴───────────────┘
  * }
  *
- *
- *
  * <p>{@code FeatureTypeBuilder} instances should be short lived.
  * After the {@code FeatureType} has been created, the builder should be discarded.</p>
  *
@@ -183,6 +184,11 @@ public class FeatureTypeBuilder extends
     AttributeTypeBuilder<?> defaultGeometry;
 
     /**
+     * Provides method for creating geometric objects using the library specified by the user.
+     */
+    private final Geometries geometries;
+
+    /**
      * The object created by this builder, or {@code null} if not yet created.
      * This field must be cleared every time that a setter method is invoked on this builder.
      */
@@ -199,97 +205,153 @@ public class FeatureTypeBuilder extends
      * Creates a new builder instance using the given feature type as a template.
      *
      * @param template  an existing feature type to use as a template, or {@code null} if none.
+     *
+     * @see #setAll(FeatureType)
      */
     public FeatureTypeBuilder(final FeatureType template) {
-        this(template, null, null);
+        this(null, null, null);
+        if (template != null) {
+            initialize(template);
+        }
     }
 
     /**
-     * Creates a new builder instance using the given name factory, template and locale for formatting error messages.
+     * Creates a new builder instance using the given name factory, geometry library
+     * and locale for formatting error messages.
      *
-     * @param template  an existing feature type to use as a template, or {@code null} if none.
-     * @param factory   the factory to use for creating names, or {@code null} for the default factory.
-     * @param locale    the locale to use for formatting error messages, or {@code null} for the default locale.
+     * @param factory  the factory to use for creating names, or {@code null} for the default factory.
+     * @param library  the library to use for creating geometric objects, or {@code null} for the default.
+     * @param locale   the locale to use for formatting error messages, or {@code null} for the default locale.
      */
-    public FeatureTypeBuilder(final FeatureType template, NameFactory factory, final Locale locale) {
-        super(template, locale);
+    public FeatureTypeBuilder(NameFactory factory, final GeometryLibrary library, final Locale locale) {
+        super(locale);
         if (factory == null) {
             factory = DefaultFactories.forBuildin(NameFactory.class);
         }
-        nameFactory = factory;
-        properties  = new ArrayList<>();
-        superTypes  = new ArrayList<>();
-        idDelimiter = ":";
+        nameFactory          = factory;
+        geometries           = Geometries.implementation(library);
+        properties           = new ArrayList<>();
+        superTypes           = new ArrayList<>();
+        idDelimiter          = ":";
+        defaultMinimumOccurs = 1;
+        defaultMaximumOccurs = 1;
+    }
+
+    /**
+     * Clears all setting in this builder. After invoking this method, this {@code FeatureTypeBuilder}
+     * is in same state that after it has been constructed. This method can be invoked for reusing the
+     * same builder for creating other {@code FeatureType} instances after {@link #build()} invocation.
+     *
+     * @return {@code this} for allowing method calls chaining.
+     */
+    public FeatureTypeBuilder clear() {
+        reset();
+        properties.clear();
+        superTypes.clear();
+        isAbstract           = false;
+        namespace            = null;
         defaultMinimumOccurs = 1;
         defaultMaximumOccurs = 1;
+        idPrefix             = null;
+        idSuffix             = null;
+        idDelimiter          = ":";
+        identifierCount      = 0;
+        defaultGeometry      = null;
+        clearCache();
+        return this;
+    }
+
+    /**
+     * Sets all properties of this builder to the values of the given feature type.
+     * This builder is {@linkplain #clear() cleared} before the properties of the given type are copied.
+     *
+     * @param  template  an existing feature type to use as a template, or {@code null} if none.
+     * @return {@code this} for allowing method calls chaining.
+     *
+     * @see #FeatureTypeBuilder(FeatureType)
+     */
+    public FeatureTypeBuilder setAll(final FeatureType template) {
+        clear();
         if (template != null) {
-            feature    = template;
-            isAbstract = template.isAbstract();
-            superTypes.addAll(template.getSuperTypes());
+            initialize(template);
+        }
+        return this;
+    }
+
+    /**
+     * Initializes this builder to the value of the given type.
+     * The caller is responsible to invoke {@link #clear()} (if needed) before this method.
+     *
+     * @see #setAll(FeatureType)
+     */
+    private void initialize(final FeatureType template) {
+        super.initialize(template);
+        feature    = template;
+        isAbstract = template.isAbstract();
+        superTypes.addAll(template.getSuperTypes());
+        /*
+         * For each attribute and association, wrap those properties in a builder.
+         * For each operation, wrap them in pseudo-builder only if the operation
+         * is not one of the operations automatically generated by this builder.
+         */
+        final Map<String,Set<AttributeRole>> propertyRoles = new HashMap<>();
+        for (final PropertyType property : template.getProperties(false)) {
+            PropertyTypeBuilder builder;
+            if (property instanceof AttributeType<?>) {
+                builder = new AttributeTypeBuilder<>(this, (AttributeType<?>) property);
+            } else if (property instanceof FeatureAssociationRole) {
+                builder = new AssociationRoleBuilder(this, (FeatureAssociationRole) property);
+            } else {
+                builder = null;                             // Do not create OperationWrapper now - see below.
+            }
             /*
-             * For each attribute and association, wrap those properties in a builder.
-             * For each operation, wrap them in pseudo-builder only if the operation
-             * is not one of the operations automatically generated by this builder.
+             * If the property name is one of our (Apache SIS specific) conventional names, try to reconstitute
+             * the attribute roles that caused FeatureTypeBuilder to produce such property. Those roles usually
+             * need to be applied on the source properties used for calculating the current property. There is
+             * usually at most one role for each source property, but we nevertheless allow an arbitrary amount.
              */
-            final Map<String,Set<AttributeRole>> propertyRoles = new HashMap<>();
-            for (final PropertyType property : template.getProperties(false)) {
-                PropertyTypeBuilder builder;
-                if (property instanceof AttributeType<?>) {
-                    builder = new AttributeTypeBuilder<>(this, (AttributeType<?>) property);
-                } else if (property instanceof FeatureAssociationRole) {
-                    builder = new AssociationRoleBuilder(this, (FeatureAssociationRole) property);
-                } else {
-                    builder = null;                             // Do not create OperationWrapper now - see below.
-                }
-                /*
-                 * If the property name is one of our (Apache SIS specific) conventional names, try to reconstitute
-                 * the attribute roles that caused FeatureTypeBuilder to produce such property. Those roles usually
-                 * need to be applied on the source properties used for calculating the current property. There is
-                 * usually at most one role for each source property, but we nevertheless allow an arbitrary amount.
-                 */
-                final AttributeRole role;
-                final GenericName name = property.getName();
-                if (AttributeConvention.IDENTIFIER_PROPERTY.equals(name)) {
-                    role = AttributeRole.IDENTIFIER_COMPONENT;
-                } else if (AttributeConvention.GEOMETRY_PROPERTY.equals(name)) {
-                    role = AttributeRole.DEFAULT_GEOMETRY;
-                } else if (AttributeConvention.ENVELOPE_PROPERTY.equals(name)) {
-                    // If "sis:envelope" is an operation, skip it completely.
-                    // It will be recreated if a default geometry exists.
-                    role = null;
-                } else {
-                    if (builder == null) {
-                        // For all unknown operation, wrap as-is.
-                        builder = new OperationWrapper(this, property);
-                    }
-                    role = null;
+            final AttributeRole role;
+            final GenericName name = property.getName();
+            if (AttributeConvention.IDENTIFIER_PROPERTY.equals(name)) {
+                role = AttributeRole.IDENTIFIER_COMPONENT;
+            } else if (AttributeConvention.GEOMETRY_PROPERTY.equals(name)) {
+                role = AttributeRole.DEFAULT_GEOMETRY;
+            } else if (AttributeConvention.ENVELOPE_PROPERTY.equals(name)) {
+                // If "sis:envelope" is an operation, skip it completely.
+                // It will be recreated if a default geometry exists.
+                role = null;
+            } else {
+                if (builder == null) {
+                    // For all unknown operation, wrap as-is.
+                    builder = new OperationWrapper(this, property);
                 }
-                if (role != null) {
-                    final Set<AttributeRole> rc = Collections.singleton(role);
-                    if (property instanceof AbstractOperation) {
-                        for (final String dependency : ((AbstractOperation) property).getDependencies()) {
-                            JDK8.merge(propertyRoles, dependency, rc, AttributeRole.merge);
-                        }
-                    } else {
-                        JDK8.merge(propertyRoles, name.toString(), rc, AttributeRole.merge);
+                role = null;
+            }
+            if (role != null) {
+                final Set<AttributeRole> rc = Collections.singleton(role);
+                if (property instanceof AbstractOperation) {
+                    for (final String dependency : ((AbstractOperation) property).getDependencies()) {
+                        JDK8.merge(propertyRoles, dependency, rc, AttributeRole.merge);
                     }
-                }
-                if (builder != null) {
-                    properties.add(builder);
+                } else {
+                    JDK8.merge(propertyRoles, name.toString(), rc, AttributeRole.merge);
                 }
             }
-            /*
-             * At this point we finished to collect information about the attribute roles.
-             * Now assign those roles to the attribute builders. Note that some roles may
-             * be ignored if we didn't found a suitable builder. The roles inference done
-             * in this constructor is only a "best effort".
-             */
-            if (!propertyRoles.isEmpty()) {
-                for (final Map.Entry<String,Set<AttributeRole>> entry : propertyRoles.entrySet()) {
-                    final PropertyTypeBuilder property = forName(properties, entry.getKey());
-                    if (property instanceof AttributeTypeBuilder<?>) {
-                        ((AttributeTypeBuilder<?>) property).roles().addAll(entry.getValue());
-                    }
+            if (builder != null) {
+                properties.add(builder);
+            }
+        }
+        /*
+         * At this point we finished to collect information about the attribute roles.
+         * Now assign those roles to the attribute builders. Note that some roles may
+         * be ignored if we didn't found a suitable builder. The roles inference done
+         * in this constructor is only a "best effort".
+         */
+        if (!propertyRoles.isEmpty()) {
+            for (final Map.Entry<String,Set<AttributeRole>> entry : propertyRoles.entrySet()) {
+                final PropertyTypeBuilder property = forName(properties, entry.getKey());
+                if (property instanceof AttributeTypeBuilder<?>) {
+                    ((AttributeTypeBuilder<?>) property).roles().addAll(entry.getValue());
                 }
             }
         }
@@ -298,6 +360,8 @@ public class FeatureTypeBuilder extends
     /**
      * If the {@code FeatureType} created by the last call to {@link #build()} has been cached,
      * clears that cache. This method must be invoked every time that a setter method is invoked.
+     *
+     * @see #clear()
      */
     @Override
     final void clearCache() {
@@ -614,6 +678,56 @@ public class FeatureTypeBuilder extends
     }
 
     /**
+     * Creates a new attribute for geometries of the given type. This method delegates to {@link #addAttribute(Class)}
+     * with a {@code valueClass} argument inferred from the combination of the {@link GeometryType} argument given to
+     * this method with the {@link GeometryLibrary} argument given at {@linkplain #FeatureTypeBuilder(NameFactory,
+     * GeometryLibrary, Locale) builder creation time}.
+     * The geometry type can be:
+     *
+     * <ul>
+     *   <li>{@link GeometryType#POINT}  for {@code Point} or {@code Point2D} type.</li>
+     *   <li>{@link GeometryType#LINEAR} for {@code Polyline} or {@code LineString} type.</li>
+     *   <li>{@link GeometryType#AREAL}  for {@code Polygon} type.</li>
+     * </ul>
+     *
+     * Geometric objects outside the above list can still be used by declaring their type explicitely.
+     * However in this case there is no isolation level between the geometry types and the library that implement them.
+     *
+     * <div class="note"><b>Example:</b>
+     * the following code creates an attribute named "MyPoint" with values of class
+     * {@link java.awt.geom.Point2D} if the library in use is {@linkplain GeometryLibrary#JAVA2D Java2D}.
+     * The Coordinate Reference System (CRS) uses (<var>longitude</var>, <var>latitude</var>) axes on the WGS 84 datum.
+     * Finally that new attribute is declared the feature <em>default</em> geometry:
+     *
+     * {@preformat java
+     *   builder.addAttribute(GeometryType.POINT).setName("MyPoint")
+     *          .setCRS(CommonCRS.WGS84.normalizedGeographic())
+     *          .addRole(AttributeRole.DEFAULT_GEOMETRY);
+     * }
+     *
+     * If the library in use is JTS or ESRI instead than Java2D,
+     * then the {@code Point} class of those libraries will be used instead of {@code Point2D}.
+     * The fully-qualified class names are given in the {@link GeometryLibrary} javadoc.</div>
+     *
+     * @param  type  kind of geometric object (point, polyline or polygon).
+     * @return a builder for an {@code AttributeType}.
+     */
+    public AttributeTypeBuilder<?> addAttribute(final GeometryType type) {
+        ensureNonNull("type", type);
+        final Class<?> c;
+        if (type.equals(GeometryType.POINT)) {
+            c = geometries.pointClass;
+        } else if (type.equals(GeometryType.LINEAR)) {
+            c = geometries.polylineClass;
+        } else if (type.equals(GeometryType.AREAL)) {
+            c = geometries.polygonClass;
+        } else {
+            throw new IllegalArgumentException(errors().getString(Errors.Keys.UnsupportedArgumentValue_1, type));
+        }
+        return addAttribute(c);
+    }
+
+    /**
      * Creates a new {@code FeatureAssociationRole} builder for features of the given type.
      * The default association name is the name of the given type, but callers should invoke one
      * of the {@code AssociationRoleBuilder.setName(…)} methods on the returned instance with a better name.
@@ -743,6 +857,8 @@ public class FeatureTypeBuilder extends
      *
      * @return the feature type.
      * @throws IllegalStateException if the builder contains inconsistent information.
+     *
+     * @see #clear()
      */
     @Override
     public FeatureType build() throws IllegalStateException {

Modified: sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/builder/OperationWrapper.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/builder/OperationWrapper.java?rev=1799891&r1=1799890&r2=1799891&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/builder/OperationWrapper.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/builder/OperationWrapper.java [UTF-8] Mon Jun 26 12:25:46 2017
@@ -43,10 +43,11 @@ final class OperationWrapper extends Pro
      * Creates a new wrapper for the given operation.
      */
     OperationWrapper(final FeatureTypeBuilder owner, final PropertyType operation) {
-        super(owner, operation);
+        super(owner);
         this.operation = operation;
         minimumOccurs = 1;
         maximumOccurs = 1;
+        initialize(operation);
     }
 
     /**

Modified: sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/builder/PropertyTypeBuilder.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/builder/PropertyTypeBuilder.java?rev=1799891&r1=1799890&r2=1799891&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/builder/PropertyTypeBuilder.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/builder/PropertyTypeBuilder.java [UTF-8] Mon Jun 26 12:25:46 2017
@@ -85,13 +85,12 @@ public abstract class PropertyTypeBuilde
     }
 
     /**
-     * Creates a new {@code PropertyType} builder initialized to the values of an existing property.
+     * Creates a new {@code PropertyType} builder.
      *
-     * @param owner     the builder of the {@code FeatureType} for which to add this property.
-     * @param template  an existing property to use as a template, or {@code null} if none.
+     * @param owner  the builder of the {@code FeatureType} for which to add this property.
      */
-    PropertyTypeBuilder(final FeatureTypeBuilder owner, final PropertyType template) {
-        super(template, owner.getLocale());
+    PropertyTypeBuilder(final FeatureTypeBuilder owner) {
+        super(owner.getLocale());
         this.owner    = owner;
         minimumOccurs = owner.defaultMinimumOccurs;
         maximumOccurs = owner.defaultMaximumOccurs;

Modified: sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/builder/TypeBuilder.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/builder/TypeBuilder.java?rev=1799891&r1=1799890&r2=1799891&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/builder/TypeBuilder.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/builder/TypeBuilder.java [UTF-8] Mon Jun 26 12:25:46 2017
@@ -88,6 +88,8 @@ public abstract class TypeBuilder implem
 
     /**
      * Creates a new builder initialized to the values of the given builder.
+     * This constructor is for {@link AttributeTypeBuilder#setValueClass(Class)}
+     * and {@link CharacteristicTypeBuilder#setValueClass(Class)} implementations.
      *
      * @param builder  the builder from which to copy information.
      */
@@ -96,19 +98,36 @@ public abstract class TypeBuilder implem
     }
 
     /**
-     * Creates a new builder initialized to the values of an existing type.
+     * Creates a new builder initialized to the given configuration.
      */
-    TypeBuilder(final IdentifiedType template, final Locale locale) {
+    TypeBuilder(final Locale locale) {
         identification = new HashMap<>(4);
         putIfNonNull(Errors.LOCALE_KEY, locale);
-        if (template != null) {
-            putIfNonNull(AbstractIdentifiedType.NAME_KEY,        template.getName());
-            putIfNonNull(AbstractIdentifiedType.DEFINITION_KEY,  template.getDefinition());
-            putIfNonNull(AbstractIdentifiedType.DESIGNATION_KEY, template.getDesignation());
-            putIfNonNull(AbstractIdentifiedType.DESCRIPTION_KEY, template.getDescription());
-            if (template instanceof Deprecable && ((Deprecable) template).isDeprecated()) {
-                identification.put(AbstractIdentifiedType.DEPRECATED_KEY, Boolean.TRUE);
-            }
+    }
+
+    /**
+     * Resets the identification map. After invoking this method, this {@code TypeBuilder}
+     * is in same state that after it has been {@linkplain #TypeBuilder(Locale) constructed}.
+     *
+     * @see #clearCache()
+     */
+    final void reset() {
+        final Object locale = identification.get(Errors.LOCALE_KEY);
+        identification.clear();
+        putIfNonNull(Errors.LOCALE_KEY, locale);
+    }
+
+    /**
+     * Initializes this builder to the value of the given type.
+     * The caller is responsible to invoke {@link #reset()} (if needed) before this method.
+     */
+    final void initialize(final IdentifiedType template) {
+        putIfNonNull(AbstractIdentifiedType.NAME_KEY,        template.getName());
+        putIfNonNull(AbstractIdentifiedType.DEFINITION_KEY,  template.getDefinition());
+        putIfNonNull(AbstractIdentifiedType.DESIGNATION_KEY, template.getDesignation());
+        putIfNonNull(AbstractIdentifiedType.DESCRIPTION_KEY, template.getDescription());
+        if (template instanceof Deprecable && ((Deprecable) template).isDeprecated()) {
+            identification.put(AbstractIdentifiedType.DEPRECATED_KEY, Boolean.TRUE);
         }
     }
 
@@ -152,6 +171,8 @@ public abstract class TypeBuilder implem
 
     /**
      * If the object created by the last call to {@code build()} has been cached, clears that cache.
+     *
+     * @see #reset()
      */
     abstract void clearCache();
 

Modified: sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/builder/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/builder/package-info.java?rev=1799891&r1=1799890&r2=1799891&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/builder/package-info.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/builder/package-info.java [UTF-8] Mon Jun 26 12:25:46 2017
@@ -46,9 +46,9 @@
  *   ┌────────────┬─────────┬─────────────┬───────────────┐
  *   │ Name       │ Type    │ Cardinality │ Default value │
  *   ├────────────┼─────────┼─────────────┼───────────────┤
- *   │ name       │ String  │ [1 … 1]     │ Utopia        │
- *   │ population │ Integer │ [1 … 1]     │               │
- *   │ parliament │ String  │ [1 … 1]     │               │
+ *   │ name       │ String  │     [1 … 1] │ Utopia        │
+ *   │ population │ Integer │     [1 … 1] │               │
+ *   │ parliament │ String  │     [1 … 1] │               │
  *   └────────────┴─────────┴─────────────┴───────────────┘
  * }
  *

Modified: sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Geometries.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Geometries.java?rev=1799891&r1=1799890&r2=1799891&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Geometries.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Geometries.java [UTF-8] Mon Jun 26 12:25:46 2017
@@ -16,15 +16,14 @@
  */
 package org.apache.sis.internal.feature;
 
+import java.util.Iterator;
 import java.util.logging.Level;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import com.esri.core.geometry.Geometry;
-import com.esri.core.geometry.Envelope2D;
-import org.apache.sis.geometry.GeneralEnvelope;
-import org.apache.sis.util.Static;
+import java.util.logging.LogRecord;
 import org.apache.sis.util.logging.Logging;
 import org.apache.sis.internal.system.Loggers;
+import org.apache.sis.geometry.GeneralEnvelope;
+import org.apache.sis.setup.GeometryLibrary;
+import org.apache.sis.math.Vector;
 
 
 /**
@@ -40,110 +39,218 @@ import org.apache.sis.internal.system.Lo
  * @since   0.7
  * @module
  */
-public final class Geometries extends Static {
+public abstract class Geometries {
+    /*
+     * Registers all supported library implementations. Those libraries are optional
+     * (users will typically put at most one on their classpath).
+     */
+    static {
+        register("Java2D");
+        register("JTS");
+        register("ESRI");       // Default implementation if other libraries are also present.
+    }
+
     /**
-     * The geometry object from Java Topology Suite (JTS),
-     * or {@code null} if the JTS library is not on the classpath.
+     * The enumeration that identifies the geometry library used.
      */
-    private static final Class<?> JTS;
+    public final GeometryLibrary library;
 
     /**
-     * Getter methods on JTS envelopes, or {@code null} if the JTS library is not on the classpath.
-     * Each methods take no argument and return a {@code double} value.
+     * The root geometry class.
      */
-    private static final Method INTERNAL, MIN_X, MIN_Y, MAX_X, MAX_Y;
+    public final Class<?> rootClass;
 
-    static {
-        Class<?> type;
-        Method genv, xmin, ymin, xmax, ymax;
+    /**
+     * The class for a point, ployline and polygon.
+     */
+    public final Class<?> pointClass, polylineClass, polygonClass;
+
+    /**
+     * The default geometry implementation to use. Unmodifiable after class initialization.
+     */
+    private static Geometries implementation;
+
+    /**
+     * The fallback implementation to use if the default one is not available.
+     */
+    private final Geometries fallback;
+
+    /**
+     * Creates a new adapter for the given root geometry class.
+     */
+    Geometries(final GeometryLibrary library, final Class<?> rootClass, final Class<?> pointClass,
+            final Class<?> polylineClass, final Class<?> polygonClass)
+    {
+        this.library       = library;
+        this.rootClass     = rootClass;
+        this.pointClass    = pointClass;
+        this.polylineClass = polylineClass;
+        this.polygonClass  = polygonClass;
+        fallback = implementation;
+    }
+
+    /**
+     * Registers the library implementation of the given name (JTS or ESRI) if present; ignore otherwise.
+     * The given name shall be the simple name of a {@code Geometries} subclass in the same package.
+     * The last registered library will be the default implementation.
+     */
+    private static void register(final String name) {
+        String classname = Geometries.class.getName();
+        classname = classname.substring(0, classname.lastIndexOf('.')+1).concat(name);
         try {
-            final Class<?> envt;
-            type = Class.forName("com.vividsolutions.jts.geom.Geometry");
-            genv = type.getMethod("getEnvelopeInternal", (Class[]) null);
-            envt = genv.getReturnType();
-            xmin = envt.getMethod("getMinX", (Class[]) null);
-            ymin = envt.getMethod("getMinY", (Class[]) null);
-            xmax = envt.getMethod("getMaxX", (Class[]) null);
-            ymax = envt.getMethod("getMaxY", (Class[]) null);
-        } catch (ClassNotFoundException | NoSuchMethodException e) {
-            Logging.getLogger(Loggers.GEOMETRY).log(Level.CONFIG, e.toString());
-            type = null;
-            genv = null;
-            xmin = null;
-            xmax = null;
-            ymin = null;
-            ymax = null;
-        }
-        JTS = type;
-        INTERNAL = genv;
-        MIN_X = xmin;
-        MIN_Y = ymin;
-        MAX_X = xmax;
-        MAX_Y = ymax;
+            implementation = (Geometries) Class.forName(classname).newInstance();
+        } catch (ReflectiveOperationException | LinkageError e) {
+            LogRecord record = Resources.forLocale(null).getLogRecord(Level.CONFIG,
+                    Resources.Keys.OptionalLibraryNotFound_2, name, e.toString());
+            record.setLoggerName(Loggers.GEOMETRY);
+            Logging.log(Geometries.class, "register", record);
+        }
     }
 
     /**
-     * Do not allow instantiation of this class.
+     * Returns an accessor to the default geometry library implementation in use.
+     *
+     * @param  library  the required library, or {@code null} for the default.
+     * @return the default geometry implementation.
+     * @throws IllegalArgumentException if the given library is non-null but not available.
      */
-    private Geometries() {
+    public static Geometries implementation(final GeometryLibrary library) {
+        if (library == null) {
+            return implementation;
+        }
+        for (Geometries g = implementation; g != null; g = g.fallback) {
+            if (g.library == library) return g;
+        }
+        throw new IllegalArgumentException(Resources.format(Resources.Keys.UnavailableGeometryLibrary_1, library));
     }
 
     /**
-     * Returns {@code true} if the given type is one of the type known to Apache SIS.
+     * Returns {@code true} if the given type is one of the types known to Apache SIS.
      *
      * @param  type  the type to verify.
      * @return {@code true} if the given type is one of the geometry type known to SIS.
      */
     public static boolean isKnownType(final Class<?> type) {
-        return Geometry.class.isAssignableFrom(type) || (JTS != null && JTS.isAssignableFrom(type));
+        for (Geometries g = implementation; g != null; g = g.fallback) {
+            if (g.rootClass.isAssignableFrom(type)) return true;
+        }
+        return false;
+    }
+
+    /**
+     * If the given point is an implementation of this library, returns its coordinate.
+     * Otherwise returns {@code null}.
+     */
+    abstract double[] tryGetCoordinate(Object point);
+
+    /**
+     * If the given object is one of the recognized point implementation, returns its coordinate.
+     * Otherwise returns {@code null}. If non-null, the returned array may have a length of 2 or 3.
+     * If the CRS is geographic, then the (x,y) values should be (longitude, latitude) for compliance
+     * with usage in ESRI and JTS libraries.
+     *
+     * @param  point  the point from which to get the coordinate, or {@code null}.
+     * @return the coordinate of the given point as an array of length 2 or 3,
+     *         or {@code null} if the given object is not a recognized implementation.
+     *
+     * @see #createPoint(double, double)
+     */
+    public static double[] getCoordinate(final Object point) {
+        for (Geometries g = implementation; g != null; g = g.fallback) {
+            double[] coord = g.tryGetCoordinate(point);
+            if (coord != null) return coord;
+        }
+        return null;
     }
 
     /**
+     * If the given geometry is the type supported by this {@code Geometries} instance,
+     * returns its envelope if non-empty. Otherwise returns {@code null}. We currently
+     * do not distinguish the reasons why this method may return null.
+     */
+    abstract GeneralEnvelope tryGetEnvelope(Object geometry);
+
+    /**
      * If the given object is one of the recognized type and its envelope is non-empty,
      * returns that envelope as an Apache SIS implementation. Otherwise returns {@code null}.
      *
      * @param  geometry  the geometry from which to get the envelope, or {@code null}.
-     * @return the envelope of the given object, or {@code null} if the object is not
-     *         a recognized geometry or its envelope is empty.
+     * @return the envelope of the given geometry, or {@code null} if the given object
+     *         is not a recognized geometry or its envelope is empty.
      */
     public static GeneralEnvelope getEnvelope(final Object geometry) {
-        final double xmin, ymin, xmax, ymax;
-        if (geometry instanceof Geometry) {
-            final Envelope2D bounds = new Envelope2D();
-            ((Geometry) geometry).queryEnvelope2D(bounds);
-            if (bounds.isEmpty()) {                                     // Test if there is NaN values.
-                return null;
-            }
-            xmin = bounds.xmin;
-            ymin = bounds.ymin;
-            xmax = bounds.xmax;
-            ymax = bounds.ymax;
-        } else if (JTS != null && JTS.isInstance(geometry)) {
-            try {
-                final Object env = INTERNAL.invoke(geometry, (Object[]) null);
-                xmin = (Double) MIN_X.invoke(env, (Object[]) null);
-                ymin = (Double) MIN_Y.invoke(env, (Object[]) null);
-                xmax = (Double) MAX_X.invoke(env, (Object[]) null);
-                ymax = (Double) MAX_Y.invoke(env, (Object[]) null);
-            } catch (ReflectiveOperationException e) {
-                if (e instanceof InvocationTargetException) {
-                    final Throwable cause = e.getCause();
-                    if (cause instanceof RuntimeException) {
-                        throw (RuntimeException) cause;
-                    }
-                    if (cause instanceof Error) {
-                        throw (Error) cause;
+        for (Geometries g = implementation; g != null; g = g.fallback) {
+            GeneralEnvelope env = g.tryGetEnvelope(geometry);
+            if (env != null) return env;
+        }
+        return null;
+    }
+
+    /**
+     * Creates a two-dimensional point from the given coordinate. If the CRS is geographic, then the
+     * (x,y) values should be (longitude, latitude) for compliance with usage in ESRI and JTS libraries.
+     *
+     * @param  x  the first ordinate value.
+     * @param  y  the second ordinate value.
+     * @return the point for the given ordinate values.
+     *
+     * @see #getCoordinate(Object)
+     */
+    public abstract Object createPoint(double x, double y);
+
+    /**
+     * Creates a path or polyline from the given ordinate values.
+     * Each {@link Double#NaN} ordinate value start a new path.
+     * The implementation returned by this method is an instance of {@link #rootClass}.
+     *
+     * @param  dimension  the number of dimensions (2 or 3).
+     * @param  ordinates  sequence of (x,y) or (x,y,z) tuples.
+     * @return the geometric object for the given points.
+     * @throws UnsupportedOperationException if the geometry library can not create the requested path.
+     */
+    public abstract Object createPolyline(int dimension, Vector ordinates);
+
+    /**
+     * Merges a sequence of polyline instances if the first instance is an implementation of this library.
+     *
+     * @param  first      the first instance to merge.
+     * @param  polylines  the second and subsequent instances to merge.
+     * @return the merged polyline, or {@code null} if the first instance is not an implementation of this library.
+     * @throws ClassCastException if an element in the iterator is not an implementation of this library.
+     */
+    abstract Object tryMergePolylines(Object first, Iterator<?> polylines);
+
+    /**
+     * Merges a sequence of points or polylines into a single polyline instances.
+     * Each previous polyline will be a separated path in the new polyline instances.
+     * The implementation returned by this method is an instance of {@link #rootClass}.
+     *
+     * @param  paths  the points or polylines to merge in a single polyline object.
+     * @return the merged polyline, or {@code null} if the given iterator has no element.
+     * @throws ClassCastException if not all elements in the given iterator are instances of the same library.
+     */
+    public static Object mergePolylines(final Iterator<?> paths) {
+        while (paths.hasNext()) {
+            final Object first = paths.next();
+            if (first != null) {
+                for (Geometries g = implementation; g != null; g = g.fallback) {
+                    final Object merged = g.tryMergePolylines(first, paths);
+                    if (merged != null) {
+                        return merged;
                     }
                 }
-                // Should never happen unless JTS's API changed.
-                throw (Error) new IncompatibleClassChangeError(e.toString()).initCause(e);
+                throw unsupported(2);
             }
-        } else {
-            return null;
         }
-        final GeneralEnvelope env = new GeneralEnvelope(2);
-        env.setRange(0, xmin, xmax);
-        env.setRange(1, ymin, ymax);
-        return env;
+        return null;
+    }
+
+    /**
+     * Returns an error message for an unsupported geometry object.
+     *
+     * @param  dimension  number of dimensions (2 or 3) requested for the geometry object.
+     */
+    static UnsupportedOperationException unsupported(final int dimension) {
+        return new UnsupportedOperationException(Resources.format(Resources.Keys.UnsupportedGeometryObject_1, dimension));
     }
 }

Modified: sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Resources.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Resources.java?rev=1799891&r1=1799890&r2=1799891&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Resources.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Resources.java [UTF-8] Mon Jun 26 12:25:46 2017
@@ -133,6 +133,12 @@ public final class Resources extends Ind
         public static final short NotASingleton_1 = 14;
 
         /**
+         * The {0} optional library is not available. Geometric operations will ignore that library.
+         * Cause is {1}.
+         */
+        public static final short OptionalLibraryNotFound_2 = 19;
+
+        /**
          * Property “{1}” already exists in feature “{0}”.
          */
         public static final short PropertyAlreadyExists_2 = 15;
@@ -143,6 +149,11 @@ public final class Resources extends Ind
         public static final short PropertyNotFound_2 = 16;
 
         /**
+         * The {0} geometry library is not available in current runtime environment.
+         */
+        public static final short UnavailableGeometryLibrary_1 = 21;
+
+        /**
          * The “{1}” value given to “{0}” property should be separable in {2} components, but we got
          * {3}.
          */
@@ -152,6 +163,11 @@ public final class Resources extends Ind
          * Feature named “{0}” has not yet been resolved.
          */
         public static final short UnresolvedFeatureName_1 = 18;
+
+        /**
+         * Unsupported geometry {0}D object.
+         */
+        public static final short UnsupportedGeometryObject_1 = 20;
     }
 
     /**

Modified: sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Resources.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Resources.properties?rev=1799891&r1=1799890&r2=1799891&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Resources.properties [ISO-8859-1] (original)
+++ sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Resources.properties [ISO-8859-1] Mon Jun 26 12:25:46 2017
@@ -33,7 +33,10 @@ IllegalPropertyValueClass_3       = Prop
 MismatchedPropertyType_1          = Mismatched type for \u201c{0}\u201d property.
 MismatchedValueClass_3            = An attribute for \u2018{1}\u2019 values where expected, but the \u201c{0}\u201d attribute specifies values of type \u2018{2}\u2019.
 NotASingleton_1                   = Property \u201c{0}\u201d contains more than one value.
+OptionalLibraryNotFound_2         = The {0} optional library is not available. Geometric operations will ignore that library.\nCause is {1}.
 PropertyAlreadyExists_2           = Property \u201c{1}\u201d already exists in feature \u201c{0}\u201d.
 PropertyNotFound_2                = No property named \u201c{1}\u201d has been found in \u201c{0}\u201d feature.
+UnavailableGeometryLibrary_1      = The {0} geometry library is not available in current runtime environment.
 UnexpectedNumberOfComponents_4    = The \u201c{1}\u201d value given to \u201c{0}\u201d property should be separable in {2} components, but we got {3}.
 UnresolvedFeatureName_1           = Feature named \u201c{0}\u201d has not yet been resolved.
+UnsupportedGeometryObject_1       = Unsupported geometry {0}D object.

Modified: sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Resources_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Resources_fr.properties?rev=1799891&r1=1799890&r2=1799891&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Resources_fr.properties [ISO-8859-1] (original)
+++ sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Resources_fr.properties [ISO-8859-1] Mon Jun 26 12:25:46 2017
@@ -38,7 +38,10 @@ IllegalPropertyValueClass_3       = La p
 MismatchedPropertyType_1          = Le type de la propri\u00e9t\u00e9 \u00ab\u202f{0}\u202f\u00bb ne correspond pas.
 MismatchedValueClass_3            = Un attribut pour des valeurs de type \u2018{1}\u2019 \u00e9tait attendu, mais l\u2019attribut \u00ab\u202f{0}\u202f\u00bb sp\u00e9cifie des valeurs de type \u2018{2}\u2019.
 NotASingleton_1                   = La propri\u00e9t\u00e9 \u00ab\u202f{0}\u202f\u00bb contient plus de une valeur.
+OptionalLibraryNotFound_2         = La biblioth\u00e8que optionnelle {0} n\u2019est pas disponible. Les op\u00e9rations g\u00e9om\u00e9triques ignoreront cette biblioth\u00e8que.\nLa cause est {1}.
 PropertyNotFound_2                = Aucune propri\u00e9t\u00e9 nomm\u00e9e \u00ab\u202f{1}\u202f\u00bb n\u2019a \u00e9t\u00e9 trouv\u00e9e dans l\u2019entit\u00e9 \u00ab\u202f{0}\u202f\u00bb.
 PropertyAlreadyExists_2           = La propri\u00e9t\u00e9 \u00ab\u202f{1}\u202f\u00bb existe d\u00e9j\u00e0 dans l\u2019entit\u00e9 \u00ab\u202f{0}\u202f\u00bb.
+UnavailableGeometryLibrary_1      = La biblioth\u00e8que de g\u00e9om\u00e9tries {0} n\u2019est pas disponible dans l\u2019environnement d\u2019ex\u00e9cution actuel.
 UnexpectedNumberOfComponents_4    = La valeur \u00ab\u202f{1}\u202f\u00bb donn\u00e9e \u00e0 la propri\u00e9t\u00e9 \u00ab\u202f{0}\u202f\u00bb devrait \u00eatre s\u00e9parable en {2} composantes, mais on en a obtenus {3}.
 UnresolvedFeatureName_1           = L\u2019entit\u00e9 nomm\u00e9e \u00ab\u202f{0}\u202f\u00bb n\u2019a pas encore \u00e9t\u00e9 r\u00e9solue.
+UnsupportedGeometryObject_1       = Object g\u00e9om\u00e9trique {0}D non-support\u00e9.

Modified: sis/branches/JDK7/core/sis-feature/src/test/java/org/apache/sis/feature/FeatureMemoryBenchmark.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-feature/src/test/java/org/apache/sis/feature/FeatureMemoryBenchmark.java?rev=1799891&r1=1799890&r2=1799891&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-feature/src/test/java/org/apache/sis/feature/FeatureMemoryBenchmark.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-feature/src/test/java/org/apache/sis/feature/FeatureMemoryBenchmark.java [UTF-8] Mon Jun 26 12:25:46 2017
@@ -21,6 +21,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Random;
 import org.opengis.feature.Feature;
+import org.apache.sis.internal.util.StandardDateFormat;
 
 import static java.util.Collections.singletonMap;
 
@@ -179,7 +180,7 @@ public final class FeatureMemoryBenchmar
                 long time = System.nanoTime();
                 b.run();
                 time = System.nanoTime() - time;
-                System.console().printf("Ellapsed time: %f%n", time / 1E+9);
+                System.console().printf("Ellapsed time: %f%n", time / (float) StandardDateFormat.NANOS_PER_SECOND);
                 return;
             }
         }

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/geometry/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/geometry/package-info.java?rev=1799891&r1=1799890&r2=1799891&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/geometry/package-info.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/geometry/package-info.java [UTF-8] Mon Jun 26 12:25:46 2017
@@ -81,6 +81,8 @@
  *       than an inclusion area.</li>
  * </ul>
  *
+ * @see org.apache.sis.setup.GeometryLibrary
+ *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @version 0.8
  * @since   0.3

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java?rev=1799891&r1=1799890&r2=1799891&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java [UTF-8] Mon Jun 26 12:25:46 2017
@@ -56,6 +56,7 @@ import org.apache.sis.internal.system.De
 import org.apache.sis.internal.system.Shutdown;
 import org.apache.sis.internal.system.Loggers;
 import org.apache.sis.internal.util.CollectionsExt;
+import org.apache.sis.internal.util.StandardDateFormat;
 import org.apache.sis.util.logging.PerformanceLevel;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.resources.Messages;
@@ -192,7 +193,7 @@ public abstract class ConcurrentAuthorit
                 value = depth;
             } else {
                 text = "%s made available %d seconds ago";
-                value = Math.round((System.nanoTime() - timestamp) / 1E+9);   // Convert nanoseconds to seconds.
+                value = Math.round((System.nanoTime() - timestamp) / (double) StandardDateFormat.NANOS_PER_SECOND);
             }
             return String.format(text, Classes.getShortClassName(factory), value);
         }
@@ -450,8 +451,8 @@ public abstract class ConcurrentAuthorit
                 if (caller == null) {
                     caller = "create".concat(type.getSimpleName());
                 }
-                final Double duration = time / 1E+9;
                 final PerformanceLevel level = PerformanceLevel.forDuration(time, TimeUnit.NANOSECONDS);
+                final Double duration = time / (double) StandardDateFormat.NANOS_PER_SECOND;
                 final Messages resources = Messages.getResources(null);
                 final LogRecord record;
                 if (code != null) {

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGInstaller.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGInstaller.java?rev=1799891&r1=1799890&r2=1799891&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGInstaller.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGInstaller.java [UTF-8] Mon Jun 26 12:25:46 2017
@@ -30,6 +30,7 @@ import org.apache.sis.util.StringBuilder
 import org.apache.sis.internal.metadata.sql.ScriptRunner;
 import org.apache.sis.internal.metadata.sql.SQLUtilities;
 import org.apache.sis.internal.system.DefaultFactories;
+import org.apache.sis.internal.util.StandardDateFormat;
 import org.apache.sis.internal.util.Fallback;
 import org.apache.sis.util.Exceptions;
 import org.apache.sis.util.resources.Messages;
@@ -254,7 +255,7 @@ final class EPSGInstaller extends Script
         time = System.nanoTime() - time;
         InstallationScriptProvider.log(Messages.getResources(locale).getLogRecord(
                 PerformanceLevel.forDuration(time, TimeUnit.NANOSECONDS),
-                Messages.Keys.InsertDuration_2, numRows, time / 1E9f));
+                Messages.Keys.InsertDuration_2, numRows, time / (float) StandardDateFormat.NANOS_PER_SECOND));
     }
 
     /**

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/Benchmark.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/Benchmark.java?rev=1799891&r1=1799890&r2=1799891&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/Benchmark.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/Benchmark.java [UTF-8] Mon Jun 26 12:25:46 2017
@@ -28,6 +28,7 @@ import org.apache.sis.math.StatisticsFor
 import org.apache.sis.measure.Latitude;
 import org.apache.sis.parameter.Parameters;
 import org.apache.sis.internal.util.Constants;
+import org.apache.sis.internal.util.StandardDateFormat;
 import org.apache.sis.internal.referencing.provider.AbstractProvider;
 import org.apache.sis.referencing.operation.transform.LinearTransform;
 import org.apache.sis.referencing.operation.transform.MathTransforms;
@@ -216,7 +217,7 @@ public final class Benchmark {
             long time = System.nanoTime();
             projection.transform(sources, 0, targets, 0, NUM_POINTS);
             time = System.nanoTime() - time;
-            final double seconds = time * NANOS_TO_SECONDS;
+            final double seconds = time / (double) StandardDateFormat.NANOS_PER_SECOND;
             System.out.printf("%s time: %1.4f%n", performance.name(), seconds);
             performance.accept(seconds);
         }
@@ -231,15 +232,10 @@ public final class Benchmark {
             kernel.transform(targets, 0, targets, 0, NUM_POINTS);
             time = System.nanoTime() - time;
             denormalize.transform(targets, 0, targets, 0, NUM_POINTS);
-            final double seconds = time * NANOS_TO_SECONDS;
+            final double seconds = time / (double) StandardDateFormat.NANOS_PER_SECOND;
             System.out.printf("%s time: %1.4f%n", performance.name(), seconds);
             performance.accept(seconds);
         }
-
-        /**
-         * For reporting the time measured by {@link System#nanoTime()}.
-         */
-        private static final double NANOS_TO_SECONDS = 1E-9;
     }
 
     /**

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MercatorMethodComparison.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MercatorMethodComparison.java?rev=1799891&r1=1799890&r2=1799891&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MercatorMethodComparison.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MercatorMethodComparison.java [UTF-8] Mon Jun 26 12:25:46 2017
@@ -27,6 +27,7 @@ import org.apache.sis.internal.referenci
 import org.apache.sis.internal.metadata.ReferencingServices;
 
 import static java.lang.Math.*;     // Not StrictMath in this particular case.
+import static org.apache.sis.internal.util.StandardDateFormat.NANOS_PER_SECOND;
 
 
 /**
@@ -323,9 +324,9 @@ public final class MercatorMethodCompari
         }
         final long t3 = System.nanoTime();
         final float c = (t1 - t0) / 100f;
-        out.println("Iterative method:         " + ((t1 - t0) / 1E9f) + " seconds (" + round((t1 - t0) / c) + "%).");
-        out.println("Series expansion:         " + ((t2 - t1) / 1E9f) + " seconds (" + round((t2 - t1) / c) + "%).");
-        out.println("Trigonometric identities: " + ((t3 - t2) / 1E9f) + " seconds (" + round((t3 - t2) / c) + "%).");
+        out.println("Iterative method:         " + ((t1 - t0) / (float) NANOS_PER_SECOND) + " seconds (" + round((t1 - t0) / c) + "%).");
+        out.println("Series expansion:         " + ((t2 - t1) / (float) NANOS_PER_SECOND) + " seconds (" + round((t2 - t1) / c) + "%).");
+        out.println("Trigonometric identities: " + ((t3 - t2) / (float) NANOS_PER_SECOND) + " seconds (" + round((t3 - t2) / c) + "%).");
         out.println("Mean φ values: " + (s0 / t.length) + ", "
                                       + (s1 / t.length) + " and "
                                       + (s2 / t.length) + ".");

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/StandardDateFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/StandardDateFormat.java?rev=1799891&r1=1799890&r2=1799891&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/StandardDateFormat.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/StandardDateFormat.java [UTF-8] Mon Jun 26 12:25:46 2017
@@ -96,6 +96,16 @@ public final class StandardDateFormat ex
     public static final String PATTERN = SHORT_PATTERN + "'T'" + TIME_PATTERN;
 
     /**
+     * Number of nanoseconds in one millisecond.
+     */
+    public static final long NANOS_PER_MILLISECOND = 1000000;
+
+    /**
+     * Number of nanoseconds in one second.
+     */
+    public static final long NANOS_PER_SECOND = 1000000000;
+
+    /**
      * The length of a day in number of milliseconds.
      */
     public static final int MILLISECONDS_PER_DAY = 24*60*60*1000;

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/math/Vector.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/math/Vector.java?rev=1799891&r1=1799890&r2=1799891&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/math/Vector.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/math/Vector.java [UTF-8] Mon Jun 26 12:25:46 2017
@@ -203,6 +203,20 @@ public abstract class Vector extends Abs
      * is backed by an array of type {@code float[]}, then this method returns {@code Float.class},
      * not {@link Float#TYPE}.
      *
+     * <p>The information returned by this method is only indicative; it is not guaranteed to specify accurately
+     * this kind of objects returned by the {@link #get(int)} method. There is various situation where the types
+     * may not match:</p>
+     *
+     * <ul>
+     *   <li>If this vector {@linkplain #isUnsigned() is unsigned}, then the values returned by {@code get(int)}
+     *       may be instances of a type wider than the type used by this vector for storing the values.</li>
+     *   <li>If this vector has been {@linkplain #createForDecimal(float[]) created for decimal numbers},
+     *       then the values returned by {@code get(int)} will use double-precision even if this vector
+     *       stores the values as single-precision floating point numbers.</li>
+     *   <li>If this vector {@linkplain #compress(double) has been compressed}, then the type returned by this
+     *       method does not describe accurately the range of values that this vector can store.</li>
+     * </ul>
+     *
      * <p>Users of the {@link #doubleValue(int)} method do not need to care about this information since
      * {@code Vector} will perform automatically the type conversion. Users of other methods may want to
      * verify this information for avoiding {@link ArithmeticException}.</p>
@@ -426,14 +440,16 @@ public abstract class Vector extends Abs
     /**
      * Sets the number at the given index.
      * The given number should be an instance of the same type than the number returned by {@link #get(int)}.
+     * If not, the stored value may lost precision as a result of the cast.
      *
      * @param  index  the index in the [0 … {@linkplain #size() size}-1] range.
      * @param  value  the value to set at the given index.
      * @return the value previously stored at the given index.
+     * @throws UnsupportedOperationException if this vector is read-only.
      * @throws IndexOutOfBoundsException if the given index is out of bounds.
      * @throws NumberFormatException if the previous value was stored as a {@code String} and can not be parsed.
-     * @throws ClassCastException if the given value can not be converted to the type expected by this vector.
-     * @throws ArrayStoreException if the given value can not be stored in this vector.
+     * @throws ArithmeticException if this vector uses some {@linkplain #compress(double) compression} technic
+     *         and the given value is out of range for that compression.
      */
     @Override
     public abstract Number set(int index, Number value);

Copied: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/setup/GeometryLibrary.java (from r1799882, sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/setup/GeometryLibrary.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/setup/GeometryLibrary.java?p2=sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/setup/GeometryLibrary.java&p1=sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/setup/GeometryLibrary.java&r1=1799882&r2=1799891&rev=1799891&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/setup/GeometryLibrary.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/setup/GeometryLibrary.java [UTF-8] Mon Jun 26 12:25:46 2017
@@ -31,7 +31,7 @@ import org.opengis.metadata.acquisition.
  * @version 0.8
  *
  * @see OptionKey#GEOMETRY_LIBRARY
- * @see GeometryType
+ * @see org.apache.sis.feature.builder.FeatureTypeBuilder#addAttribute(GeometryType)
  *
  * @since 0.8
  * @module

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/setup/OptionKey.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/setup/OptionKey.java?rev=1799891&r1=1799890&r2=1799891&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/setup/OptionKey.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/setup/OptionKey.java [UTF-8] Mon Jun 26 12:25:46 2017
@@ -75,6 +75,16 @@ public class OptionKey<T> implements Ser
     private static final long serialVersionUID = -7580514229639750246L;
 
     /**
+     * The library to use for creating geometric objects at reading time.
+     * Some libraries are the Java Topology Suite (JTS), ESRI geometry API and Java2D.
+     * If this option is not specified, then a library will be selected automatically
+     * among the libraries available in the runtime environment.
+     *
+     * @since 0.8
+     */
+    public static final OptionKey<GeometryLibrary> GEOMETRY_LIBRARY = new OptionKey<>("GEOMETRY_LIBRARY", GeometryLibrary.class);
+
+    /**
      * The locale to use for locale-sensitive data. This option determines the language to use for writing
      * {@link org.apache.sis.util.iso.AbstractInternationalString international strings} when the target
      * storage support only one language. It may also control number and date patterns in some file formats

Modified: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/internal/util/StandardDateFormatTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/internal/util/StandardDateFormatTest.java?rev=1799891&r1=1799890&r2=1799891&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/internal/util/StandardDateFormatTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/internal/util/StandardDateFormatTest.java [UTF-8] Mon Jun 26 12:25:46 2017
@@ -17,6 +17,7 @@
 package org.apache.sis.internal.util;
 
 import java.util.Date;
+import java.util.concurrent.TimeUnit;
 import java.text.ParseException;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.TestCase;
@@ -36,6 +37,17 @@ import static org.junit.Assert.*;
  */
 public final strictfp class StandardDateFormatTest extends TestCase {
     /**
+     * Verifies the {@link StandardDateFormat#MILLISECONDS_PER_DAY}, {@link StandardDateFormat#NANOS_PER_MILLISECOND}
+     * and {@link StandardDateFormat#NANOS_PER_SECOND} constant values.
+     */
+    @Test
+    public void verifyConstantValues() {
+        assertEquals("MILLISECONDS_PER_DAY",  TimeUnit.DAYS.toMillis(1),        StandardDateFormat.MILLISECONDS_PER_DAY);
+        assertEquals("NANOS_PER_MILLISECOND", TimeUnit.MILLISECONDS.toNanos(1), StandardDateFormat.NANOS_PER_MILLISECOND);
+        assertEquals("NANOS_PER_SECOND",      TimeUnit.SECONDS.toNanos(1),      StandardDateFormat.NANOS_PER_SECOND);
+    }
+
+    /**
      * Verifies the condition documented in {@link StandardDateFormat#SHORT_PATTERN} javadoc.
      */
     @Test

Modified: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/collection/CacheTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/collection/CacheTest.java?rev=1799891&r1=1799890&r2=1799891&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/collection/CacheTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/collection/CacheTest.java [UTF-8] Mon Jun 26 12:25:46 2017
@@ -26,6 +26,7 @@ import java.io.PrintWriter;
 
 import org.apache.sis.math.Statistics;
 import org.apache.sis.math.StatisticsFormat;
+import org.apache.sis.internal.util.StandardDateFormat;
 import org.apache.sis.util.CharSequences;
 import org.apache.sis.test.TestUtilities;
 import org.apache.sis.test.TestCase;
@@ -291,7 +292,8 @@ public final strictfp class CacheTest ex
         long time = System.nanoTime();
         for (int i=0; i<10; i++) {
             final long t = System.nanoTime();
-            out.printf("Cache size: %4d (after %3d ms)%n", cache.size(), round((t - time) / 1E+6));
+            out.printf("Cache size: %4d (after %3d ms)%n", cache.size(),
+                       round((t - time) / (double) StandardDateFormat.NANOS_PER_MILLISECOND));
             time = t;
             Thread.sleep(250);
             if (i >= 2) {

Modified: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/collection/RangeSetTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/collection/RangeSetTest.java?rev=1799891&r1=1799890&r2=1799891&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/collection/RangeSetTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/collection/RangeSetTest.java [UTF-8] Mon Jun 26 12:25:46 2017
@@ -35,6 +35,7 @@ import org.junit.Test;
 
 import static org.apache.sis.test.Assert.*;
 import static org.apache.sis.internal.util.StandardDateFormat.MILLISECONDS_PER_DAY;
+import static org.apache.sis.internal.util.StandardDateFormat.NANOS_PER_SECOND;
 
 
 /**
@@ -559,7 +560,7 @@ public final strictfp class RangeSetTest
                     set.remove(lower, upper);
                 }
             }
-            out.print((System.nanoTime() - start) / 1E9);
+            out.print((System.nanoTime() - start) / (float) NANOS_PER_SECOND);
             out.print(" seconds for a size of ");
             out.println(set.size());
             Thread.sleep(1000);

Modified: sis/branches/JDK7/ide-project/NetBeans/nbproject/genfiles.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/ide-project/NetBeans/nbproject/genfiles.properties?rev=1799891&r1=1799890&r2=1799891&view=diff
==============================================================================
--- sis/branches/JDK7/ide-project/NetBeans/nbproject/genfiles.properties [ISO-8859-1] (original)
+++ sis/branches/JDK7/ide-project/NetBeans/nbproject/genfiles.properties [ISO-8859-1] Mon Jun 26 12:25:46 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=0c9ec53c
+nbproject/build-impl.xml.data.CRC32=18a5b904
 nbproject/build-impl.xml.script.CRC32=4fad40a6
 nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48

Modified: sis/branches/JDK7/ide-project/NetBeans/nbproject/project.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/ide-project/NetBeans/nbproject/project.xml?rev=1799891&r1=1799890&r2=1799891&view=diff
==============================================================================
--- sis/branches/JDK7/ide-project/NetBeans/nbproject/project.xml (original)
+++ sis/branches/JDK7/ide-project/NetBeans/nbproject/project.xml Mon Jun 26 12:25:46 2017
@@ -94,6 +94,8 @@
             <word>namespaces</word>
             <word>orthodromic</word>
             <word>parsable</word>
+            <word>polyline</word>
+            <word>polylines</word>
             <word>spliterator</word>
             <word>timezone</word>
             <word>Unicode</word>

Modified: sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/GridGeometryInfo.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/GridGeometryInfo.java?rev=1799891&r1=1799890&r2=1799891&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/GridGeometryInfo.java [UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/GridGeometryInfo.java [UTF-8] Mon Jun 26 12:25:46 2017
@@ -179,7 +179,7 @@ final class GridGeometryInfo extends Gri
     @Override
     protected double coordinateForAxis(final Object axis, final int j, final int i) throws IOException, DataStoreException {
         final VariableInfo v = ((VariableInfo) axis);
-        final int n = v.getGridEnvelope()[0];
+        final int n = v.dimensions[0].length;
         return v.read().doubleValue(j + n*i);
     }
 }

Modified: sis/branches/JDK7/storage/sis-shapefile/pom.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-shapefile/pom.xml?rev=1799891&r1=1799890&r2=1799891&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-shapefile/pom.xml (original)
+++ sis/branches/JDK7/storage/sis-shapefile/pom.xml Mon Jun 26 12:25:46 2017
@@ -121,6 +121,11 @@ Read and write files in the Shapefile fo
       <artifactId>sis-storage</artifactId>
       <version>${project.version}</version>
     </dependency>
+    <dependency>
+      <groupId>com.esri.geometry</groupId>
+      <artifactId>esri-geometry-api</artifactId>
+      <scope>compile</scope>
+    </dependency>
   </dependencies>
 
 </project>



Mime
View raw message