/** * Constructs a new coordinate 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. */ AbstractCoordinateOperation( final Conversion definition, final CoordinateReferenceSystem sourceCRS, final CoordinateReferenceSystem targetCRS, final MathTransform transform) { super(definition); this.sourceCRS = sourceCRS; this.targetCRS = targetCRS; this.operationVersion = definition.getOperationVersion(); this.coordinateOperationAccuracy = definition.getCoordinateOperationAccuracy(); this.domainOfValidity = definition.getDomainOfValidity(); this.scope = definition.getScope(); this.transform = transform; }
/** * Validates the given conversion. * * @param object the object to validate, or {@code null}. */ public void validate(final Conversion object) { if (object == null) { return; } validateOperation(object); assertFalse("Projection: can't be both planar and conic.", (object instanceof PlanarProjection) && (object instanceof ConicProjection)); assertFalse("Projection: can't be both planar and cylindrical.", (object instanceof PlanarProjection) && (object instanceof CylindricalProjection)); assertFalse("Projection: can't be both cylindrical and conic.", (object instanceof CylindricalProjection) && (object instanceof ConicProjection)); if (object.getMathTransform() != null) { mandatory("Conversion: non-defining conversion should have a source CRS.", object.getSourceCRS()); mandatory("Conversion: non-defining conversion should have a target CRS.", object.getTargetCRS()); } forbidden("Conversion: should not have operation version.", object.getOperationVersion()); if (object.getMathTransform() == null) { forbidden("Conversion: defining conversion should not have source CRS", object.getSourceCRS()); forbidden("Conversion: defining conversion should not have target CRS", object.getTargetCRS()); } }
/** * Validates the given conversion. * * @param object The object to validate, or {@code null}. */ public void validate(final Conversion object) { if (object == null) { return; } validateOperation(object); assertFalse("Projection: can't be both planar and conic.", (object instanceof PlanarProjection) && (object instanceof ConicProjection)); assertFalse("Projection: can't be both planar and cylindrical.", (object instanceof PlanarProjection) && (object instanceof CylindricalProjection)); assertFalse("Projection: can't be both cylindrical and conic.", (object instanceof CylindricalProjection) && (object instanceof ConicProjection)); if (object.getMathTransform() != null) { mandatory("Conversion: non-defining conversion should have a source CRS.", object.getSourceCRS()); mandatory("Conversion: non-defining conversion should have a target CRS.", object.getTargetCRS()); } forbidden("Conversion: should not have operation version.", object.getOperationVersion()); if (object.getMathTransform() == null) { forbidden("Conversion: defining conversion should not have source CRS", object.getSourceCRS()); forbidden("Conversion: defining conversion should not have target CRS", object.getTargetCRS()); } }