Refine search
/** * Checks if transforms are compatibles. The default implementation check if transfert dimension * match. */ boolean isValid() { return transform1.getTargetDimensions() == transform2.getSourceDimensions(); }
/** Checks if transforms are compatibles with this implementation. */ @Override boolean isValid() { return super.isValid() && transform1.getSourceDimensions() == transform1.getTargetDimensions() && transform2.getSourceDimensions() == transform2.getTargetDimensions(); }
/** * Convenience constructor that creates an operation method from a math transform. The * information provided in the newly created object are approximative, and usually acceptable * only as a fallback when no other information are available. * * @param transform The math transform to describe. */ public DefaultOperationMethod(final MathTransform transform) { this( getProperties(transform), transform.getSourceDimensions(), transform.getTargetDimensions(), getDescriptor(transform)); }
final int srcDimension = delegate.getSourceDimensions(); final int dstDimension = delegate.getTargetDimensions(); double lastSrcLon = source[srcOff]; double lastDstLon = dstPts[dstOff];
/** * Constructor. * * <p>Note that the {@link MathTransform} must be a 2D affine transform. * * @param outLocation where to create the world file. * @param transform the transformation that we want to write out. * @param buffSize size of the buffer to use. * @throws IOException in case something bad happens. */ public WorldFileWriter( final OutputStream outLocation, final MathTransform transform, final int buffSize) throws IOException { if (outLocation == null) throw new NullPointerException( Errors.format(ErrorKeys.NULL_ARGUMENT_$1, "outLocation")); if (transform.getSourceDimensions() != 2 || transform.getTargetDimensions() != 2) throw new IllegalArgumentException( Errors.format( ErrorKeys.MISMATCHED_DIMENSION_$3, "transform", transform.getSourceDimensions(), 2)); if (buffSize <= 0) throw new IllegalArgumentException( Errors.format(ErrorKeys.ILLEGAL_ARGUMENT_$2, "buffSize", buffSize)); write(new BufferedWriter(new OutputStreamWriter(outLocation), buffSize), transform); }
/** Tests the validity of this grid geometry. */ private boolean isValid() { if (gridToCRS != null) { final int sourceDim = gridToCRS.getSourceDimensions(); final int targetDim = gridToCRS.getTargetDimensions(); assert gridToCRS.equals(gridToCRS2D) == (sourceDim == 2 && targetDim == 2); assert !gridToCRS2D.equals(cornerToCRS2D); assert gridRange == null || sourceDim == gridRange.getDimension() : gridRange; assert envelope == null || targetDim == envelope.getDimension() : envelope; assert gridDimensionY < sourceDim : gridDimensionY; assert axisDimensionY < targetDim : axisDimensionY; } assert gridDimensionX < gridDimensionY : gridDimensionX; assert axisDimensionX < axisDimensionY : axisDimensionX; return crs2D == null || crs2D.getCoordinateSystem().getDimension() == 2; }
/** * Workaround for RFE #4093999 ("Relax constraint on placement of this()/super() call in * constructors"). We could write this code in a less convolved way if only this requested was * honored... */ private GridGeometry2D( final GridEnvelope gridRange, final PixelOrientation anchor, final MathTransform gridToCRS, final int[] dimensions, // Allocated by caller. final CoordinateReferenceSystem crs, final Hints hints) { this( gridRange, anchor, (gridToCRS != null) && (gridToCRS.getSourceDimensions() == 2) && (gridToCRS.getTargetDimensions() == 2) && PixelOrientation.UPPER_LEFT.equals(anchor) ? PixelInCell.CELL_CORNER : PixelInCell.CELL_CENTER, gridToCRS, getMathTransform2D(gridToCRS, gridRange, dimensions, hints), dimensions, crs); }
Errors.format(ErrorKeys.NULL_ARGUMENT_$1, "outLocation")); checkMathTransform(transform); if (transform.getSourceDimensions() != 2 || transform.getTargetDimensions() != 2) throw new IllegalArgumentException( Errors.format( ErrorKeys.MISMATCHED_DIMENSION_$3, "transform", transform.getSourceDimensions(), 2)); if (!outLocation.exists())
final double[] srcPts, int srcOff, final double[] dstPts, int dstOff, int numPts) throws TransformException { final int subDimSource = subTransform.getSourceDimensions(); final int subDimTarget = subTransform.getTargetDimensions(); int srcStep = numTrailingOrdinates; int dstStep = numTrailingOrdinates;
final float[] srcPts, int srcOff, final float[] dstPts, int dstOff, int numPts) throws TransformException { final int subDimSource = subTransform.getSourceDimensions(); final int subDimTarget = subTransform.getTargetDimensions(); int srcStep = numTrailingOrdinates; int dstStep = numTrailingOrdinates;
ensureNonNull("transform", transform); final int sourceDim = transform.getSourceDimensions(); final int targetDim = transform.getTargetDimensions();
/** * Creates a projective transform from the specified group of parameter values. * * @param values The group of parameter values. * @return The created math transform. * @throws ParameterNotFoundException if a required parameter was not found. */ protected MathTransform createMathTransform(final ParameterValueGroup values) throws ParameterNotFoundException { final MathTransform transform; transform = create(((MatrixParameterDescriptors) getParameters()).getMatrix(values)); return new Delegate( transform, getProvider(transform.getSourceDimensions(), transform.getTargetDimensions())); }
/** Checks consistency between the base CRS and the "base to derived" transform. */ private static void checkDimensions( final CoordinateReferenceSystem base, final MathTransform baseToDerived, final CoordinateSystem derivedCS) throws MismatchedDimensionException { final int dimSource = baseToDerived.getSourceDimensions(); final int dimTarget = baseToDerived.getTargetDimensions(); int dim1, dim2; if ((dim1 = dimSource) != (dim2 = base.getCoordinateSystem().getDimension()) || (dim1 = dimTarget) != (dim2 = derivedCS.getDimension())) { throw new MismatchedDimensionException( Errors.format(ErrorKeys.MISMATCHED_DIMENSION_$2, dim1, dim2)); } }
transform, ProjectiveTransform.ProviderAffine.getProvider( transform.getSourceDimensions(), transform.getTargetDimensions()), type);
final int dimSource = tr1.getSourceDimensions(); final int dimTarget = tr2.getTargetDimensions(); if (dimSource == tr1.getTargetDimensions() && tr2.getSourceDimensions() == dimTarget) { return new ConcatenatedTransformDirect(tr1, tr2); } else {
/** * Verify that the specified transform implements {@link MathTransform1D} or {@link * MathTransform2D} as needed. * * @param transform The transform to test. */ public static void assertInterfaced(final MathTransform transform) { int dim = transform.getSourceDimensions(); if (transform.getTargetDimensions() != dim) { dim = 0; } assertTrue("MathTransform1D", (dim == 1) == (transform instanceof MathTransform1D)); assertTrue("MathTransform2D", (dim == 2) == (transform instanceof MathTransform2D)); }
/** * Checks the validity of this operation. This method is invoked by the constructor after every * fields have been assigned. It can be overriden by subclasses if different rules should be * applied. * * <p>{@link DefaultConversion} overrides this method in order to allow null values, providing * that all of {@code transform}, {@code sourceCRS} and {@code targetCRS} are null together. * Note that null values are not allowed for transformations, so {@link DefaultTransformation} * does not override this method. * * @throws IllegalArgumentException if at least one of {@code transform}, {@code sourceCRS} or * {@code targetCRS} is invalid. We throw this kind of exception rather than {@link * IllegalStateException} because this method is invoked by the constructor for checking * argument validity. */ void validate() throws IllegalArgumentException { ensureNonNull("sourceCRS", transform); ensureNonNull("targetCRS", transform); ensureNonNull("transform", transform); checkDimension("sourceCRS", sourceCRS, transform.getSourceDimensions()); checkDimension("targetCRS", targetCRS, transform.getTargetDimensions()); }
/** * Constructs a single operation from a set of properties and the given transform. The * properties given in argument follow the same rules than for the {@link * AbstractCoordinateOperation} constructor. * * @param properties Set of properties. Should contains at least {@code "name"}. * @param sourceCRS The source CRS. * @param targetCRS The target CRS. * @param operation The operation to apply on the subset of a coordinate tuple. * @param transform The {@linkplain MathTransformFactory#createPassThroughTransform pass through * transform}. */ public DefaultPassThroughOperation( final Map<String, ?> properties, final CoordinateReferenceSystem sourceCRS, final CoordinateReferenceSystem targetCRS, final Operation operation, final MathTransform transform) { super(properties, sourceCRS, targetCRS, transform); this.operation = operation; ensureNonNull("operation", operation); ensureValidDimension(operation.getSourceCRS(), transform.getSourceDimensions()); ensureValidDimension(operation.getTargetCRS(), transform.getTargetDimensions()); }
sourceDimensions = series(0, transform.getSourceDimensions()); if (targetDimensions == null) { targetDimensions = series(0, transform.getTargetDimensions()); return transform; targetDimensions = target; assert sourceDimensions.length == transform.getSourceDimensions() : transform; assert targetDimensions.length == transform.getTargetDimensions() : transform; return transform;
if (gridToCRS.getSourceDimensions() == 2 && gridToCRS.getTargetDimensions() == 2) { cornerToCRS2D = (MathTransform2D) super.getGridToCRS(PixelInCell.CELL_CORNER); } else {