Author: desruisseaux
Date: Mon Jul 20 17:01:11 2015
New Revision: 1691979
URL: http://svn.apache.org/r1691979
Log:
Added "Polar Stereographic (variant C)" projection method (EPSG:9830).
Added:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PolarStereographicC.java
- copied, changed from r1691751,
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PolarStereographicB.java
Modified:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/PolarStereographic.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/PolarStereographicTest.java
Copied:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PolarStereographicC.java
(from r1691751,
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PolarStereographicB.java)
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PolarStereographicC.java?p2=sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PolarStereographicC.java&p1=sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PolarStereographicB.java&r1=1691751&r2=1691979&rev=1691979&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PolarStereographicB.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PolarStereographicC.java
[UTF-8] Mon Jul 20 17:01:11 2015
@@ -18,93 +18,60 @@ package org.apache.sis.internal.referenc
import org.opengis.parameter.ParameterDescriptor;
import org.opengis.parameter.ParameterDescriptorGroup;
-import org.apache.sis.metadata.iso.citation.Citations;
-import org.apache.sis.parameter.ParameterBuilder;
/**
- * The provider for <cite>"Polar Stereographic (Variant B)"</cite> projection
(EPSG:9829).
- * This provider includes a <cite>"Latitude of standard parallel"</cite>
parameter and
- * determines the hemisphere of the projection from that parameter value.
+ * The provider for <cite>"Polar Stereographic (Variant C)"</cite> projection
(EPSG:9830).
+ * This is very similar to variant B except in the way to use the false
northing.
*
- * @author Rueben Schulz (UBC)
* @author Martin Desruisseaux (Geomatys)
* @since 0.6
* @version 0.6
* @module
*/
-public final class PolarStereographicB extends AbstractStereographic {
+public final class PolarStereographicC extends AbstractStereographic {
/**
* For cross-version compatibility.
*/
- private static final long serialVersionUID = 5188231050523249971L;
+ private static final long serialVersionUID = 9094868630348858992L;
/**
* The EPSG identifier, to be preferred to the name when available.
*/
- public static final String IDENTIFIER = "9829";
+ public static final String IDENTIFIER = "9830";
/**
- * The operation parameter descriptor for the <cite>Longitude of
origin</cite> (λ₀) parameter value.
- * Valid values range is [-180 … 180]° and default value is 0°.
+ * The operation parameter descriptor for the <cite>Easting at false
origin</cite> (Ef) parameter value.
+ * Valid values range is unrestricted and default value is 0 metre.
*/
- public static final ParameterDescriptor<Double> LONGITUDE_OF_ORIGIN;
+ public static final ParameterDescriptor<Double> EASTING_AT_FALSE_ORIGIN =
RegionalMercator.EASTING_AT_FALSE_ORIGIN;
/**
- * The operation parameter descriptor for the <cite>Latitude of standard
parallel</cite> (φ₁) parameter value.
- * Valid values are -90° or 90°.
+ * The operation parameter descriptor for the <cite>Northing at false
origin</cite> (Nf) parameter value.
+ * Valid values range is unrestricted and default value is 0 metre.
*/
- public static final ParameterDescriptor<Double> STANDARD_PARALLEL;
-
- /**
- * The operation parameter descriptor for the <cite>Scale factor</cite>
(not necessarily at natural origin)
- * parameter value. Valid values range is (0 … ∞) and default value is 1.
- *
- * <p>This parameter is used by {@link PolarStereographicA} and is not
formally a parameter of
- * {@code PolarStereographicB} projection. Nevertheless we declare it is
as an optional parameter
- * because it is sometime used in Well Known Text (WKT). However it shall
be interpreted as a
- * <cite>Scale factor at the standard parallel</cite> rather than at the
natural origin.</p>
- */
- static final ParameterDescriptor<Double> SCALE_FACTOR;
+ public static final ParameterDescriptor<Double> NORTHING_AT_FALSE_ORIGIN =
RegionalMercator.NORTHING_AT_FALSE_ORIGIN;
/**
* The group of all parameters expected by this coordinate operation.
*/
static final ParameterDescriptorGroup PARAMETERS;
static {
- final ParameterBuilder builder = builder();
- LONGITUDE_OF_ORIGIN = createLongitude(
- exceptEPSG(PolarStereographicA.LONGITUDE_OF_ORIGIN,
- builder.addIdentifier("8833").addName("Longitude of
origin").setDeprecated(false)));
-
- STANDARD_PARALLEL = createMandatoryLatitude(builder
- .addIdentifier("8832").addName("Latitude of standard parallel")
- .addName(sameNameAs(Citations.OGC,
Mercator2SP.STANDARD_PARALLEL)));
-
- SCALE_FACTOR = createScale(builder
- .addNamesAndIdentifiers(Mercator2SP.SCALE_FACTOR)
- .setRemarks(notFormalParameter("Polar Stereographic (variant
A)")).setDeprecated(true));
-
- PARAMETERS = builder
+ PARAMETERS = builder()
.addIdentifier(IDENTIFIER)
- .addName("Polar Stereographic (variant B)")
- .addName(Citations.ESRI, "Stereographic_North_Pole")
- .addName(Citations.ESRI, "Stereographic_South_Pole")
- .addName(Citations.S57, "Polar stereographic")
- .addName(Citations.S57, "PST")
- .addIdentifier(Citations.S57, "11")
+ .addName("Polar Stereographic (variant C)")
.createGroupForMapProjection(
- STANDARD_PARALLEL,
- LONGITUDE_OF_ORIGIN,
- SCALE_FACTOR, // Not formally a parameter of this
projection.
- FALSE_EASTING,
- FALSE_NORTHING);
+ PolarStereographicB.STANDARD_PARALLEL,
+ PolarStereographicB.LONGITUDE_OF_ORIGIN,
+ PolarStereographicB.SCALE_FACTOR, // Not formally a
parameter of this projection.
+ EASTING_AT_FALSE_ORIGIN,
+ NORTHING_AT_FALSE_ORIGIN);
}
/**
* Constructs a new provider.
*/
- public PolarStereographicB() {
+ public PolarStereographicC() {
super(PARAMETERS);
}
}
Modified:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/PolarStereographic.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/PolarStereographic.java?rev=1691979&r1=1691978&r2=1691979&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/PolarStereographic.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/PolarStereographic.java
[UTF-8] Mon Jul 20 17:01:11 2015
@@ -29,6 +29,7 @@ import org.apache.sis.referencing.operat
import org.apache.sis.referencing.operation.matrix.MatrixSIS;
import org.apache.sis.internal.referencing.provider.PolarStereographicA;
import org.apache.sis.internal.referencing.provider.PolarStereographicB;
+import org.apache.sis.internal.referencing.provider.PolarStereographicC;
import org.apache.sis.internal.referencing.Formulas;
import org.apache.sis.parameter.Parameters;
import org.apache.sis.util.resources.Errors;
@@ -78,7 +79,7 @@ public class PolarStereographic extends
private static byte getVariant(final ParameterDescriptorGroup parameters) {
if (identMatch(parameters, "(?i).*\\bvariant\\s*A\\b.*",
PolarStereographicA.IDENTIFIER)) return A;
if (identMatch(parameters, "(?i).*\\bvariant\\s*B\\b.*",
PolarStereographicB.IDENTIFIER)) return B;
-// if (identMatch(parameters, "(?i).*\\bvariant\\s*C\\b.*",
PolarStereographicC.IDENTIFIER)) return C;
+ if (identMatch(parameters, "(?i).*\\bvariant\\s*C\\b.*",
PolarStereographicC.IDENTIFIER)) return C;
if (identMatch(parameters, "(?i).*\\bNorth\\b.*", null))
return NORTH;
if (identMatch(parameters, "(?i).*\\bSouth\\b.*", null))
return SOUTH;
return 0; // Unidentified case, to be considered as variant A.
@@ -92,10 +93,16 @@ public class PolarStereographic extends
*/
private static Map<ParameterRole, ParameterDescriptor<Double>> roles(final
byte variant) {
final EnumMap<ParameterRole, ParameterDescriptor<Double>> roles = new
EnumMap<>(ParameterRole.class);
+ ParameterDescriptor<Double> falseEasting =
PolarStereographicA.FALSE_EASTING;
+ ParameterDescriptor<Double> falseNorthing =
PolarStereographicA.FALSE_NORTHING;
+ if (variant == C) {
+ falseEasting = PolarStereographicC.EASTING_AT_FALSE_ORIGIN;
+ falseNorthing = PolarStereographicC.NORTHING_AT_FALSE_ORIGIN;
+ }
+ roles.put(ParameterRole.FALSE_EASTING, falseEasting);
+ roles.put(ParameterRole.FALSE_NORTHING, falseNorthing);
roles.put(ParameterRole.SCALE_FACTOR,
PolarStereographicA.SCALE_FACTOR);
- roles.put(ParameterRole.FALSE_EASTING,
PolarStereographicA.FALSE_EASTING);
- roles.put(ParameterRole.FALSE_NORTHING,
PolarStereographicA.FALSE_NORTHING);
- roles.put(ParameterRole.CENTRAL_MERIDIAN, (variant == B)
+ roles.put(ParameterRole.CENTRAL_MERIDIAN, (variant == B || variant ==
C)
? PolarStereographicB.LONGITUDE_OF_ORIGIN
: PolarStereographicA.LONGITUDE_OF_ORIGIN);
return roles;
Modified:
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/PolarStereographicTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/PolarStereographicTest.java?rev=1691979&r1=1691978&r2=1691979&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/PolarStereographicTest.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/PolarStereographicTest.java
[UTF-8] Mon Jul 20 17:01:11 2015
@@ -21,6 +21,7 @@ import org.opengis.referencing.operation
import org.apache.sis.internal.referencing.Formulas;
import org.apache.sis.internal.referencing.provider.PolarStereographicA;
import org.apache.sis.internal.referencing.provider.PolarStereographicB;
+import org.apache.sis.internal.referencing.provider.PolarStereographicC;
import org.apache.sis.referencing.operation.transform.CoordinateDomain;
import org.apache.sis.parameter.Parameters;
import org.apache.sis.test.DependsOnMethod;
@@ -119,6 +120,20 @@ public final strictfp class PolarStereog
}
/**
+ * Tests the <cite>Polar Stereographic (variant C)</cite> case (EPSG:9830).
+ * 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#testPolarStereographicC()
+ */
+ @Test
+ public void testPolarStereographicC() throws FactoryException,
TransformException {
+ createGeoApiTest(new PolarStereographicC()).testPolarStereographicC();
+ }
+
+ /**
* Verifies the consistency of elliptical formulas with the spherical
formulas.
* This test compares the results of elliptical formulas with the
spherical ones
* for some random points.