@Test public void testParameterNames() throws FactoryException { final Map<String,Integer> names = new LinkedHashMap<>(); for (final Class<? extends Projection> type : projections) { final Projection projection; try { projection = type.getConstructor().newInstance(); } catch (ReflectiveOperationException e) { throw new AssertionError(e); } final String projectionName = projection.getClassName(); if (projectionName.equalsIgnoreCase("LatLonProjection")) { continue; } names.clear(); for (final Parameter param : projection.getProjectionParameters()) { final String parameterName = param.getName(); if (names.put(parameterName, param.isString() ? 1 : param.getLength()) != null) { fail("Duplicated \"" + parameterName + "\" parameter in \"" + projectionName + "\" projection."); } } if (names.remove(CF.GRID_MAPPING_NAME) == null) { fail("Missing \"" + CF.GRID_MAPPING_NAME + "\" parameter in \"" + projectionName + "\" projection."); } final ParameterValueGroup group = factory.getDefaultParameters(projectionName); validators.validate(group); for (final GeneralParameterValue param : group.values()) { String parameterName = param.getDescriptor().getName().getCode(); final int s = parameterName.lastIndexOf('['); if (s >= 0) { parameterName = parameterName.substring(0, s); } final Integer count = names.remove(parameterName); if (count != null) { final int n = count - 1; if (n != 0) { assertNull(names.put(parameterName, n)); } } else if (!isIgnorable(parameterName)) { fail("Unknown \"" + parameterName + "\" parameter in \"" + projectionName + "\" projection."); } } assertTrue("Missing parameter in \"" + projectionName + "\" projection: " + names, names.isEmpty()); } }
@Override public ParameterValueGroup getDefaultParameters(final String method) throws NoSuchIdentifierException { final ProjectionProvider<?> provider = providers.get(method); if (provider != null) { return provider.createValue(); } throw new NoSuchIdentifierException("Projection \"" + method + "\" not found.", method); }
NetcdfTransformFactory implements MathTransformFactory { @Override public ParameterValueGroup getDefaultParameters(final String method) throws NoSuchIdentifierException { final ProjectionProvider<?> provider = providers.get(method); if (provider != null) { return provider.createValue(); } throw new NoSuchIdentifierException("Projection \"" + method + "\" not found.", method); } }
NetcdfTransformFactory implements MathTransformFactory { @Override public ParameterValueGroup getDefaultParameters(final String method) throws NoSuchIdentifierException { final ProjectionProvider<?> provider = providers.get(method); if (provider != null) { return provider.createValue(); } throw new NoSuchIdentifierException("Projection \"" + method + "\" not found.", method); } NetcdfTransformFactory(); }
NetcdfTransformFactory implements MathTransformFactory { @Override public ParameterValueGroup getDefaultParameters(final String method) throws NoSuchIdentifierException { final ProjectionProvider<?> provider = providers.get(method); if (provider != null) { return provider.createValue(); } throw new NoSuchIdentifierException("Projection \"" + method + "\" not found.", method); } NetcdfTransformFactory(); @Override Citation getVendor(); @Override Set<OperationMethod> getAvailableMethods(final Class<? extends SingleOperation> type); @Override OperationMethod getLastMethodUsed(); @Override ParameterValueGroup getDefaultParameters(final String method); @Override MathTransform createBaseToDerived(final CoordinateReferenceSystem baseCRS,
                                             final ParameterValueGroup parameters,
                                             final CoordinateSystem derivedCS); @Override MathTransform createParameterizedTransform(final ParameterValueGroup parameters); @Override MathTransform createAffineTransform(final Matrix matrix); @Override MathTransform createConcatenatedTransform(final MathTransform transform1,
                                                     final MathTransform transform2); @Override MathTransform createPassThroughTransform(final int firstAffectedCoordinate,
                                                    final MathTransform subTransform,
                                                    final int numTrailingCoordinates); @Override MathTransform createFromWKT(final String wkt); }
NetcdfTransformFactory implements MathTransformFactory { @Override public ParameterValueGroup getDefaultParameters(final String method) throws NoSuchIdentifierException { final ProjectionProvider<?> provider = providers.get(method); if (provider != null) { return provider.createValue(); } throw new NoSuchIdentifierException("Projection \"" + method + "\" not found.", method); } NetcdfTransformFactory(); @Override Citation getVendor(); @Override Set<OperationMethod> getAvailableMethods(final Class<? extends SingleOperation> type); @Override OperationMethod getLastMethodUsed(); @Override ParameterValueGroup getDefaultParameters(final String method); @Override MathTransform createBaseToDerived(final CoordinateReferenceSystem baseCRS,
                                             final ParameterValueGroup parameters,
                                             final CoordinateSystem derivedCS); @Override MathTransform createParameterizedTransform(final ParameterValueGroup parameters); @Override MathTransform createAffineTransform(final Matrix matrix); @Override MathTransform createConcatenatedTransform(final MathTransform transform1,
                                                     final MathTransform transform2); @Override MathTransform createPassThroughTransform(final int firstAffectedCoordinate,
                                                    final MathTransform subTransform,
                                                    final int numTrailingCoordinates); @Override MathTransform createFromWKT(final String wkt);  }