/** * Constructs a new operation with the same values than the specified defining conversion, * together with the specified source and target CRS. This constructor is used by {@link * DefaultConversion} only. */ DefaultOperation( final Conversion definition, final CoordinateReferenceSystem sourceCRS, final CoordinateReferenceSystem targetCRS, final MathTransform transform) { super(definition, sourceCRS, targetCRS, transform); method = definition.getMethod(); }
final Class<? extends Conversion> typeHint) { Class<? extends CoordinateOperation> type = getType(definition); final OperationMethod method = definition.getMethod(); if (method instanceof MathTransformProvider) { final Class<? extends Operation> candidate =
this.baseCRS = base; checkDimensions(base, baseToDerived, derivedCS); DefaultOperationMethod.checkDimensions(conversionFromBase.getMethod(), baseToDerived); final Class<?> c = (Class<?>) properties.get(CONVERSION_TYPE_KEY); Class<? extends Conversion> typeHint = getConversionType();
OperationMethod method = conversionFromBase.getMethod(); if (!(method instanceof MathTransformProvider)) {
GeoTiffPCSCodes.ProjectionGeoKey, GeoTiffConstants.GTUserDefinedGeoKey); final OperationMethod method = conversion.getMethod();
final Conversion conversion = projCRS.getConversionFromBase(); assertSame(mt, conversion.getMathTransform()); final OperationMethod projMethod = conversion.getMethod(); assertEquals(classification, projMethod.getName().getCode());
new DefiningConversion( getProperties(fromBase), fromBase.getMethod(), fromBase.getParameterValues()); if (crs instanceof ProjectedCRS) {
DefaultGeographicCRS.getAngularUnit(baseCRS.getCoordinateSystem())); formatter.append(baseCRS); formatter.append(conversionFromBase.getMethod()); for (final GeneralParameterValue param : conversionFromBase.getParameterValues().values()) { final GeneralParameterDescriptor desc = param.getDescriptor();
projection = new DefiningConversion( AbstractCS.getProperties(projection), projection.getMethod(), mt);
@Override protected String formatTo(final Formatter formatter) { WKTUtilities.appendName(conversion, formatter, null); formatter.newLine(); formatter.append(DefaultOperationMethod.castOrCopy(conversion.getMethod())); formatter.newLine(); for (final GeneralParameterValue param : conversion.getParameterValues().values()) { WKTUtilities.append(param, formatter); } return WKTKeywords.DerivingConversion; } });
@Override protected String formatTo(final Formatter formatter) { WKTUtilities.appendName(conversion, formatter, null); formatter.newLine(); formatter.append(DefaultOperationMethod.castOrCopy(conversion.getMethod())); formatter.newLine(); for (final GeneralParameterValue param : conversion.getParameterValues().values()) { WKTUtilities.append(param, formatter); } return WKTKeywords.DerivingConversion; } });
/** * Verifies the properties of the conversion given by {@link #getIdentifiedObject()}. */ private void createAndVerifyProjection(final int code) throws FactoryException { this.code = code; conversion = null; // For forcing the fetch of a new operation. final Conversion conversion = getIdentifiedObject(); assertNotNull("Conversion", conversion); validators.validate(conversion); // Map projection identifier. assertContainsCode("Conversion.getIdentifiers()", "EPSG", code, conversion.getIdentifiers()); // Map projection name. if (isStandardNameSupported) { configurationTip = Configuration.Key.isStandardNameSupported; assertEquals("Conversion.getMethod().getName()", methodName, getVerifiableName(conversion.getMethod())); configurationTip = null; } }
metadata.addGeoAscii(GeoTiffPCSCodes.PCSCitationGeoKey, conversionName); final OperationMethod method = conversion.getMethod();
/** * Returns the inverse of the given conversion. This method is not strictly correct * since we reuse the properties (name, aliases, etc.) from the given conversion. * However those properties are not significant for the purpose of this test. */ private static Conversion inverse(final Conversion conversion) throws NoninvertibleTransformException { return new DefaultConversion(IdentifiedObjects.getProperties(conversion), conversion.getTargetCRS(), conversion.getSourceCRS(), null, conversion.getMethod(), conversion.getMathTransform().inverse()); }
final GeographicBoundingBox candidate = CRS.getGeographicBoundingBox(crs); if (candidate != null) { final String name = ((GeneralDerivedCRS) crs).getConversionFromBase().getMethod().getName().getCode(); DefaultGeographicBoundingBox validity = domainOfValidity.get(name); if (validity == null) {
/** * Tests {@link Envelopes#findOperation(Envelope, Envelope)}. * * @throws FactoryException if an error occurred while searching the operation. * * @since 1.0 */ @Test public void testFindOperation() throws FactoryException { final GeneralEnvelope source = new GeneralEnvelope(HardCodedCRS.WGS84); final GeneralEnvelope target = new GeneralEnvelope(HardCodedCRS.GEOCENTRIC); source.setRange(0, 20, 30); source.setRange(1, 40, 45); target.setRange(0, 6000, 8000); target.setRange(1, 7000, 9000); target.setRange(2, 4000, 5000); CoordinateOperation op = Envelopes.findOperation(source, target); assertInstanceOf("findOperation", Conversion.class, op); assertEquals("Geographic/geocentric conversions", ((Conversion) op).getMethod().getName().getCode()); }
/** * Tests (un)marshalling of a derived coordinate reference system. * * @throws JAXBException if an error occurred during (un)marshalling. * * @since 0.7 */ @Test public void testXML() throws JAXBException { final DefaultDerivedCRS crs = unmarshalFile(DefaultDerivedCRS.class, XML_FILE); Validators.validate(crs); assertEpsgNameAndIdentifierEqual("WGS 84", 4979, crs.getBaseCRS()); assertAxisDirectionsEqual("baseCRS", crs.getBaseCRS().getCoordinateSystem(), AxisDirection.NORTH, AxisDirection.EAST, AxisDirection.UP); assertAxisDirectionsEqual("coordinateSystem", crs.getCoordinateSystem(), AxisDirection.EAST, AxisDirection.NORTH, AxisDirection.UP); final Conversion conversion = crs.getConversionFromBase(); final ParameterValueGroup pg = conversion.getParameterValues(); assertEpsgNameAndIdentifierEqual("Geographic/topocentric conversions", 9837, conversion.getMethod()); assertEquals("Latitude", 55, pg.parameter("Latitude of topocentric origin" ).doubleValue(Units.DEGREE), STRICT); assertEquals("Longitude", 5, pg.parameter("Longitude of topocentric origin").doubleValue(Units.DEGREE), STRICT); assertEquals("Height", 0, pg.parameter("Ellipsoidal height of topocentric origin").doubleValue(Units.METRE), STRICT); /* * Test marshalling and compare with the original file. */ assertMarshalEqualsFile(XML_FILE, crs, "xmlns:*", "xsi:schemaLocation"); } }