Author: desruisseaux
Date: Wed Jan 15 18:19:40 2014
New Revision: 1558496
URL: http://svn.apache.org/r1558496
Log:
Added overridden methods and a test case for AbstractCRS.forConvention(...).
Added:
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/AbstractCRSTest.java
(with props)
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultEngineeringCRS.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeocentricCRS.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeographicCRS.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultImageCRS.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultTemporalCRS.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultVerticalCRS.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/package-info.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeodeticCRSTest.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultEngineeringCRS.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultEngineeringCRS.java?rev=1558496&r1=1558495&r2=1558496&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultEngineeringCRS.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultEngineeringCRS.java
[UTF-8] Wed Jan 15 18:19:40 2014
@@ -30,6 +30,7 @@ import org.opengis.referencing.cs.PolarC
import org.opengis.referencing.cs.SphericalCS;
import org.opengis.referencing.cs.UserDefinedCS;
import org.opengis.referencing.datum.EngineeringDatum;
+import org.apache.sis.referencing.cs.AxesConvention;
import org.apache.sis.referencing.AbstractReferenceSystem;
import org.apache.sis.io.wkt.Formatter;
@@ -233,6 +234,16 @@ public class DefaultEngineeringCRS exten
private void setUserDefinedCS(final UserDefinedCS cs)
{super.setCoordinateSystem("userDefinedCS", cs);}
/**
+ * {@inheritDoc}
+ *
+ * @return {@inheritDoc}
+ */
+ @Override
+ public DefaultEngineeringCRS forConvention(final AxesConvention
convention) {
+ return (DefaultEngineeringCRS) super.forConvention(convention);
+ }
+
+ /**
* Returns a coordinate reference system of the same type than this CRS
but with different axes.
*/
@Override
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeocentricCRS.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeocentricCRS.java?rev=1558496&r1=1558495&r2=1558496&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeocentricCRS.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeocentricCRS.java
[UTF-8] Wed Jan 15 18:19:40 2014
@@ -18,13 +18,14 @@ package org.apache.sis.referencing.crs;
import java.util.Map;
import javax.xml.bind.annotation.XmlTransient;
+import javax.measure.unit.Unit;
import org.opengis.referencing.cs.CartesianCS;
import org.opengis.referencing.cs.SphericalCS;
import org.opengis.referencing.cs.CoordinateSystem;
import org.opengis.referencing.crs.GeocentricCRS;
import org.opengis.referencing.datum.GeodeticDatum;
-import javax.measure.unit.Unit;
import org.apache.sis.io.wkt.Formatter;
+import org.apache.sis.referencing.cs.AxesConvention;
import org.apache.sis.referencing.AbstractReferenceSystem;
@@ -191,6 +192,16 @@ public class DefaultGeocentricCRS extend
}
/**
+ * {@inheritDoc}
+ *
+ * @return {@inheritDoc}
+ */
+ @Override
+ public DefaultGeocentricCRS forConvention(final AxesConvention convention)
{
+ return (DefaultGeocentricCRS) super.forConvention(convention);
+ }
+
+ /**
* Returns a coordinate reference system of the same type than this CRS
but with different axes.
*/
@Override
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeographicCRS.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeographicCRS.java?rev=1558496&r1=1558495&r2=1558496&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeographicCRS.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeographicCRS.java
[UTF-8] Wed Jan 15 18:19:40 2014
@@ -27,6 +27,7 @@ import org.opengis.referencing.cs.Coordi
import org.opengis.referencing.cs.EllipsoidalCS;
import org.opengis.referencing.datum.GeodeticDatum;
import org.opengis.referencing.crs.GeographicCRS;
+import org.apache.sis.referencing.cs.AxesConvention;
import org.apache.sis.referencing.AbstractReferenceSystem;
import org.apache.sis.internal.referencing.AxisDirections;
import org.apache.sis.io.wkt.Formatter;
@@ -178,6 +179,16 @@ public class DefaultGeographicCRS extend
}
/**
+ * {@inheritDoc}
+ *
+ * @return {@inheritDoc}
+ */
+ @Override
+ public DefaultGeographicCRS forConvention(final AxesConvention convention)
{
+ return (DefaultGeographicCRS) super.forConvention(convention);
+ }
+
+ /**
* Returns a coordinate reference system of the same type than this CRS
but with different axes.
*/
@Override
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultImageCRS.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultImageCRS.java?rev=1558496&r1=1558495&r2=1558496&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultImageCRS.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultImageCRS.java
[UTF-8] Wed Jan 15 18:19:40 2014
@@ -25,6 +25,7 @@ import org.opengis.referencing.cs.Affine
import org.opengis.referencing.crs.ImageCRS;
import org.opengis.referencing.cs.CartesianCS;
import org.opengis.referencing.datum.ImageDatum;
+import org.apache.sis.referencing.cs.AxesConvention;
import org.apache.sis.referencing.AbstractReferenceSystem;
import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
@@ -233,6 +234,16 @@ public class DefaultImageCRS extends Abs
}
/**
+ * {@inheritDoc}
+ *
+ * @return {@inheritDoc}
+ */
+ @Override
+ public DefaultImageCRS forConvention(final AxesConvention convention) {
+ return (DefaultImageCRS) super.forConvention(convention);
+ }
+
+ /**
* Returns a coordinate reference system of the same type than this CRS
but with different axes.
*/
@Override
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultTemporalCRS.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultTemporalCRS.java?rev=1558496&r1=1558495&r2=1558496&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultTemporalCRS.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultTemporalCRS.java
[UTF-8] Wed Jan 15 18:19:40 2014
@@ -27,6 +27,7 @@ import org.opengis.referencing.cs.Coordi
import org.opengis.referencing.cs.TimeCS;
import org.opengis.referencing.crs.TemporalCRS;
import org.opengis.referencing.datum.TemporalDatum;
+import org.apache.sis.referencing.cs.AxesConvention;
import org.apache.sis.referencing.AbstractReferenceSystem;
import org.apache.sis.measure.Units;
@@ -238,6 +239,16 @@ public class DefaultTemporalCRS extends
}
/**
+ * {@inheritDoc}
+ *
+ * @return {@inheritDoc}
+ */
+ @Override
+ public DefaultTemporalCRS forConvention(final AxesConvention convention) {
+ return (DefaultTemporalCRS) super.forConvention(convention);
+ }
+
+ /**
* Returns a coordinate reference system of the same type than this CRS
but with different axes.
*/
@Override
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultVerticalCRS.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultVerticalCRS.java?rev=1558496&r1=1558495&r2=1558496&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultVerticalCRS.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultVerticalCRS.java
[UTF-8] Wed Jan 15 18:19:40 2014
@@ -24,6 +24,7 @@ import org.opengis.referencing.cs.Coordi
import org.opengis.referencing.cs.VerticalCS;
import org.opengis.referencing.crs.VerticalCRS;
import org.opengis.referencing.datum.VerticalDatum;
+import org.apache.sis.referencing.cs.AxesConvention;
import org.apache.sis.referencing.AbstractReferenceSystem;
import org.apache.sis.io.wkt.Formatter;
@@ -210,6 +211,16 @@ public class DefaultVerticalCRS extends
}
/**
+ * {@inheritDoc}
+ *
+ * @return {@inheritDoc}
+ */
+ @Override
+ public DefaultVerticalCRS forConvention(final AxesConvention convention) {
+ return (DefaultVerticalCRS) super.forConvention(convention);
+ }
+
+ /**
* Returns a coordinate reference system of the same type than this CRS
but with different axes.
*/
@Override
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/package-info.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/package-info.java?rev=1558496&r1=1558495&r2=1558496&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/package-info.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/package-info.java
[UTF-8] Wed Jan 15 18:19:40 2014
@@ -52,6 +52,7 @@
* Some SIS implementations provide additional methods that are not part of
OGC/ISO specifications:
*
* <ul>
+ * <li>{@link org.apache.sis.referencing.crs.AbstractCRS#forConvention
AbstractCRS.forConvention(AxesConvention)}</li>
* <li>{@link
org.apache.sis.referencing.crs.DefaultTemporalCRS#toDate(double)}</li>
* <li>{@link org.apache.sis.referencing.crs.DefaultTemporalCRS#toValue
DefaultTemporalCRS.toValue(Date)}</li>
* </ul>
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java?rev=1558496&r1=1558495&r2=1558496&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java
[UTF-8] Wed Jan 15 18:19:40 2014
@@ -49,7 +49,7 @@ import org.opengis.referencing.cs.Coordi
* {@link #RIGHT_HANDED} or {@link #NORMALIZED} enumeration value.</p>
*
* {@section Normalized coordinate systems}
- * The definition the <cite>normalized coordinate systems</cite> is somewhat
fuzzy.
+ * The definition of <cite>normalized coordinate systems</cite> is somewhat
fuzzy.
* This concept appears in the Web Map Services (WMS) 1.3 specification,
quoted here:
*
* <blockquote><font size="-1"><b>6.7.2 Map CS</b> —
@@ -64,7 +64,7 @@ import org.opengis.referencing.cs.Coordi
* for the creation of transformation steps, as in the example below:
*
* {@preformat java
- * Matrix step1 = swapAndScaleAxes(sourceCS,
sourceCS.forConvention(NORMALIZED);
+ * Matrix step1 = swapAndScaleAxes(sourceCS,
sourceCS.forConvention(NORMALIZED));
* Matrix step2 = ... some coordinate operation working on normalized axes
...
* Matrix step3 = swapAndScaleAxes(targetCS.forConvention(NORMALIZED),
targetCS);
* }
Added:
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/AbstractCRSTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/AbstractCRSTest.java?rev=1558496&view=auto
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/AbstractCRSTest.java
(added)
+++
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/AbstractCRSTest.java
[UTF-8] Wed Jan 15 18:19:40 2014
@@ -0,0 +1,61 @@
+/*
+ * 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.referencing.crs;
+
+import org.apache.sis.referencing.cs.AbstractCS;
+import org.apache.sis.referencing.cs.CommonAxes;
+import org.apache.sis.referencing.cs.AxesConvention;
+import org.apache.sis.test.DependsOn;
+import org.apache.sis.test.TestCase;
+import org.junit.Test;
+
+import static java.util.Collections.singletonMap;
+import static org.opengis.referencing.cs.CoordinateSystem.NAME_KEY;
+import static org.apache.sis.test.Assert.*;
+
+
+/**
+ * Tests {@link AbstractCRS}
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @since 0.4
+ * @version 0.4
+ * @module
+ */
+@DependsOn(org.apache.sis.referencing.cs.AbstractCSTest.class)
+public final strictfp class AbstractCRSTest extends TestCase {
+ /**
+ * Tests {@link AbstractCRS#forConvention(AxesConvention)}.
+ */
+ @Test
+ public void testForConvention() {
+ final AbstractCRS toTest, expected, actual;
+ toTest = new AbstractCRS(singletonMap(NAME_KEY, "My CRS"),
+ new AbstractCS (singletonMap(NAME_KEY, "My strange CS"),
+ CommonAxes.TIME, CommonAxes.ALTITUDE, CommonAxes.LATITUDE,
CommonAxes.LONGITUDE));
+ expected = new AbstractCRS(singletonMap(NAME_KEY, "My CRS"),
+ new AbstractCS (singletonMap(NAME_KEY, "Coordinate system:
East (deg), North (deg), Up (m), Future (d)."),
+ CommonAxes.LONGITUDE, CommonAxes.LATITUDE,
CommonAxes.ALTITUDE, CommonAxes.TIME));
+ actual = toTest.forConvention(AxesConvention.RIGHT_HANDED);
+
+ assertEquals("forConvention(RIGHT_HANDED)", expected, actual);
+ assertSame(actual, toTest
.forConvention(AxesConvention.RIGHT_HANDED));
+ assertSame(actual, toTest
.forConvention(AxesConvention.NORMALIZED));
+ assertSame(expected,
expected.forConvention(AxesConvention.RIGHT_HANDED));
+ assertSame(expected,
expected.forConvention(AxesConvention.NORMALIZED));
+ }
+}
Propchange:
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/AbstractCRSTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/AbstractCRSTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain;charset=UTF-8
Modified:
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeodeticCRSTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeodeticCRSTest.java?rev=1558496&r1=1558495&r2=1558496&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeodeticCRSTest.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeodeticCRSTest.java
[UTF-8] Wed Jan 15 18:19:40 2014
@@ -37,6 +37,7 @@ import static org.apache.sis.test.Assert
* @module
*/
@DependsOn({
+ AbstractCRSTest.class,
org.apache.sis.referencing.cs.DefaultEllipsoidalCSTest.class,
org.apache.sis.referencing.datum.DefaultGeodeticDatumTest.class
})
Modified:
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java?rev=1558496&r1=1558495&r2=1558496&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
[UTF-8] Wed Jan 15 18:19:40 2014
@@ -69,6 +69,7 @@ import org.junit.BeforeClass;
org.apache.sis.referencing.cs.DefaultEllipsoidalCSTest.class,
org.apache.sis.referencing.cs.DefaultCompoundCSTest.class,
org.apache.sis.referencing.cs.CoordinateSystemsTest.class,
+ org.apache.sis.referencing.crs.AbstractCRSTest.class,
org.apache.sis.referencing.crs.DefaultGeodeticCRSTest.class,
org.apache.sis.referencing.StandardDefinitionsTest.class,
org.apache.sis.referencing.GeodeticObjectsTest.class,