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 2015/05/05 13:36:06 UTC
svn commit: r1677789 [2/2] - in /sis/branches/JDK7: ./
core/sis-feature/src/main/java/org/apache/sis/feature/
core/sis-feature/src/test/java/org/apache/sis/feature/
core/sis-feature/src/test/java/org/apache/sis/test/suite/
core/sis-metadata/src/main/ja...
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConversion.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConversion.java?rev=1677789&r1=1677788&r2=1677789&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConversion.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConversion.java [UTF-8] Tue May 5 11:36:05 2015
@@ -17,6 +17,8 @@
package org.apache.sis.referencing.operation;
import java.util.Map;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlRootElement;
import org.opengis.referencing.operation.Conversion;
import org.opengis.referencing.operation.OperationMethod;
import org.opengis.referencing.operation.MathTransform;
@@ -58,6 +60,8 @@ import org.apache.sis.util.ArgumentCheck
*
* @see DefaultTransformation
*/
+@XmlType(name = "ConversionType")
+@XmlRootElement(name = "Conversion")
public class DefaultConversion extends AbstractSingleOperation implements Conversion {
/**
* Serial number for inter-operability with different versions.
@@ -65,6 +69,14 @@ public class DefaultConversion extends A
private static final long serialVersionUID = -2148164324805562793L;
/**
+ * Constructs a new object in which every attributes are set to a null value.
+ * <strong>This is not a valid object.</strong> This constructor is strictly
+ * reserved to JAXB, which will assign values to the fields using reflexion.
+ */
+ private DefaultConversion() {
+ }
+
+ /**
* Creates a coordinate conversion from the given properties.
* The properties given in argument follow the same rules than for the
* {@linkplain AbstractCoordinateOperation#AbstractCoordinateOperation(Map, CoordinateReferenceSystem,
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultCylindricalProjection.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultCylindricalProjection.java?rev=1677789&r1=1677788&r2=1677789&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultCylindricalProjection.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultCylindricalProjection.java [UTF-8] Tue May 5 11:36:05 2015
@@ -16,6 +16,7 @@
*/
package org.apache.sis.referencing.operation;
+import javax.xml.bind.annotation.XmlTransient;
import org.opengis.referencing.operation.Conversion;
import org.opengis.referencing.operation.CylindricalProjection;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
@@ -32,6 +33,7 @@ import org.opengis.referencing.crs.Coord
* @see org.apache.sis.referencing.crs.DefaultProjectedCRS
* @see <a href="http://mathworld.wolfram.com/CylindricalProjection.html">Cylindrical projection on MathWorld</a>
*/
+@XmlTransient
final class DefaultCylindricalProjection extends DefaultProjection implements CylindricalProjection {
/**
* Serial number for inter-operability with different versions.
@@ -47,9 +49,9 @@ final class DefaultCylindricalProjection
* @param sourceCRS The source CRS.
* @param targetCRS The target CRS.
*/
- public DefaultCylindricalProjection(final Conversion definition,
- final CoordinateReferenceSystem sourceCRS,
- final CoordinateReferenceSystem targetCRS)
+ DefaultCylindricalProjection(final Conversion definition,
+ final CoordinateReferenceSystem sourceCRS,
+ final CoordinateReferenceSystem targetCRS)
{
super(definition, sourceCRS, targetCRS);
}
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java?rev=1677789&r1=1677788&r2=1677789&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java [UTF-8] Tue May 5 11:36:05 2015
@@ -276,7 +276,7 @@ public class DefaultOperationMethod exte
* or {@code null} if it is not going to have any declared authority.
* @return The identified object properties in a mutable map.
*/
- static Map<String,Object> getProperties(final IdentifiedObject info, final Citation authority) {
+ private static Map<String,Object> getProperties(final IdentifiedObject info, final Citation authority) {
final Map<String,Object> properties = new HashMap<>(IdentifiedObjects.getProperties(info));
properties.put(NAME_KEY, new NamedIdentifier(authority, info.getName().getCode()));
properties.remove(IDENTIFIERS_KEY);
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultPassThroughOperation.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultPassThroughOperation.java?rev=1677789&r1=1677788&r2=1677789&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultPassThroughOperation.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultPassThroughOperation.java [UTF-8] Tue May 5 11:36:05 2015
@@ -100,6 +100,39 @@ public class DefaultPassThroughOperation
}
/**
+ * Creates a new coordinate operation with the same values than the specified one.
+ * This copy constructor provides a way to convert an arbitrary implementation into a SIS one
+ * or a user-defined one (as a subclass), usually in order to leverage some implementation-specific API.
+ *
+ * <p>This constructor performs a shallow copy, i.e. the properties are not cloned.</p>
+ *
+ * @param operation The coordinate operation to copy.
+ *
+ * @see #castOrCopy(PassThroughOperation)
+ */
+ protected DefaultPassThroughOperation(final PassThroughOperation operation) {
+ super(operation);
+ this.operation = operation.getOperation();
+ }
+
+ /**
+ * Returns a SIS coordinate operation implementation with the values of the given arbitrary implementation.
+ * If the given object is already an instance of {@code DefaultPassThroughOperation}, then it is returned
+ * unchanged. Otherwise a new {@code DefaultPassThroughOperation} instance is created using the
+ * {@linkplain #DefaultPassThroughOperation(PassThroughOperation) copy constructor} and returned.
+ * Note that this is a <cite>shallow</cite> copy operation, since the other properties contained in the given
+ * object are not recursively copied.
+ *
+ * @param object The object to get as a SIS implementation, or {@code null} if none.
+ * @return A SIS implementation containing the values of the given object (may be the
+ * given object itself), or {@code null} if the argument was null.
+ */
+ public static DefaultPassThroughOperation castOrCopy(final PassThroughOperation object) {
+ return (object == null) || (object instanceof DefaultPassThroughOperation)
+ ? (DefaultPassThroughOperation) object : new DefaultPassThroughOperation(object);
+ }
+
+ /**
* Returns the GeoAPI interface implemented by this class.
* The SIS implementation returns {@code PassThroughOperation.class}.
*
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultPlanarProjection.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultPlanarProjection.java?rev=1677789&r1=1677788&r2=1677789&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultPlanarProjection.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultPlanarProjection.java [UTF-8] Tue May 5 11:36:05 2015
@@ -16,6 +16,7 @@
*/
package org.apache.sis.referencing.operation;
+import javax.xml.bind.annotation.XmlTransient;
import org.opengis.referencing.operation.Conversion;
import org.opengis.referencing.operation.PlanarProjection;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
@@ -32,6 +33,7 @@ import org.opengis.referencing.crs.Coord
* @see org.apache.sis.referencing.crs.DefaultProjectedCRS
* @see <a href="http://mathworld.wolfram.com/AzimuthalProjection.html">Azimuthal projection on MathWorld</a>
*/
+@XmlTransient
final class DefaultPlanarProjection extends DefaultProjection implements PlanarProjection {
/**
* Serial number for inter-operability with different versions.
@@ -47,9 +49,9 @@ final class DefaultPlanarProjection exte
* @param sourceCRS The source CRS.
* @param targetCRS The target CRS.
*/
- public DefaultPlanarProjection(final Conversion definition,
- final CoordinateReferenceSystem sourceCRS,
- final CoordinateReferenceSystem targetCRS)
+ DefaultPlanarProjection(final Conversion definition,
+ final CoordinateReferenceSystem sourceCRS,
+ final CoordinateReferenceSystem targetCRS)
{
super(definition, sourceCRS, targetCRS);
}
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultProjection.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultProjection.java?rev=1677789&r1=1677788&r2=1677789&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultProjection.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultProjection.java [UTF-8] Tue May 5 11:36:05 2015
@@ -16,9 +16,13 @@
*/
package org.apache.sis.referencing.operation;
+import javax.xml.bind.annotation.XmlTransient;
import org.opengis.referencing.operation.Conversion;
import org.opengis.referencing.operation.Projection;
+import org.opengis.referencing.crs.ProjectedCRS;
+import org.opengis.referencing.crs.GeographicCRS;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
+import org.apache.sis.util.ArgumentChecks;
/**
@@ -44,6 +48,7 @@ import org.opengis.referencing.crs.Coord
*
* @see org.apache.sis.referencing.crs.DefaultProjectedCRS
*/
+@XmlTransient
class DefaultProjection extends DefaultConversion implements Projection {
/**
* Serial number for inter-operability with different versions.
@@ -59,11 +64,13 @@ class DefaultProjection extends DefaultC
* @param sourceCRS The source CRS.
* @param targetCRS The target CRS.
*/
- public DefaultProjection(final Conversion definition,
- final CoordinateReferenceSystem sourceCRS,
- final CoordinateReferenceSystem targetCRS)
+ DefaultProjection(final Conversion definition,
+ final CoordinateReferenceSystem sourceCRS,
+ final CoordinateReferenceSystem targetCRS)
{
super(definition, sourceCRS, targetCRS);
+ ArgumentChecks.ensureCanCast("sourceCRS", GeographicCRS.class, sourceCRS);
+ ArgumentChecks.ensureCanCast("targetCRS", ProjectedCRS .class, targetCRS);
}
/**
@@ -90,4 +97,20 @@ class DefaultProjection extends DefaultC
public Class<? extends Projection> getInterface() {
return Projection.class;
}
+
+ /**
+ * Returns the source CRS, which must be geographic or {@code null}.
+ */
+ @Override
+ public final GeographicCRS getSourceCRS() {
+ return (GeographicCRS) super.getSourceCRS();
+ }
+
+ /**
+ * Returns the target CRS, which must be projected or {@code null}.
+ */
+ @Override
+ public final ProjectedCRS getTargetCRS() {
+ return (ProjectedCRS) super.getTargetCRS();
+ }
}
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/SubTypes.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/SubTypes.java?rev=1677789&r1=1677788&r2=1677789&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/SubTypes.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/SubTypes.java [UTF-8] Tue May 5 11:36:05 2015
@@ -57,6 +57,12 @@ final class SubTypes {
if (object instanceof Conversion) {
return forConversion((Conversion) object);
}
+ if (object instanceof PassThroughOperation) {
+ return DefaultPassThroughOperation.castOrCopy((PassThroughOperation) object);
+ }
+ if (object instanceof ConcatenatedOperation) {
+ return DefaultConcatenatedOperation.castOrCopy((ConcatenatedOperation) object);
+ }
if (object instanceof SingleOperation) {
return (object instanceof AbstractSingleOperation) ? (AbstractSingleOperation) object
: new AbstractSingleOperation((SingleOperation) object);
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/package-info.java?rev=1677789&r1=1677788&r2=1677789&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/package-info.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/package-info.java [UTF-8] Tue May 5 11:36:05 2015
@@ -48,4 +48,28 @@
* @since 0.6
* @module
*/
+@XmlSchema(elementFormDefault= XmlNsForm.QUALIFIED, namespace = Namespaces.GML, xmlns = {
+ @XmlNs(prefix = "gml", namespaceURI = Namespaces.GML),
+ @XmlNs(prefix = "xsi", namespaceURI = Namespaces.XSI)
+})
+@XmlAccessorType(XmlAccessType.NONE)
+@XmlJavaTypeAdapters({
+ @XmlJavaTypeAdapter(EX_Extent.class),
+ @XmlJavaTypeAdapter(DQ_PositionalAccuracy.class),
+ @XmlJavaTypeAdapter(StringAdapter.class),
+ @XmlJavaTypeAdapter(InternationalStringConverter.class)
+})
package org.apache.sis.referencing.operation;
+
+import javax.xml.bind.annotation.XmlNs;
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlSchema;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapters;
+import org.apache.sis.xml.Namespaces;
+import org.apache.sis.internal.jaxb.gco.*;
+import org.apache.sis.internal.jaxb.referencing.*;
+import org.apache.sis.internal.jaxb.metadata.EX_Extent;
+import org.apache.sis.internal.jaxb.metadata.DQ_PositionalAccuracy;
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticObjectBuilder.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticObjectBuilder.java?rev=1677789&r1=1677788&r2=1677789&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticObjectBuilder.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticObjectBuilder.java [UTF-8] Tue May 5 11:36:05 2015
@@ -200,7 +200,7 @@ public class GeodeticObjectBuilder exten
if (name != null) {
properties.put(Conversion.NAME_KEY, name);
}
- return new DefaultProjectedCRS(properties, conversion, baseCRS, derivedCS);
+ return new DefaultProjectedCRS(properties, baseCRS, conversion, derivedCS);
} finally {
onCreate(true);
properties.remove(OperationMethods.PARAMETERS_KEY);
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultCompoundCRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultCompoundCRSTest.java?rev=1677789&r1=1677788&r2=1677789&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultCompoundCRSTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultCompoundCRSTest.java [UTF-8] Tue May 5 11:36:05 2015
@@ -153,7 +153,7 @@ public final strictfp class DefaultCompo
" GEOGCS[“WGS 84”,\n" +
" DATUM[“World Geodetic System 1984”,\n" +
" SPHEROID[“WGS84”, 6378137.0, 298.257223563]],\n" +
- " PRIMEM[“Greenwich”, 0.0],\n" +
+ " PRIMEM[“Greenwich”, 0.0],\n" +
" UNIT[“degree”, 0.017453292519943295],\n" +
" AXIS[“Longitude”, EAST],\n" +
" AXIS[“Latitude”, NORTH]],\n" +
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeocentricCRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeocentricCRSTest.java?rev=1677789&r1=1677788&r2=1677789&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeocentricCRSTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeocentricCRSTest.java [UTF-8] Tue May 5 11:36:05 2015
@@ -39,6 +39,8 @@ import static org.apache.sis.test.Metada
public final strictfp class DefaultGeocentricCRSTest extends TestCase {
/**
* Tests WKT 1 formatting.
+ * Axis directions Geocentric X, Y and Z shall be replaced be Other, East and North respectively,
+ * for conformance with legacy WKT 1 practice.
*/
@Test
public void testWKT1() {
@@ -46,7 +48,7 @@ public final strictfp class DefaultGeoce
"GEOCCS[“Geocentric”,\n" +
" DATUM[“World Geodetic System 1984”,\n" +
" SPHEROID[“WGS84”, 6378137.0, 298.257223563]],\n" +
- " PRIMEM[“Greenwich”, 0.0],\n" +
+ " PRIMEM[“Greenwich”, 0.0],\n" +
" UNIT[“metre”, 1],\n" +
" AXIS[“X”, OTHER],\n" +
" AXIS[“Y”, EAST],\n" +
@@ -106,6 +108,7 @@ public final strictfp class DefaultGeoce
"GeodeticCRS[“Geocentric”,\n" +
" Datum[“World Geodetic System 1984”,\n" +
" Ellipsoid[“WGS84”, 6378137.0, 298.257223563],\n" +
+ " Scope[“Satellite navigation.”],\n" +
" Id[“EPSG”, 6326]],\n" +
" PrimeMeridian[“Greenwich”, 0.0, Id[“EPSG”, 8901]],\n" +
" CS[“Cartesian”, 3],\n" +
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=1677789&r1=1677788&r2=1677789&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] Tue May 5 11:36:05 2015
@@ -43,7 +43,7 @@ import static org.apache.sis.test.Assert
})
public final strictfp class DefaultGeodeticCRSTest extends XMLTestCase {
/**
- * An XML file in this package containing a Cartesian coordinate system definition.
+ * An XML file in this package containing a geodetic CRS definition.
*/
private static final String XML_FILE = "WGS 84.xml";
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java?rev=1677789&r1=1677788&r2=1677789&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java [UTF-8] Tue May 5 11:36:05 2015
@@ -143,7 +143,7 @@ public final strictfp class DefaultGeogr
"GEOGCS[“WGS 84”,\n" +
" DATUM[“World Geodetic System 1984”,\n" +
" SPHEROID[“WGS84”, 6378137.0, 298.257223563]],\n" +
- " PRIMEM[“Greenwich”, 0.0],\n" +
+ " PRIMEM[“Greenwich”, 0.0],\n" +
" UNIT[“degree”, 0.017453292519943295],\n" +
" AXIS[“Longitude”, EAST],\n" +
" AXIS[“Latitude”, NORTH]]",
@@ -199,6 +199,7 @@ public final strictfp class DefaultGeogr
"GeodeticCRS[“WGS 84”,\n" +
" Datum[“World Geodetic System 1984”,\n" +
" Ellipsoid[“WGS84”, 6378137.0, 298.257223563],\n" +
+ " Scope[“Satellite navigation.”],\n" +
" Id[“EPSG”, 6326]],\n" +
" PrimeMeridian[“Greenwich”, 0.0, Id[“EPSG”, 8901]],\n" +
" CS[“ellipsoidal”, 2],\n" +
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java?rev=1677789&r1=1677788&r2=1677789&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java [UTF-8] Tue May 5 11:36:05 2015
@@ -19,8 +19,10 @@ package org.apache.sis.referencing.crs;
import javax.measure.unit.SI;
import javax.measure.unit.NonSI;
import javax.measure.unit.Unit;
+import javax.xml.bind.JAXBException;
import org.opengis.util.FactoryException;
import org.opengis.referencing.crs.ProjectedCRS;
+import org.opengis.test.Validators;
import org.apache.sis.referencing.cs.HardCodedCS;
import org.apache.sis.referencing.GeodeticObjectBuilder;
import org.apache.sis.metadata.iso.citation.Citations;
@@ -28,7 +30,7 @@ import org.apache.sis.internal.util.Cons
import org.apache.sis.io.wkt.Convention;
import org.apache.sis.test.DependsOnMethod;
import org.apache.sis.test.DependsOn;
-import org.apache.sis.test.TestCase;
+import org.apache.sis.test.XMLTestCase;
import org.junit.Test;
import static org.apache.sis.test.MetadataAssert.*;
@@ -45,7 +47,12 @@ import static org.apache.sis.test.Metada
@DependsOn({
DefaultGeographicCRSTest.class
})
-public final strictfp class DefaultProjectedCRSTest extends TestCase {
+public final strictfp class DefaultProjectedCRSTest extends XMLTestCase {
+ /**
+ * An XML file in this package containing a projected CRS definition.
+ */
+ private static final String XML_FILE = "NTF.xml";
+
/**
* Creates the "NTF (Paris) / Lambert zone II" CRS.
*
@@ -73,12 +80,13 @@ public final strictfp class DefaultProje
@Test
public void testWKT1() throws FactoryException {
final ProjectedCRS crs = create();
+ Validators.validate(crs);
assertWktEquals(Convention.WKT1,
"PROJCS[“NTF (Paris) / Lambert zone II”,\n" +
" GEOGCS[“NTF (Paris)”,\n" +
" DATUM[“Nouvelle Triangulation Francaise”,\n" +
" SPHEROID[“NTF”, 6378249.2, 293.4660212936269]],\n" +
- " PRIMEM[“Paris”, 2.33722917],\n" + // Note the conversion from 2.5969213 grades.
+ " PRIMEM[“Paris”, 2.33722917],\n" + // Note the conversion from 2.5969213 grades.
" UNIT[“degree”, 0.017453292519943295],\n" +
" AXIS[“Longitude”, EAST],\n" +
" AXIS[“Latitude”, NORTH]],\n" +
@@ -124,4 +132,22 @@ public final strictfp class DefaultProje
" Id[“EPSG”, 27572, Citation[“IOGP”], URI[“urn:ogc:def:crs:EPSG::27572”]]]",
crs);
}
+
+ /**
+ * Tests (un)marshalling of a projected coordinate reference system.
+ *
+ * @throws FactoryException if the CRS creation failed.
+ * @throws JAXBException If an error occurred during (un)marshalling.
+ */
+ @Test
+ @org.junit.Ignore("Still missing some JAXB annotations.")
+ public void testXML() throws FactoryException, JAXBException {
+ final DefaultProjectedCRS crs = unmarshalFile(DefaultProjectedCRS.class, XML_FILE);
+ Validators.validate(crs);
+ assertEquals("scope", "Large and medium scale topographic mapping and engineering survey.", crs.getScope().toString());
+ /*
+ * Marshal and compare with the original file.
+ */
+ assertMarshalEqualsFile(XML_FILE, crs, "xmlns:*", "xsi:schemaLocation");
+ }
}
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java?rev=1677789&r1=1677788&r2=1677789&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java [UTF-8] Tue May 5 11:36:05 2015
@@ -27,7 +27,7 @@ import org.apache.sis.referencing.NamedI
import org.apache.sis.internal.referencing.VerticalDatumTypes;
import org.apache.sis.metadata.iso.citation.HardCodedCitations;
-import static org.opengis.referencing.IdentifiedObject.*;
+import static org.opengis.referencing.datum.Datum.*;
/**
@@ -43,7 +43,8 @@ public final strictfp class HardCodedDat
* Greenwich meridian (EPSG:8901), with angular measurements in decimal degrees.
*/
public static final DefaultPrimeMeridian GREENWICH = new DefaultPrimeMeridian(
- properties("Greenwich", "8901"), 0, NonSI.DEGREE_ANGLE);
+ properties("Greenwich", "8901", null),
+ 0, NonSI.DEGREE_ANGLE);
/**
* Paris meridian (EPSG:8903), with angular measurements in grad.
@@ -51,7 +52,8 @@ public final strictfp class HardCodedDat
* @since 0.5
*/
public static final DefaultPrimeMeridian PARIS = new DefaultPrimeMeridian(
- properties("Paris", "8903"), 2.5969213, NonSI.GRADE);
+ properties("Paris", "8903", null),
+ 2.5969213, NonSI.GRADE);
/**
* Old Paris meridian (EPSG:8914) defined as 2°20'13.95"E.
@@ -63,14 +65,15 @@ public final strictfp class HardCodedDat
* @since 0.5
*/
public static final DefaultPrimeMeridian PARIS_RGS = new DefaultPrimeMeridian(
- properties("Paris RGS", "8914"), 2 + (20 + 13.95/60)/60, NonSI.DEGREE_ANGLE);
+ properties("Paris RGS", "8914", null),
+ 2 + (20 + 13.95/60)/60, NonSI.DEGREE_ANGLE);
/**
* WGS 1984 datum (EPSG:6326). Prime meridian is Greenwich.
* This datum is used in GPS systems.
*/
public static final DefaultGeodeticDatum WGS84 = new DefaultGeodeticDatum(
- properties("World Geodetic System 1984", "6326"),
+ properties("World Geodetic System 1984", "6326", "Satellite navigation."),
new DefaultEllipsoid(GeodeticDatumMock.WGS84.getEllipsoid()), GREENWICH);
/**
@@ -80,7 +83,7 @@ public final strictfp class HardCodedDat
* Earth Gravitational Model}.
*/
public static final DefaultGeodeticDatum WGS72 = new DefaultGeodeticDatum(
- properties("World Geodetic System 1972", "6322"),
+ properties("World Geodetic System 1972", "6322", "Satellite navigation."),
new DefaultEllipsoid(GeodeticDatumMock.WGS84.getEllipsoid()), GREENWICH);
/**
@@ -89,62 +92,70 @@ public final strictfp class HardCodedDat
* @since 0.5
*/
public static final DefaultGeodeticDatum NTF = new DefaultGeodeticDatum(
- properties("Nouvelle Triangulation Française", "6807"),
+ properties("Nouvelle Triangulation Française", "6807", "Topographic mapping."),
new DefaultEllipsoid(GeodeticDatumMock.NTF.getEllipsoid()), PARIS);
/**
* Spherical datum based on GRS 1980 Authalic Sphere (EPSG:6047). Prime meridian is Greenwich.
*/
public static final DefaultGeodeticDatum SPHERE = new DefaultGeodeticDatum(
- properties("Not specified (based on GRS 1980 Authalic Sphere)", "6047"),
+ properties("Not specified (based on GRS 1980 Authalic Sphere)", "6047", "Not a valid datum."),
new DefaultEllipsoid(GeodeticDatumMock.SPHERE.getEllipsoid()), GREENWICH);
/**
* Mean sea level, which can be used as an approximation of geoid.
*/
public static final DefaultVerticalDatum MEAN_SEA_LEVEL = new DefaultVerticalDatum(
- properties("Mean Sea Level", "5100"), VerticalDatumType.GEOIDAL);
+ properties("Mean Sea Level", "5100", "Hydrography."),
+ VerticalDatumType.GEOIDAL);
/**
* Ellipsoid for measurements of height above the ellipsoid.
* This is not a valid datum according ISO 19111, but is used by Apache SIS for internal calculation.
*/
public static final DefaultVerticalDatum ELLIPSOID = new DefaultVerticalDatum(
- properties("Ellipsoid", null), VerticalDatumTypes.ELLIPSOIDAL);
+ properties("Ellipsoid", null, "Not a valid datum."),
+ VerticalDatumTypes.ELLIPSOIDAL);
/**
* Default datum for time measured since January 1st, 1970 at 00:00 UTC.
*/
public static final DefaultTemporalDatum UNIX = new DefaultTemporalDatum(
- properties("UNIX", null), new Date(0));
+ properties("UNIX", null, null),
+ new Date(0));
/**
* Default datum for time measured since November 17, 1858 at 00:00 UTC.
*/
public static final DefaultTemporalDatum MODIFIED_JULIAN = new DefaultTemporalDatum(
- properties("Modified Julian", null), new Date(-40587 * (24*60*60*1000L)));
+ properties("Modified Julian", null, null),
+ new Date(-40587 * (24*60*60*1000L)));
/**
* Image with {@link PixelInCell#CELL_CENTER}.
*/
public static final DefaultImageDatum IMAGE = new DefaultImageDatum(
- properties("Image", null), PixelInCell.CELL_CENTER);
+ properties("Image", null, null),
+ PixelInCell.CELL_CENTER);
/**
* An engineering datum for unknown coordinate reference system. Such CRS are usually
* assumed Cartesian, but will not have any transformation path to other CRS.
*/
- public static final DefaultEngineeringDatum UNKNOWN = new DefaultEngineeringDatum(properties("Unknown", null));
+ public static final DefaultEngineeringDatum UNKNOWN = new DefaultEngineeringDatum(properties("Unknown", null, null));
/**
* Creates a map of properties for the given name and EPSG code.
*/
- private static Map<String,?> properties(final String name, final String code) {
+ private static Map<String,?> properties(final String name, final String code, final String scope) {
final Map<String,Object> properties = new HashMap<>(4);
properties.put(NAME_KEY, name);
if (code != null) {
properties.put(IDENTIFIERS_KEY, new NamedIdentifier(HardCodedCitations.EPSG, code));
}
+ if (scope != null) {
+ properties.put(SCOPE_KEY, scope);
+ }
return properties;
}
Modified: sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/crs/WGS 84.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/crs/WGS%2084.xml?rev=1677789&r1=1677788&r2=1677789&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/crs/WGS 84.xml (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/crs/WGS 84.xml Tue May 5 11:36:05 2015
@@ -18,11 +18,11 @@
under the License.
-->
<gml:GeodeticCRS xsi:schemaLocation = "http://www.opengis.net/gml/3.2 http://schemas.opengis.net/gml/3.2.1/coordinateReferenceSystems.xsd"
- xmlns:gml = "http://www.opengis.net/gml/3.2"
- xmlns:gmd = "http://www.isotc211.org/2005/gmd"
- xmlns:gco = "http://www.isotc211.org/2005/gco"
- xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
- gml:id = "epsg-crs-4326">
+ xmlns:gml = "http://www.opengis.net/gml/3.2"
+ xmlns:gmd = "http://www.isotc211.org/2005/gmd"
+ xmlns:gco = "http://www.isotc211.org/2005/gco"
+ xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
+ gml:id = "epsg-crs-4326">
<gml:identifier codeSpace="IOGP">urn:ogc:def:crs:EPSG::4326</gml:identifier>
<gml:name>WGS 84</gml:name>
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/TM_Primitive.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/TM_Primitive.java?rev=1677789&r1=1677788&r2=1677789&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/TM_Primitive.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/TM_Primitive.java [UTF-8] Tue May 5 11:36:05 2015
@@ -164,6 +164,8 @@ public final class TM_Primitive extends
* @param e the exception.
*/
private static void warningOccured(final String method, final Exception e) {
- Context.warningOccured(Context.current(), TM_Primitive.class, method, e, true);
+ if (TemporalUtilities.REPORT_MISSING_MODULE || !e.getMessage().contains("sis-temporal")) {
+ Context.warningOccured(Context.current(), TM_Primitive.class, method, e, true);
+ }
}
}
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/TemporalUtilities.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/TemporalUtilities.java?rev=1677789&r1=1677788&r2=1677789&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/TemporalUtilities.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/TemporalUtilities.java [UTF-8] Tue May 5 11:36:05 2015
@@ -37,6 +37,15 @@ import org.apache.sis.internal.system.De
*/
public final class TemporalUtilities extends Static {
/**
+ * {@code true} if the SIS library should log the "This operation requires the sis-temporal module" warning.
+ * This flag can be {@code true} during development phase, but should be set to {@code false} in SIS releases
+ * until we can really provide a sis-temporal module.
+ *
+ * This constant will be removed after SIS release a sis-temporal module.
+ */
+ public static final boolean REPORT_MISSING_MODULE = true;
+
+ /**
* Do not allow instantiation of this class.
*/
private TemporalUtilities() {