org.opengis.referencing.operation.Projection Java Examples

The following examples show how to use org.opengis.referencing.operation.Projection. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CRSTable.java    From sis with Apache License 2.0 6 votes vote down vote up
static Image getIcon(IdentifiedObject obj) {
    Image icon = ICON_UNKNOWN;
    if (obj instanceof GeographicCRS) {
        icon = ICON_GEO;
    } else if (obj instanceof ProjectedCRS) {
        final ProjectedCRS pcrs = (ProjectedCRS) obj;
        final Projection proj = pcrs.getConversionFromBase();

        if (String.valueOf(proj.getName()).toLowerCase().contains("utm")) {
            icon = ICON_UTM;
        } else if (proj instanceof ConicProjection) {
            icon = ICON_CONIC;
        } else if (proj instanceof CylindricalProjection) {
            icon = ICON_SQUARE;
        } else if (proj instanceof PlanarProjection) {
            icon = ICON_STEREO;
        } else {
            icon = ICON_SQUARE;
        }
    } else {
        icon = ICON_SQUARE;
    }
    return icon;
}
 
Example #2
Source File: DefaultProjectedCRSTest.java    From sis with Apache License 2.0 6 votes vote down vote up
/**
 * Tests (un)marshalling of a projected coordinate reference system.
 *
 * @throws FactoryException if the CRS creation failed.
 * @throws JAXBException if an error occurred during (un)marshalling.
 */
@Test
public void testXML() throws FactoryException, JAXBException {
    final DefaultProjectedCRS crs = unmarshalFile(DefaultProjectedCRS.class, XML_FILE);
    Validators.validate(crs);
    assertEpsgNameAndIdentifierEqual("NTF (Paris) / Lambert zone II", 27572, crs);
    assertEpsgNameAndIdentifierEqual("NTF (Paris)", 4807, crs.getBaseCRS());
    assertEquals("scope", "Large and medium scale topographic mapping and engineering survey.", crs.getScope().toString());
    assertAxisDirectionsEqual("baseCRS", crs.getBaseCRS().getCoordinateSystem(), AxisDirection.NORTH, AxisDirection.EAST);
    assertAxisDirectionsEqual("coordinateSystem", crs.getCoordinateSystem(), AxisDirection.EAST, AxisDirection.NORTH);

    final Projection conversion = crs.getConversionFromBase();
    assertEpsgNameAndIdentifierEqual("Lambert zone II", 18082, conversion);
    assertEpsgNameAndIdentifierEqual("Lambert Conic Conformal (1SP)", 9801, conversion.getMethod());
    assertNotNull("conversion.mathTransform", conversion.getMathTransform());
    verifyParameters(conversion.getParameterValues());
    /*
     * Test marshalling and compare with the original file. The comparison ignores the <gml:name> nodes because the
     * marshalled CRS contains many operation method and parameter aliases which were not in the original XML file.
     */
    assertMarshalEqualsFile(XML_FILE, crs, null, STRICT, new String[] {"gml:name"},
            new String[] {"xmlns:*", "xsi:schemaLocation", "gml:id"});
}
 
Example #3
Source File: DefaultMathTransformFactoryTest.java    From sis with Apache License 2.0 6 votes vote down vote up
/**
 * Tests the {@link DefaultMathTransformFactory#getAvailableMethods(Class)} method.
 *
 * @throws NoSuchIdentifierException if the operation was not found.
 */
@Test
@DependsOnMethod("testGetOperationMethod")
public void testGetAvailableMethods() throws NoSuchIdentifierException {
    final DefaultMathTransformFactory factory = factory();
    final Set<OperationMethod> transforms  = factory.getAvailableMethods(SingleOperation.class);
    final Set<OperationMethod> conversions = factory.getAvailableMethods(Conversion.class);
    final Set<OperationMethod> projections = factory.getAvailableMethods(Projection.class);
    /*
     * Following tests should not cause loading of more classes than needed.
     */
    assertFalse(transforms .isEmpty());
    assertFalse(conversions.isEmpty());
    assertFalse(projections.isEmpty());
    assertTrue (transforms.contains(factory.getOperationMethod(Constants.AFFINE)));
    /*
     * Following tests will force instantiation of all remaining OperationMethod.
     */
    assertTrue("Conversions should be a subset of transforms.",  transforms .containsAll(conversions));
    assertTrue("Projections should be a subset of conversions.", conversions.containsAll(projections));
}
 
Example #4
Source File: OperationMethodSetTest.java    From sis with Apache License 2.0 6 votes vote down vote up
/**
 * Creates an {@code OperationMethodSet} from the given methods, using an iterable
 * which will guarantee that the iteration is performed at most once.
 *
 * @param  type     the type of coordinate operation for which to retain methods.
 * @param  methods  the {@link DefaultMathTransformFactory#methods} used for fetching the initial methods.
 */
private static OperationMethodSet create(final Class<? extends Projection> type, final DefaultOperationMethod... methods) {
    @SuppressWarnings("serial")
    final Iterable<DefaultOperationMethod> asList = new UnmodifiableArrayList<DefaultOperationMethod>(methods) {
        private boolean isIterationDone;

        @Override
        public Iterator<DefaultOperationMethod> iterator() {
            assertFalse("Expected no more than one iteration.", isIterationDone);
            isIterationDone = true;
            return super.iterator();
        }
    };
    synchronized (asList) {                           // Needed for avoiding assertion error in OperationMethodSet.
        return new OperationMethodSet(type, asList);
    }
}
 
Example #5
Source File: OperationMethodSetTest.java    From sis with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a new two-dimensional operation method for an operation of the given name.
 *
 * @param  type    the value to be returned by {@link DefaultOperationMethod#getOperationType()}.
 * @param  method  the operation name (example: "Mercator (variant A)").
 * @return the operation method.
 */
@SuppressWarnings("serial")
private static DefaultOperationMethod createMethod(final Class<? extends Projection> type, final String method) {
    Map<String,?> properties = Collections.singletonMap(DefaultOperationMethod.NAME_KEY, method);
    final ParameterDescriptorGroup parameters = new DefaultParameterDescriptorGroup(properties, 1, 1);
    /*
     * Recycle the ParameterDescriptorGroup name for DefaultOperationMethod.
     * This save us one object creation, and is often the same name anyway.
     */
    properties = Collections.singletonMap(DefaultOperationMethod.NAME_KEY, parameters.getName());
    return new DefaultOperationMethod(properties, 2, 2, parameters) {
        @Override public Class<? extends Projection> getOperationType() {
            return type;
        }
    };
}
 
Example #6
Source File: CustomCrsPanel.java    From snap-desktop with GNU General Public License v3.0 5 votes vote down vote up
public static Set<AbstractCrsProvider> createCrsProviderSet() {
    MathTransformFactory factory = ReferencingFactoryFinder.getMathTransformFactory(null);
    Set<OperationMethod> methods = factory.getAvailableMethods(Projection.class);

    TreeSet<AbstractCrsProvider> crsProviderSet = new TreeSet<>(new CrsProviderComparator());
    for (OperationMethod method : methods) {
        crsProviderSet.add(new OperationMethodCrsProvider(method));
    }

    return crsProviderSet;
}
 
Example #7
Source File: ProjectedCrsImpl.java    From geomajas-project-server with GNU Affero General Public License v3.0 4 votes vote down vote up
public Projection getConversionFromBase() {
	return base.getConversionFromBase();
}
 
Example #8
Source File: MilitaryGridReferenceSystem.java    From sis with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a new converter from direct positions to MGRS references.
 *
 * @param  datum  the datum to which to transform the coordinate before formatting the MGRS reference,
 *                or {@code null} for inferring the datum from the given {@code crs}.
 * @param  crs    the coordinate reference system of the coordinates for which to create MGRS references.
 * @throws IllegalArgumentException if the given CRS do not use one of the supported datums.
 * @throws FactoryException if the creation of a coordinate operation failed.
 * @throws TransformException if the creation of an inverse operation failed.
 */
Encoder(CommonCRS datum, CoordinateReferenceSystem crs) throws FactoryException, TransformException {
    CoordinateReferenceSystem horizontal = CRS.getHorizontalComponent(crs);
    if (horizontal == null) {
        horizontal = crs;
    }
    if (datum == null) {
        datum = CommonCRS.forDatum(horizontal);
    }
    this.datum = datum;
    if (horizontal instanceof ProjectedCRS) {
        ProjectedCRS  projCRS = (ProjectedCRS) horizontal;
        Projection projection = projCRS.getConversionFromBase();
        final OperationMethod method = projection.getMethod();
        if (IdentifiedObjects.isHeuristicMatchForName(method, TransverseMercator.NAME)) {
            crsZone = ZONER.zone(projection.getParameterValues());
        } else if (IdentifiedObjects.isHeuristicMatchForName(method, PolarStereographicA.NAME)) {
            crsZone = POLE * PolarStereographicA.isUPS(projection.getParameterValues());
        } else {
            crsZone = 0;                                    // Neither UTM or UPS projection.
        }
        if (crsZone != 0) {
            /*
             * Usually, the projected CRS already has (E,N) axis orientations with metres units,
             * so we let 'toNormalized' to null. In the rarer cases where the CRS axes do not
             * have the expected orientations and units, then we build a normalized version of
             * that CRS and compute the transformation to that CRS.
             */
            final DefaultProjectedCRS userAxisOrder = DefaultProjectedCRS.castOrCopy(projCRS);
            projCRS = userAxisOrder.forConvention(AxesConvention.NORMALIZED);
            if (crs != horizontal || projCRS != userAxisOrder) {
                toNormalized = CRS.findOperation(crs, projCRS, null).getMathTransform();
                projection   = projCRS.getConversionFromBase();
                horizontal   = projCRS;
                crs          = projCRS;         // Next step in the chain of transformations.
            } else {
                toNormalized = null;            // ProjectedCRS (UTM or UPS) is already normalized.
            }
        } else {
            toNormalized = null;    // ProjectedCRS is neither UTM or UPS — will need full reprojection.
        }
        /*
         * We will also need the transformation from the normalized projected CRS to latitude and
         * longitude (in that order) in degrees. We can get this transform directly from the
         * projected CRS if its base CRS already has the expected axis orientations and units.
         */
        if (crs == horizontal && Utilities.equalsIgnoreMetadata(projCRS.getBaseCRS(), datum.geographic())) {
            toGeographic = projection.getMathTransform().inverse();
            return;
        }
    } else {
        crsZone      = 0;
        toNormalized = null;
    }
    toGeographic = CRS.findOperation(crs, datum.geographic(), null).getMathTransform();
}
 
Example #9
Source File: CoordinateOperationFinderTest.java    From sis with Apache License 2.0 4 votes vote down vote up
/**
 * Tests conversion from a geographic to a projected CRS without datum of axis changes.
 *
 * @throws ParseException if a CRS used in this test can not be parsed.
 * @throws FactoryException if the operation can not be created.
 * @throws TransformException if an error occurred while converting the test points.
 */
@Test
@DependsOnMethod("testIdentityTransform")
public void testGeographicToProjected() throws ParseException, FactoryException, TransformException {
    final CoordinateReferenceSystem sourceCRS = parse("$Sphere");
    final CoordinateReferenceSystem targetCRS = parse(
            "ProjectedCRS[“TM”,\n" +
            "  $Sphere,\n" +
            "  Conversion[“TM”,\n" +
            "    Method[“Transverse Mercator”],\n" +
            "    Parameter[“Longitude of natural origin”, 170],\n" +
            "    Parameter[“Latitude of natural origin”, 50],\n" +
            "    Parameter[“Scale factor at natural origin”, 0.95]],\n" +
            "  CS[Cartesian, 2],\n" +
            "    Axis[“x”, EAST],\n" +
            "    Axis[“y”, NORTH],\n" +
            "    Unit[“US survey foot”, 0.304800609601219]]");

    final CoordinateOperation operation = finder.createOperation(sourceCRS, targetCRS);
    assertSame      ("sourceCRS", sourceCRS,        operation.getSourceCRS());
    assertSame      ("targetCRS", targetCRS,        operation.getTargetCRS());
    assertEquals    ("name",      "TM",             operation.getName().getCode());
    assertInstanceOf("operation", Projection.class, operation);

    final ParameterValueGroup param = ((SingleOperation) operation).getParameterValues();
    assertEquals("semi_major",     6370997, param.parameter("semi_major"        ).doubleValue(), STRICT);
    assertEquals("semi_minor",     6370997, param.parameter("semi_minor"        ).doubleValue(), STRICT);
    assertEquals("latitude_of_origin",  50, param.parameter("latitude_of_origin").doubleValue(), STRICT);
    assertEquals("central_meridian",   170, param.parameter("central_meridian"  ).doubleValue(), STRICT);
    assertEquals("scale_factor",      0.95, param.parameter("scale_factor"      ).doubleValue(), STRICT);
    assertEquals("false_easting",        0, param.parameter("false_easting"     ).doubleValue(), STRICT);
    assertEquals("false_northing",       0, param.parameter("false_northing"    ).doubleValue(), STRICT);

    transform = operation.getMathTransform();
    tolerance = ANGULAR_TOLERANCE;
    verifyTransform(new double[] {170, 50}, new double[] {0, 0});
    validate();

    transform  = transform.inverse();
    tolerance  = LINEAR_TOLERANCE;
    λDimension = new int[] {0};
    verifyTransform(new double[] {0, 0}, new double[] {170, 50});
    validate();
}
 
Example #10
Source File: OperationMethodSetTest.java    From sis with Apache License 2.0 4 votes vote down vote up
/**
 * Tests a non-empty set.
 */
@Test
@DependsOnMethod("testEmpty")
public void testMixedCases() {
    final DefaultOperationMethod merA = createMethod(CylindricalProjection.class, "Mercator (variant A)");
    final DefaultOperationMethod merB = createMethod(CylindricalProjection.class, "Mercator (variant B)");
    final DefaultOperationMethod merC = createMethod(CylindricalProjection.class, "Mercator (variant C)");
    final DefaultOperationMethod dup  = createMethod(CylindricalProjection.class, "Mercator (variant B)");
    final DefaultOperationMethod lamb = createMethod(ConicProjection.class, "Lambert");
    final DefaultOperationMethod[] methods = new DefaultOperationMethod[] {merA, merB, merC, dup, lamb};
    final OperationMethodSet mercators = create(CylindricalProjection.class, methods);
    final OperationMethodSet lambert   = create(      ConicProjection.class, methods);
    final OperationMethodSet all       = create(           Projection.class, methods);
    /*
     * Mercator case.
     *   - Intentionally start the iteration without checking 'hasNext()' - the iterator shall be robust to that.
     *   - Intentionally start an other iteration (indirectly) in the middle of the first one.
     */
    final Iterator<OperationMethod> iterator = mercators.iterator();
    assertSame(merA, iterator.next());
    assertSame(merB, iterator.next());
    assertArrayEquals("toArray", new DefaultOperationMethod[] {merA, merB, merC}, mercators.toArray());
    assertSame(merC, iterator.next());
    assertFalse (iterator.hasNext());
    assertFalse ("isEmpty", mercators.isEmpty());
    assertEquals("size", 3, mercators.size());
    /*
     * Lambert case. Test twice since the two excecutions will take different code paths.
     */
    assertEquals(Collections.singleton(lamb), lambert);
    assertEquals(Collections.singleton(lamb), lambert);
    /*
     * Test filtering: the test should not contain any conic projection.
     */
    assertEmpty(create(PlanarProjection.class, methods));
    /*
     * Opportunist tests.
     */
    assertFalse(lambert.containsAll(all));
    assertTrue(all.containsAll(lambert));
    assertTrue(all.containsAll(mercators));
}
 
Example #11
Source File: OperationMethodSetTest.java    From sis with Apache License 2.0 4 votes vote down vote up
/**
 * Tests construction from an empty list.
 */
@Test
public void testEmpty() {
    assertEmpty(create(Projection.class));
}
 
Example #12
Source File: MapProjection3D.java    From sis with Apache License 2.0 4 votes vote down vote up
/**
 * Returns the operation type for this map projection.
 */
@Override
public Class<? extends Projection> getOperationType() {
    return redimensioned.getOperationType();
}
 
Example #13
Source File: DefaultProjectedCRS.java    From sis with Apache License 2.0 4 votes vote down vote up
/**
 * Returns a coordinate reference system of the same type than this CRS but with different axes.
 */
@Override
final AbstractCRS createSameType(final Map<String,?> properties, final CoordinateSystem cs) {
    final Projection conversion = super.getConversionFromBase();
    return new DefaultProjectedCRS(properties, (GeographicCRS) conversion.getSourceCRS(), conversion, (CartesianCS) cs);
}
 
Example #14
Source File: DefaultProjectedCRS.java    From sis with Apache License 2.0 4 votes vote down vote up
/**
 * Returns the type of conversion associated to this {@code DefaultProjectedCRS}.
 * Must be a hard-coded, constant value (not dependent on object state).
 */
@Override
final Class<Projection> getConversionType() {
    return Projection.class;
}
 
Example #15
Source File: AuthorityCodes.java    From sis with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a new map of authority codes for the specified type.
 *
 * @param  connection  the connection to the EPSG database.
 * @param  table       the table to query.
 * @param  type        the type to query.
 * @param  factory     the factory originator.
 */
AuthorityCodes(final Connection connection, final TableInfo table, final Class<?> type, final EPSGDataAccess factory)
        throws SQLException
{
    this.factory = factory;
    /*
     * Build the SQL query for fetching the codes of all object. It is of the form:
     *
     *     SELECT code FROM table ORDER BY code;
     */
    final StringBuilder buffer = new StringBuilder(100);
    final int columnNameStart = buffer.append("SELECT ").length();
    final int columnNameEnd = buffer.append(table.codeColumn).length();
    buffer.append(" FROM ").append(table.table);
    final Class<?> tableType = table.where(type, buffer);
    final int conditionStart = buffer.length();
    if (table.showColumn != null) {
        buffer.append(table.showColumn).append("<>0 AND ");
        // Do not put spaces around "<>" - SQLTranslator searches for this exact match.
    }
    // Do not put spaces around "=" - SQLTranslator searches for this exact match.
    buffer.append("DEPRECATED=0 ORDER BY ").append(table.codeColumn);
    sql[ALL] = factory.translator.apply(buffer.toString());
    /*
     * Build the SQL query for fetching the name of a single object for a given code.
     * This query will also be used for testing object existence. It is of the form:
     *
     *     SELECT name FROM table WHERE code = ?
     */
    buffer.setLength(conditionStart);
    if (table.nameColumn != null) {
        buffer.replace(columnNameStart, columnNameEnd, table.nameColumn);
    }
    buffer.append(table.codeColumn).append(" = ?");
    sql[ONE] = factory.translator.apply(buffer.toString());
    /*
     * Other information opportunistically computed from above search.
     */
    this.type = tableType;
    isProjection = Projection.class.isAssignableFrom(tableType);
}
 
Example #16
Source File: DefaultOperationMethod.java    From sis with Apache License 2.0 4 votes vote down vote up
/**
 * Formats this operation as a <cite>Well Known Text</cite> {@code Method[…]} element.
 *
 * @return {@code "Method"} (WKT 2) or {@code "Projection"} (WKT 1).
 *
 * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#118">WKT 2 specification §17.2.3</a>
 */
@Override
protected String formatTo(final Formatter formatter) {
    final boolean isWKT1 = formatter.getConvention().majorVersion() == 1;
    /*
     * The next few lines below are basically a copy of the work done by super.formatTo(formatter),
     * which search for the name to write inside METHOD["name"]. The difference is in the fallback
     * executed if we do not find a name for the given authority.
     */
    final Citation authority = formatter.getNameAuthority();
    String name = IdentifiedObjects.getName(this, authority);
    ElementKind kind = ElementKind.METHOD;
    if (name == null) {
        /*
         * No name found for the given authority. We may use the primary name as a fallback.
         * But before doing that, maybe we can find the name that we are looking for in the
         * hard-coded values in the 'org.apache.sis.internal.referencing.provider' package.
         * The typical use case is when this DefaultOperationMethod has been instantiated
         * by the EPSG factory using only the information found in the EPSG database.
         *
         * We can find the hard-coded names by looking at the ParameterDescriptorGroup of the
         * enclosing ProjectedCRS or DerivedCRS. This is because that parameter descriptor was
         * typically provided by the 'org.apache.sis.internal.referencing.provider' package in
         * order to create the MathTransform associated with the enclosing CRS.  The enclosing
         * CRS is either the immediate parent in WKT 1, or the parent of the parent in WKT 2.
         */
        final FormattableObject parent = formatter.getEnclosingElement(isWKT1 ? 1 : 2);
        if (parent instanceof GeneralDerivedCRS) {
            final Conversion conversion = ((GeneralDerivedCRS) parent).getConversionFromBase();
            if (conversion != null) {   // Should never be null, but let be safe.
                final ParameterDescriptorGroup descriptor;
                if (conversion instanceof Parameterized) {  // Usual case in SIS implementation.
                    descriptor = ((Parameterized) conversion).getParameterDescriptors();
                } else {
                    descriptor = conversion.getParameterValues().getDescriptor();
                }
                name = IdentifiedObjects.getName(descriptor, authority);
            }
        }
        if (name == null) {
            name = IdentifiedObjects.getName(this, null);
            if (name == null) {
                name = Vocabulary.getResources(formatter.getLocale()).getString(Vocabulary.Keys.Unnamed);
                kind = ElementKind.NAME;  // Because the "Unnamed" string is not a real OperationMethod name.
            }
        }
    }
    formatter.append(name, kind);
    if (isWKT1) {
        /*
         * The WKT 1 keyword is "PROJECTION", which imply that the operation method should be of type
         * org.opengis.referencing.operation.Projection. So strictly speaking only the first check in
         * the following 'if' statement is relevant.
         *
         * Unfortunately in many cases we do not know the operation type, because the method that we
         * invoked - getOperationType() - is not a standard OGC/ISO property, so this information is
         * usually not provided in XML documents for example.  The user could also have instantiated
         * DirectOperationMethod directly without creating a subclass. Consequently we also accept to
         * format the keyword as "PROJECTION" if the operation type *could* be a projection. This is
         * the second check in the following 'if' statement.
         *
         * In other words, the combination of those two checks exclude the following operation types:
         * Transformation, ConcatenatedOperation, PassThroughOperation, or any user-defined type that
         * do not extend Projection. All other operation types are accepted.
         */
        final Class<? extends SingleOperation> type = getOperationType();
        if (Projection.class.isAssignableFrom(type) || type.isAssignableFrom(Projection.class)) {
            return WKTKeywords.Projection;
        }
        formatter.setInvalidWKT(this, null);
    }
    return WKTKeywords.Method;
}
 
Example #17
Source File: DefaultProjectedCRS.java    From sis with Apache License 2.0 3 votes vote down vote up
/**
 * Returns the geographic CRS on which the map projection is applied.
 * This CRS defines the {@linkplain #getDatum() datum} of this CRS and (at least implicitly)
 * the {@linkplain org.apache.sis.referencing.operation.DefaultConversion#getSourceCRS() source}
 * of the {@linkplain #getConversionFromBase() conversion from base}.
 *
 * @return the base coordinate reference system, which must be geographic.
 */
@Override
@XmlElement(name = "baseGeodeticCRS", required = true)        // Note: older GML version used "baseGeographicCRS".
public GeographicCRS getBaseCRS() {
    final Projection projection = super.getConversionFromBase();
    return (projection != null) ? (GeographicCRS) projection.getSourceCRS() : null;
}
 
Example #18
Source File: MapProjection.java    From sis with Apache License 2.0 2 votes vote down vote up
/**
 * Returns the operation type for this map projection.
 *
 * @return {@code Projection.class} or a sub-type.
 */
@Override
public Class<? extends Projection> getOperationType() {
    return Projection.class;
}
 
Example #19
Source File: ZonedTransverseMercator.java    From sis with Apache License 2.0 2 votes vote down vote up
/**
 * Returns the operation type for this projection. We do not classify this operation as a cylindrical projection
 * for now because of the discontinuities between zones. But we may revisit that choice in any future SIS version.
 *
 * @return {@code Projection.class} or a sub-type.
 */
@Override
public Class<? extends Projection> getOperationType() {
    return Projection.class;
}
 
Example #20
Source File: DefaultProjectedCRS.java    From sis with Apache License 2.0 2 votes vote down vote up
/**
 * Returns the map projection from the {@linkplain #getBaseCRS() base CRS} to this CRS.
 * In Apache SIS, the conversion source and target CRS are set to the following values:
 *
 * <ul>
 *   <li>The conversion {@linkplain org.apache.sis.referencing.operation.DefaultConversion#getSourceCRS()
 *       source CRS} is the {@linkplain #getBaseCRS() base CRS} of {@code this} CRS.</li>
 *   <li>The conversion {@linkplain org.apache.sis.referencing.operation.DefaultConversion#getTargetCRS()
 *       target CRS} is {@code this} CRS.
 * </ul>
 *
 * <div class="note"><b>Note:</b>
 * This is different than ISO 19111, which allows source and target CRS to be {@code null}.</div>
 *
 * @return the map projection from base CRS to this CRS.
 */
@Override
public Projection getConversionFromBase() {
    return super.getConversionFromBase();
}
 
Example #21
Source File: DefaultProjection.java    From sis with Apache License 2.0 2 votes vote down vote up
/**
 * Returns the GeoAPI interface implemented by this class.
 * The default implementation returns {@code Projection.class}.
 * Subclasses implementing a more specific GeoAPI interface shall override this method.
 *
 * @return the conversion interface implemented by this class.
 */
@Override
public Class<? extends Projection> getInterface() {
    return Projection.class;
}
 
Example #22
Source File: DefaultProjection.java    From sis with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a new coordinate operation with the same values than the specified one.
 * This copy constructor provides a way to convert an arbitrary implementation into a SIS one
 * or a user-defined one (as a subclass), usually in order to leverage some implementation-specific API.
 *
 * <p>This constructor performs a shallow copy, i.e. the properties are not cloned.</p>
 *
 * @param  operation  the coordinate operation to copy.
 */
protected DefaultProjection(final Projection operation) {
    super(operation);
}