You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2014/02/03 12:24:28 UTC
svn commit: r1563839 - in /sis/branches/JDK7/core:
sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/
sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/
sis-referencing/src/main/java/org/apache/sis/io/wkt/
sis-referencing/src/te...
Author: desruisseaux
Date: Mon Feb 3 11:24:27 2014
New Revision: 1563839
URL: http://svn.apache.org/r1563839
Log:
Initial support of VERTICALEXTENT.
Added:
sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/mock/VerticalCRSMock.java (with props)
Modified:
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/Extents.java
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/ExtentsTest.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Formatter.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Symbols.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/Assert.java
Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/Extents.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/Extents.java?rev=1563839&r1=1563838&r2=1563839&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/Extents.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/Extents.java [UTF-8] Mon Feb 3 11:24:27 2014
@@ -44,7 +44,8 @@ import static org.apache.sis.internal.me
* This class provides methods for:
*
* <ul>
- * <li>{@link #getGeographicBoundingBox(Extent)} and {@link #getDate(Extent, double)}
+ * <li>{@link #getGeographicBoundingBox(Extent)}, {@link #getVerticalRange(Extent)}
+ * and {@link #getDate(Extent, double)}
* for fetching geographic or temporal components in a convenient form.</li>
* <li>Methods for computing {@linkplain #intersection intersection} of bounding boxes
* and {@linkplain #area area} estimations.</li>
Modified: sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/ExtentsTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/ExtentsTest.java?rev=1563839&r1=1563838&r2=1563839&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/ExtentsTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/ExtentsTest.java [UTF-8] Mon Feb 3 11:24:27 2014
@@ -16,7 +16,11 @@
*/
package org.apache.sis.metadata.iso.extent;
+import java.util.Arrays;
+import javax.measure.unit.SI;
import org.opengis.metadata.extent.GeographicBoundingBox;
+import org.apache.sis.measure.MeasurementRange;
+import org.apache.sis.test.mock.VerticalCRSMock;
import org.apache.sis.test.DependsOn;
import org.apache.sis.test.TestCase;
import org.junit.Test;
@@ -41,6 +45,26 @@ public final strictfp class ExtentsTest
private static final double MINUTE = 1./60;
/**
+ * Tests {@link Extents#getVerticalRange(Extent)}.
+ */
+ @Test
+ public void testGetVerticalRange() {
+ final DefaultExtent extent = new DefaultExtent();
+ extent.setVerticalElements(Arrays.asList(
+ new DefaultVerticalExtent( -200, -100, VerticalCRSMock.HEIGHT),
+ new DefaultVerticalExtent( 150, 300, VerticalCRSMock.DEPTH),
+ new DefaultVerticalExtent( 0.1, 0.2, VerticalCRSMock.SIGMA_LEVEL),
+ new DefaultVerticalExtent( -600, -300, VerticalCRSMock.HEIGHT_ft), // [91.44 182.88] metres
+ new DefaultVerticalExtent(10130, 20260, VerticalCRSMock.BAROMETRIC_HEIGHT)
+ ));
+ final MeasurementRange<Double> range = Extents.getVerticalRange(extent);
+ assertNotNull("getVerticalRange", range);
+ assertEquals("unit", SI.METRE, range.unit());
+ assertEquals("minimum", -300, range.getMinDouble(), 0.001);
+ assertEquals("maximum", -91.44, range.getMaxDouble(), 0.001);
+ }
+
+ /**
* Tests {@link Extents#intersection(GeographicBoundingBox, GeographicBoundingBox)}.
*/
@Test
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Formatter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Formatter.java?rev=1563839&r1=1563838&r2=1563839&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Formatter.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Formatter.java [UTF-8] Mon Feb 3 11:24:27 2014
@@ -56,6 +56,7 @@ import org.apache.sis.util.CharSequences
import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.internal.util.Citations;
+import org.apache.sis.measure.MeasurementRange;
import org.apache.sis.metadata.iso.extent.Extents;
import org.apache.sis.referencing.IdentifiedObjects;
import org.apache.sis.referencing.AbstractIdentifiedObject;
@@ -63,23 +64,21 @@ import org.apache.sis.referencing.operat
/**
- * Formats an object as <cite>Well Known Text</cite> (WKT). {@code Formatter} instances are created by
- * {@link WKTFormat} and given to the {@link FormattableObject#formatTo(Formatter)} method of the object
- * to format. {@code Formatter} provides the following services:
+ * Provides support methods for formatting a <cite>Well Known Text</cite> (WKT).
+ *
+ * <p>{@code Formatter} instances are created by {@link WKTFormat} and given to the
+ * {@link FormattableObject#formatTo(Formatter)} method of the object to format.
+ * {@code Formatter} provides the following services:</p>
*
* <ul>
* <li>A series of {@code append(…)} methods to be invoked by the {@code formatTo(Formatter)} implementations.</li>
- * <li>Information about the context: {@link #getConvention()}, {@link #getAngularUnit()}, {@link #getLinearUnit()}.
- * Some of those information (e.g. the angular units) depend on the enclosing WKT element.</li>
- * <li>Convenience methods for fetching relevant information from the object to format:
- * {@link #getName(IdentifiedObject)}, {@link #getIdentifier(IdentifiedObject)}.</li>
+ * <li>Contextual information. In particular, the {@linkplain #getLinearUnit() linear unit} and the
+ * {@linkplain #getAngularUnit() angular unit} depend on the enclosing WKT element.</li>
+ * <li>Convenience methods for fetching relevant information from the object to format, like
+ * {@linkplain #getName(IdentifiedObject) name} and {@linkplain #getIdentifier(IdentifiedObject) identifier}.</li>
* <li>A flag for declaring the object unformattable.</li>
* </ul>
*
- * {@section Thread safety}
- * Formatters are not synchronized. It is recommended to create separated formatter instances for each thread.
- * If multiple threads access a formatter concurrently, then the formatter must be synchronized externally.
- *
* @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.4 (derived from geotk-2.0)
* @version 0.4
@@ -234,14 +233,14 @@ public class Formatter {
Exception errorCause;
/**
- * Creates a new formatter instance with the default symbols, no syntax coloring and the default indentation.
+ * Creates a new formatter instance with the default configuration.
*/
public Formatter() {
this(Convention.DEFAULT, Symbols.getDefault(), WKTFormat.DEFAULT_INDENTATION);
}
/**
- * Creates a new formatter instance with the specified convention, colors and indentation.
+ * Creates a new formatter instance with the specified convention, symbols and indentation.
*
* @param convention The convention to use.
* @param symbols The symbols.
@@ -426,6 +425,23 @@ public class Formatter {
}
/**
+ * Appends a separator if needed, then opens a new element.
+ *
+ * @param keyword The element keyword (e.g. {@code "DATUM"}, {@code "AXIS"}, <i>etc</i>).
+ */
+ private void openElement(final String keyword) {
+ appendSeparator(requestNewLine);
+ buffer.append(keyword).appendCodePoint(symbols.getOpeningBracket(0));
+ }
+
+ /**
+ * Closes the element opened by {@link #openElement(String)}.
+ */
+ private void closeElement() {
+ buffer.appendCodePoint(symbols.getClosingBracket(0));
+ }
+
+ /**
* Appends the given {@code FormattableObject}.
* This method performs the following steps:
*
@@ -446,8 +462,6 @@ public class Formatter {
return;
}
final StringBuffer buffer = this.buffer;
- final int open = symbols.getOpeningBracket(0);
- final int close = symbols.getClosingBracket(0);
/*
* Formats the opening bracket and the object name (e.g. "NAD27").
* The WKT entity name (e.g. "PROJCS") will be formatted later.
@@ -458,7 +472,7 @@ public class Formatter {
*/
appendSeparator(true);
int base = buffer.length();
- buffer.appendCodePoint(open);
+ buffer.appendCodePoint(symbols.getOpeningBracket(0));
final IdentifiedObject info = (object instanceof IdentifiedObject) ? (IdentifiedObject) object : null;
if (info != null) {
final ElementKind type = ElementKind.forType(info.getClass());
@@ -524,15 +538,14 @@ public class Formatter {
}
}
if (codeSpace != null) {
- appendSeparator(requestNewLine);
- buffer.append("AUTHORITY").appendCodePoint(open);
+ openElement("AUTHORITY");
quote(codeSpace);
final String code = identifier.getCode();
if (code != null) {
buffer.append(symbols.getSeparator());
quote(code);
}
- buffer.appendCodePoint(close);
+ closeElement();
}
}
/*
@@ -541,7 +554,7 @@ public class Formatter {
if (info != null) {
append("REMARKS", info.getRemarks());
}
- buffer.appendCodePoint(close);
+ buffer.appendCodePoint(symbols.getClosingBracket(0));
requestNewLine = true;
indent(-1);
}
@@ -569,6 +582,14 @@ public class Formatter {
if (area != null) {
append("AREA", area.getDescription());
append(Extents.getGeographicBoundingBox(area), 2);
+ final MeasurementRange<Double> range = Extents.getVerticalRange(area);
+ if (range != null) {
+ openElement("VERTICALEXTENT");
+ append(range.getMinDouble());
+ append(range.getMaxDouble());
+ append(range.unit());
+ closeElement();
+ }
}
}
@@ -603,8 +624,7 @@ public class Formatter {
*/
public void append(final GeographicBoundingBox bbox, final int fractionDigits) {
if (bbox != null) {
- appendSeparator(requestNewLine);
- buffer.append("BBOX").appendCodePoint(symbols.getOpeningBracket(0));
+ openElement("BBOX");
numberFormat.setMinimumFractionDigits(fractionDigits);
numberFormat.setMaximumFractionDigits(fractionDigits);
numberFormat.setRoundingMode(RoundingMode.FLOOR);
@@ -613,7 +633,7 @@ public class Formatter {
numberFormat.setRoundingMode(RoundingMode.CEILING);
appendPreset(bbox.getNorthBoundLatitude());
appendPreset(bbox.getEastBoundLongitude());
- buffer.appendCodePoint(symbols.getClosingBracket(0));
+ closeElement();
}
}
@@ -654,34 +674,31 @@ public class Formatter {
}
final int numRow = matrix.getNumRow();
final int numCol = matrix.getNumCol();
- final int openingBracket = symbols.getOpeningBracket(0);
- final int closingBracket = symbols.getClosingBracket(0);
- final int openQuote = symbols.getOpeningQuote(0);
- final int closeQuote = symbols.getClosingQuote(0);
- final String separator = symbols.getSeparator();
+ final int openQuote = symbols.getOpeningQuote(0);
+ final int closeQuote = symbols.getClosingQuote(0);
+ final String separator = symbols.getSeparator();
final StringBuffer buffer = this.buffer;
boolean columns = false;
+ requestNewLine = true;
do {
- appendSeparator(true);
- buffer.append("PARAMETER").appendCodePoint(openingBracket);
+ openElement("PARAMETER");
quote(columns ? "num_col" : "num_row");
buffer.append(separator);
format(columns ? numCol : numRow);
- buffer.appendCodePoint(closingBracket);
+ closeElement();
} while ((columns = !columns) == true);
for (int j=0; j<numRow; j++) {
for (int i=0; i<numCol; i++) {
final double element = matrix.getElement(j, i);
if (element != (i == j ? 1 : 0)) {
- appendSeparator(true);
- buffer.append("PARAMETER").appendCodePoint(openingBracket);
+ openElement("PARAMETER");
setColor(ElementKind.PARAMETER);
buffer.appendCodePoint(openQuote).append("elt_").append(j)
.append('_').append(i).appendCodePoint(closeQuote);
resetColor();
buffer.append(separator);
format(element);
- buffer.appendCodePoint(closingBracket);
+ closeElement();
}
}
}
@@ -832,11 +849,10 @@ public class Formatter {
if (text != null) {
final String localized = CharSequences.trimWhitespaces(text.toString(locale));
if (localized != null && !localized.isEmpty()) {
- appendSeparator(true);
- buffer.append(keyword).appendCodePoint(symbols.getOpeningBracket(0));
- quote(localized);
- buffer.appendCodePoint(symbols.getClosingBracket(0));
requestNewLine = true;
+ openElement(keyword);
+ quote(localized);
+ closeElement();
}
}
}
@@ -936,7 +952,7 @@ public class Formatter {
/**
* Appends a unit in WKT form.
- * For example {@code append(SI.KILO(SI.METRE))} will append "{@code UNIT["km", 1000]}" to the WKT.
+ * For example {@code append(SI.KILOMETRE)} will append "{@code UNIT["km", 1000]}" to the WKT.
*
* @param unit The unit to append to the WKT, or {@code null} if none.
*/
@@ -957,7 +973,7 @@ public class Formatter {
closeQuote(fromIndex);
resetColor();
append(Units.toStandardUnit(unit));
- buffer.appendCodePoint(symbols.getClosingBracket(0));
+ closeElement();
}
}
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Symbols.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Symbols.java?rev=1563839&r1=1563838&r2=1563839&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Symbols.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Symbols.java [UTF-8] Mon Feb 3 11:24:27 2014
@@ -32,11 +32,30 @@ import static org.apache.sis.util.Argume
* This class allows to specify the following properties:
*
* <table class="sis">
- * <tr><th>Property</th> <th>Standard value</th> <th>Legal alternative</th></tr>
- * <tr><td>Locale for number format</td> <td>{@link Locale#ROOT}</td> <td></td></tr>
- * <tr><td>Bracket symbols</td> <td>{@code [} … {@code ]}</td> <td>{@code (} … {@code )}</td></tr>
- * <tr><td>Quote symbols</td> <td>{@code "} … {@code "}</td> <td></td></tr>
- * <tr><td>Separator</td> <td>{@code ,}</td> <td></td></tr>
+ * <tr>
+ * <th>Property</th>
+ * <th>Standard value</th>
+ * <th>Remarks</th>
+ * </tr>
+ * <tr>
+ * <td>Locale for number format</td>
+ * <td>{@link Locale#ROOT}</td>
+ * <td></td>
+ * </tr>
+ * <tr>
+ * <td>Bracket symbols</td>
+ * <td>{@code [}…{@code ]} or {@code (}…{@code )}</td>
+ * <td>The former is more common in referencing WKT, while the later is more common in geometry WKT.</td>
+ * </tr>
+ * <tr>
+ * <td>Quote symbols</td>
+ * <td>{@code "}…{@code "}</td>
+ * <td>Apache SIS also accepts {@code “}…{@code ”}, but this is non-standard.</td>
+ * </tr>
+ * <tr><td>Separator</td>
+ * <td>{@code ,}</td>
+ * <td></td>
+ * </tr>
* </table>
*
* The two constants defined in this class, namely {@link #SQUARE_BRACKETS} and {@link #CURLY_BRACKETS},
@@ -59,14 +78,29 @@ public class Symbols implements Localize
/**
* A set of symbols with values between square brackets, like {@code DATUM["WGS84"]}.
- * This is the most frequently used WKT format.
+ * This instance defines:
+ *
+ * <ul>
+ * <li>{@link Locale#ROOT} for {@linkplain java.text.DecimalFormatSymbols decimal format symbols}.</li>
+ * <li>Square brackets by default, as in {@code DATUM["WGS84"]}, but accepting also curly brackets as in
+ * {@code DATUM("WGS84")}. Both are legal WKT.</li>
+ * <li>English quotation mark ({@code '"'}) by default, but accepting also “…” quotes
+ * for more readable {@link String} constants in Java code.</li>
+ * <li>Coma separator followed by a space ({@code ", "}).</li>
+ * </ul>
+ *
+ * This is the most frequently used WKT format for referencing objects.
*/
public static final Symbols SQUARE_BRACKETS = new Symbols(
new int[] {'[', ']', '(', ')'}, new int[] {'"', '"', '“', '”'});
/**
* A set of symbols with values between parentheses, like {@code DATUM("WGS84")}.
- * This is a less frequently used but legal WKT format.
+ * This instance is identical to {@link #SQUARE_BRACKETS} except that the default
+ * brackets are the curly ones instead than the square ones (but both are still
+ * accepted at parsing time).
+ *
+ * <p>This format is rare with referencing objects but common with geometry objects.</p>
*/
public static final Symbols CURLY_BRACKETS = new Symbols(
new int[] {'(', ')', '[', ']'}, SQUARE_BRACKETS.quotes);
@@ -133,28 +167,12 @@ public class Symbols implements Localize
private boolean isImmutable;
/**
- * Creates a new set of WKT symbols initialized to the default values.
- * Newly created {@code Symbols} instances use the following defaults:
- *
- * <ul>
- * <li>{@link Locale#ROOT} for {@linkplain java.text.DecimalFormatSymbols decimal format symbols}.</li>
- * <li>Square brackets by default, as in {@code DATUM["WGS84"]}, but accepting also curly brackets as in
- * {@code DATUM("WGS84")}. Both are legal WKT.</li>
- * <li>English quotation mark ({@code '"'}) by default, but accepting also {@code '“'} … {@code '”'} quotes
- * for more readable {@link String} constants in Java code.</li>
- * <li>Coma separator followed by a space ({@code ", "}).</li>
- * </ul>
- */
- public Symbols() {
- this(SQUARE_BRACKETS);
- }
-
- /**
- * Creates a copy of the given set of WKT symbols.
+ * Creates a new set of WKT symbols initialized to a copy of the given symbols.
*
* @param symbols The symbols to copy.
*/
public Symbols(final Symbols symbols) {
+ ensureNonNull("symbols", symbols);
locale = symbols.locale;
brackets = symbols.brackets;
quotes = symbols.quotes;
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/Assert.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/Assert.java?rev=1563839&r1=1563838&r2=1563839&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/Assert.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/Assert.java [UTF-8] Mon Feb 3 11:24:27 2014
@@ -60,7 +60,7 @@ public strictfp class Assert extends org
*/
private static final WKTFormat WKT_FORMAT = new WKTFormat(null, null);
static {
- final Symbols s = new Symbols();
+ final Symbols s = new Symbols(Symbols.SQUARE_BRACKETS);
s.setPairedQuotes("“”", "\"\"");
WKT_FORMAT.setSymbols(s);
}
Added: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/mock/VerticalCRSMock.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/mock/VerticalCRSMock.java?rev=1563839&view=auto
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/mock/VerticalCRSMock.java (added)
+++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/mock/VerticalCRSMock.java [UTF-8] Mon Feb 3 11:24:27 2014
@@ -0,0 +1,133 @@
+/*
+ * 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.test.mock;
+
+import java.util.Date;
+import javax.measure.unit.Unit;
+import javax.measure.unit.SI;
+import javax.measure.unit.NonSI;
+import org.opengis.metadata.extent.Extent;
+import org.opengis.referencing.crs.VerticalCRS;
+import org.opengis.referencing.cs.AxisDirection;
+import org.opengis.referencing.cs.CoordinateSystemAxis;
+import org.opengis.referencing.cs.RangeMeaning;
+import org.opengis.referencing.cs.VerticalCS;
+import org.opengis.referencing.datum.VerticalDatum;
+import org.opengis.referencing.datum.VerticalDatumType;
+import org.opengis.util.InternationalString;
+
+
+/**
+ * A dummy implementation of {@link VerticalCRS}, which is also its own datum, coordinate system and axis.
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @since 0.4
+ * @version 0.4
+ * @module
+ */
+@SuppressWarnings("serial")
+public final strictfp class VerticalCRSMock extends IdentifiedObjectMock
+ implements VerticalCRS, VerticalDatum, VerticalCS, CoordinateSystemAxis
+{
+ /**
+ * Height in metres.
+ */
+ public static final VerticalCRS HEIGHT = new VerticalCRSMock("Height",
+ Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, SI.METRE, true);
+
+ /**
+ * Height in feet.
+ */
+ public static final VerticalCRS HEIGHT_ft = new VerticalCRSMock("Height",
+ Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, NonSI.FOOT, true);
+
+ /**
+ * Height estimated from hPa.
+ */
+ public static final VerticalCRS BAROMETRIC_HEIGHT = new VerticalCRSMock("Barometric height",
+ 0, Double.POSITIVE_INFINITY, SI.MetricPrefix.HECTO(SI.PASCAL), true);
+
+ /**
+ * Depth in metres.
+ */
+ public static final VerticalCRS DEPTH = new VerticalCRSMock("Depth",
+ 0, Double.POSITIVE_INFINITY, SI.METRE, false);
+
+ /**
+ * Depth as a fraction of the sea floor depth at the location of the point for which the depth is evaluated.
+ */
+ public static final VerticalCRS SIGMA_LEVEL = new VerticalCRSMock("Sigma level",
+ 0, 1, Unit.ONE, false);
+
+ /**
+ * The minimum and maximum values.
+ */
+ private final double minimumValue, maximumValue;
+
+ /**
+ * The unit of measurement.
+ */
+ private final Unit<?> unit;
+
+ /**
+ * {@code true} if the axis direction is up, or {@code false} if down.
+ */
+ private final boolean up;
+
+ /**
+ * Creates a new vertical CRS for the given name.
+ *
+ * @param name The CRS, CS, datum and axis name.
+ * @param up {@code true} if the axis direction is up, or {@code false} if down.
+ * @param unit The unit of measurement.
+ * @param minimumValue The minium value.
+ * @param maximumValue The maximum value.
+ */
+ private VerticalCRSMock(final String name, final double minimumValue, final double maximumValue,
+ final Unit<?> unit, final boolean up)
+ {
+ super(name);
+ this.minimumValue = minimumValue;
+ this.maximumValue = maximumValue;
+ this.unit = unit;
+ this.up = up;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ Object[] properties() {
+ return new Object[] {getCode(), alias, minimumValue, maximumValue, unit, up};
+ }
+
+ @Override public String getAbbreviation() {return up ? "h" : "d";}
+ @Override public InternationalString getScope() {return null;}
+ @Override public InternationalString getAnchorPoint() {return null;}
+ @Override public Date getRealizationEpoch() {return null;}
+ @Override public Extent getDomainOfValidity() {return null;}
+ @Override public VerticalDatumType getVerticalDatumType() {return VerticalDatumType.GEOIDAL;}
+ @Override public VerticalDatum getDatum() {return this;}
+ @Override public VerticalCS getCoordinateSystem() {return this;}
+ @Override public int getDimension() {return 1;}
+ @Override public CoordinateSystemAxis getAxis(int dimension) {return this;}
+ @Override public AxisDirection getDirection() {return up ? AxisDirection.UP : AxisDirection.DOWN;}
+ @Override public double getMinimumValue() {return minimumValue;}
+ @Override public double getMaximumValue() {return maximumValue;}
+ @Override public RangeMeaning getRangeMeaning() {return RangeMeaning.EXACT;}
+ @Override public Unit<?> getUnit() {return unit;}
+}
Propchange: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/mock/VerticalCRSMock.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/mock/VerticalCRSMock.java
------------------------------------------------------------------------------
svn:mime-type = text/plain;charset=UTF-8