/** Test the general passthrough transform. */ @Test public void testPassthrough() throws FactoryException, TransformException { final ParameterValueGroup param = mtFactory.getDefaultParameters("Exponential"); runTest(mtFactory.createParameterizedTransform(param)); }
return factory.createAffineTransform(MatrixFactory.create(dimInput + 1)); step2 = separateInput(ctr.transform2); sourceDimensions = original; return factory.createConcatenatedTransform(step1, step2); return factory.createAffineTransform(MatrixFactory.create(dimInput + 1)); final int firstAffectedOrdinate = Math.max(0, subLower - lower); final int numTrailingOrdinates = Math.max(0, upper - subUpper); return factory.createPassThroughTransform( firstAffectedOrdinate, subTransform, numTrailingOrdinates); return factory.createAffineTransform(new GeneralMatrix(rows));
/** * Returns the operation method for the last math transform parsed. This is used by {@link * Parser} in order to built {@link org.opengis.referencing.crs.DerivedCRS}. */ final OperationMethod getOperationMethod() { if (lastMethod == null) { /* * Safety in case come MathTransformFactory implementation do not support * getLastMethod(). Performs a slower and less robust check as a fallback. */ if (classification != null) { for (final OperationMethod method : mtFactory.getAvailableMethods(Operation.class)) { if (AbstractIdentifiedObject.nameMatches(method, classification)) { lastMethod = method; break; } } } } return lastMethod; } }
/** * Creates a coordinate operation from a set of parameters. The {@linkplain OperationMethod * operation method} is inferred automatically, if possible. * * @param name The identifier for the operation to be created. * @param sourceCRS The source coordinate reference system. * @param targetCRS The target coordinate reference system. * @param parameters The parameters. * @return The conversion or transformation. * @throws FactoryException if the operation can't be created. */ protected CoordinateOperation createFromParameters( final ReferenceIdentifier name, final CoordinateReferenceSystem sourceCRS, final CoordinateReferenceSystem targetCRS, final ParameterValueGroup parameters) throws FactoryException { final Map<String, ?> properties = getProperties(name); final MathTransform transform = mtFactory.createParameterizedTransform(parameters); final OperationMethod method = mtFactory.getLastMethodUsed(); return createFromMathTransform( properties, sourceCRS, targetCRS, transform, method, Operation.class); }
final ParameterValueGroup parameters; try { parameters = mtFactory.getDefaultParameters(classification); } catch (NoSuchIdentifierException exception) { throw element.parseFailed(exception, null); transform = mtFactory.createParameterizedTransform(parameters); } catch (FactoryException exception) { throw element.parseFailed(exception, null); lastMethod = mtFactory.getLastMethodUsed(); return transform;
MathTransform filtered = factory.createAffineTransform(matrix); if (transform != null) { filtered = factory.createConcatenatedTransform(transform, filtered);
/** * Test the pass through transform using an affine transform. The "passthrough" of such * transform are optimized in a special way. */ @Test public void testLinear() throws FactoryException, TransformException { runTest( mtFactory.createAffineTransform( new GeneralMatrix(AffineTransform.getScaleInstance(4, 2)))); }
/** * Get Projection parameters from the specified projection name. * * @param projectionName * @return * @throws NoSuchIdentifierException */ public static ParameterValueGroup getProjectionParameters(String projectionName) throws NoSuchIdentifierException { return mtFactory.getDefaultParameters(projectionName); }
final MathTransformFactory mtFactory = ReferencingFactoryFinder.getMathTransformFactory(null); final Collection<OperationMethod> methods = mtFactory.getAvailableMethods(Projection.class); final Map<String, ?> dummyName = Collections.singletonMap("name", "Test"); for (final OperationMethod method : methods) { final String classification = method.getName().getCode(); final ParameterValueGroup param = mtFactory.getDefaultParameters(classification); try { param.parameter("semi_major").setValue(6377563.396); mt = mtFactory.createParameterizedTransform(param); } catch (FactoryException e) {
/** * Parses a "CONCAT_MT" element. This element has the following pattern: * * <blockquote> * * <code> * CONCAT_MT[<math transform> {,<math transform>}*] * </code> * * </blockquote> * * @param parent The parent element. * @return The "CONCAT_MT" element as an {@link MathTransform} object. * @throws ParseException if the "CONCAT_MT" element can't be parsed. */ private MathTransform parseConcatMT(final Element parent) throws ParseException { final Element element = parent.pullElement("CONCAT_MT"); MathTransform transform = parseMathTransform(element, true); MathTransform optionalTransform; while ((optionalTransform = parseMathTransform(element, false)) != null) { try { transform = mtFactory.createConcatenatedTransform(transform, optionalTransform); } catch (FactoryException exception) { throw element.parseFailed(exception, null); } } element.close(); return transform; }
/** * A datum identical to the specified datum except for the prime meridian, which is replaced by * Greenwich. This datum is processed in a special way by {@link #equalsIgnorePrimeMeridian}. */ private static final class TemporaryDatum extends DefaultGeodeticDatum { /** For cros-version compatibility. */ private static final long serialVersionUID = -8964199103509187219L; /** The wrapped datum. */ private final GeodeticDatum datum; /** Wrap the specified datum. */ public TemporaryDatum(final GeodeticDatum datum) { super(getTemporaryName(datum), datum.getEllipsoid(), DefaultPrimeMeridian.GREENWICH); this.datum = datum; } /** Unwrap the datum. */ public static GeodeticDatum unwrap(GeodeticDatum datum) { while (datum instanceof TemporaryDatum) { datum = ((TemporaryDatum) datum).datum; } return datum; } /** Compares this datum with the specified object for equality. */ @Override public boolean equals( final AbstractIdentifiedObject object, final boolean compareMetadata) { if (super.equals(object, compareMetadata)) {
MathTransform step = filter.separate(toSource); ensureStableDimensions(filter); step = factory.createPassThroughTransform(0, step, sourceDim - lowerDim); toTarget = factory.createConcatenatedTransform(step, toTarget); MathTransform step = filter.separate(toSource); ensureStableDimensions(filter); step = factory.createPassThroughTransform(upperDim, step, 0); toTarget = factory.createConcatenatedTransform(toTarget, step);
/** * Parses a "PASSTHROUGH_MT" element. This element has the following pattern: * * <blockquote> * * <code> * PASSTHROUGH_MT[<integer>, <math transform>] * </code> * * </blockquote> * * @param parent The parent element. * @return The "PASSTHROUGH_MT" element as an {@link MathTransform} object. * @throws ParseException if the "PASSTHROUGH_MT" element can't be parsed. */ private MathTransform parsePassThroughMT(final Element parent) throws ParseException { final Element element = parent.pullElement("PASSTHROUGH_MT"); final int firstAffectedOrdinate = parent.pullInteger("firstAffectedOrdinate"); final MathTransform transform = parseMathTransform(element, true); element.close(); try { return mtFactory.createPassThroughTransform(firstAffectedOrdinate, transform, 0); } catch (FactoryException exception) { throw element.parseFailed(exception, null); } }
transform = mtFactory.createParameterizedTransform(parameters); assertNotNull(description, transform); validators.validate(transform); final ParameterDescriptorGroup descriptor = parameters.getDescriptor(); if (!Collections.disjoint(Utilities.getNameAndAliases(descriptor), Utilities.getNameAndAliases(mtFactory.getAvailableMethods(type))))
public static MathTransform createTransform(ParameterValueGroup parameters) throws NoSuchIdentifierException, FactoryException { return mtFactory.createParameterizedTransform(parameters); }
MathTransform gridToCRS; if (affine != null) { gridToCRS = factory.createAffineTransform(Matrices.resizeAffine(affine, ++n, n)); } else { pixelIsPoint = true; gridToCRS = Localization.nonLinear(modelTiePoints); gridToCRS = factory.createPassThroughTransform(0, gridToCRS, n - 2);
transform = factory.createBaseToDerived(source, parameters, target.getCoordinateSystem()); actual[0] = factory.getLastMethodUsed(); } else { transform = factory.createPassThroughTransform(interpDim, transform, 0);
/** * Convenience method adding all {@linkplain MathTransformFactory#getAvailableMethods(Class) * available methods} from the given factory. Each {@linkplain OperationMethod coordinate * operation method} is added to the {@linkplain #rows} list as below: * * <blockquote><code>{@linkplain #add(IdentifiedObject, ParameterDescriptorGroup) * add}(method, method.{@linkplain OperationMethod#getParameters() getParameters()});</code></blockquote> * * @param factory the factory for which to add available methods. */ public void add(final MathTransformFactory factory) { defaultProperties.setProperty("OBJECTS.KIND", "Coordinate Operations"); defaultProperties.setProperty("FILENAME", "CoordinateOperations.html"); setVendor("PRODUCT", factory.getVendor()); final Set<OperationMethod> operations = factory.getAvailableMethods(SingleOperation.class); final int previousCount = rows.size(); for (final OperationMethod operation : operations) { add(operation, operation.getParameters()); progress(previousCount + rows.size(), previousCount + operations.size()); } }
MathTransform mt = projection.getMathTransform(); mt = mtFactory.createConcatenatedTransform( mtFactory.createConcatenatedTransform( mtFactory.createAffineTransform(prepend), mt), mtFactory.createAffineTransform(append)); projection = new DefiningConversion(
final Matrix matrix) throws FactoryException { final MathTransform transform = mtFactory.createAffineTransform(matrix); final Map<String, ?> properties = getProperties(name); final Class<? extends Operation> type =