/** * Returns a SIS operation method implementation with the same values than the given arbitrary implementation. * If the given object is {@code null}, then {@code null} is returned. * Otherwise if the given object is already a SIS implementation, then the given object is returned unchanged. * Otherwise a new SIS implementation is created and initialized to the attribute values of the given object. * * @param object the object to get as a SIS implementation, or {@code null} if none. * @return a SIS implementation containing the values of the given object (may be the * given object itself), or {@code null} if the argument was null. */ public static DefaultOperationMethod castOrCopy(final OperationMethod object) { return (object == null) || (object instanceof DefaultOperationMethod) ? (DefaultOperationMethod) object : new DefaultOperationMethod(object); }
/** * Returns a SIS operation method implementation with the same values than the given arbitrary implementation. * If the given object is {@code null}, then {@code null} is returned. * Otherwise if the given object is already a SIS implementation, then the given object is returned unchanged. * Otherwise a new SIS implementation is created and initialized to the attribute values of the given object. * * @param object the object to get as a SIS implementation, or {@code null} if none. * @return a SIS implementation containing the values of the given object (may be the * given object itself), or {@code null} if the argument was null. */ public static DefaultOperationMethod castOrCopy(final OperationMethod object) { return (object == null) || (object instanceof DefaultOperationMethod) ? (DefaultOperationMethod) object : new DefaultOperationMethod(object); }
static OperationMethod wrap(final ParameterDescriptorGroup descriptor) { return new DefaultOperationMethod(singletonMap(DefaultOperationMethod.NAME_KEY, "Test"), 2, 2, descriptor); }
/** * Creates a new conversion between two types of coordinate system. * Subclasses may need to invoke {@link ContextualParameters#normalizeGeographicInputs(double)} * or {@link ContextualParameters#denormalizeGeographicOutputs(double)} after this constructor. */ CoordinateSystemTransform(final String method, final int dimension) { this.dimension = dimension; final Map<String,?> properties = Collections.singletonMap(DefaultOperationMethod.NAME_KEY, new ImmutableIdentifier(Citations.SIS, Constants.SIS, method)); context = new ContextualParameters(new DefaultOperationMethod(properties, dimension, dimension, new DefaultParameterDescriptorGroup(properties, 1, 1))); }
/** * Creates an instance to use for testing purpose. */ private static ContextualParameters create(final int srcDim, final int dstDim) { return new ContextualParameters(new DefaultOperationMethod( Collections.singletonMap(DefaultOperationMethod.NAME_KEY, "Test method"), srcDim, dstDim, DefaultParameterDescriptorGroupTest.M1_M1_O1_O2)); }
/** * Creates a new conversion between two types of coordinate system. * Subclasses may need to invoke {@link ContextualParameters#normalizeGeographicInputs(double)} * or {@link ContextualParameters#denormalizeGeographicOutputs(double)} after this constructor. */ CoordinateSystemTransform(final String method, final int dimension) { this.dimension = dimension; final Map<String,?> properties = Collections.singletonMap(DefaultOperationMethod.NAME_KEY, new ImmutableIdentifier(Citations.SIS, Constants.SIS, method)); context = new ContextualParameters(new DefaultOperationMethod(properties, dimension, dimension, new DefaultParameterDescriptorGroup(properties, 1, 1))); }
method = new DefaultOperationMethod(properties, sourceDimensions, targetDimensions, parameters); } catch (IllegalArgumentException exception) { throw new InvalidGeodeticParameterException(exception.getLocalizedMessage(), exception);
/** * Creates a dummy operation method of the given dimensions. */ private static OperationMethod createOperationMethod(final int sourceDimension, final int targetDimension) { final ParameterDescriptorGroup parameters = new DefaultParameterDescriptorGroup( Collections.singletonMap(ParameterDescriptorGroup.NAME_KEY, "Dummy"), 1, 1); return new DefaultOperationMethod(Collections.singletonMap(OperationMethod.NAME_KEY, parameters.getName()), sourceDimension, targetDimension, parameters); }
method = new DefaultOperationMethod(properties, sourceDimensions, targetDimensions, parameters); } catch (IllegalArgumentException exception) { throw new InvalidGeodeticParameterException(exception.getLocalizedMessage(), exception);
/** * Work around for RFE #4093999 in Sun's bug database * ("Relax constraint on placement of this()/super() call in constructors"). */ @Workaround(library="JDK", version="1.7") private NoOp(final Parameters parameters) { super(new Initializer(new DefaultOperationMethod( Collections.singletonMap(DefaultOperationMethod.NAME_KEY, parameters.getDescriptor().getName()), 2, 2, parameters.getDescriptor()), parameters, Collections.emptyMap(), (byte) 0)); super.computeCoefficients(); }
method.getName().getCode(), sourceDimensions, targetDimensions)); return new DefaultOperationMethod(method, sourceDimensions, targetDimensions);
method.getName().getCode(), sourceDimensions, targetDimensions)); return new DefaultOperationMethod(method, sourceDimensions, targetDimensions);
assertNull(properties.put(OperationMethod.IDENTIFIERS_KEY, new ImmutableIdentifier(Citations.EPSG, "EPSG", identifier))); assertNull(properties.put(OperationMethod.FORMULA_KEY, new DefaultCitation(formula))); return new DefaultOperationMethod(properties, dimension, dimension, pg);
/** * Creates the test operation method. */ private static DefaultOperationMethod createMercatorMethod() { final ParameterBuilder builder = new ParameterBuilder(); builder.setCodeSpace(EPSG, "EPSG").setRequired(true); ParameterDescriptor<?>[] parameters = { builder.addIdentifier("8801").addName("Latitude of natural origin" ).create(0, Units.DEGREE), builder.addIdentifier("8802").addName("Longitude of natural origin").create(0, Units.DEGREE) // There is more parameters for a Mercator projection, but 2 is enough for this test. }; builder.addName(null, "Mercator (1SP)"); final ParameterDescriptorGroup descriptor = builder.createGroup(parameters); final Map<String,Object> properties = new HashMap<>(4); properties.put(DefaultOperationMethod.NAME_KEY, descriptor.getName()); properties.put(DefaultOperationMethod.FORMULA_KEY, new DefaultFormula("See EPSG guide.")); return new DefaultOperationMethod(properties, 2, 2, descriptor); }
Map<String,Object> properties = createProperties("Coordinate_Operation Method", name, epsg, remarks, deprecated); final OperationMethod method = new DefaultOperationMethod(properties, dim[0], dim[1], new DefaultParameterDescriptorGroup(properties, 1, 1, descriptors)); returnValue = ensureSingleton(method, returnValue, code);
Map<String,Object> properties = createProperties("Coordinate_Operation Method", name, epsg, remarks, deprecated); final OperationMethod method = new DefaultOperationMethod(properties, dim[0], dim[1], new DefaultParameterDescriptorGroup(properties, 1, 1, descriptors)); returnValue = ensureSingleton(method, returnValue, code);
op = factorySIS.createSingleOperation(properties, subOperation.getSourceCRS(), subOperation.getTargetCRS(), null, new DefaultOperationMethod(subTransform), subTransform);
op = factorySIS.createSingleOperation(properties, subOperation.getSourceCRS(), subOperation.getTargetCRS(), null, new DefaultOperationMethod(subTransform), subTransform);