/** * Constructs a new derived CRS with the same values than the specified one. This copy * constructor provides a way to wrap an arbitrary implementation into a Geotools one or a * user-defined one (as a subclass), usually in order to leverage some implementation-specific * API. This constructor performs a shallow copy, i.e. the properties are not cloned. * * @param crs The coordinate reference system to copy. * @since 2.2 */ protected AbstractDerivedCRS(final GeneralDerivedCRS crs) { super(crs); baseCRS = crs.getBaseCRS(); conversionFromBase = crs.getConversionFromBase(); }
crs = ((CRSAuthorityFactory) factory).createCoordinateReferenceSystem(String.valueOf(base)); if (crs instanceof GeneralDerivedCRS) { return ((GeneralDerivedCRS) crs).getConversionFromBase();
IdentifiedObject dependency; if (object instanceof GeneralDerivedCRS) { dependency = ((GeneralDerivedCRS) object).getBaseCRS(); where = "SOURCE_GEOGCRS_CODE"; } else if (object instanceof SingleCRS) {
crs = ((CRSAuthorityFactory) factory).createCoordinateReferenceSystem(String.valueOf(base)); if (crs instanceof GeneralDerivedCRS) { return ((GeneralDerivedCRS) crs).getConversionFromBase();
IdentifiedObject dependency; if (object instanceof GeneralDerivedCRS) { dependency = ((GeneralDerivedCRS) object).getBaseCRS(); where = "SOURCE_GEOGCRS_CODE"; } else if (object instanceof SingleCRS) {
final CoordinateReferenceSystem base = target.getBaseCRS(); final Set<CoordinateOperation> step1 = findOperations(sourceCRS, base, limit); final CoordinateOperation step2 = target.getConversionFromBase(); return concatenate(step1, Collections.singleton(step2)); final CoordinateReferenceSystem base = source.getBaseCRS(); final Set<CoordinateOperation> step2 = findOperations(base, targetCRS, limit); CoordinateOperation step1 = source.getConversionFromBase(); MathTransform transform = step1.getMathTransform(); try {
/** * Returns an error message for "Can not invert operation XYZ.". * This is used for the construction of {@link OperationNotFoundException}. * * @param crs the CRS having a conversion that can not be inverted. * @return a default error message. */ private static String canNotInvert(final GeneralDerivedCRS crs) { return Resources.format(Resources.Keys.NonInvertibleOperation_1, crs.getConversionFromBase().getName().getCode()); } }
/** * Returns the class of the given CRS after unwrapping derived and projected CRS. * The returned type is for use with {@link #COMPATIBLE_TYPES}. */ private static Class<?> type(SingleCRS crs) { while (crs instanceof GeneralDerivedCRS) { crs = (SingleCRS) ((GeneralDerivedCRS) crs).getBaseCRS(); } return crs.getClass(); }
/** * Returns {@code true} if this coordinate operation is for the definition of a * {@linkplain org.apache.sis.referencing.crs.DefaultDerivedCRS derived} or * {@linkplain org.apache.sis.referencing.crs.DefaultProjectedCRS projected CRS}. * The standard (ISO 19111) approach constructs <cite>defining conversion</cite> * as an operation of type {@link org.opengis.referencing.operation.Conversion} * with null {@linkplain #getSourceCRS() source} and {@linkplain #getTargetCRS() target CRS}. * But SIS supports also defining conversions with non-null CRS provided that: * * <ul> * <li>{@link GeneralDerivedCRS#getBaseCRS()} is the {@linkplain #getSourceCRS() source CRS} of this operation, and</li> * <li>{@link GeneralDerivedCRS#getConversionFromBase()} is this operation instance.</li> * </ul> * * When this method returns {@code true}, the source and target CRS are not marshalled in XML documents. * * @return {@code true} if this coordinate operation is for the definition of a derived or projected CRS. */ public boolean isDefiningConversion() { /* * Trick: we do not need to verify if (this instanceof Conversion) because: * - Only DefaultConversion constructor accepts null source and target CRS. * - GeneralDerivedCRS.getConversionFromBase() return type is Conversion. */ return (sourceCRS == null && targetCRS == null) || ((targetCRS instanceof GeneralDerivedCRS) && ((GeneralDerivedCRS) targetCRS).getBaseCRS() == sourceCRS && ((GeneralDerivedCRS) targetCRS).getConversionFromBase() == this); }
/** * Returns an error message for "Can not invert operation XYZ.". * This is used for the construction of {@link OperationNotFoundException}. * * @param crs the CRS having a conversion that can not be inverted. * @return a default error message. */ private static String canNotInvert(final GeneralDerivedCRS crs) { return Resources.format(Resources.Keys.NonInvertibleOperation_1, crs.getConversionFromBase().getName().getCode()); } }
/** * Returns the class of the given CRS after unwrapping derived and projected CRS. * The returned type is for use with {@link #COMPATIBLE_TYPES}. */ private static Class<?> type(SingleCRS crs) { while (crs instanceof GeneralDerivedCRS) { crs = (SingleCRS) ((GeneralDerivedCRS) crs).getBaseCRS(); } return crs.getClass(); }
/** * Returns {@code true} if this coordinate operation is for the definition of a * {@linkplain org.apache.sis.referencing.crs.DefaultDerivedCRS derived} or * {@linkplain org.apache.sis.referencing.crs.DefaultProjectedCRS projected CRS}. * The standard (ISO 19111) approach constructs <cite>defining conversion</cite> * as an operation of type {@link org.opengis.referencing.operation.Conversion} * with null {@linkplain #getSourceCRS() source} and {@linkplain #getTargetCRS() target CRS}. * But SIS supports also defining conversions with non-null CRS provided that: * * <ul> * <li>{@link GeneralDerivedCRS#getBaseCRS()} is the {@linkplain #getSourceCRS() source CRS} of this operation, and</li> * <li>{@link GeneralDerivedCRS#getConversionFromBase()} is this operation instance.</li> * </ul> * * When this method returns {@code true}, the source and target CRS are not marshalled in XML documents. * * @return {@code true} if this coordinate operation is for the definition of a derived or projected CRS. */ public boolean isDefiningConversion() { /* * Trick: we do not need to verify if (this instanceof Conversion) because: * - Only DefaultConversion constructor accepts null source and target CRS. * - GeneralDerivedCRS.getConversionFromBase() return type is Conversion. */ return (sourceCRS == null && targetCRS == null) || ((targetCRS instanceof GeneralDerivedCRS) && ((GeneralDerivedCRS) targetCRS).getBaseCRS() == sourceCRS && ((GeneralDerivedCRS) targetCRS).getConversionFromBase() == this); }
if (!Utilities.equalsApproximatively(crsA, crsG)) { if (crsA instanceof GeneralDerivedCRS && crsG instanceof GeneralDerivedCRS) { final Conversion cnvA = ((GeneralDerivedCRS) crsA).getConversionFromBase(); final Conversion cnvG = ((GeneralDerivedCRS) crsG).getConversionFromBase(); if (!Utilities.equalsApproximatively(cnvA, cnvG)) { return Utilities.equalsApproximatively(cnvA.getMethod(), cnvG.getMethod()) ? CONVERSION : METHOD;
crs = ((GeneralDerivedCRS) crs).getBaseCRS();
/** * Constructs a new coordinate reference system 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 crs the coordinate reference system to copy. */ AbstractDerivedCRS(final GeneralDerivedCRS crs) { super(crs); conversionFromBase = createConversionFromBase(null, (SingleCRS) crs.getBaseCRS(), crs.getConversionFromBase()); }
if (!Utilities.equalsApproximatively(crsA, crsG)) { if (crsA instanceof GeneralDerivedCRS && crsG instanceof GeneralDerivedCRS) { final Conversion cnvA = ((GeneralDerivedCRS) crsA).getConversionFromBase(); final Conversion cnvG = ((GeneralDerivedCRS) crsG).getConversionFromBase(); if (!Utilities.equalsApproximatively(cnvA, cnvG)) { return Utilities.equalsApproximatively(cnvA.getMethod(), cnvG.getMethod()) ? CONVERSION : METHOD;
base = ((GeneralDerivedCRS) base).getBaseCRS();
/** * Constructs a new coordinate reference system 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 crs the coordinate reference system to copy. */ AbstractDerivedCRS(final GeneralDerivedCRS crs) { super(crs); conversionFromBase = createConversionFromBase(null, (SingleCRS) crs.getBaseCRS(), crs.getConversionFromBase()); }
return deepEquals(strict ? conversionFromBase : getConversionFromBase(), strict ? ((AbstractDerivedCRS) object).conversionFromBase : ((GeneralDerivedCRS) object).getConversionFromBase(), mode); } finally { Semaphores.clear(Semaphores.CONVERSION_AND_CRS);
final IdentifiedObject dependency; if (object instanceof GeneralDerivedCRS) { dependency = ((GeneralDerivedCRS) object).getBaseCRS(); where = "SOURCE_GEOGCRS_CODE"; table = TableInfo.CRS;