Author: desruisseaux
Date: Thu Jul 25 16:06:47 2013
New Revision: 1507043
URL: http://svn.apache.org/r1507043
Log:
Added convenience constructors for DefaultExtent.
Modified:
sis/branches/JDK7/core/sis-build-helper/src/site/apt/index.apt
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultExtent.java
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultGeographicBoundingBox.java
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties
sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java
Modified: sis/branches/JDK7/core/sis-build-helper/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-build-helper/src/site/apt/index.apt?rev=1507043&r1=1507042&r2=1507043&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-build-helper/src/site/apt/index.apt [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-build-helper/src/site/apt/index.apt [UTF-8] Thu Jul 25 16:06:47
2013
@@ -163,3 +163,6 @@ Building Apache SIS
----------------------------------------------------------------
unpack200 --remove-pack-file sis-<version>.pack.gz sis.jar
----------------------------------------------------------------
+
+ The Pack200 bundle does not include the <<<sis-webapp>>> module because
the later can be downloaded
+ as a <<<WAR>>> file from the Maven repository.
Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultExtent.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultExtent.java?rev=1507043&r1=1507042&r2=1507043&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultExtent.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultExtent.java
[UTF-8] Thu Jul 25 16:06:47 2013
@@ -17,7 +17,6 @@
package org.apache.sis.metadata.iso.extent;
import java.util.Collection;
-import java.util.Collections;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@@ -29,6 +28,8 @@ import org.opengis.metadata.extent.Geogr
import org.opengis.metadata.extent.GeographicBoundingBox;
import org.opengis.referencing.operation.TransformException;
import org.opengis.util.InternationalString;
+import org.apache.sis.util.iso.Types;
+import org.apache.sis.util.resources.Vocabulary;
import org.apache.sis.metadata.iso.ISOMetadata;
import org.apache.sis.internal.metadata.ReferencingServices;
@@ -72,17 +73,19 @@ public class DefaultExtent extends ISOMe
/**
* A geographic extent ranging from 180°W to 180°E and 90°S to 90°N.
+ * This extent has no vertical and no temporal components.
*/
public static final Extent WORLD;
static {
- final DefaultExtent world = new DefaultExtent();
- world.setGeographicElements(Collections.singleton(DefaultGeographicBoundingBox.WORLD));
+ final DefaultExtent world = new DefaultExtent(
+ Vocabulary.formatInternational(Vocabulary.Keys.World),
+ DefaultGeographicBoundingBox.WORLD, null, null);
world.freeze();
WORLD = world;
}
/**
- * Returns the spatial and temporal extent for the referring object.
+ * The spatial and temporal extent for the referring object.
*/
private InternationalString description;
@@ -108,6 +111,58 @@ public class DefaultExtent extends ISOMe
}
/**
+ * Constructs an extent initialized to the given description or components.
+ * Any argument given to this constructor can be {@code null}.
+ * While a valid {@code Extent} requires at least one component to be non-null,
+ * this constructor does not perform such verification.
+ *
+ * @param description A description, or {@code null} if none.
+ * @param geographicElements A geographic component, or {@code null} if none.
+ * @param verticalElements A vertical component, or {@code null} if none.
+ * @param temporalElements A temporal component, or {@code null} if none.
+ */
+ public DefaultExtent(final CharSequence description,
+ final GeographicExtent geographicElements,
+ final VerticalExtent verticalElements,
+ final TemporalExtent temporalElements)
+ {
+ this.description = Types.toInternationalString(description);
+ this.geographicElements = singleton(geographicElements, GeographicExtent.class);
+ this.verticalElements = singleton(verticalElements, VerticalExtent.class);
+ this.temporalElements = singleton(temporalElements, TemporalExtent.class);
+ }
+
+ /**
+ * Constructs an extent initialized to the given geographic bounding box.
+ *
+ * <p><strong>Caution:</strong> Arguments are expected in the same
order than they appear
+ * in the ISO 19115 specification. This is different than the order commonly found in
the
+ * Java2D world, which is rather (<var>x</var><sub>min</sub>,
<var>y</var><sub>min</sub>,
+ * <var>x</var><sub>max</sub>, <var>y</var><sub>max</sub>).</p>
+ *
+ * @param westBoundLongitude The minimal λ value.
+ * @param eastBoundLongitude The maximal λ value.
+ * @param southBoundLatitude The minimal φ value.
+ * @param northBoundLatitude The maximal φ value.
+ *
+ * @throws IllegalArgumentException If (<var>west bound</var> > <var>east
bound</var>)
+ * or (<var>south bound</var> > <var>north bound</var>).
+ * Note that {@linkplain Double#NaN NaN} values are allowed.
+ *
+ * @see DefaultGeographicBoundingBox#DefaultGeographicBoundingBox(double, double, double,
double)
+ */
+ public DefaultExtent(final double westBoundLongitude,
+ final double eastBoundLongitude,
+ final double southBoundLatitude,
+ final double northBoundLatitude)
+ throws IllegalArgumentException
+ {
+ geographicElements = singleton(new DefaultGeographicBoundingBox(
+ westBoundLongitude, eastBoundLongitude,
+ southBoundLatitude, northBoundLatitude), GeographicExtent.class);
+ }
+
+ /**
* Constructs a new instance initialized with the values from the specified metadata
object.
* This is a <cite>shallow</cite> copy constructor, since the other metadata
contained in the
* given object are not recursively copied.
Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultGeographicBoundingBox.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultGeographicBoundingBox.java?rev=1507043&r1=1507042&r2=1507043&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultGeographicBoundingBox.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultGeographicBoundingBox.java
[UTF-8] Thu Jul 25 16:06:47 2013
@@ -138,6 +138,7 @@ public class DefaultGeographicBoundingBo
* Note that {@linkplain Double#NaN NaN} values are allowed.
*
* @see #setBounds(double, double, double, double)
+ * @see DefaultExtent#DefaultExtent(double, double, double, double)
*/
public DefaultGeographicBoundingBox(final double westBoundLongitude,
final double eastBoundLongitude,
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java?rev=1507043&r1=1507042&r2=1507043&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
[UTF-8] Thu Jul 25 16:06:47 2013
@@ -328,6 +328,11 @@ public final class Vocabulary extends In
* Versions
*/
public static final int Versions = 15;
+
+ /**
+ * World
+ */
+ public static final int World = 55;
}
/**
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties?rev=1507043&r1=1507042&r2=1507043&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties
[ISO-8859-1] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties
[ISO-8859-1] Thu Jul 25 16:06:47 2013
@@ -69,3 +69,4 @@ Value = Value
Variables = Variables
Version_2 = {0} version {1}
Versions = Versions
+World = World
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties?rev=1507043&r1=1507042&r2=1507043&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties
[ISO-8859-1] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties
[ISO-8859-1] Thu Jul 25 16:06:47 2013
@@ -69,3 +69,4 @@ Value = Valeur
Variables = Variables
Version_2 = {0} version {1}
Versions = Versions
+World = Monde
Modified: sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java?rev=1507043&r1=1507042&r2=1507043&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java
[UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java
[UTF-8] Thu Jul 25 16:06:47 2013
@@ -622,10 +622,8 @@ final class MetadataReader {
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);
- extent = new DefaultExtent();
- extent.getGeographicElements().add(new DefaultGeographicBoundingBox(
- valueOf(xmin, xConv), valueOf(xmax, xConv),
- valueOf(ymin, yConv), valueOf(ymax, yConv)));
+ extent = new DefaultExtent(valueOf(xmin, xConv), valueOf(xmax, xConv),
+ valueOf(ymin, yConv), valueOf(ymax, yConv));
}
/*
* If at least one vertical ordinates above is available, add a VerticalExtent.
|