sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1764673 [10/10] - in /sis/branches/JDK8: ./ application/sis-console/src/main/java/org/apache/sis/console/ core/ core/sis-feature/src/main/java/org/apache/sis/feature/builder/ core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/met...
Date Thu, 13 Oct 2016 13:38:52 GMT
Modified: sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java?rev=1764673&r1=1764672&r2=1764673&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java
[UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java
[UTF-8] Thu Oct 13 13:38:49 2016
@@ -25,8 +25,6 @@ import java.util.Locale;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.io.LineNumberReader;
-import javax.measure.unit.SI;
-import javax.measure.unit.NonSI;
 
 import org.opengis.metadata.Metadata;
 import org.opengis.metadata.citation.Citation;
@@ -42,6 +40,7 @@ import org.opengis.referencing.operation
 import org.opengis.util.NoSuchIdentifierException;
 import org.opengis.util.FactoryException;
 
+import org.apache.sis.measure.Units;
 import org.apache.sis.metadata.iso.DefaultMetadata;
 import org.apache.sis.metadata.iso.DefaultIdentifier;
 import org.apache.sis.metadata.iso.citation.Citations;
@@ -802,7 +801,7 @@ final class LandsatReader {
             band = new DefaultBand();
             band.setDescription(new SimpleInternationalString(BAND_NAMES[index]));
             band.setPeakResponse((double) WAVELENGTHS[index]);
-            band.setBoundUnits(SI.MetricPrefix.NANO(SI.METRE));
+            band.setBoundUnits(Units.NANOMETRE);
             bands[index] = band;
         }
         return band;
@@ -818,7 +817,7 @@ final class LandsatReader {
      */
     private void setProjectionParameter(final String key, final String name, final String
value, final boolean isLinear) {
         if (projection != null) {
-            projection.parameter(name).setValue(Double.parseDouble(value), isLinear ? SI.METRE
: NonSI.DEGREE_ANGLE);
+            projection.parameter(name).setValue(Double.parseDouble(value), isLinear ? Units.METRE
: Units.DEGREE);
         } else {
             listeners.warning(errors().getString(Errors.Keys.UnexpectedProperty_2, filename,
key), null);
         }

Modified: sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Decoder.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Decoder.java?rev=1764673&r1=1764672&r2=1764673&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Decoder.java
[UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Decoder.java
[UTF-8] Thu Oct 13 13:38:49 2016
@@ -19,7 +19,8 @@ package org.apache.sis.internal.netcdf;
 import java.util.Date;
 import java.io.Closeable;
 import java.io.IOException;
-import javax.measure.unit.Unit;
+import javax.measure.Unit;
+import javax.measure.format.ParserException;
 import org.apache.sis.measure.Units;
 import org.apache.sis.storage.DataStoreException;
 import org.apache.sis.util.logging.WarningListeners;
@@ -146,7 +147,7 @@ public abstract class Decoder implements
         final String unit = stringValue(name);
         if (unit != null) try {
             return Units.valueOf(unit);
-        } catch (IllegalArgumentException e) {
+        } catch (ParserException e) {
             listeners.warning(null, e);
         }
         return null;

Modified: sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java?rev=1764673&r1=1764672&r2=1764673&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java
[UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java
[UTF-8] Thu Oct 13 13:38:49 2016
@@ -31,8 +31,9 @@ import java.util.regex.Pattern;
 import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.nio.channels.ReadableByteChannel;
-import javax.measure.converter.UnitConverter;
-import javax.measure.converter.ConversionException;
+import javax.measure.UnitConverter;
+import javax.measure.IncommensurableException;
+import javax.measure.format.ParserException;
 import org.opengis.parameter.InvalidParameterCardinalityException;
 import org.apache.sis.internal.netcdf.DataType;
 import org.apache.sis.internal.netcdf.Decoder;
@@ -728,7 +729,7 @@ public final class ChannelDecoder extend
                     dates[i] = new Date(epoch + Math.round(converter.convert(value.doubleValue())));
                 }
             }
-        } catch (ConversionException | DateTimeException | ArithmeticException e) {
+        } catch (IncommensurableException | ParserException | DateTimeException | ArithmeticException
e) {
             listeners.warning(null, e);
         }
         return dates;

Modified: sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java?rev=1764673&r1=1764672&r2=1764673&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java
[UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java
[UTF-8] Thu Oct 13 13:38:49 2016
@@ -27,11 +27,10 @@ import java.util.HashMap;
 import java.util.Arrays;
 import java.util.Collection;
 import java.io.IOException;
-import javax.measure.unit.Unit;
-import javax.measure.unit.SI;
-import javax.measure.unit.NonSI;
-import javax.measure.converter.UnitConverter;
-import javax.measure.converter.ConversionException;
+import javax.measure.Unit;
+import javax.measure.UnitConverter;
+import javax.measure.IncommensurableException;
+import javax.measure.format.ParserException;
 
 import org.opengis.util.NameFactory;
 import org.opengis.util.InternationalString;
@@ -685,8 +684,8 @@ final class MetadataReader {
          * If at least one geographic ordinates above is available, add a GeographicBoundingBox.
          */
         if (xmin != null || xmax != null || ymin != null || ymax != null) {
-            final UnitConverter xConv = getConverterTo(decoder.unitValue(LONGITUDE.UNITS),
NonSI.DEGREE_ANGLE);
-            final UnitConverter yConv = getConverterTo(decoder.unitValue(LATITUDE .UNITS),
NonSI.DEGREE_ANGLE);
+            final UnitConverter xConv = getConverterTo(decoder.unitValue(LONGITUDE.UNITS),
Units.DEGREE);
+            final UnitConverter yConv = getConverterTo(decoder.unitValue(LATITUDE .UNITS),
Units.DEGREE);
             extent = new DefaultExtent(null, new DefaultGeographicBoundingBox(
                     valueOf(xmin, xConv), valueOf(xmax, xConv),
                     valueOf(ymin, yConv), valueOf(ymax, yConv)), null, null);
@@ -695,7 +694,7 @@ final class MetadataReader {
          * If at least one vertical ordinates above is available, add a VerticalExtent.
          */
         if (zmin != null || zmax != null) {
-            final UnitConverter c = getConverterTo(decoder.unitValue(VERTICAL.UNITS), SI.METRE);
+            final UnitConverter c = getConverterTo(decoder.unitValue(VERTICAL.UNITS), Units.METRE);
             double min = valueOf(zmin, c);
             double max = valueOf(zmax, c);
             if (CF.POSITIVE_DOWN.equals(stringValue(VERTICAL.POSITIVE))) {
@@ -761,7 +760,7 @@ final class MetadataReader {
     private UnitConverter getConverterTo(final Unit<?> source, final Unit<?>
target) {
         if (source != null) try {
             return source.getConverterToAny(target);
-        } catch (ConversionException e) {
+        } catch (IncommensurableException e) {
             warning(e);
         }
         return null;
@@ -867,7 +866,7 @@ final class MetadataReader {
         final String units = variable.getUnitsString();
         if (units != null) try {
             band.setUnits(Units.valueOf(units));
-        } catch (IllegalArgumentException e) {
+        } catch (ParserException e) {
             decoder.listeners.warning(errors().getString(Errors.Keys.CanNotAssignUnitToDimension_2,
name, units), e);
         }
         return band;

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=1764673&r1=1764672&r2=1764673&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] Thu Oct 13 13:38:49 2016
@@ -30,10 +30,8 @@ import java.io.LineNumberReader;
 import java.io.IOException;
 import java.net.URI;
 import java.nio.charset.Charset;
-import javax.measure.unit.Unit;
-import javax.measure.unit.SI;
-import javax.measure.unit.NonSI;
-import javax.measure.quantity.Duration;
+import javax.measure.Unit;
+import javax.measure.quantity.Time;
 import org.opengis.metadata.Metadata;
 import org.opengis.util.FactoryException;
 import org.opengis.metadata.maintenance.ScopeCode;
@@ -60,6 +58,7 @@ import org.apache.sis.util.ObjectConvert
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.resources.IndexedResourceBundle;
 import org.apache.sis.util.collection.BackingStoreException;
+import org.apache.sis.measure.Units;
 
 // Branch-dependent imports
 import java.time.Instant;
@@ -261,13 +260,13 @@ public final class Store extends DataSto
     @SuppressWarnings("fallthrough")
     private GeneralEnvelope parseEnvelope(final List<String> elements) throws DataStoreException,
FactoryException {
         CoordinateReferenceSystem crs = null;
-        int spatialDimensionCount     = 2;
-        double[]       lowerCorner    = ArraysExt.EMPTY_DOUBLE;
-        double[]       upperCorner    = ArraysExt.EMPTY_DOUBLE;
-        Instant        startTime      = null;
-        Instant        endTime        = null;
-        Unit<Duration> timeUnit       = SI.SECOND;
-        boolean        isTimeAbsolute = false;
+        int spatialDimensionCount = 2;
+        double[]   lowerCorner    = ArraysExt.EMPTY_DOUBLE;
+        double[]   upperCorner    = ArraysExt.EMPTY_DOUBLE;
+        Instant    startTime      = null;
+        Instant    endTime        = null;
+        Unit<Time> timeUnit       = Units.SECOND;
+        boolean    isTimeAbsolute = false;
         int ordinal = -1;
         for (final String element : elements) {
             ordinal++;
@@ -295,10 +294,10 @@ public final class Store extends DataSto
                     case 6: endTime     = Instant.parse(element); continue;
                     case 7: switch (element.toLowerCase(Locale.US)) {
                                 case "sec":
-                                case "second":   /* Already SI.SECOND. */ continue;
-                                case "minute":   timeUnit = NonSI.MINUTE; continue;
-                                case "hour":     timeUnit = NonSI.HOUR;   continue;
-                                case "day":      timeUnit = NonSI.DAY;    continue;
+                                case "second":   /* Already SECOND. */    continue;
+                                case "minute":   timeUnit = Units.MINUTE; continue;
+                                case "hour":     timeUnit = Units.HOUR;   continue;
+                                case "day":      timeUnit = Units.DAY;    continue;
                                 case "absolute": isTimeAbsolute = true;   continue;
                                 default: throw new DataStoreContentException(errors().getString(Errors.Keys.UnknownUnit_1,
element));
                             }

Modified: sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/TimeEncoding.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/TimeEncoding.java?rev=1764673&r1=1764672&r2=1764673&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/TimeEncoding.java
[UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/TimeEncoding.java
[UTF-8] Thu Oct 13 13:38:49 2016
@@ -16,9 +16,8 @@
  */
 package org.apache.sis.internal.storage.csv;
 
-import javax.measure.unit.Unit;
-import javax.measure.unit.NonSI;
-import javax.measure.quantity.Duration;
+import javax.measure.Unit;
+import javax.measure.quantity.Time;
 import org.opengis.referencing.datum.TemporalDatum;
 import org.apache.sis.internal.converter.SurjectiveConverter;
 import org.apache.sis.referencing.CommonCRS;
@@ -47,7 +46,7 @@ class TimeEncoding extends SurjectiveCon
     /**
      * Times are formatted as ISO dates.
      */
-    static final TimeEncoding ABSOLUTE = new TimeEncoding(DEFAULT.datum(), NonSI.DAY) {
+    static final TimeEncoding ABSOLUTE = new TimeEncoding(DEFAULT.datum(), Units.DAY) {
         @Override public Instant apply(final String time) {
             return Instant.parse(time);
         }
@@ -66,7 +65,7 @@ class TimeEncoding extends SurjectiveCon
     /**
      * Creates a new time encoding.
      */
-    TimeEncoding(final TemporalDatum datum, final Unit<Duration> unit) {
+    TimeEncoding(final TemporalDatum datum, final Unit<Time> unit) {
         this.origin   = datum.getOrigin().getTime();
         this.interval = unit.getConverterTo(Units.MILLISECOND).convert(1);
     }

Modified: sis/branches/JDK8/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/wkt/StoreTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/wkt/StoreTest.java?rev=1764673&r1=1764672&r2=1764673&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/wkt/StoreTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/wkt/StoreTest.java
[UTF-8] Thu Oct 13 13:38:49 2016
@@ -52,7 +52,7 @@ public final strictfp class StoreTest ex
             "  DATUM[\"Nouvelle Triangulation Francaise (Paris)\",\n" +
             "    SPHEROID[\"Clarke 1880 (IGN)\", 6378249.2, 293.4660212936269]],\n" +
             "    PRIMEM[\"Paris\", 2.5969213, AUTHORITY[\"EPSG\", \"8903\"]],\n" +
-            "  UNIT[\"grade\", 0.015707963267948967],\n" +
+            "  UNIT[\"grad\", 0.015707963267948967],\n" +
             "  AXIS[\"Latitude\", NORTH],\n" +
             "  AXIS[\"Longitude\", EAST]]";
 



Mime
View raw message