sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1800165 - in /sis/branches/JDK8: core/sis-feature/src/main/java/org/apache/sis/feature/ core/sis-feature/src/main/java/org/apache/sis/feature/builder/ core/sis-feature/src/main/java/org/apache/sis/internal/feature/ core/sis-utility/src/mai...
Date Wed, 28 Jun 2017 13:24:33 GMT
Author: desruisseaux
Date: Wed Jun 28 13:24:33 2017
New Revision: 1800165

URL: http://svn.apache.org/viewvc?rev=1800165&view=rev
Log:
Prepare for the concatenation of some CSV lines in single Moving Feature instances.
The concatenation is not yet enabled, but this commit provides the basis for it.

Added:
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/DateList.java   (with props)
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/MovingFeature.java   (with props)
Modified:
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractAttribute.java
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAttributeType.java
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DenseFeature.java
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/SparseFeature.java
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/builder/FeatureTypeBuilder.java
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/ESRI.java
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Geometries.java
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/JTS.java
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Java2D.java
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Resources.java
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Resources.properties
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Resources_fr.properties
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/math/Fraction.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/UnitFormat.java
    sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/GeometryParser.java
    sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java
    sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/GroupAsPolylineOperation.java
    sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Types.java

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractAttribute.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractAttribute.java?rev=1800165&r1=1800164&r2=1800165&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractAttribute.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractAttribute.java [UTF-8] Wed Jun 28 13:24:33 2017
@@ -315,7 +315,7 @@ public abstract class AbstractAttribute<
      *     Example:
      *
      *     {@preformat java
-     *       Attribute<?> accuracy = ...; // To be created by the caller.
+     *       Attribute<?> accuracy = ...;                               // To be created by the caller.
      *       characteristics.put("accuracy", accuracy);
      *     }</li>
      *
@@ -325,7 +325,7 @@ public abstract class AbstractAttribute<
      *     Example:
      *
      *     {@preformat java
-     *       Attribute<?> accuracy = ...; // To be created by the caller.
+     *       Attribute<?> accuracy = ...;                               // To be created by the caller.
      *       characteristics.values().add(accuracy);
      *     }</li>
      *
@@ -334,9 +334,9 @@ public abstract class AbstractAttribute<
      *     Example:
      *
      *     {@preformat java
-     *       characteristics.keySet().add("accuracy"); // Ensure that an entry will exist for that name.
+     *       characteristics.keySet().add("accuracy");                  // Ensure that an entry will exist for that name.
      *       Attribute<?> accuracy = characteristics.get("accuracy");
-     *       Features.cast(accuracy, Float.class).setValue(...); // Set new accuracy value here as a float.
+     *       Features.cast(accuracy, Float.class).setValue(...);        // Set new accuracy value here as a float.
      *     }</li>
      * </ol>
      *

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAttributeType.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAttributeType.java?rev=1800165&r1=1800164&r2=1800165&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAttributeType.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAttributeType.java [UTF-8] Wed Jun 28 13:24:33 2017
@@ -186,6 +186,7 @@ public class DefaultAttributeType<V> ext
      *
      * @see org.apache.sis.feature.builder.AttributeTypeBuilder
      */
+    @SuppressWarnings("ThisEscapedInObjectConstruction")    // Okay because used only in package-private class.
     public DefaultAttributeType(final Map<String,?> identification, final Class<V> valueClass,
             final int minimumOccurs, final int maximumOccurs, final V defaultValue,
             final AttributeType<?>... characterizedBy)

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DenseFeature.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DenseFeature.java?rev=1800165&r1=1800164&r2=1800165&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DenseFeature.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DenseFeature.java [UTF-8] Wed Jun 28 13:24:33 2017
@@ -71,7 +71,7 @@ final class DenseFeature extends Abstrac
     /**
      * Creates a new feature of the given type.
      *
-     * @param type Information about the feature (name, characteristics, <i>etc.</i>).
+     * @param type  information about the feature (name, characteristics, <i>etc.</i>).
      */
     public DenseFeature(final DefaultFeatureType type) {
         super(type);

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/SparseFeature.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/SparseFeature.java?rev=1800165&r1=1800164&r2=1800165&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/SparseFeature.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/SparseFeature.java [UTF-8] Wed Jun 28 13:24:33 2017
@@ -58,7 +58,7 @@ final class SparseFeature extends Abstra
     /**
      * A {@link #valuesKind} flag meaning that the {@link #properties} map contains raw values.
      */
-    private static final byte VALUES = 0; // Must be zero, because we want it to be 'valuesKind' default value.
+    private static final byte VALUES = 0;   // Must be zero, because we want it to be 'valuesKind' default value.
 
     /**
      * A {@link #valuesKind} flag meaning that the {@link #properties} map contains {@link Property} instances.
@@ -277,7 +277,7 @@ final class SparseFeature extends Abstra
              * a new value or a value of a different type, then we need to check the name and type validity.
              */
             if (!canSkipVerification(previous, value)) {
-                Object toStore = previous; // This initial value will restore the previous value if the check fail.
+                Object toStore = previous;  // This initial value will restore the previous value if the check fail.
                 try {
                     toStore = verifyPropertyValue(name, value);
                 } finally {

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/builder/FeatureTypeBuilder.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/builder/FeatureTypeBuilder.java?rev=1800165&r1=1800164&r2=1800165&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/builder/FeatureTypeBuilder.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/builder/FeatureTypeBuilder.java [UTF-8] Wed Jun 28 13:24:33 2017
@@ -185,7 +185,7 @@ public class FeatureTypeBuilder extends
     /**
      * Provides method for creating geometric objects using the library specified by the user.
      */
-    private final Geometries geometries;
+    private final Geometries<?> geometries;
 
     /**
      * The object created by this builder, or {@code null} if not yet created.

Added: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/DateList.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/DateList.java?rev=1800165&view=auto
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/DateList.java (added)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/DateList.java [UTF-8] Wed Jun 28 13:24:33 2017
@@ -0,0 +1,104 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.internal.feature;
+
+import java.util.AbstractList;
+import org.apache.sis.util.collection.IntegerList;
+import org.apache.sis.util.collection.CheckedContainer;
+
+// Branch-dependent imports
+import java.time.Instant;
+
+
+/**
+ * Unmodifiable lists of instants.
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @version 0.8
+ * @since   0.8
+ * @module
+ */
+final class DateList extends AbstractList<Instant> implements CheckedContainer<Instant> {
+    /**
+     * The times in multiples of {@link #increment} milliseconds since the {@link #epoch}.
+     */
+    private final IntegerList times;
+
+    /**
+     * The value by which to multiply the {@link #times} values in order to get milliseconds.
+     */
+    private final long increment;
+
+    /**
+     * The epoch in milliseconds since January 1st, 1970 midnight UTC.
+     */
+    private final long epoch;
+
+    /**
+     * Creates a new list for the given times. The given array shall be a temporary one
+     * since this constructor modifies the array values for computational purpose.
+     */
+    DateList(final long[] millis) {
+        long min = Long.MAX_VALUE;
+        for (final long t : millis) {
+            if (t < min) min = t;
+        }
+        long max = Long.MIN_VALUE;
+        for (int i=0; i<millis.length; i++) {
+            final long t = (millis[i] -= min);
+            if (t > max) max = t;
+        }
+        long inc = max;
+        for (long t : millis) {
+            if ((t % inc) != 0) do {
+                final long r = (inc % t);       // Search for greatest common divisor with Euclid's algorithm.
+                inc = t;
+                t = r;
+            } while (t != 0);
+        }
+        epoch = min;
+        increment = inc;
+        times = new IntegerList(millis.length, Math.toIntExact(max / inc));
+        for (final long t : millis) {
+            times.add(Math.toIntExact(t / inc));
+        }
+    }
+
+    /**
+     * Returns the kind of elements in this list.
+     */
+    @Override
+    public Class<Instant> getElementType() {
+        return Instant.class;
+    }
+
+    /**
+     * Returns the number of instants in this list.
+     */
+    @Override
+    public int size() {
+        return times.size();
+    }
+
+    /**
+     * Returns the instant at the given index.
+     */
+    @Override
+    public Instant get(final int index) {
+        return Instant.ofEpochMilli(times.getInt(index)*increment + epoch);
+    }
+}

Propchange: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/DateList.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/DateList.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/ESRI.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/ESRI.java?rev=1800165&r1=1800164&r2=1800165&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/ESRI.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/ESRI.java [UTF-8] Wed Jun 28 13:24:33 2017
@@ -39,7 +39,7 @@ import org.apache.sis.math.Vector;
  * @since   0.7
  * @module
  */
-final class ESRI extends Geometries {
+final class ESRI extends Geometries<Geometry> {
     /**
      * Creates the singleton instance.
      */
@@ -107,23 +107,27 @@ final class ESRI extends Geometries {
      * The implementation returned by this method must be an instance of {@link #rootClass}.
      */
     @Override
-    public Object createPolyline(final int dimension, final Vector ordinates) {
+    public Geometry createPolyline(final int dimension, final Vector... ordinates) {
         if (dimension != 2) {
             throw unsupported(dimension);
         }
-        final Polyline path = new Polyline();
-        final int size = ordinates.size();
         boolean lineTo = false;
-        for (int i=0; i<size;) {
-            final double x = ordinates.doubleValue(i++);
-            final double y = ordinates.doubleValue(i++);
-            if (Double.isNaN(x) || Double.isNaN(y)) {
-                lineTo = false;
-            } else if (lineTo) {
-                path.lineTo(x, y);
-            } else {
-                path.startPath(x, y);
-                lineTo = true;
+        final Polyline path = new Polyline();
+        for (final Vector v : ordinates) {
+            if (v != null) {
+                final int size = v.size();
+                for (int i=0; i<size;) {
+                    final double x = v.doubleValue(i++);
+                    final double y = v.doubleValue(i++);
+                    if (Double.isNaN(x) || Double.isNaN(y)) {
+                        lineTo = false;
+                    } else if (lineTo) {
+                        path.lineTo(x, y);
+                    } else {
+                        path.startPath(x, y);
+                        lineTo = true;
+                    }
+                }
             }
         }
         return path;
@@ -135,7 +139,7 @@ final class ESRI extends Geometries {
      * @throws ClassCastException if an element in the iterator is not a JTS geometry.
      */
     @Override
-    final Object tryMergePolylines(Object next, final Iterator<?> polylines) {
+    final Geometry tryMergePolylines(Object next, final Iterator<?> polylines) {
         if (!(next instanceof MultiPath || next instanceof Point)) {
             return null;
         }

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Geometries.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Geometries.java?rev=1800165&r1=1800164&r2=1800165&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Geometries.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Geometries.java [UTF-8] Wed Jun 28 13:24:33 2017
@@ -33,13 +33,15 @@ import org.apache.sis.math.Vector;
  * This gives us a single place to review if we want to support different geometry libraries,
  * or if Apache SIS come with its own implementation.
  *
+ * @param   <G>  the base class of all geometry objects (except point in some implementations).
+ *
  * @author  Johann Sorel (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
  * @version 0.8
  * @since   0.7
  * @module
  */
-public abstract class Geometries {
+public abstract class Geometries<G> {
     /*
      * Registers all supported library implementations. Those libraries are optional
      * (users will typically put at most one on their classpath).
@@ -58,28 +60,33 @@ public abstract class Geometries {
     /**
      * The root geometry class.
      */
-    public final Class<?> rootClass;
+    public final Class<G> rootClass;
+
+    /**
+     * The class for points.
+     */
+    public final Class<?> pointClass;
 
     /**
-     * The class for a point, ployline and polygon.
+     * The class for polylines and polygons.
      */
-    public final Class<?> pointClass, polylineClass, polygonClass;
+    public final Class<? extends G> polylineClass, polygonClass;
 
     /**
      * The default geometry implementation to use. Unmodifiable after class initialization.
      */
-    private static Geometries implementation;
+    private static Geometries<?> implementation;
 
     /**
      * The fallback implementation to use if the default one is not available.
      */
-    private final Geometries fallback;
+    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)
+    Geometries(final GeometryLibrary library, final Class<G> rootClass, final Class<?> pointClass,
+            final Class<? extends G> polylineClass, final Class<? extends G> polygonClass)
     {
         this.library       = library;
         this.rootClass     = rootClass;
@@ -114,11 +121,11 @@ public abstract class Geometries {
      * @return the default geometry implementation.
      * @throws IllegalArgumentException if the given library is non-null but not available.
      */
-    public static Geometries implementation(final GeometryLibrary library) {
+    public static Geometries<?> implementation(final GeometryLibrary library) {
         if (library == null) {
             return implementation;
         }
-        for (Geometries g = implementation; g != null; g = g.fallback) {
+        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));
@@ -131,7 +138,7 @@ public abstract class Geometries {
      * @return {@code true} if the given type is one of the geometry type known to SIS.
      */
     public static boolean isKnownType(final Class<?> type) {
-        for (Geometries g = implementation; g != null; g = g.fallback) {
+        for (Geometries<?> g = implementation; g != null; g = g.fallback) {
             if (g.rootClass.isAssignableFrom(type)) return true;
         }
         return false;
@@ -156,7 +163,7 @@ public abstract class Geometries {
      * @see #createPoint(double, double)
      */
     public static double[] getCoordinate(final Object point) {
-        for (Geometries g = implementation; g != null; g = g.fallback) {
+        for (Geometries<?> g = implementation; g != null; g = g.fallback) {
             double[] coord = g.tryGetCoordinate(point);
             if (coord != null) return coord;
         }
@@ -179,7 +186,7 @@ public abstract class Geometries {
      *         is not a recognized geometry or its envelope is empty.
      */
     public static GeneralEnvelope getEnvelope(final Object geometry) {
-        for (Geometries g = implementation; g != null; g = g.fallback) {
+        for (Geometries<?> g = implementation; g != null; g = g.fallback) {
             GeneralEnvelope env = g.tryGetEnvelope(geometry);
             if (env != null) return env;
         }
@@ -200,7 +207,9 @@ public abstract class Geometries {
 
     /**
      * Creates a path or polyline from the given ordinate values.
-     * Each {@link Double#NaN} ordinate value start a new path.
+     * The array of ordinate vectors will be handled as if all vectors were concatenated in a single vector,
+     * ignoring {@code null} array elements.
+     * Each {@link Double#NaN} ordinate value in the concatenated vector starts a new path.
      * The implementation returned by this method is an instance of {@link #rootClass}.
      *
      * @param  dimension  the number of dimensions (2 or 3).
@@ -208,7 +217,7 @@ public abstract class Geometries {
      * @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);
+    public abstract G createPolyline(int dimension, Vector... ordinates);
 
     /**
      * Merges a sequence of polyline instances if the first instance is an implementation of this library.
@@ -218,7 +227,7 @@ public abstract class Geometries {
      * @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);
+    abstract G tryMergePolylines(Object first, Iterator<?> polylines);
 
     /**
      * Merges a sequence of points or polylines into a single polyline instances.
@@ -233,7 +242,7 @@ public abstract class Geometries {
         while (paths.hasNext()) {
             final Object first = paths.next();
             if (first != null) {
-                for (Geometries g = implementation; g != null; g = g.fallback) {
+                for (Geometries<?> g = implementation; g != null; g = g.fallback) {
                     final Object merged = g.tryMergePolylines(first, paths);
                     if (merged != null) {
                         return merged;

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/JTS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/JTS.java?rev=1800165&r1=1800164&r2=1800165&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/JTS.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/JTS.java [UTF-8] Wed Jun 28 13:24:33 2017
@@ -37,7 +37,7 @@ import org.apache.sis.math.Vector;
  * @todo avoid use of reflection and use JTS API directly after JTS released
  *       a new version of the library under BSD-like license.
  */
-final class JTS extends Geometries {
+final class JTS extends Geometries<Object> {
     /**
      * Getter methods on JTS envelopes.
      * Each methods take no argument and return a {@code double} value.
@@ -49,7 +49,7 @@ final class JTS extends Geometries {
      */
     JTS() throws ClassNotFoundException, NoSuchMethodException {
         super(/*GeometryLibrary.JTS, */ null,                               // TODO
-              Class.forName("com.vividsolutions.jts.geom.Geometry"),
+              (Class) Class.forName("com.vividsolutions.jts.geom.Geometry"),    // TODO
               Class.forName("com.vividsolutions.jts.geom.Point"),
               Class.forName("com.vividsolutions.jts.geom.LineString"),
               Class.forName("com.vividsolutions.jts.geom.Polygon"));
@@ -123,7 +123,7 @@ final class JTS extends Geometries {
      * The implementation returned by this method must be an instance of {@link #rootClass}.
      */
     @Override
-    public Object createPolyline(final int dimension, final Vector ordinates) {
+    public Object createPolyline(final int dimension, final Vector... ordinates) {
         // TODO - see class javadoc
         throw unsupported(dimension);
     }

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Java2D.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Java2D.java?rev=1800165&r1=1800164&r2=1800165&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Java2D.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Java2D.java [UTF-8] Wed Jun 28 13:24:33 2017
@@ -39,7 +39,7 @@ import org.apache.sis.math.Vector;
  * @since   0.7
  * @module
  */
-final class Java2D extends Geometries {
+final class Java2D extends Geometries<Shape> {
     /**
      * Creates the singleton instance.
      */
@@ -94,64 +94,71 @@ final class Java2D extends Geometries {
     }
 
     /**
-     * Returns {@code true} if all values in the given vector can be casted to {@code float} without precision lost.
-     *
-     * @param  data  the data to test.
-     * @return whether all the given data can be casted to {@code float} type.
-     */
-    private static boolean isConvertibleToFloats(final Vector data) {
-        for (int i=data.size(); --i >= 0;) {
-            final double value = data.doubleValue(i);
-            if (Double.doubleToRawLongBits(value) != Double.doubleToRawLongBits((float) value)) {
-                return false;
-            }
-        }
-        return true;
-    }
-
-    /**
      * Creates a path from the given ordinate values.
      * Each {@link Double#NaN} ordinate value start a new path.
      * The implementation returned by this method must be an instance of {@link #rootClass}.
      */
     @Override
-    public Object createPolyline(final int dimension, final Vector ordinates) {
+    public Shape createPolyline(final int dimension, final Vector... ordinates) {
         if (dimension != 2) {
             throw unsupported(dimension);
         }
-        final boolean isFloat = isConvertibleToFloats(ordinates);
-        final int size = ordinates.size();
+        /*
+         * Computes the total length of all vectors and verifies if all values
+         * can be casted to float without precision lost.
+         */
+        int length = 0;
+        boolean isFloat = true;
+        for (final Vector v : ordinates) {
+            if (v != null) {
+                length = Math.addExact(length, v.size());
+                if (isFloat) {
+                    for (int i=v.size(); --i >= 0;) {
+                        final double value = v.doubleValue(i);
+                        if (Double.doubleToRawLongBits(value) != Double.doubleToRawLongBits((float) value)) {
+                            isFloat = false;
+                            break;
+                        }
+                    }
+                }
+            }
+        }
         /*
          * Note: Point2D is not an instance of Shape, so we can not make a special case for it.
          */
-        if (size == 4) {
+        length /= 2;
+        if (length == 2 && ordinates.length == 1) {
+            final Vector v = ordinates[0];
             final double x1, y1, x2, y2;
-            if (!Double.isNaN(x1 = ordinates.doubleValue(0)) &&
-                !Double.isNaN(y1 = ordinates.doubleValue(1)) &&
-                !Double.isNaN(x2 = ordinates.doubleValue(2)) &&
-                !Double.isNaN(y2 = ordinates.doubleValue(3)))
+            if (!Double.isNaN(x1 = v.doubleValue(0)) &&
+                !Double.isNaN(y1 = v.doubleValue(1)) &&
+                !Double.isNaN(x2 = v.doubleValue(2)) &&
+                !Double.isNaN(y2 = v.doubleValue(3)))
             {
                 final Line2D path = isFloat ? new Line2D.Float() : new Line2D.Double();
                 path.setLine(x1, y1, x2, y2);
                 return path;
             }
         }
-        final Path2D path = isFloat ? new Path2D.Float (Path2D.WIND_NON_ZERO, size/2)
-                                    : new Path2D.Double(Path2D.WIND_NON_ZERO, size/2);
+        final Path2D path = isFloat ? new Path2D.Float (Path2D.WIND_NON_ZERO, length)
+                                    : new Path2D.Double(Path2D.WIND_NON_ZERO, length);
         boolean lineTo = false;
-        for (int i=0; i<size;) {
-            final double x = ordinates.doubleValue(i++);
-            final double y = ordinates.doubleValue(i++);
-            if (Double.isNaN(x) || Double.isNaN(y)) {
-                lineTo = false;
-            } else if (lineTo) {
-                path.lineTo(x, y);
-            } else {
-                path.moveTo(x, y);
-                lineTo = true;
+        for (final Vector v : ordinates) {
+            final int size = v.size();
+            for (int i=0; i<size;) {
+                final double x = v.doubleValue(i++);
+                final double y = v.doubleValue(i++);
+                if (Double.isNaN(x) || Double.isNaN(y)) {
+                    lineTo = false;
+                } else if (lineTo) {
+                    path.lineTo(x, y);
+                } else {
+                    path.moveTo(x, y);
+                    lineTo = true;
+                }
             }
         }
-        return path;
+        return ShapeUtilities.toPrimitive(path);
     }
 
     /**
@@ -160,7 +167,7 @@ final class Java2D extends Geometries {
      * @throws ClassCastException if an element in the iterator is not a {@link Shape} or a {@link Point2D}.
      */
     @Override
-    final Object tryMergePolylines(Object next, final Iterator<?> polylines) {
+    final Shape tryMergePolylines(Object next, final Iterator<?> polylines) {
         if (!(next instanceof Shape || next instanceof Point2D)) {
             return null;
         }

Added: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/MovingFeature.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/MovingFeature.java?rev=1800165&view=auto
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/MovingFeature.java (added)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/MovingFeature.java [UTF-8] Wed Jun 28 13:24:33 2017
@@ -0,0 +1,278 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.internal.feature;
+
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Date;
+import java.util.Objects;
+import java.util.logging.Level;
+import java.util.logging.LogRecord;
+import java.lang.reflect.Array;
+import org.opengis.util.LocalName;
+import org.apache.sis.math.Vector;
+import org.apache.sis.util.iso.Names;
+import org.apache.sis.feature.DefaultAttributeType;
+import org.apache.sis.util.CorruptedObjectException;
+import org.apache.sis.internal.util.UnmodifiableArrayList;
+
+// Branch-dependent imports
+import java.time.Instant;
+import java.util.function.Consumer;
+import org.opengis.feature.Attribute;
+import org.opengis.feature.AttributeType;
+
+
+/**
+ * A feature implementation where the geometry is a trajectory and some property values may change with time.
+ * In current implementation this is a helper method for updating a {@code Feature} attribute.
+ * However in future versions, it could extend {@code DenseFeature} directly.
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @version 0.8
+ * @since   0.8
+ * @module
+ */
+public final class MovingFeature {
+    /**
+     * Definition of characteristics containing a list of time instants in chronological order, without duplicates.
+     */
+    public static final AttributeType<Instant> TIME;
+    static {
+        final LocalName scope = Names.createLocalName("OGC", null, "MF");
+        final Map<String,Object> properties = new HashMap<>(4);
+        properties.put(DefaultAttributeType.NAME_KEY, Names.createScopedName(scope, null, "datetimes"));
+        TIME = new DefaultAttributeType<>(properties, Instant.class, 0, Integer.MAX_VALUE, null);
+    }
+
+    /**
+     * The properties having values that may change in time.
+     * May contain the values of arbitrary properties (e.g. as {@link String} instances),
+     * or may contain the coordinates of part of a trajectory as array of primitive type like {@code float[]}.
+     * Trajectories may be specified in many parts if for example, the different parts are given on different
+     * lines of a CSV file.
+     */
+    private final Period[] properties;
+
+    /**
+     * Number of {@code Property} instances added for each index of the {@link #properties} table.
+     */
+    private int[] count;
+
+    /**
+     * A dynamic property value together with the period of time in which this property is valid.
+     */
+    private static final class Period {
+        /**
+         * Beginning in milliseconds since Java epoch of the period when the property value is valid.
+         */
+        final long startTime;
+
+        /**
+         * End in milliseconds since Java epoch of the period when the the property value is valid.
+         * This end time will be adjusted if the property has the same valid in the next time step.
+         */
+        long endTime;
+
+        /**
+         * The property value.
+         */
+        final Object value;
+
+        /**
+         * Previous property in a chained list of properties.
+         */
+        final Period previous;
+
+        /**
+         * Creates a new property value valid on the given period of time.
+         */
+        Period(final Period previous, final long startTime, final long endTime, final Object value) {
+            this.previous  = previous;
+            this.startTime = startTime;
+            this.endTime   = endTime;
+            this.value     = value;
+        }
+    }
+
+    /**
+     * Creates a new moving feature.
+     *
+     * @param numProperties  maximal number of dynamic properties.
+     */
+    public MovingFeature(final int numProperties) {
+        properties = new Period[numProperties];
+    }
+
+    /**
+     * Adds a dynamic property value. This method shall be invoked with time periods in chronological order.
+     *
+     * @param  index      the property index.
+     * @param  startTime  beginning in milliseconds since Java epoch of the period when the property value is valid.
+     * @param  endTime    end in milliseconds since Java epoch of the period when the the property value is valid.
+     * @param  value      the property value which is valid during the given period.
+     */
+    public final void addValue(final int index, final long startTime, final long endTime, final Object value) {
+        final Period p = properties[index];
+        if (p != null && p.endTime == startTime && Objects.equals(p.value, value)) {
+            p.endTime = endTime;
+        } else {
+            properties[index] = new Period(p, startTime, endTime, value);
+            count[index]++;
+        }
+    }
+
+    /**
+     * Sets the values of the given attribute to the values collected by this {@code MovingFeatures}.
+     * This method sets also the {@code "datetimes"} characteristic.
+     *
+     * @param  <V>    the type of values in the given attribute.
+     * @param  index  index of the property for which values are desired.
+     * @param  dest   attribute where to store the value.
+     */
+    @SuppressWarnings("unchecked")
+    public final <V> void storeAttribute(final int index, final Attribute<V> dest) {
+        int n = count[index];
+        final long[] times  = new long[n];
+        final V[]    values = (V[]) Array.newInstance(dest.getType().getValueClass(), n);
+        for (Period p = properties[index]; p != null; p = p.previous) {
+            times [--n] = p.startTime;
+            values[  n] = (V) p.value;
+        }
+        if (n != 0) {
+            // Should never happen unless this object has been modified concurrently in another thread.
+            throw new CorruptedObjectException();
+        }
+        dest.setValues(UnmodifiableArrayList.wrap(values));
+        final Attribute<Instant> c = TIME.newInstance();
+        c.setValues(new DateList(times));
+        dest.characteristics().values().add(c);
+    }
+
+    /**
+     * Sets the geometry of the given attribute to the values collected by this {@code MovingFeatures}.
+     * This method sets also the {@code "datetimes"} characteristic.
+     *
+     * @param  <G>              the type of the geometry value.
+     * @param  featureName      the name of the feature containing the attribute to update, for logging purpose.
+     * @param  index            index of the property for which geometry value is desired.
+     * @param  dimension        number of dimensions for all coordinates.
+     * @param  factory          the factory to use for creating the geometry object.
+     * @param  dest             attribute where to store the geometry value.
+     * @param  warningListener  where to report warnings. Implementation should set the source class name,
+     *                          source method name and logger name, then forward to a {@code WarningListener}.
+     */
+    public final <G> void storeGeometry(final String featureName, final int index, final int dimension,
+            final Geometries<G> factory, final Attribute<G> dest, final Consumer<LogRecord> warningListener)
+    {
+        int n = count[index];
+        final Vector[] coords = new Vector[n];
+        for (Period p = properties[index]; p != null; p = p.previous) {
+            coords[--n] = Vector.create(p.value, false);
+        }
+        if (n != 0) {
+            // Should never happen unless this object has been modified concurrently in another thread.
+            throw new CorruptedObjectException();
+        }
+        int    warnings = 10;                   // Maximal number of warnings, for avoiding to flood the logger.
+        int    numPts   = 0;                    // Total number of points in all vectors, ignoring invalid ones.
+        Vector previous = null;                 // If non-null, shall be non-empty.
+        for (int i=0; i<coords.length; i++) {
+            Vector v = coords[i];
+            int length;
+            if (v == null || (length = v.size()) == 0) {
+                continue;
+            }
+            if ((length % dimension) != 0) {
+                if (--warnings >= 0) {
+                    Period p = properties[index];
+                    for (int j=i; --j >= 0;) {          // This is inefficient but used only in case of warnings.
+                        p = p.previous;
+                    }
+                    warningListener.accept(Resources.forLocale(null).getLogRecord(Level.WARNING,
+                            Resources.Keys.UnexpectedNumberOfOrdinates_4, featureName, new Date(p.startTime), dimension, length));
+                }
+                continue;
+            }
+            /*
+             * At this point we have a non-empty valid sequence of ordinate values. If the first point of current
+             * vector is equals to the last point of previous vector, assume that they form a continuous polyline.
+             */
+            if (previous != null) {
+                if (equals(previous, v, dimension)) {
+                    v = v.subList(dimension, length);                               // Skip the first coordinate.
+                    length -= dimension;
+                    if (length == 0) {
+                        coords[i] = null;
+                        continue;
+                    }
+                    coords[i] = v;
+                }
+            }
+            numPts += length;
+            previous = v;
+        }
+        /*
+         * At this point we got the list of all coordinates to join together in a polyline.
+         * We will create the geometry at the end of this method. Before that, interpolate
+         * the dates and times.
+         */
+        int i = coords.length;
+        numPts /= dimension;
+        final long[] times = new long[numPts];
+        for (Period p = properties[index]; p != null; p = p.previous) {
+            final Vector v = coords[--i];
+            if (v != null) {
+                int c = v.size() / dimension;
+                final long startTime = p.startTime;
+                final double scale = (p.endTime - startTime) / (double) Math.max(c-1, 1);
+                while (--c >= 0) {
+                    times[--numPts] = startTime + Math.round(scale * c);
+                }
+            }
+        }
+        if (numPts != 0) {
+            // Should never happen unless this object has been modified concurrently in another thread.
+            throw new CorruptedObjectException();
+        }
+        /*
+         * Store the geometry and characteristics in the attribute.
+         */
+        dest.setValue(factory.createPolyline(dimension, coords));
+        final Attribute<Instant> c = TIME.newInstance();
+        c.setValues(new DateList(times));
+        dest.characteristics().values().add(c);
+    }
+
+    /**
+     * Returns {@code true} if the last coordinate of the {@code previous} vector is equals to the first
+     * coordinate of the {@code next} vector.
+     *
+     * @param previous   the previous vector.
+     * @param next       the next vector.
+     * @param dimension  number of dimension in each coordinate.
+     */
+    private static boolean equals(final Vector previous, final Vector next, int dimension) {
+        int p = previous.size();
+        while (--dimension >= 0) {
+            if (next.doubleValue(dimension) != previous.doubleValue(--p)) {
+                return false;
+            }
+        }
+        return true;
+    }
+}

Propchange: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/MovingFeature.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/MovingFeature.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Resources.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Resources.java?rev=1800165&r1=1800164&r2=1800165&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Resources.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Resources.java [UTF-8] Wed Jun 28 13:24:33 2017
@@ -160,6 +160,11 @@ public final class Resources extends Ind
         public static final short UnexpectedNumberOfComponents_4 = 17;
 
         /**
+         * The “{0}” feature at {1} has a {3} ordinate values, while we expected a multiple of {2}.
+         */
+        public static final short UnexpectedNumberOfOrdinates_4 = 22;
+
+        /**
          * Feature named “{0}” has not yet been resolved.
          */
         public static final short UnresolvedFeatureName_1 = 18;

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Resources.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Resources.properties?rev=1800165&r1=1800164&r2=1800165&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Resources.properties [ISO-8859-1] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Resources.properties [ISO-8859-1] Wed Jun 28 13:24:33 2017
@@ -38,5 +38,6 @@ PropertyAlreadyExists_2           = Prop
 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}.
+UnexpectedNumberOfOrdinates_4     = The \u201c{0}\u201d feature at {1} has a {3} ordinate values, while we expected a multiple of {2}.
 UnresolvedFeatureName_1           = Feature named \u201c{0}\u201d has not yet been resolved.
 UnsupportedGeometryObject_1       = Unsupported geometry {0}D object.

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Resources_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Resources_fr.properties?rev=1800165&r1=1800164&r2=1800165&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Resources_fr.properties [ISO-8859-1] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Resources_fr.properties [ISO-8859-1] Wed Jun 28 13:24:33 2017
@@ -43,5 +43,6 @@ PropertyNotFound_2                = Aucu
 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}.
+UnexpectedNumberOfOrdinates_4     = L\u2019entit\u00e9 nomm\u00e9e \u00ab\u202f{0}\u202f\u00bb \u00e0 {1} contient {3} ordonn\u00e9es, alors qu\u2019on attendait un multiple de {2}.
 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/JDK8/core/sis-utility/src/main/java/org/apache/sis/math/Fraction.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/math/Fraction.java?rev=1800165&r1=1800164&r2=1800165&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/math/Fraction.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/math/Fraction.java [UTF-8] Wed Jun 28 13:24:33 2017
@@ -136,7 +136,7 @@ public final class Fraction extends Numb
                 num /= den;                     // Simplify  xy/x  as  y/1
                 den = 1;
             } else {
-                do {                            // Search for greater common divisor with Euclid's algorithm.
+                do {                            // Search for greatest common divisor with Euclid's algorithm.
                     a   = gcd;
                     gcd = remainder;
                     remainder = a % gcd;

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/UnitFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/UnitFormat.java?rev=1800165&r1=1800164&r2=1800165&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/UnitFormat.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/UnitFormat.java [UTF-8] Wed Jun 28 13:24:33 2017
@@ -421,13 +421,17 @@ public class UnitFormat extends Format i
         final Unit<?> unitForOldLabel = labelToUnit.remove(unitToLabel.put(unit, label));
         final Unit<?> oldUnitForLabel = labelToUnit.put(label, unit);
         if (oldUnitForLabel != null && !oldUnitForLabel.equals(unit) && !label.equals(unitToLabel.remove(oldUnitForLabel))) {
-            // Assuming there is no bug in our algorithm, this exception should never happen
-            // unless this UnitFormat has been modified concurrently in another thread.
+            /*
+             * Assuming there is no bug in our algorithm, this exception should never happen
+             * unless this UnitFormat has been modified concurrently in another thread.
+             */
             throw new CorruptedObjectException("unitToLabel");
         }
         if (unitForOldLabel != null && !unitForOldLabel.equals(unit)) {
-            // Assuming there is no bug in our algorithm, this exception should never happen
-            // unless this UnitFormat has been modified concurrently in another thread.
+            /*
+             * Assuming there is no bug in our algorithm, this exception should never happen
+             * unless this UnitFormat has been modified concurrently in another thread.
+             */
             throw new CorruptedObjectException("labelToUnit");
         }
     }

Modified: sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/GeometryParser.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/GeometryParser.java?rev=1800165&r1=1800164&r2=1800165&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/GeometryParser.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/GeometryParser.java [UTF-8] Wed Jun 28 13:24:33 2017
@@ -26,8 +26,7 @@ import org.apache.sis.math.Vector;
  * The converter to use for converting a text into a geometry.
  * The geometry class depends on the library available at runtime.
  *
- * @param  <G>  the geometry class. There is actually no easy way this class can ensure that we comply
- *              with this parameterized type. This class shall not be public in part for that reason.
+ * @param  <G>  the geometry class.
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @version 0.8
@@ -43,7 +42,7 @@ final class GeometryParser<G> extends Su
     /**
      * The factory to use for creating polylines.
      */
-    private final Geometries geometries;
+    private final Geometries<G> geometries;
 
     /**
      * The number of dimensions other than time in the coordinate reference system.
@@ -55,7 +54,7 @@ final class GeometryParser<G> extends Su
     /**
      * Creates a new converter from CSV encoded trajectories to geometries.
      */
-    private GeometryParser(final Geometries geometries, final short spatialDimensionCount) {
+    private GeometryParser(final Geometries<G> geometries, final short spatialDimensionCount) {
         this.geometries = geometries;
         this.spatialDimensionCount = spatialDimensionCount;
     }
@@ -63,7 +62,7 @@ final class GeometryParser<G> extends Su
     /**
      * Returns a parser instance for the given geometry factory.
      */
-    static GeometryParser<?> instance(final Geometries geometries, final short spatialDimensionCount) {
+    static GeometryParser<?> instance(final Geometries<?> geometries, final short spatialDimensionCount) {
         return (spatialDimensionCount == 2 && INSTANCE.geometries == geometries)
                ? INSTANCE : new GeometryParser<>(geometries, spatialDimensionCount);
     }
@@ -90,14 +89,13 @@ final class GeometryParser<G> extends Su
      * Converts an element from the CSV file to the geometry type.
      */
     @Override
-    @SuppressWarnings("unchecked")
     public G apply(final String text) {
         /*
          * We could avoid the "unchecked" warning by using getTargetClass().cast(…), but it would be
          * a false sense of safety since 'getTargetClass()' is itself unchecked. The real check will
          * be performed by DefaultFeatureType.setPropertyValue(…) anyway.
          */
-        return (G) geometries.createPolyline(spatialDimensionCount,
+        return geometries.createPolyline(spatialDimensionCount,
                 Vector.create(CharSequences.parseDoubles(text, Store.ORDINATE_SEPARATOR), false));
     }
 }

Modified: sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java?rev=1800165&r1=1800164&r2=1800165&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java [UTF-8] Wed Jun 28 13:24:33 2017
@@ -167,7 +167,7 @@ public final class Store extends Feature
     /**
      * The factory to use for creating geometries.
      */
-    private final Geometries geometries;
+    private final Geometries<?> geometries;
 
     /**
      * Appearing order of trajectories (time or sequential), or {@code null} if unspecified.

Modified: sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/GroupAsPolylineOperation.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/GroupAsPolylineOperation.java?rev=1800165&r1=1800164&r2=1800165&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/GroupAsPolylineOperation.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/GroupAsPolylineOperation.java [UTF-8] Wed Jun 28 13:24:33 2017
@@ -103,7 +103,7 @@ final class GroupAsPolylineOperation ext
      *
      * @param  geometries  accessor to the geometry implementation in use (Java2D, ESRI or JTS).
      */
-    static AttributeType<?> getResult(final Geometries geometries) {
+    static <G> AttributeType<? extends G> getResult(final Geometries<G> geometries) {
         return new DefaultAttributeType<>(Collections.singletonMap(NAME_KEY, AttributeConvention.ENVELOPE_PROPERTY),
                 geometries.polylineClass, 1, 1, null);
     }

Modified: sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Types.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Types.java?rev=1800165&r1=1800164&r2=1800165&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Types.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Types.java [UTF-8] Wed Jun 28 13:24:33 2017
@@ -97,7 +97,7 @@ final class Types {
     /**
      * Accessor to the geometry implementation in use (Java2D, ESRI or JTS).
      */
-    final Geometries geometries;
+    final Geometries<?> geometries;
 
     /**
      * A system-wide instance for {@code FeatureType} instances created using the {@link DefaultNameFactory}.



Mime
View raw message