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/10/20 18:24:55 UTC
svn commit: r1709637 [3/4] - in /sis/trunk: ./
core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/
core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/
core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/ core/sis-ref...
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java?rev=1709637&r1=1709636&r2=1709637&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java [UTF-8] Tue Oct 20 16:24:53 2015
@@ -84,7 +84,7 @@ import org.apache.sis.internal.referenci
* @author Martin Desruisseaux (IRD, Geomatys)
* @author Cédric Briançon (Geomatys)
* @since 0.4
- * @version 0.6
+ * @version 0.7
* @module
*
* @see org.apache.sis.referencing.CommonCRS#primeMeridian()
@@ -406,6 +406,12 @@ public class DefaultPrimeMeridian extend
*/
private DefaultPrimeMeridian() {
super(org.apache.sis.internal.referencing.NilReferencingObject.INSTANCE);
+ /*
+ * Angular units are mandatory for SIS working. We do not verify their presence here (because the
+ * verification would have to be done in an 'afterMarshal(…)' method and throwing an exception in
+ * that method causes the whole unmarshalling to fail). But the CD_PrimeMeridian adapter does some
+ * verifications.
+ */
}
/**
@@ -427,11 +433,10 @@ public class DefaultPrimeMeridian extend
/*
* Missing unit: if the Greenwich longitude is zero, any angular unit gives the same result
* (assuming that the missing unit was not applying an offset), so we can select a default.
- * If the Greenwich longitude is not zero, we can not guess. Our object will be invalid.
+ * If the Greenwich longitude is not zero, presume egrees but log a warning.
*/
- if (greenwichLongitude == 0) {
- angularUnit = NonSI.DEGREE_ANGLE;
- } else {
+ angularUnit = NonSI.DEGREE_ANGLE;
+ if (greenwichLongitude != 0) {
Measure.missingUOM(DefaultPrimeMeridian.class, "setGreenwichMeasure");
}
}
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java?rev=1709637&r1=1709636&r2=1709637&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java [UTF-8] Tue Oct 20 16:24:53 2015
@@ -215,8 +215,8 @@ public class DefaultTemporalDatum extend
* @return The date and time origin of this temporal datum.
*/
@Override
- @XmlElement(name = "origin")
@XmlSchemaType(name = "dateTime")
+ @XmlElement(name = "origin", required = true)
@XmlJavaTypeAdapter(UniversalTimeAdapter.class)
public Date getOrigin() {
return MetadataUtilities.toDate(origin);
@@ -322,6 +322,11 @@ public class DefaultTemporalDatum extend
*/
private DefaultTemporalDatum() {
origin = Long.MIN_VALUE;
+ /*
+ * The origin is mandatory for SIS working. We do not verify its presence here because the verification
+ * would have to be done in an 'afterMarshal(…)' method and throwing an exception in that method causes
+ * the whole unmarshalling to fail. But the CD_TemporalDatum adapter does some verifications.
+ */
}
/**
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/package-info.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/package-info.java?rev=1709637&r1=1709636&r2=1709637&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/package-info.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/package-info.java [UTF-8] Tue Oct 20 16:24:53 2015
@@ -43,10 +43,12 @@
* @author Martin Desruisseaux (IRD, Geomatys)
* @author Cédric Briançon (Geomatys)
* @since 0.4
- * @version 0.4
+ * @version 0.7
* @module
*/
-@XmlSchema(elementFormDefault = XmlNsForm.QUALIFIED, namespace = Namespaces.GML, xmlns = {
+@XmlSchema(location = "http://schemas.opengis.net/gml/3.2.1/datums.xsd",
+ elementFormDefault = XmlNsForm.QUALIFIED, namespace = Namespaces.GML, xmlns =
+{
@XmlNs(prefix = "gml", namespaceURI = Namespaces.GML),
@XmlNs(prefix = "gmd", namespaceURI = Namespaces.GMD),
@XmlNs(prefix = "gco", namespaceURI = Namespaces.GCO),
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java?rev=1709637&r1=1709636&r2=1709637&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java [UTF-8] Tue Oct 20 16:24:53 2015
@@ -52,6 +52,7 @@ import org.apache.sis.internal.referenci
import org.apache.sis.internal.referencing.WKTUtilities;
import org.apache.sis.internal.metadata.WKTKeywords;
import org.apache.sis.internal.util.CollectionsExt;
+import org.apache.sis.internal.util.UnmodifiableArrayList;
import org.apache.sis.internal.system.Semaphores;
import static org.apache.sis.util.Utilities.deepEquals;
@@ -92,17 +93,18 @@ import org.apache.sis.internal.jdk7.Obje
* @version 0.7
* @module
*/
-@XmlType(name="AbstractCoordinateOperationType", propOrder = {
+@XmlType(name = "AbstractCoordinateOperationType", propOrder = {
"domainOfValidity",
"scope",
"operationVersion",
- "coordinateOperationAccuracy",
+ "accuracy",
"source",
"target"
})
@XmlRootElement(name = "AbstractCoordinateOperation")
@XmlSeeAlso({
AbstractSingleOperation.class,
+ DefaultPassThroughOperation.class,
DefaultConcatenatedOperation.class
})
public class AbstractCoordinateOperation extends AbstractIdentifiedObject implements CoordinateOperation {
@@ -147,32 +149,44 @@ public class AbstractCoordinateOperation
/**
* Version of the coordinate transformation
* (i.e., instantiation due to the stochastic nature of the parameters).
+ *
+ * <p><b>Consider this field as final!</b>
+ * This field is modified only at unmarshalling time by {@link #setOperationVersion(String)}</p>
+ *
+ * @see #getOperationVersion()
*/
- @XmlElement
- private final String operationVersion;
+ private String operationVersion;
/**
* Estimate(s) of the impact of this operation on point accuracy, or {@code null} if none.
*
* <p><b>Consider this field as final!</b>
- * This field is non-final only for the convenience of constructors.</p>
+ * This field is non-final only for the convenience of constructors and for initialization
+ * at XML unmarshalling time by {@link #setAccuracy(PositionalAccuracy[])}.</p>
*
* @see #getCoordinateOperationAccuracy()
*/
- @XmlElement
Collection<PositionalAccuracy> coordinateOperationAccuracy;
/**
* Area in which this operation is valid, or {@code null} if not available.
+ *
+ * <p><b>Consider this field as final!</b>
+ * This field is modified only at unmarshalling time by {@link #setDomainOfValidity(Extent)}</p>
+ *
+ * @see #getDomainOfValidity()
*/
- @XmlElement
- private final Extent domainOfValidity;
+ private Extent domainOfValidity;
/**
* Description of domain of usage, or limitations of usage, for which this operation is valid.
+ *
+ * <p><b>Consider this field as final!</b>
+ * This field is modified only at unmarshalling time by {@link #setScope(InternationalString)}</p>
+ *
+ * @see #getScope()
*/
- @XmlElement
- private final InternationalString scope;
+ private InternationalString scope;
/**
* Transform from positions in the {@linkplain #getSourceCRS source coordinate reference system}
@@ -180,7 +194,7 @@ public class AbstractCoordinateOperation
*
* <p><b>Consider this field as final!</b>
* This field is non-final only for the convenience of constructors and for initialization
- * at XML unmarshalling time by {@link #afterUnmarshal(Unmarshaller, Object)}</p>
+ * at XML unmarshalling time by {@link AbstractSingleOperation#afterUnmarshal(Unmarshaller, Object)}</p>
*/
MathTransform transform;
@@ -506,6 +520,7 @@ check: for (int isTarget=0; ; isTar
* @return The coordinate operation version, or {@code null} in none.
*/
@Override
+ @XmlElement(name = "operationVersion")
public String getOperationVersion() {
return operationVersion;
}
@@ -521,7 +536,7 @@ check: for (int isTarget=0; ; isTar
*/
@Override
public Collection<PositionalAccuracy> getCoordinateOperationAccuracy() {
- return (coordinateOperationAccuracy != null) ? coordinateOperationAccuracy : Collections.<PositionalAccuracy>emptySet();
+ return CollectionsExt.nonNull(coordinateOperationAccuracy);
}
/**
@@ -572,6 +587,7 @@ check: for (int isTarget=0; ; isTar
* @return The coordinate operation valid domain, or {@code null} if not available.
*/
@Override
+ @XmlElement(name = "domainOfValidity")
public Extent getDomainOfValidity() {
return domainOfValidity;
}
@@ -582,6 +598,7 @@ check: for (int isTarget=0; ; isTar
* @return A description of domain of usage, or {@code null} if none.
*/
@Override
+ @XmlElement(name = "scope", required = true)
public InternationalString getScope() {
return scope;
}
@@ -843,9 +860,6 @@ check: for (int isTarget=0; ; isTar
*/
AbstractCoordinateOperation() {
super(org.apache.sis.internal.referencing.NilReferencingObject.INSTANCE);
- operationVersion = null;
- domainOfValidity = null;
- scope = null;
}
/**
@@ -885,4 +899,64 @@ check: for (int isTarget=0; ; isTar
ReferencingUtilities.propertyAlreadySet(AbstractCoordinateOperation.class, "setTarget", "targetCRS");
}
}
+
+ /**
+ * Invoked by JAXB only at marshalling time.
+ */
+ @XmlElement(name = "coordinateOperationAccuracy")
+ private PositionalAccuracy[] getAccuracy() {
+ final Collection<PositionalAccuracy> accuracy = getCoordinateOperationAccuracy();
+ final int size = accuracy.size();
+ return (size != 0) ? accuracy.toArray(new PositionalAccuracy[size]) : null;
+ }
+
+ /**
+ * Invoked by JAXB only at unmarshalling time.
+ */
+ private void setAccuracy(final PositionalAccuracy[] values) {
+ if (coordinateOperationAccuracy == null) {
+ coordinateOperationAccuracy = UnmodifiableArrayList.wrap(values);
+ } else {
+ ReferencingUtilities.propertyAlreadySet(AbstractCoordinateOperation.class, "setAccuracy", "coordinateOperationAccuracy");
+ }
+ }
+
+ /**
+ * Invoked by JAXB only at unmarshalling time.
+ *
+ * @see #getOperationVersion()
+ */
+ private void setOperationVersion(final String value) {
+ if (operationVersion == null) {
+ operationVersion = value;
+ } else {
+ ReferencingUtilities.propertyAlreadySet(AbstractCoordinateOperation.class, "setOperationVersion", "operationVersion");
+ }
+ }
+
+ /**
+ * Invoked by JAXB only at unmarshalling time.
+ *
+ * @see #getDomainOfValidity()
+ */
+ private void setDomainOfValidity(final Extent value) {
+ if (domainOfValidity == null) {
+ domainOfValidity = value;
+ } else {
+ ReferencingUtilities.propertyAlreadySet(AbstractCoordinateOperation.class, "setDomainOfValidity", "domainOfValidity");
+ }
+ }
+
+ /**
+ * Invoked by JAXB only at unmarshalling time.
+ *
+ * @see #getScope()
+ */
+ private void setScope(final InternationalString value) {
+ if (scope == null) {
+ scope = value;
+ } else {
+ ReferencingUtilities.propertyAlreadySet(AbstractCoordinateOperation.class, "setScope", "scope");
+ }
+ }
}
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractSingleOperation.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractSingleOperation.java?rev=1709637&r1=1709636&r2=1709637&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractSingleOperation.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractSingleOperation.java [UTF-8] Tue Oct 20 16:24:53 2015
@@ -63,12 +63,18 @@ import org.apache.sis.internal.jdk7.Obje
* Shared implementation for {@link DefaultConversion} and {@link DefaultTransformation}.
* Does not need to be public, as users should handle only conversions or transformations.
*
+ * <p><b>Note:</b> this class is not strictly equivalent to {@code <gml:AbstractSingleOperationType>}
+ * because the GML schema does not define the method and parameters in this base class. Instead, they
+ * repeat those two elements in the {@code <gml:Conversion>} and {@code <gml:Transformation>} subtypes.
+ * An other difference is that SIS does not use {@code AbstractSingleOperation} as the base class of
+ * {@link DefaultPassThroughOperation}.</p>
+ *
* @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.6
* @version 0.7
* @module
*/
-@XmlType(name="AbstractSingleOperationType", propOrder = {
+@XmlType(name = "AbstractSingleOperationType", propOrder = { // See note in class javadoc.
"method",
"parameters"
})
@@ -85,9 +91,13 @@ class AbstractSingleOperation extends Ab
/**
* The operation method.
+ *
+ * <p><b>Consider this field as final!</b>
+ * This field is modified only at unmarshalling time by {@link #setMethod(OperationMethod)}</p>
+ *
+ * @see #getMethod()
*/
- @XmlElement
- private final OperationMethod method;
+ private OperationMethod method;
/**
* The parameter values, or {@code null} for inferring it from the math transform.
@@ -269,6 +279,7 @@ class AbstractSingleOperation extends Ab
* @return A description of the operation method.
*/
@Override
+ @XmlElement(name = "method", required = true)
public OperationMethod getMethod() {
return method;
}
@@ -408,7 +419,24 @@ class AbstractSingleOperation extends Ab
* reserved to JAXB, which will assign values to the fields using reflexion.
*/
AbstractSingleOperation() {
- method = null;
+ /*
+ * The method is mandatory for SIS working. We do not verify its presence here because the verification
+ * would have to be done in an 'afterMarshal(…)' method and throwing an exception in that method causes
+ * the whole unmarshalling to fail. But the CC_CoordinateOperation adapter does some verifications.
+ */
+ }
+
+ /**
+ * Invoked by JAXB at unmarshalling time.
+ *
+ * @see #getMethod()
+ */
+ private void setMethod(final OperationMethod value) {
+ if (method == null) {
+ method = value;
+ } else {
+ ReferencingUtilities.propertyAlreadySet(AbstractSingleOperation.class, "setMethod", "method");
+ }
}
/**
@@ -497,6 +525,8 @@ class AbstractSingleOperation extends Ab
* @see <a href="http://issues.apache.org/jira/browse/SIS-291">SIS-291</a>
*/
private void afterUnmarshal(Unmarshaller unmarshaller, Object parent) {
+ final CoordinateReferenceSystem sourceCRS = super.getSourceCRS();
+ final CoordinateReferenceSystem targetCRS = super.getTargetCRS();
if (transform == null && sourceCRS != null && targetCRS != null && parameters != null) try {
transform = DefaultFactories.forBuildin(MathTransformFactory.class)
.createBaseToDerived(sourceCRS, parameters, targetCRS.getCoordinateSystem());
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperation.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperation.java?rev=1709637&r1=1709636&r2=1709637&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperation.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperation.java [UTF-8] Tue Oct 20 16:24:53 2015
@@ -21,6 +21,7 @@ import java.util.Set;
import java.util.List;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.LinkedHashSet;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlElement;
@@ -353,6 +354,7 @@ final class DefaultConcatenatedOperation
* reserved to JAXB, which will assign values to the fields using reflexion.
*/
private DefaultConcatenatedOperation() {
+ operations = Collections.emptyList();
}
/**
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConversion.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConversion.java?rev=1709637&r1=1709636&r2=1709637&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConversion.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConversion.java [UTF-8] Tue Oct 20 16:24:53 2015
@@ -256,6 +256,8 @@ public class DefaultConversion extends A
* ProjectedCRS), then DefaultMathTransformFactory has a specialized createBaseToDerived(…)
* method for this job.
*/
+ final CoordinateReferenceSystem sourceCRS = super.getSourceCRS();
+ final CoordinateReferenceSystem targetCRS = super.getTargetCRS();
if (sourceCRS == null && targetCRS == null && factory instanceof DefaultMathTransformFactory) {
transform = ((DefaultMathTransformFactory) factory).createBaseToDerived(
source.getCoordinateSystem(), transform,
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactory.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactory.java?rev=1709637&r1=1709636&r2=1709637&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactory.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactory.java [UTF-8] Tue Oct 20 16:24:53 2015
@@ -174,12 +174,12 @@ public class DefaultCoordinateOperationF
* @see DefaultMathTransformFactory#getOperationMethod(String)
*/
public OperationMethod getOperationMethod(String name) throws FactoryException {
+ name = CharSequences.trimWhitespaces(name);
+ ArgumentChecks.ensureNonEmpty("name", name);
final MathTransformFactory mtFactory = getMathTransformFactory();
if (mtFactory instanceof DefaultMathTransformFactory) {
return ((DefaultMathTransformFactory) mtFactory).getOperationMethod(name);
}
- name = CharSequences.trimWhitespaces(name);
- ArgumentChecks.ensureNonEmpty("name", name);
final OperationMethod method = ReferencingServices.getInstance().getOperationMethod(
mtFactory.getAvailableMethods(SingleOperation.class), name);
if (method != null) {
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java?rev=1709637&r1=1709636&r2=1709637&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java [UTF-8] Tue Oct 20 16:24:53 2015
@@ -118,7 +118,7 @@ import org.apache.sis.internal.jdk7.Obje
* {@link org.apache.sis.referencing.operation.transform.DefaultMathTransformFactory}.
*
* @author Martin Desruisseaux (IRD, Geomatys)
- * @version 0.6
+ * @version 0.7
* @since 0.5
* @module
*
@@ -126,7 +126,7 @@ import org.apache.sis.internal.jdk7.Obje
* @see DefaultTransformation
* @see org.apache.sis.referencing.operation.transform.MathTransformProvider
*/
-@XmlType(name="OperationMethodType", propOrder = {
+@XmlType(name = "OperationMethodType", propOrder = {
"formulaCitation",
"formulaDescription",
"sourceDimensions",
@@ -161,19 +161,25 @@ public class DefaultOperationMethod exte
* Number of dimensions in the source CRS of this operation method.
* May be {@code null} if this method can work with any number of
* source dimensions (e.g. <cite>Affine Transform</cite>).
+ *
+ * <p><b>Consider this field as final!</b>
+ * This field is modified only at unmarshalling time by {@link #setSourceDimensions(Integer)}</p>
+ *
+ * @see #getSourceDimensions()
*/
- @XmlElement
- @XmlSchemaType(name = "positiveInteger")
- private final Integer sourceDimensions;
+ private Integer sourceDimensions;
/**
* Number of dimensions in the target CRS of this operation method.
* May be {@code null} if this method can work with any number of
* target dimensions (e.g. <cite>Affine Transform</cite>).
+ *
+ * <p><b>Consider this field as final!</b>
+ * This field is modified only at unmarshalling time by {@link #setTargetDimensions(Integer)}</p>
+ *
+ * @see #getTargetDimensions()
*/
- @XmlElement
- @XmlSchemaType(name = "positiveInteger")
- private final Integer targetDimensions;
+ private Integer targetDimensions;
/**
* The set of parameters, or {@code null} if none.
@@ -564,6 +570,8 @@ public class DefaultOperationMethod exte
* @see org.apache.sis.referencing.operation.transform.AbstractMathTransform#getSourceDimensions()
*/
@Override
+ @XmlElement(name = "sourceDimensions")
+ @XmlSchemaType(name = "positiveInteger")
public Integer getSourceDimensions() {
return sourceDimensions;
}
@@ -577,6 +585,8 @@ public class DefaultOperationMethod exte
* @see org.apache.sis.referencing.operation.transform.AbstractMathTransform#getTargetDimensions()
*/
@Override
+ @XmlElement(name = "targetDimensions")
+ @XmlSchemaType(name = "positiveInteger")
public Integer getTargetDimensions() {
return targetDimensions;
}
@@ -777,8 +787,32 @@ public class DefaultOperationMethod exte
*/
private DefaultOperationMethod() {
super(org.apache.sis.internal.referencing.NilReferencingObject.INSTANCE);
- sourceDimensions = null;
- targetDimensions = null;
+ }
+
+ /**
+ * Invoked by JAXB at unmarshalling time.
+ *
+ * @see #getSourceDimensions()
+ */
+ private void setSourceDimensions(final Integer value) {
+ if (sourceDimensions == null) {
+ sourceDimensions = value;
+ } else {
+ ReferencingUtilities.propertyAlreadySet(DefaultOperationMethod.class, "setSourceDimensions", "sourceDimensions");
+ }
+ }
+
+ /**
+ * Invoked by JAXB at unmarshalling time.
+ *
+ * @see #getTargetDimensions()
+ */
+ private void setTargetDimensions(final Integer value) {
+ if (targetDimensions == null) {
+ targetDimensions = value;
+ } else {
+ ReferencingUtilities.propertyAlreadySet(DefaultOperationMethod.class, "setTargetDimensions", "targetDimensions");
+ }
}
/**
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultPassThroughOperation.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultPassThroughOperation.java?rev=1709637&r1=1709636&r2=1709637&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultPassThroughOperation.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultPassThroughOperation.java [UTF-8] Tue Oct 20 16:24:53 2015
@@ -17,15 +17,22 @@
package org.apache.sis.referencing.operation;
import java.util.Map;
+import java.util.Arrays;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
import org.opengis.parameter.ParameterValueGroup;
import org.opengis.referencing.operation.MathTransform;
import org.opengis.referencing.operation.CoordinateOperation;
import org.opengis.referencing.operation.PassThroughOperation;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
+import org.opengis.referencing.crs.CompoundCRS;
import org.apache.sis.referencing.operation.transform.PassThroughTransform;
+import org.apache.sis.internal.referencing.ReferencingUtilities;
import org.apache.sis.util.UnsupportedImplementationException;
import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.util.ComparisonMode;
+import org.apache.sis.util.resources.Errors;
import static org.apache.sis.util.Utilities.deepEquals;
@@ -40,10 +47,14 @@ import org.opengis.referencing.operation
*
* @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.6
- * @version 0.6
+ * @version 0.7
* @module
*/
-// Missing JAXB annotation. See http://issues.apache.org/jira/browse/SIS-293
+@XmlType(name = "PassThroughOperationType", propOrder = {
+ "indices",
+ "operation"
+})
+@XmlRootElement(name = "PassThroughOperation")
public class DefaultPassThroughOperation extends AbstractCoordinateOperation implements PassThroughOperation {
/**
* Serial number for inter-operability with different versions.
@@ -52,8 +63,13 @@ public class DefaultPassThroughOperation
/**
* The operation to apply on the subset of a coordinate tuple.
+ *
+ * <p><b>Consider this field as final!</b>
+ * This field is modified only at unmarshalling time by {@link #setOperation(CoordinateOperation)}</p>
+ *
+ * @see #getOperation()
*/
- private final SingleOperation operation;
+ private SingleOperation operation;
/**
* Constructs a single operation from a set of properties.
@@ -186,6 +202,7 @@ public class DefaultPassThroughOperation
* @see PassThroughTransform#getSubTransform()
*/
@Override
+ @XmlElement(name = "coordOperation", required = true)
public SingleOperation getOperation() {
return operation;
}
@@ -194,7 +211,7 @@ public class DefaultPassThroughOperation
* Returns the ordered sequence of indices in a source coordinate tuple of the coordinates
* affected by this pass-through operation.
*
- * @return Indices of the modified source coordinates.
+ * @return Zero-based indices of the modified source coordinates.
*
* @see PassThroughTransform#getModifiedCoordinates()
*/
@@ -204,7 +221,27 @@ public class DefaultPassThroughOperation
if (transform instanceof PassThroughTransform) {
return ((PassThroughTransform) transform).getModifiedCoordinates();
} else {
- // Should not happen since the constructor created the transform itself.
+ /*
+ * Should not happen with objects created by public methods since the constructor created the transform
+ * itself. However may happen with operations parsed from GML. As a fallback, search in the components
+ * of CompoundCRS. This is not a universal fallback, but work for the most straightforward cases.
+ */
+ final CoordinateReferenceSystem sourceCRS = super.getSourceCRS();
+ if (sourceCRS instanceof CompoundCRS) {
+ int firstAffectedOrdinate = 0;
+ final CoordinateReferenceSystem search = operation.getSourceCRS();
+ for (final CoordinateReferenceSystem c : ((CompoundCRS) sourceCRS).getComponents()) {
+ final int dim = ReferencingUtilities.getDimension(c);
+ if (c == search) {
+ final int[] indices = new int[dim];
+ for (int i=0; i<dim; i++) {
+ indices[i] = firstAffectedOrdinate + i;
+ }
+ return indices;
+ }
+ firstAffectedOrdinate += dim;
+ }
+ }
throw new UnsupportedImplementationException(transform.getClass());
}
}
@@ -241,4 +278,87 @@ public class DefaultPassThroughOperation
protected long computeHashCode() {
return super.computeHashCode() + 31 * operation.hashCode();
}
+
+
+
+
+ //////////////////////////////////////////////////////////////////////////////////////////////////
+ //////// ////////
+ //////// XML support with JAXB ////////
+ //////// ////////
+ //////// The following methods are invoked by JAXB using reflection (even if ////////
+ //////// they are private) or are helpers for other methods invoked by JAXB. ////////
+ //////// Those methods can be safely removed if Geographic Markup Language ////////
+ //////// (GML) support is not needed. ////////
+ //////// ////////
+ //////////////////////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * 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 DefaultPassThroughOperation() {
+ /*
+ * A sub-operation is mandatory for SIS working. We do not verify its presence here because the verification
+ * would have to be done in an 'afterMarshal(…)' method and throwing an exception in that method causes the
+ * whole unmarshalling to fail. But the CC_CoordinateOperation adapter does some verifications.
+ */
+ }
+
+ /**
+ * Invoked by JAXB at unmarshalling time for setting the coordinate operation
+ * applied on the subset of a coordinate tuple.
+ *
+ * @see #getOperation()
+ */
+ private void setOperation(final SingleOperation op) {
+ if (operation == null) {
+ operation = op;
+ } else {
+ ReferencingUtilities.propertyAlreadySet(DefaultPassThroughOperation.class, "setOperation", "coordOperation");
+ }
+ }
+
+ /**
+ * Invoked by JAXB at marshalling time for getting the modified coordinates.
+ * This method converts the zero-based indices to 1-based indices.
+ *
+ * @see #getModifiedCoordinates()
+ */
+ @XmlElement(name = "modifiedCoordinate", required = true)
+ private int[] getIndices() {
+ final int[] indices = getModifiedCoordinates();
+ for (int i=0; i<indices.length; i++) {
+ indices[i]++;
+ }
+ return indices;
+ }
+
+ /**
+ * Invoked by JAXB at unmarshalling time for setting the modified coordinates.
+ */
+ private void setIndices(final int[] ordinates) {
+ String missing = "sourceCRS";
+ final CoordinateReferenceSystem sourceCRS = super.getSourceCRS();
+ if (sourceCRS != null) {
+ missing = "modifiedCoordinate";
+ if (ordinates != null && ordinates.length != 0) {
+ missing = "coordOperation";
+ if (operation != null) {
+ for (int i=1; i<ordinates.length; i++) {
+ final int previous = ordinates[i-1];
+ if (previous < 1 || ordinates[i] != previous + 1) {
+ throw new IllegalArgumentException(Errors.format(
+ Errors.Keys.CanNotAssign_2, missing, Arrays.toString(ordinates)));
+ }
+ }
+ transform = PassThroughTransform.create(ordinates[0] - 1, operation.getMathTransform(),
+ ReferencingUtilities.getDimension(sourceCRS) - ordinates[ordinates.length - 1]);
+ return;
+ }
+ }
+ }
+ throw new IllegalStateException(Errors.format(Errors.Keys.MissingComponentInElement_2, missing, "PassThroughOperation"));
+ }
}
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/package-info.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/package-info.java?rev=1709637&r1=1709636&r2=1709637&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/package-info.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/package-info.java [UTF-8] Tue Oct 20 16:24:53 2015
@@ -58,7 +58,9 @@
* @since 0.6
* @module
*/
-@XmlSchema(elementFormDefault= XmlNsForm.QUALIFIED, namespace = Namespaces.GML, xmlns = {
+@XmlSchema(location = "http://schemas.opengis.net/gml/3.2.1/coordinateOperations.xsd",
+ elementFormDefault = XmlNsForm.QUALIFIED, namespace = Namespaces.GML, xmlns =
+{
@XmlNs(prefix = "gml", namespaceURI = Namespaces.GML),
@XmlNs(prefix = "xsi", namespaceURI = Namespaces.XSI)
})
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Initializer.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Initializer.java?rev=1709637&r1=1709636&r2=1709637&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Initializer.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Initializer.java [UTF-8] Tue Oct 20 16:24:53 2015
@@ -55,8 +55,9 @@ import static org.apache.sis.internal.ut
* in some relatively rare scenarios like 1 ± x where <var>x</var> is much smaller than 1.</p>
*
* @author Martin Desruisseaux (Geomatys)
+ * @author Rémi Marechal (Geomatys)
* @since 0.6
- * @version 0.6
+ * @version 0.7
* @module
*/
final class Initializer {
@@ -304,6 +305,28 @@ final class Initializer {
}
/**
+ * Returns the radius of the conformal sphere (assuming a semi-major axis length of 1) at a given latitude.
+ * The radius of conformal sphere is computed from ρ, which is the radius of curvature in the meridian at
+ * latitude φ, and ν which is the radius of curvature in the prime vertical, as below:
+ *
+ * <blockquote>Rc = √(ρ⋅ν) = √(1 – ℯ²) / (1 – ℯ²sin²φ)</blockquote>
+ *
+ * This is a function of latitude and therefore not constant. When used for spherical projections
+ * the use of φ₀ (or φ₁ as relevant to method) for φ is suggested, except if the projection is
+ * equal area when the radius of authalic sphere should be used.
+ *
+ * @param sinφ The sine of the φ latitude.
+ * @return Radius of the conformal sphere at latitude φ.
+ */
+ final double radiusOfConformalSphere(final double sinφ) {
+ final DoubleDouble Rc = verbatim(1);
+ Rc.subtract(excentricitySquared); // 1 - ℯ²
+ Rc.sqrt(); // √(1 - ℯ²)
+ Rc.divide(rν2(sinφ)); // √(1 - ℯ²) / (1 - ℯ²sin²φ)
+ return Rc.value;
+ }
+
+ /**
* Returns the scale factor at latitude φ. This is computed as:
*
* <blockquote>cosφ / sqrt(rν2(sinφ))</blockquote>
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/LambertConicConformal.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/LambertConicConformal.java?rev=1709637&r1=1709636&r2=1709637&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/LambertConicConformal.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/LambertConicConformal.java [UTF-8] Tue Oct 20 16:24:53 2015
@@ -354,7 +354,7 @@ public class LambertConicConformal exten
* comparing two {@code LambertConicConformal} projections or formatting them in debug mode.
*/
@Override
- String[] getInternalParameterNames() {
+ final String[] getInternalParameterNames() {
return new String[] {"n"};
}
@@ -363,7 +363,7 @@ public class LambertConicConformal exten
* comparing two {@code LambertConicConformal} projections or formatting them in debug mode.
*/
@Override
- double[] getInternalParameterValues() {
+ final double[] getInternalParameterValues() {
return new double[] {n};
}
@@ -406,7 +406,7 @@ public class LambertConicConformal exten
* the first non-linear one moved to the "normalize" affine transform, and the linear operations
* applied after the last non-linear one moved to the "denormalize" affine transform.
*/
- final double θ = srcPts[srcOff ]; // θ = λ⋅n
+ final double θ = srcPts[srcOff ]; // θ = λ⋅n (ignoring longitude of origin)
final double φ = srcPts[srcOff+1]; // Sign may be reversed
final double absφ = abs(φ);
final double sinθ = sin(θ);
@@ -431,9 +431,9 @@ public class LambertConicConformal exten
if (!derivate) {
return null;
}
- //
- // End of map projection. Now compute the derivative.
- //
+ /*
+ * End of map projection. Now compute the derivative.
+ */
final double dρ;
if (sinφ != 1) {
dρ = n * dy_dφ(sinφ, cos(φ)) * ρ;
@@ -445,7 +445,7 @@ public class LambertConicConformal exten
}
/**
- * Transforms the specified (<var>x</var>,<var>y</var>) coordinates and stores the (θ,φ) result in {@code dstPts}.
+ * Converts the specified (<var>x</var>,<var>y</var>) coordinates and stores the (θ,φ) result in {@code dstPts}.
*
* @throws ProjectionException if the point can not be converted.
*/
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Mercator.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Mercator.java?rev=1709637&r1=1709636&r2=1709637&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Mercator.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Mercator.java [UTF-8] Tue Oct 20 16:24:53 2015
@@ -405,7 +405,7 @@ public class Mercator extends ConformalP
}
/**
- * Transforms the specified (<var>x</var>,<var>y</var>) coordinates
+ * Converts the specified (<var>x</var>,<var>y</var>) coordinates
* and stores the result in {@code dstPts} (angles in radians).
*
* @throws ProjectionException if the point can not be converted.
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/NormalizedProjection.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/NormalizedProjection.java?rev=1709637&r1=1709636&r2=1709637&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/NormalizedProjection.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/NormalizedProjection.java [UTF-8] Tue Oct 20 16:24:53 2015
@@ -26,6 +26,7 @@ import org.opengis.parameter.ParameterDe
import org.opengis.referencing.operation.Matrix;
import org.opengis.referencing.operation.MathTransform;
import org.opengis.referencing.operation.MathTransform2D;
+import org.opengis.referencing.operation.SingleOperation;
import org.opengis.referencing.operation.OperationMethod;
import org.opengis.referencing.operation.TransformException;
import org.opengis.referencing.operation.MathTransformFactory;
@@ -40,11 +41,15 @@ import org.apache.sis.referencing.operat
import org.apache.sis.referencing.operation.matrix.MatrixSIS;
import org.apache.sis.referencing.operation.transform.AbstractMathTransform2D;
import org.apache.sis.referencing.operation.transform.ContextualParameters;
+import org.apache.sis.referencing.operation.transform.DefaultMathTransformFactory;
+import org.apache.sis.referencing.operation.transform.MathTransformProvider;
+import org.apache.sis.internal.metadata.ReferencingServices;
import org.apache.sis.internal.referencing.Formulas;
import org.apache.sis.internal.util.CollectionsExt;
import org.apache.sis.internal.util.Constants;
import org.apache.sis.internal.util.Utilities;
import org.apache.sis.internal.util.Numerics;
+import org.apache.sis.util.resources.Errors;
import static java.lang.Math.*;
@@ -481,6 +486,43 @@ public abstract class NormalizedProjecti
}
/**
+ * If this map projection can not handle the parameters given by the user but an other projection could, delegates
+ * to the other projection. This method can be invoked by some {@link #createMapProjection(MathTransformFactory)}
+ * implementations when the other projection can be seen as a special case.
+ *
+ * <div class="note"><b>Example:</b>
+ * the {@link ObliqueStereographic} formulas do not work anymore when the latitude of origin is 90°N or 90°S,
+ * because some internal coefficients become infinite. However the {@link PolarStereographic} implementation
+ * is designed especially for those special cases. So the {@code ObliqueStereographic.createMapProjection(…)}
+ * method can redirect to {@code PolarStereographic.createMapProjection(…)} when it detects such cases.</div>
+ *
+ * It is caller's responsibility to choose an alternative method that can understand the parameters which were
+ * given to this original projection.
+ *
+ * @param factory The factory given to {@link #createMapProjection(MathTransformFactory)}.
+ * @param name The name of the alternative map projection to use.
+ * @return The alternative projection.
+ * @throws FactoryException if an error occurred while creating the alternative projection.
+ *
+ * @since 0.7
+ */
+ final MathTransform delegate(final MathTransformFactory factory, final String name) throws FactoryException {
+ final OperationMethod method;
+ if (factory instanceof DefaultMathTransformFactory) {
+ method = ((DefaultMathTransformFactory) factory).getOperationMethod(name);
+ } else {
+ method = ReferencingServices.getInstance().getOperationMethod(
+ factory.getAvailableMethods(SingleOperation.class), name);
+ }
+ if (method instanceof MathTransformProvider) {
+ return ((MathTransformProvider) method).createMathTransform(factory, context);
+ } else {
+ throw new FactoryException(Errors.format(Errors.Keys.UnsupportedImplementation_1,
+ (method != null ? method : factory).getClass()));
+ }
+ }
+
+ /**
* Returns the parameters used for creating the complete map projection. Those parameters describe a sequence of
* <cite>normalize</cite> → {@code this} → <cite>denormalize</cite> transforms, <strong>not</strong> including
* {@linkplain org.apache.sis.referencing.cs.CoordinateSystems#swapAndScaleAxes axis swapping}.
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/PolarStereographic.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/PolarStereographic.java?rev=1709637&r1=1709636&r2=1709637&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/PolarStereographic.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/PolarStereographic.java [UTF-8] Tue Oct 20 16:24:53 2015
@@ -41,6 +41,13 @@ import static org.apache.sis.internal.ut
/**
* <cite>Polar Stereographic</cite> projection (EPSG codes 9810, 9829, 9830).
+ * This is a special case of {@link ObliqueStereographic} when the projection origin is at a pole.
+ *
+ * <p>EPSG defines three variants for this projection, <cite>A</cite>, <cite>B</cite> and <cite>C</cite>,
+ * which differ by the way the parameters are specified. The <cite>"Polar Stereographic (variant B)"</cite>
+ * projection includes a <cite>"Latitude of standard parallel"</cite> parameter where is effective the scale factor
+ * (normally 1). The <cite>"Polar Stereographic (variant A)"</cite> forces its <cite>"Latitude of natural origin"</cite>
+ * parameter to ±90°, depending on the hemisphere.</p>
*
* @author Gerald Evenden (USGS)
* @author André Gosselin (MPO)
@@ -51,7 +58,6 @@ import static org.apache.sis.internal.ut
* @version 0.6
* @module
*
- * @see EquatorialStereographic
* @see ObliqueStereographic
*/
public class PolarStereographic extends ConformalProjection {
@@ -308,16 +314,16 @@ public class PolarStereographic extends
if (!derivate) {
return null;
}
- //
- // End of map projection. Now compute the derivative.
- //
+ /*
+ * End of map projection. Now compute the derivative.
+ */
final double dt = t * dy_dφ(sinφ, cos(φ));
return new Matrix2(y, dt*sinθ, // ∂x/∂λ , ∂x/∂φ
-x, dt*cosθ); // ∂y/∂λ , ∂y/∂φ
}
/**
- * Transforms the specified (x,y) coordinates and stores the result in {@code dstPts} (angles in radians).
+ * Converts the specified (x,y) coordinates and stores the result in {@code dstPts} (angles in radians).
*
* @throws ProjectionException if the point can not be converted.
*/
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/TransverseMercator.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/TransverseMercator.java?rev=1709637&r1=1709636&r2=1709637&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/TransverseMercator.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/TransverseMercator.java [UTF-8] Tue Oct 20 16:24:53 2015
@@ -34,6 +34,7 @@ import org.apache.sis.util.Workaround;
import static java.lang.Math.*;
import static org.apache.sis.math.MathFunctions.asinh;
import static org.apache.sis.math.MathFunctions.atanh;
+import static org.apache.sis.internal.referencing.provider.TransverseMercator.*;
/**
@@ -116,10 +117,10 @@ public class TransverseMercator extends
xOffset = ParameterRole.FALSE_WESTING;
yOffset = ParameterRole.FALSE_SOUTHING;
}
- roles.put(ParameterRole.CENTRAL_MERIDIAN, org.apache.sis.internal.referencing.provider.TransverseMercator.LONGITUDE_OF_ORIGIN);
- roles.put(ParameterRole.SCALE_FACTOR, org.apache.sis.internal.referencing.provider.TransverseMercator.SCALE_FACTOR);
- roles.put(xOffset, org.apache.sis.internal.referencing.provider.TransverseMercator.FALSE_EASTING);
- roles.put(yOffset, org.apache.sis.internal.referencing.provider.TransverseMercator.FALSE_NORTHING);
+ roles.put(ParameterRole.CENTRAL_MERIDIAN, LONGITUDE_OF_ORIGIN);
+ roles.put(ParameterRole.SCALE_FACTOR, SCALE_FACTOR);
+ roles.put(xOffset, FALSE_EASTING);
+ roles.put(yOffset, FALSE_NORTHING);
return new Initializer(method, parameters, roles, isSouth ? (byte) 1 : (byte) 0);
}
@@ -130,8 +131,7 @@ public class TransverseMercator extends
@Workaround(library="JDK", version="1.7")
private TransverseMercator(final Initializer initializer) {
super(initializer);
- final double φ0 = toRadians(initializer.getAndStore(
- org.apache.sis.internal.referencing.provider.TransverseMercator.LATITUDE_OF_ORIGIN));
+ final double φ0 = toRadians(initializer.getAndStore(LATITUDE_OF_ORIGIN));
/*
* Opportunistically use double-double arithmetic for computation of B since we will store
* it in the denormalization matrix, and there is no sine/cosine functions involved here.
@@ -384,33 +384,30 @@ public class TransverseMercator extends
sinh_8η0 = sinh_4η0 * cosh_4η0; assert identityEquals(sinh_8η0, sinh(8*η0) / 8) : η0;
}
/*
- * Assuming that (λ, φ) ↦ Proj((λ, φ))
- * where Proj is defined by: Proj((λ, φ)) : (η(λ, φ), ξ(λ, φ)).
- *
- * => (λ, φ) ↦ (η(λ, φ), ξ(λ, φ)).
+ * The projection of (λ,φ) is given by (η⋅B, ξ⋅B+M₀) — ignoring scale factors and false easting/northing.
+ * But the B and M₀ parameters have been merged by the constructor with other linear operations in the
+ * "denormalization" matrix. Consequently we only need to compute (η,ξ) below.
*/
- //-- ξ(λ, φ)
- final double ξ = cf8 * sin_8ξ0 * cosh_8η0
- + cf6 * sin_6ξ0 * cosh_6η0
- + cf4 * sin_4ξ0 * cosh_4η0
- + cf2 * sin_2ξ0 * cosh_2η0
- + ξ0;
-
- //-- η(λ, φ)
- final double η = cf8 * cos_8ξ0 * sinh_8η0
- + cf6 * cos_6ξ0 * sinh_6η0
- + cf4 * cos_4ξ0 * sinh_4η0
- + cf2 * cos_2ξ0 * sinh_2η0
- + η0;
-
if (dstPts != null) {
- dstPts[dstOff ] = η;
- dstPts[dstOff+1] = ξ;
+ // η(λ,φ)
+ dstPts[dstOff ] = cf8 * cos_8ξ0 * sinh_8η0
+ + cf6 * cos_6ξ0 * sinh_6η0
+ + cf4 * cos_4ξ0 * sinh_4η0
+ + cf2 * cos_2ξ0 * sinh_2η0
+ + η0;
+ // ξ(λ,φ)
+ dstPts[dstOff+1] = cf8 * sin_8ξ0 * cosh_8η0
+ + cf6 * sin_6ξ0 * cosh_6η0
+ + cf4 * sin_4ξ0 * cosh_4η0
+ + cf2 * sin_2ξ0 * cosh_2η0
+ + ξ0;
}
if (!derivate) {
return null;
}
-
+ /*
+ * Now compute the derivative, if the user asked for it.
+ */
final double cosλ = cos(λ); //-- λ
final double cosφ = cos(φ); //-- φ
final double cosh2Q = coshQ * coshQ; //-- Q
@@ -429,14 +426,14 @@ public class TransverseMercator extends
final double dξ0_dλ = sinhQ * sinhη0 * cosλ / (cosh2Q_sin2λ * sqrt1_thQchη0);
final double dξ0_dφ = (dQ_dφ * coshη0 / cosh2Q + dη0_dφ * sinhη0 * tanhQ) / sqrt1_thQchη0;
/*
- * Assuming that Jac(Proj((λ, φ))) is the Jacobian matrix of Proj((λ, φ)) function.
+ * Jac(Proj(λ,φ)) is the Jacobian matrix of Proj(λ,φ) function.
+ * So the derivative of Proj(λ,φ) is defined by:
*
- * So the derivative of Proj((λ, φ)) is defined by:
- * ┌ ┐
- * │ dη(λ, φ) / dλ, dη(λ, φ) / dφ │
- * Jac = │ │
- * (Proj(λ, φ)) │ dξ(λ, φ) / dλ, dξ(λ, φ) / dφ │
- * └ ┘
+ * ┌ ┐
+ * │ ∂η(λ,φ)/∂λ, ∂η(λ,φ)/∂φ │
+ * Jac = │ │
+ * (Proj(λ,φ)) │ ∂ξ(λ,φ)/∂λ, ∂ξ(λ,φ)/∂φ │
+ * └ ┘
*/
//-- dξ(λ, φ) / dλ
final double dξ_dλ = dξ0_dλ
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/package-info.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/package-info.java?rev=1709637&r1=1709636&r2=1709637&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/package-info.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/package-info.java [UTF-8] Tue Oct 20 16:24:53 2015
@@ -160,7 +160,7 @@
* @author Rémi Maréchal (Geomatys)
* @author Adrian Custer (Geomatys)
* @since 0.6
- * @version 0.6
+ * @version 0.7
* @module
*
* @see <a href="http://www.remotesensing.org/geotiff/proj_list">Projections list on RemoteSensing.org</a>
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ContextualParameters.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ContextualParameters.java?rev=1709637&r1=1709636&r2=1709637&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ContextualParameters.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ContextualParameters.java [UTF-8] Tue Oct 20 16:24:53 2015
@@ -482,7 +482,7 @@ public class ContextualParameters extend
* more parameters than what it declared at ContextualParameteres construction time, or that some
* ParameterDescriptor instances changed.
*/
- throw new IllegalStateException(Errors.format(Errors.Keys.UnexpectedChange_1, descriptor.getName()));
+ throw new ParameterNotFoundException(Errors.format(Errors.Keys.UnexpectedChange_1, descriptor.getName()), name);
}
/**
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java?rev=1709637&r1=1709636&r2=1709637&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java [UTF-8] Tue Oct 20 16:24:53 2015
@@ -268,7 +268,7 @@ public class PassThroughTransform extend
* used" fields public in order to keep the flexibility to replace them by a {@code modifiedCoordinates}
* array in a future SIS version.</div>
*
- * @return Indices of the modified source coordinates.
+ * @return Zero-based indices of the modified source coordinates.
*
* @see org.apache.sis.referencing.operation.DefaultPassThroughOperation#getModifiedCoordinates()
*/
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/package-info.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/package-info.java?rev=1709637&r1=1709636&r2=1709637&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/package-info.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/package-info.java [UTF-8] Tue Oct 20 16:24:53 2015
@@ -67,15 +67,18 @@
* @author Martin Desruisseaux (IRD, Geomatys)
* @author Guilhem Legal (Geomatys)
* @since 0.4
- * @version 0.4
+ * @version 0.7
* @module
*/
-@XmlSchema(elementFormDefault = XmlNsForm.QUALIFIED, namespace = Namespaces.GML, xmlns = {
+@XmlSchema(location = "http://schemas.opengis.net/gml/3.2.1/referenceSystems.xsd",
+ elementFormDefault = XmlNsForm.QUALIFIED, namespace = Namespaces.GML, xmlns =
+{
@XmlNs(prefix = "gml", namespaceURI = Namespaces.GML),
@XmlNs(prefix = "gmd", namespaceURI = Namespaces.GMD)
})
@XmlAccessorType(XmlAccessType.NONE)
@XmlJavaTypeAdapters({
+ @XmlJavaTypeAdapter(EX_Extent.class),
@XmlJavaTypeAdapter(CI_Citation.class),
@XmlJavaTypeAdapter(RS_Identifier.class),
@XmlJavaTypeAdapter(StringAdapter.class),
Modified: sis/trunk/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod?rev=1709637&r1=1709636&r2=1709637&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod [UTF-8] Tue Oct 20 16:24:53 2015
@@ -21,3 +21,4 @@ org.apache.sis.internal.referencing.prov
org.apache.sis.internal.referencing.provider.PolarStereographicC
org.apache.sis.internal.referencing.provider.PolarStereographicNorth
org.apache.sis.internal.referencing.provider.PolarStereographicSouth
+org.apache.sis.internal.referencing.provider.ObliqueStereographic
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/AllProvidersTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/AllProvidersTest.java?rev=1709637&r1=1709636&r2=1709637&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/AllProvidersTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/AllProvidersTest.java [UTF-8] Tue Oct 20 16:24:53 2015
@@ -36,7 +36,7 @@ import static org.junit.Assert.*;
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.6
- * @version 0.6
+ * @version 0.7
* @module
*/
@DependsOn({
@@ -62,7 +62,17 @@ public final strictfp class AllProviders
MillerCylindrical.class,
LambertConformal1SP.class,
LambertConformal2SP.class,
- LambertConformalBelgium.class
+ LambertConformalWest.class,
+ LambertConformalBelgium.class,
+ LambertConformalMichigan.class,
+ TransverseMercator.class,
+ TransverseMercatorSouth.class,
+ PolarStereographicA.class,
+ PolarStereographicB.class,
+ PolarStereographicC.class,
+ PolarStereographicNorth.class,
+ PolarStereographicSouth.class,
+ ObliqueStereographic.class
};
}
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperationTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperationTest.java?rev=1709637&r1=1709636&r2=1709637&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperationTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperationTest.java [UTF-8] Tue Oct 20 16:24:53 2015
@@ -16,8 +16,9 @@
*/
package org.apache.sis.referencing.operation;
-import org.opengis.referencing.crs.CoordinateReferenceSystem;
import javax.xml.bind.JAXBException;
+import org.opengis.referencing.crs.GeodeticCRS;
+import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.opengis.referencing.operation.CoordinateOperation;
import org.opengis.test.Validators;
import org.apache.sis.test.DependsOn;
@@ -40,7 +41,7 @@ import static org.apache.sis.test.TestUt
DefaultTransformationTest.class,
SingleOperationMarshallingTest.class
})
-public class DefaultConcatenatedOperationTest extends XMLTestCase {
+public strictfp final class DefaultConcatenatedOperationTest extends XMLTestCase {
/**
* An XML file in this package containing a projected CRS definition.
*/
@@ -66,9 +67,11 @@ public class DefaultConcatenatedOperatio
assertIdentifierEquals("targetCRS.identifier", "test", "test", null, "target", getSingleton(targetCRS.getIdentifiers()));
assertIdentifierEquals( "step1.identifier", "test", "test", null, "step-1", getSingleton(step1 .getIdentifiers()));
assertIdentifierEquals( "step2.identifier", "test", "test", null, "step-2", getSingleton(step2 .getIdentifiers()));
- assertSame("tmp CRS", step1.getTargetCRS(), step2.getSourceCRS());
+ assertInstanceOf("sourceCRS", GeodeticCRS.class, sourceCRS);
+ assertInstanceOf("targetCRS", GeodeticCRS.class, targetCRS);
assertSame("sourceCRS", step1.getSourceCRS(), sourceCRS);
assertSame("targetCRS", step2.getTargetCRS(), targetCRS);
+ assertSame("tmp CRS", step1.getTargetCRS(), step2.getSourceCRS());
/*
* Test marshalling and compare with the original file.
*/
Copied: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultPassThroughOperationTest.java (from r1709629, sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultPassThroughOperationTest.java)
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultPassThroughOperationTest.java?p2=sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultPassThroughOperationTest.java&p1=sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultPassThroughOperationTest.java&r1=1709629&r2=1709637&rev=1709637&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultPassThroughOperationTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultPassThroughOperationTest.java [UTF-8] Tue Oct 20 16:24:53 2015
@@ -28,7 +28,7 @@ import org.apache.sis.test.XMLTestCase;
import org.junit.Test;
import static org.apache.sis.test.TestUtilities.getSingleton;
-import static org.opengis.test.Assert.*;
+import static org.apache.sis.test.Assert.*;
/**
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/LambertConicConformalTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/LambertConicConformalTest.java?rev=1709637&r1=1709636&r2=1709637&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/LambertConicConformalTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/LambertConicConformalTest.java [UTF-8] Tue Oct 20 16:24:53 2015
@@ -170,10 +170,10 @@ public final strictfp class LambertConic
@Test
@DependsOnMethod("testSpecialLatitudes")
public void testDerivative() throws TransformException {
- if (transform == null) { // May have been initialized by 'testSphericalCase'.
- createNormalizedProjection(true, 40); // Elliptical case
+ if (transform == null) { // May have been initialized by 'testSphericalCase'.
+ createNormalizedProjection(true, 40); // Elliptical case
}
- final double delta = toRadians(100.0 / 60) / 1852; // Approximatively 100 metres.
+ final double delta = toRadians(100.0 / 60) / 1852; // Approximatively 100 metres.
derivativeDeltas = new double[] {delta, delta};
tolerance = 1E-9;
verifyDerivative(toRadians( 0), toRadians( 0));
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MercatorTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MercatorTest.java?rev=1709637&r1=1709636&r2=1709637&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MercatorTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MercatorTest.java [UTF-8] Tue Oct 20 16:24:53 2015
@@ -52,6 +52,7 @@ import static org.apache.sis.test.Assert
public final strictfp class MercatorTest extends MapProjectionTestCase {
/**
* Creates a new instance of {@link Mercator} for a sphere or an ellipsoid.
+ * The new instance is stored in the inherited {@link #transform} field.
*
* @param ellipse {@code false} for a sphere, or {@code true} for WGS84 ellipsoid.
*/
@@ -118,12 +119,12 @@ public final strictfp class MercatorTest
@Test
@DependsOnMethod("testSpecialLatitudes")
public void testDerivative() throws TransformException {
- if (transform == null) { // May have been initialized by 'testSphericalCase'.
- createNormalizedProjection(true); // Elliptical case
+ if (transform == null) { // May have been initialized by 'testSphericalCase'.
+ createNormalizedProjection(true); // Elliptical case
}
- final double delta = toRadians(100.0 / 60) / 1852; // Approximatively 100 metres.
+ final double delta = toRadians(100.0 / 60) / 1852; // Approximatively 100 metres.
derivativeDeltas = new double[] {delta, delta};
- tolerance = 1E-9; // More severe than Formulas.LINEAR_TOLERANCE.
+ tolerance = 1E-9; // More severe than Formulas.LINEAR_TOLERANCE.
verifyDerivative(toRadians(15), toRadians( 30));
verifyDerivative(toRadians(10), toRadians(-60));
}
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/NormalizedProjectionTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/NormalizedProjectionTest.java?rev=1709637&r1=1709636&r2=1709637&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/NormalizedProjectionTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/NormalizedProjectionTest.java [UTF-8] Tue Oct 20 16:24:53 2015
@@ -36,7 +36,8 @@ import static org.junit.Assert.*;
@DependsOn({
// Following dependency is where the basic parameters (e.g. SEMI_MAJOR) are tested.
// Those parameters are needed by NoOp pseudo-projection, which is used in this package.
- org.apache.sis.internal.referencing.provider.MapProjectionTest.class
+ org.apache.sis.internal.referencing.provider.MapProjectionTest.class,
+ InitializerTest.class
})
public final strictfp class NormalizedProjectionTest extends TransformTestCase {
/**
Copied: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/ObliqueStereographicTest.java (from r1709629, sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/ObliqueStereographicTest.java)
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/ObliqueStereographicTest.java?p2=sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/ObliqueStereographicTest.java&p1=sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/ObliqueStereographicTest.java&r1=1709629&r2=1709637&rev=1709637&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/ObliqueStereographicTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/ObliqueStereographicTest.java [UTF-8] Tue Oct 20 16:24:53 2015
@@ -25,7 +25,6 @@ import org.opengis.referencing.operation
import org.opengis.util.FactoryException;
import org.apache.sis.parameter.Parameters;
import org.apache.sis.referencing.operation.transform.ContextualParameters;
-import org.apache.sis.referencing.operation.matrix.Matrix2;
import org.apache.sis.internal.referencing.Formulas;
import org.apache.sis.internal.system.DefaultFactories;
import org.apache.sis.test.DependsOnMethod;
@@ -33,7 +32,7 @@ import org.apache.sis.test.DependsOn;
import org.junit.Test;
import static java.lang.StrictMath.*;
-import static org.junit.Assert.*;
+import static org.apache.sis.test.Assert.*;
/**
@@ -211,21 +210,6 @@ public final strictfp class ObliqueStere
}
/**
- * Tests the <cite>Oblique Stereographic</cite> case (EPSG:9809).
- * This test is defined in GeoAPI conformance test suite.
- *
- * @throws FactoryException if an error occurred while creating the map projection.
- * @throws TransformException if an error occurred while projecting a coordinate.
- *
- * @see org.opengis.test.referencing.ParameterizedTransformTest#testObliqueStereographic()
- */
- @Test
- @DependsOnMethod({"testTransform", "testInverseTransform"})
- public void testObliqueStereographic() throws FactoryException, TransformException {
- createGeoApiTest(new org.apache.sis.internal.referencing.provider.ObliqueStereographic()).testObliqueStereographic();
- }
-
- /**
* Verifies the consistency of spherical formulas with the elliptical formulas.
* This test transforms the point given in the EPSG guide and takes the result
* of the elliptical implementation as a reference.
@@ -337,9 +321,7 @@ public final strictfp class ObliqueStere
final Matrix derivative = spherical.transform(srcPts, 0, null, 0, true);
tolerance = 1E-12;
- assertMatrixEquals("Spherical derivative", reference, derivative,
- new Matrix2(tolerance, tolerance,
- tolerance, tolerance));
+ assertMatrixEquals("Spherical derivative", reference, derivative, tolerance);
}
/**
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/PolarStereographicTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/PolarStereographicTest.java?rev=1709637&r1=1709636&r2=1709637&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/PolarStereographicTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/PolarStereographicTest.java [UTF-8] Tue Oct 20 16:24:53 2015
@@ -70,7 +70,7 @@ public final strictfp class PolarStereog
@Test
public void testSphericalCaseSouth() throws FactoryException, TransformException {
createNormalizedProjection(new PolarStereographicSouth());
- final double delta = toRadians(100.0 / 60) / 1852; // Approximatively 100 metres.
+ final double delta = toRadians(100.0 / 60) / 1852; // Approximatively 100 metres.
derivativeDeltas = new double[] {delta, delta};
verifyInDomain(CoordinateDomain.GEOGRAPHIC_RADIANS_SOUTH, 56763886);
}
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/TransverseMercatorTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/TransverseMercatorTest.java?rev=1709637&r1=1709636&r2=1709637&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/TransverseMercatorTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/TransverseMercatorTest.java [UTF-8] Tue Oct 20 16:24:53 2015
@@ -117,7 +117,7 @@ public final strictfp class TransverseMe
createNormalizedProjection(false, 0);
tolerance = 1E-9;
- final double delta = toRadians(100.0 / 60) / 1852; // Approximatively 100 metres.
+ final double delta = toRadians(100.0 / 60) / 1852; // Approximatively 100 metres.
derivativeDeltas = new double[] {delta, delta};
verifyDerivative(toRadians( 0), toRadians( 0));
verifyDerivative(toRadians(-3), toRadians(30));
@@ -134,7 +134,7 @@ public final strictfp class TransverseMe
createNormalizedProjection(true, 0);
tolerance = 1E-9;
- final double delta = toRadians(100.0 / 60) / 1852; // Approximatively 100 metres.
+ final double delta = toRadians(100.0 / 60) / 1852; // Approximatively 100 metres.
derivativeDeltas = new double[] {delta, delta};
verifyDerivative(toRadians( 0), toRadians( 0));
verifyDerivative(toRadians(-3), toRadians(30));
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java?rev=1709637&r1=1709636&r2=1709637&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] Tue Oct 20 16:24:53 2015
@@ -26,7 +26,7 @@ import org.junit.BeforeClass;
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.3
- * @version 0.6
+ * @version 0.7
* @module
*/
@Suite.SuiteClasses({
@@ -102,6 +102,7 @@ import org.junit.BeforeClass;
org.apache.sis.referencing.operation.transform.DefaultMathTransformFactoryTest.class,
// Test map projections. Those tests need the providers tested above.
+ org.apache.sis.referencing.operation.projection.InitializerTest.class,
org.apache.sis.referencing.operation.projection.NormalizedProjectionTest.class,
org.apache.sis.referencing.operation.projection.EquirectangularTest.class,
org.apache.sis.referencing.operation.projection.ConformalProjectionTest.class,
@@ -109,6 +110,7 @@ import org.junit.BeforeClass;
org.apache.sis.referencing.operation.projection.LambertConicConformalTest.class,
org.apache.sis.referencing.operation.projection.TransverseMercatorTest.class,
org.apache.sis.referencing.operation.projection.PolarStereographicTest.class,
+ org.apache.sis.referencing.operation.projection.ObliqueStereographicTest.class,
// Coordinate Reference System components.
org.apache.sis.referencing.datum.BursaWolfParametersTest.class,
@@ -139,6 +141,7 @@ import org.junit.BeforeClass;
org.apache.sis.referencing.operation.DefaultTransformationTest.class,
org.apache.sis.referencing.operation.DefaultConversionTest.class,
org.apache.sis.referencing.operation.SingleOperationMarshallingTest.class,
+ org.apache.sis.referencing.operation.DefaultPassThroughOperationTest.class,
org.apache.sis.referencing.operation.DefaultConcatenatedOperationTest.class,
org.apache.sis.referencing.crs.DefaultProjectedCRSTest.class,
org.apache.sis.referencing.crs.DefaultDerivedCRSTest.class,
Modified: sis/trunk/core/sis-referencing/src/test/resources/org/apache/sis/referencing/operation/ConcatenatedOperation.xml
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/resources/org/apache/sis/referencing/operation/ConcatenatedOperation.xml?rev=1709637&r1=1709636&r2=1709637&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/resources/org/apache/sis/referencing/operation/ConcatenatedOperation.xml (original)
+++ sis/trunk/core/sis-referencing/src/test/resources/org/apache/sis/referencing/operation/ConcatenatedOperation.xml Tue Oct 20 16:24:53 2015
@@ -20,8 +20,6 @@
<gml:ConcatenatedOperation xsi:schemaLocation = "http://www.opengis.net/gml/3.2 http://schemas.opengis.net/gml/3.2.1/datums.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"
xmlns:xlink = "http://www.w3.org/1999/xlink"
gml:id = "test-coordinateOperation-concatenated">
Modified: sis/trunk/core/sis-referencing/src/test/resources/org/apache/sis/test/integration/Metadata.xml
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/resources/org/apache/sis/test/integration/Metadata.xml?rev=1709637&r1=1709636&r2=1709637&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/resources/org/apache/sis/test/integration/Metadata.xml (original)
+++ sis/trunk/core/sis-referencing/src/test/resources/org/apache/sis/test/integration/Metadata.xml Tue Oct 20 16:24:53 2015
@@ -114,12 +114,6 @@
<gmd:MD_ReferenceSystem>
<gmd:referenceSystemIdentifier>
<gmd:RS_Identifier>
- <gmd:code>
- <gmx:Anchor xlink:href="SDN:L101:2:4326">EPSG:4326</gmx:Anchor>
- </gmd:code>
- <gmd:codeSpace>
- <gco:CharacterString>L101</gco:CharacterString>
- </gmd:codeSpace>
<gmd:authority>
<gmd:CI_Citation>
<gmd:title>
@@ -140,6 +134,12 @@
</gmd:identifier>
</gmd:CI_Citation>
</gmd:authority>
+ <gmd:code>
+ <gmx:Anchor xlink:href="SDN:L101:2:4326">EPSG:4326</gmx:Anchor>
+ </gmd:code>
+ <gmd:codeSpace>
+ <gco:CharacterString>L101</gco:CharacterString>
+ </gmd:codeSpace>
</gmd:RS_Identifier>
</gmd:referenceSystemIdentifier>
</gmd:MD_ReferenceSystem>
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Schemas.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Schemas.java?rev=1709637&r1=1709636&r2=1709637&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Schemas.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Schemas.java [UTF-8] Tue Oct 20 16:24:53 2015
@@ -47,10 +47,9 @@ package org.apache.sis.internal.jaxb;
*/
public final class Schemas {
/**
- * The root directory of OGC metadata schemas.
- * This is the schema used by default in Apache SIS.
+ * The XSD definition for Geographic Markup Language (GML) objects.
*/
- public static final String METADATA_ROOT = "http://schemas.opengis.net/iso/19139/20070417/";
+ public static final String GML_XSD = "http://schemas.opengis.net/gml/3.2.1/gml.xsd";
/**
* The XSD definition for metadata objects.
@@ -58,6 +57,12 @@ public final class Schemas {
public static final String METADATA_XSD = "http://schemas.opengis.net/iso/19139/20070417/gmd/gmd.xsd";
/**
+ * The root directory of OGC metadata schemas.
+ * This is the schema used by default in Apache SIS.
+ */
+ public static final String METADATA_ROOT = "http://schemas.opengis.net/iso/19139/20070417/";
+
+ /**
* The root directory of ISO metadata schemas.
* This is sometime used as an alternative to {@link #METADATA_ROOT}.
*/
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/PropertyType.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/PropertyType.java?rev=1709637&r1=1709636&r2=1709637&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/PropertyType.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/PropertyType.java [UTF-8] Tue Oct 20 16:24:53 2015
@@ -33,6 +33,7 @@ import org.apache.sis.xml.ReferenceResol
import org.apache.sis.internal.jaxb.Context;
import org.apache.sis.internal.jaxb.PrimitiveTypeProperties;
import org.apache.sis.util.iso.SimpleInternationalString;
+import org.apache.sis.util.resources.Errors;
/**
@@ -601,6 +602,21 @@ public abstract class PropertyType<Value
return metadata;
}
+ /**
+ * Invoked by subclasses when the unmarshalled object is missing a component.
+ * This method is invoked when the missing component is essential to SIS working.
+ * This method is not invoked if the missing component is flagged as mandatory by GML,
+ * but is not mandatory for SIS working.
+ *
+ * @param missing The name of the missing XML component.
+ * @throws IllegalArgumentException Always thrown.
+ *
+ * @since 0.7
+ */
+ protected final void incomplete(final String missing) throws IllegalArgumentException {
+ throw new IllegalArgumentException(Errors.format(Errors.Keys.MissingComponentInElement_2, getBoundType(), missing));
+ }
+
/*
* Do not provide the following method here:
*
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/SC_VerticalCRS.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/SC_VerticalCRS.java?rev=1709637&r1=1709636&r2=1709637&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/SC_VerticalCRS.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/SC_VerticalCRS.java [UTF-8] Tue Oct 20 16:24:53 2015
@@ -21,6 +21,7 @@ import org.opengis.referencing.crs.Verti
import org.apache.sis.internal.jaxb.gco.PropertyType;
import org.apache.sis.internal.jaxb.Context;
import org.apache.sis.util.resources.Errors;
+import org.apache.sis.util.Classes;
/**
@@ -61,7 +62,7 @@ import org.apache.sis.util.resources.Err
* @author Guilhem Legal (Geomatys)
* @author Martin Desruisseaux (Geomatys)
* @since 0.3
- * @version 0.3
+ * @version 0.7
* @module
*
* @see org.apache.sis.internal.jaxb.AdapterReplacement
@@ -126,11 +127,16 @@ public class SC_VerticalCRS extends Prop
* of {@link VerticalCRS}, then this method assigns that value to the {@link #metadata} field.
* Otherwise this method does nothing.
*
- * @param metadata The unmarshalled metadata.
+ * @param crs The unmarshalled metadata.
*/
- public final void setElement(final Object metadata) {
- if (metadata instanceof VerticalCRS) {
- this.metadata = (VerticalCRS) metadata;
+ public final void setElement(final Object crs) {
+ if (crs instanceof VerticalCRS) {
+ metadata = (VerticalCRS) crs;
+ if (metadata.getCoordinateSystem() == null) incomplete("coordinateSystem");
+ if (metadata.getDatum() == null) incomplete("verticalDatum");
+ } else {
+ Context.warningOccured(Context.current(), SC_VerticalCRS.class, "setElement", Errors.class,
+ Errors.Keys.UnexpectedValueInElement_2, "verticalCRS", Classes.getShortClassName(crs));
}
}
}