Search in sources :

Example 6 with ParameterBuilder

use of org.apache.sis.parameter.ParameterBuilder in project sis by apache.

the class NormalizedProjection method getParameterDescriptors.

/**
 * Returns a description of the non-linear internal parameters of this {@code NormalizedProjection}.
 * The returned group contains at least a descriptor for the {@link #eccentricity} parameter.
 * Subclasses may add more parameters.
 *
 * <p>This method is for inspecting the parameter values of this non-linear kernel only,
 * not for inspecting the {@linkplain #getContextualParameters() contextual parameters}.
 * Inspecting the kernel parameter values is usually for debugging purpose only.</p>
 *
 * @return a description of the internal parameters.
 */
@Debug
@Override
public ParameterDescriptorGroup getParameterDescriptors() {
    Class<?> type = getClass();
    while (!Modifier.isPublic(type.getModifiers())) {
        type = type.getSuperclass();
    }
    ParameterDescriptorGroup group;
    synchronized (DESCRIPTORS) {
        group = DESCRIPTORS.get(type);
        if (group == null) {
            final ParameterBuilder builder = new ParameterBuilder().setRequired(true);
            if (type.getName().startsWith(Modules.CLASSNAME_PREFIX)) {
                builder.setCodeSpace(Citations.SIS, Constants.SIS);
            }
            final String[] names = getInternalParameterNames();
            final ParameterDescriptor<?>[] parameters = new ParameterDescriptor<?>[names.length + 1];
            parameters[0] = MapProjection.ECCENTRICITY;
            for (int i = 1; i < parameters.length; i++) {
                parameters[i] = builder.addName(names[i - 1]).create(Double.class, null);
            }
            group = builder.addName(CharSequences.camelCaseToSentence(type.getSimpleName()) + " (radians domain)").createGroup(1, 1, parameters);
            DESCRIPTORS.put(type, group);
        }
    }
    return group;
}
Also used : ParameterDescriptorGroup(org.opengis.parameter.ParameterDescriptorGroup) ParameterDescriptor(org.opengis.parameter.ParameterDescriptor) ParameterBuilder(org.apache.sis.parameter.ParameterBuilder) Debug(org.apache.sis.util.Debug)

Example 7 with ParameterBuilder

use of org.apache.sis.parameter.ParameterBuilder in project sis by apache.

the class EllipsoidToCentricTransform method getParameterDescriptors.

/**
 * Returns a description of the internal parameters of this {@code EllipsoidToCentricTransform} transform.
 * The returned group contains parameter descriptors for the number of dimensions and the eccentricity.
 *
 * @return a description of the internal parameters.
 */
@Debug
@Override
public ParameterDescriptorGroup getParameterDescriptors() {
    synchronized (EllipsoidToCentricTransform.class) {
        if (DESCRIPTOR == null) {
            final ParameterBuilder builder = new ParameterBuilder().setCodeSpace(Citations.SIS, Constants.SIS);
            final ParameterDescriptor<TargetType> target = builder.setRequired(true).addName("target").create(TargetType.class, TargetType.CARTESIAN);
            DESCRIPTOR = builder.addName("Ellipsoid (radians domain) to centric").createGroup(1, 1, ECCENTRICITY, target, DIMENSION);
        }
        return DESCRIPTOR;
    }
}
Also used : ParameterBuilder(org.apache.sis.parameter.ParameterBuilder) Debug(org.apache.sis.util.Debug)

Aggregations

ParameterBuilder (org.apache.sis.parameter.ParameterBuilder)7 ParameterDescriptor (org.opengis.parameter.ParameterDescriptor)4 Debug (org.apache.sis.util.Debug)3 GeneralParameterDescriptor (org.opengis.parameter.GeneralParameterDescriptor)2 ParameterDescriptorGroup (org.opengis.parameter.ParameterDescriptorGroup)2 HashMap (java.util.HashMap)1 DefaultParameterDescriptor (org.apache.sis.parameter.DefaultParameterDescriptor)1 Parameters (org.apache.sis.parameter.Parameters)1 Workaround (org.apache.sis.util.Workaround)1 ParameterValueGroup (org.opengis.parameter.ParameterValueGroup)1