/** * Returns the factory for coordinate operation objects. * The factory is backed by this {@code Proj4Factory} as the {@code MathTransformFactory} implementation. */ final DefaultCoordinateOperationFactory opFactory() { DefaultCoordinateOperationFactory factory = opFactory; if (factory == null) { final Map<String,Object> properties = new HashMap<String,Object>(defaultProperties); properties.put(ReferencingServices.CRS_FACTORY, crsFactory); properties.put(ReferencingServices.CS_FACTORY, csFactory); properties.put(ReferencingServices.DATUM_FACTORY, datumFactory); factory = new DefaultCoordinateOperationFactory(properties, mtFactory); opFactory = factory; } return factory; }
/** * Returns the coordinate operation method for the given classification. * This method checks if the given {@code opFactory} is a SIS implementation * before to fallback on a slower fallback. * * @param opFactory The coordinate operation factory to use if it is a SIS implementation. * @param mtFactory The math transform factory to use as a fallback. * @param identifier The name or identifier of the operation method to search. * @return The coordinate operation method for the given name or identifier. * @throws FactoryException if an error occurred which searching for the given method. * * @since 0.6 */ @Override public OperationMethod getOperationMethod(final CoordinateOperationFactory opFactory, final MathTransformFactory mtFactory, final String identifier) throws FactoryException { if (opFactory instanceof DefaultCoordinateOperationFactory) { ((DefaultCoordinateOperationFactory) opFactory).getOperationMethod(identifier); } return super.getOperationMethod(opFactory, mtFactory, identifier); }
/** * Creates a projected CRS from the given parameters using the default factories. * * @param properties the name and other properties, to be given both to the conversion and the CRS. * @param baseCRS the base geographic CRS. * @param parameters the map projection parameters. * @param cs the projected coordinate system. * @return the projected coordinate reference system. * @throws FactoryException if an error occurred while creating the CRS. * * @since 0.8 */ public static ProjectedCRS createProjectedCRS(final Map<String,String> properties, final GeographicCRS baseCRS, final ParameterValueGroup parameters, final CartesianCS cs) throws FactoryException { final DefaultCoordinateOperationFactory factory = DefaultFactories.forBuildin( CoordinateOperationFactory.class, DefaultCoordinateOperationFactory.class); return DefaultFactories.forBuildin(CRSFactory.class).createProjectedCRS(properties, baseCRS, factory.createDefiningConversion(properties, factory.getOperationMethod(parameters.getDescriptor().getName().getCode()), parameters), cs); }
final Identifier name = descriptor.getName(); if (name != null) { method = factorySIS.getOperationMethod(name.getCode()); method = factorySIS.createOperationMethod(properties, sourceCRS.getCoordinateSystem().getDimension(), targetCRS.getCoordinateSystem().getDimension(), JDK8.replace(properties, IdentifiedObject.NAME_KEY, AXIS_CHANGES, IDENTITY); return factorySIS.createSingleOperation(properties, sourceCRS, targetCRS, null, method, transform);
} catch (IllegalArgumentException ex) { try { method = factorySIS.getOperationMethod(method.getName().getCode()); method = DefaultOperationMethod.redimension(method, sourceDimensions, targetDimensions); } catch (NoSuchIdentifierException | IllegalArgumentException se) { return factorySIS.createSingleOperation(properties, sourceCRS, targetCRS, AbstractCoordinateOperation.getInterpolationCRS(operation), method, transform);
/** * Finds or creates an operation for conversion or transformation between two coordinate reference systems. * If an operation exists, it is returned. If more than one operation exists, the operation having the widest * domain of validity is returned. If no operation exists, then an exception is thrown. * * <p>The default implementation delegates to <code>{@linkplain #createOperation(CoordinateReferenceSystem, * CoordinateReferenceSystem, CoordinateOperationContext) createOperation}(sourceCRS, targetCRS, null)}</code>.</p> * * @param sourceCRS input coordinate reference system. * @param targetCRS output coordinate reference system. * @return a coordinate operation from {@code sourceCRS} to {@code targetCRS}. * @throws OperationNotFoundException if no operation path was found from {@code sourceCRS} to {@code targetCRS}. * @throws FactoryException if the operation creation failed for some other reason. */ @Override public CoordinateOperation createOperation(final CoordinateReferenceSystem sourceCRS, final CoordinateReferenceSystem targetCRS) throws OperationNotFoundException, FactoryException { return createOperation(sourceCRS, targetCRS, (CoordinateOperationContext) null); }
op = new DefaultConcatenatedOperation(properties, operations, getMathTransformFactory()); } catch (IllegalArgumentException exception) { throw new InvalidGeodeticParameterException(exception.getLocalizedMessage(), exception); return createSingleOperation(merge, op.getSourceCRS(), op.getTargetCRS(), AbstractCoordinateOperation.getInterpolationCRS(op), ((SingleOperation) single).getMethod(), single.getMathTransform());
/** * Unsupported by the {@literal Proj.4} wrapper — delegates to the Apache SIS default factory. */ @Override public Conversion createDefiningConversion(Map<String,?> properties, OperationMethod method, ParameterValueGroup parameters) throws FactoryException { return opFactory().createDefiningConversion(properties, method, parameters); }
df = CoordinateOperations.factory(); return df.createSingleOperation(properties, sourceCRS, targetCRS, interpolationCRS, method, null);
} else { stepSourceCRS = toAuthorityDefinition(CoordinateReferenceSystem.class, factorySIS.getCRSFactory().createCompoundCRS(derivedFrom(sourceCRS), stepComponents)); op = (SingleOperation) subOperation; } else { op = factorySIS.createSingleOperation(properties, subOperation.getSourceCRS(), subOperation.getTargetCRS(), null, new DefaultOperationMethod(subTransform), subTransform);
final DefaultCoordinateOperationFactory factory = CoordinateOperations.factory(); try { return factory.createOperations(sourceCRS, targetCRS, context); } catch (UnavailableFactoryException e) { if (AuthorityFactories.failure(e)) { throw e; } else try { return Collections.singletonList(factory.createOperation(sourceCRS, targetCRS, context)); } catch (FactoryException ex) { ex.addSuppressed(e);
return createOperationFinder((registry instanceof CoordinateOperationAuthorityFactory) ? (CoordinateOperationAuthorityFactory) registry : null, context).createOperations(sourceCRS, targetCRS);
/** * Unsupported by the {@literal Proj.4} wrapper — delegates to the Apache SIS default factory. */ @Override public CoordinateOperation createConcatenatedOperation(Map<String,?> properties, CoordinateOperation... operations) throws FactoryException { return opFactory().createConcatenatedOperation(properties, operations); }
final Identifier name = descriptor.getName(); if (name != null) { method = factorySIS.getOperationMethod(name.getCode()); method = factorySIS.createOperationMethod(properties, sourceCRS.getCoordinateSystem().getDimension(), targetCRS.getCoordinateSystem().getDimension(), properties.replace(IdentifiedObject.NAME_KEY, AXIS_CHANGES, IDENTITY); return factorySIS.createSingleOperation(properties, sourceCRS, targetCRS, null, method, transform);
} catch (IllegalArgumentException ex) { try { method = factorySIS.getOperationMethod(method.getName().getCode()); method = DefaultOperationMethod.redimension(method, sourceDimensions, targetDimensions); } catch (NoSuchIdentifierException | IllegalArgumentException se) { return factorySIS.createSingleOperation(properties, sourceCRS, targetCRS, AbstractCoordinateOperation.getInterpolationCRS(operation), method, transform);
/** * Finds or creates an operation for conversion or transformation between two coordinate reference systems. * If an operation exists, it is returned. If more than one operation exists, the operation having the widest * domain of validity is returned. If no operation exists, then an exception is thrown. * * <p>The default implementation delegates to <code>{@linkplain #createOperation(CoordinateReferenceSystem, * CoordinateReferenceSystem, CoordinateOperationContext) createOperation}(sourceCRS, targetCRS, null)}</code>.</p> * * @param sourceCRS input coordinate reference system. * @param targetCRS output coordinate reference system. * @return a coordinate operation from {@code sourceCRS} to {@code targetCRS}. * @throws OperationNotFoundException if no operation path was found from {@code sourceCRS} to {@code targetCRS}. * @throws FactoryException if the operation creation failed for some other reason. */ @Override public CoordinateOperation createOperation(final CoordinateReferenceSystem sourceCRS, final CoordinateReferenceSystem targetCRS) throws OperationNotFoundException, FactoryException { return createOperation(sourceCRS, targetCRS, (CoordinateOperationContext) null); }
op = new DefaultConcatenatedOperation(properties, operations, getMathTransformFactory()); } catch (IllegalArgumentException exception) { throw new InvalidGeodeticParameterException(exception.getLocalizedMessage(), exception); return createSingleOperation(merge, op.getSourceCRS(), op.getTargetCRS(), AbstractCoordinateOperation.getInterpolationCRS(op), ((SingleOperation) single).getMethod(), single.getMathTransform());
final Object alias = properties.put(Conversion.ALIAS_KEY, null); final Object identifier = properties.put(Conversion.IDENTIFIERS_KEY, null); final Conversion conversion = getCoordinateOperationFactory().createDefiningConversion(properties, method, parameters);
df = CoordinateOperations.factory(); return df.createSingleOperation(properties, sourceCRS, targetCRS, interpolationCRS, method, null);
} else { stepSourceCRS = toAuthorityDefinition(CoordinateReferenceSystem.class, factorySIS.getCRSFactory().createCompoundCRS(derivedFrom(sourceCRS), stepComponents)); op = (SingleOperation) subOperation; } else { op = factorySIS.createSingleOperation(properties, subOperation.getSourceCRS(), subOperation.getTargetCRS(), null, new DefaultOperationMethod(subTransform), subTransform);