Author: desruisseaux
Date: Tue Mar 24 10:38:43 2015
New Revision: 1668838

URL: http://svn.apache.org/r1668838
Log:
Referencing: added parameters for "Popular Visualisation Pseudo Mercator" 
projection (EPSG:1024).

Added:
    
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PseudoMercator.java
   (with props)
Modified:
    
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjection.java
    
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator1SP.java
    
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator2SP.java

Modified: 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjection.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjection.java?rev=1668838&r1=1668837&r2=1668838&view=diff
==============================================================================
--- 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjection.java
 [UTF-8] (original)
+++ 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjection.java
 [UTF-8] Tue Mar 24 10:38:43 2015
@@ -148,6 +148,16 @@ public abstract class MapProjection exte
     }
 
     /**
+     * Copies the EPSG name and identifier from the given parameter into the 
builder.
+     * This is used for sharing name instances created for an other operation.
+     *
+     * The EPSG objects are presumed the first name and identifier (this is 
not verified).
+     */
+    static ParameterBuilder onlyEPSG(final ParameterDescriptor<?> source, 
final ParameterBuilder builder) {
+        return 
builder.addIdentifier(source.getIdentifiers().iterator().next()).addName(source.getName());
+    }
+
+    /**
      * Copies the names and identifiers from the given parameter into the 
builder.
      * This is used for sharing name instances created for an other operation.
      *

Modified: 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator1SP.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator1SP.java?rev=1668838&r1=1668837&r2=1668838&view=diff
==============================================================================
--- 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator1SP.java
 [UTF-8] (original)
+++ 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator1SP.java
 [UTF-8] Tue Mar 24 10:38:43 2015
@@ -128,8 +128,7 @@ public final class Mercator1SP extends M
             .addName(Citations.GEOTIFF, "CT_Mercator")
             .addName(Citations.PROJ4,   "merc")
             .addIdentifier(Citations.GEOTIFF,   "7")
-            .addIdentifier(Citations.MAP_INFO, "10")
-            .addIdentifier(Citations.MAP_INFO, "26")
+            .addIdentifier(Citations.MAP_INFO, "10")    // MapInfo names this 
projection "Mercator".
             .createGroupForMapProjection(
                     LATITUDE_OF_ORIGIN,
                     CENTRAL_MERIDIAN,

Modified: 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator2SP.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator2SP.java?rev=1668838&r1=1668837&r2=1668838&view=diff
==============================================================================
--- 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator2SP.java
 [UTF-8] (original)
+++ 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator2SP.java
 [UTF-8] Tue Mar 24 10:38:43 2015
@@ -131,7 +131,8 @@ public final class Mercator2SP extends M
             .addName(Citations.NETCDF,  "Mercator")
             .addName(sameNameAs(Citations.GEOTIFF, Mercator1SP.PARAMETERS))
             .addName(sameNameAs(Citations.PROJ4,   Mercator1SP.PARAMETERS))
-            .addIdentifier(Citations.S57, "8")
+            .addIdentifier(Citations.MAP_INFO, "26")    // MapInfo names this 
projection "Regional Mercator".
+            .addIdentifier(Citations.S57,       "8")
             .createGroupForMapProjection(
                     STANDARD_PARALLEL,
                     LATITUDE_OF_ORIGIN,

Added: 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PseudoMercator.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PseudoMercator.java?rev=1668838&view=auto
==============================================================================
--- 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PseudoMercator.java
 (added)
+++ 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PseudoMercator.java
 [UTF-8] Tue Mar 24 10:38:43 2015
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.internal.referencing.provider;
+
+import org.opengis.util.InternationalString;
+import org.opengis.parameter.ParameterDescriptor;
+import org.opengis.parameter.ParameterValueGroup;
+import org.opengis.parameter.ParameterDescriptorGroup;
+import org.opengis.referencing.operation.MathTransform2D;
+import org.opengis.referencing.operation.CylindricalProjection;
+import org.apache.sis.parameter.ParameterBuilder;
+
+
+/**
+ * The provider for "<cite>Popular Visualisation Pseudo Mercator</cite>" 
projection (EPSG:1024).
+ * This is also known as the "Google projection", defined by popular demand 
but not considered
+ * a valid projection method.
+ *
+ * @author  Martin Desruisseaux (IRD, Geomatys)
+ * @since   0.6
+ * @version 0.6
+ * @module
+ */
+public final class PseudoMercator extends MapProjection {
+    /**
+     * For cross-version compatibility.
+     */
+    private static final long serialVersionUID = -8126827491349984471L;
+
+    /**
+     * The group of all parameters expected by this coordinate operation.
+     */
+    public static final ParameterDescriptorGroup PARAMETERS;
+    static {
+        final ParameterBuilder builder = builder();
+
+        final ParameterDescriptor<?> latitudeOfOrigin = createLatitude(
+                onlyEPSG(Mercator1SP.LATITUDE_OF_ORIGIN, builder), false);
+
+        final ParameterDescriptor<?> centralMeridian = createLongitude(
+                onlyEPSG(Mercator1SP.CENTRAL_MERIDIAN, builder));
+
+        final ParameterDescriptor<?> falseEasting = createShift(
+                onlyEPSG(Mercator1SP.FALSE_EASTING, builder));
+
+        final ParameterDescriptor<?> falseNorthing = createShift(
+                onlyEPSG(Mercator1SP.FALSE_NORTHING, builder));
+        /*
+         * The scale factor is not formally a parameter of the "Popular 
Visualisation Pseudo Mercator" projection
+         * according EPSG. But we declare it as an optional parameters because 
it is sometime used.
+         */
+        final InternationalString remarks = notFormallyEPSG("Mercator (variant 
A)", "Pseudo Mercator");
+        final ParameterDescriptor<?> scaleFactor = 
createScale(withEsriAndNetcdf(Mercator1SP.SCALE_FACTOR, builder,
+                "Scale_Factor", 
"scale_factor_at_projection_origin").setRemarks(remarks).setRequired(false));
+
+        PARAMETERS = builder
+            .addIdentifier("1024")
+            .addName("Popular Visualisation Pseudo Mercator")
+            .createGroupForMapProjection(
+                    latitudeOfOrigin,
+                    centralMeridian,
+                    scaleFactor, // Not an official parameter, provided for 
compatibility with those who still use it.
+                    falseEasting,
+                    falseNorthing);
+    }
+
+    /**
+     * Constructs a new provider.
+     */
+    public PseudoMercator() {
+        super(PARAMETERS);
+    }
+
+    /**
+     * Returns the operation type for this map projection.
+     *
+     * @return {@code CylindricalProjection.class}
+     */
+    @Override
+    public Class<CylindricalProjection> getOperationType() {
+        return CylindricalProjection.class;
+    }
+
+    /**
+     * {@inheritDoc}
+     *
+     * @return The map projection created from the given parameter values.
+     */
+    @Override
+    public MathTransform2D createMathTransform(ParameterValueGroup values) {
+        return null; // TODO Mercator.create(this, values);
+    }
+}

Propchange: 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PseudoMercator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PseudoMercator.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8


Reply via email to