use of org.apache.sis.util.Debug in project sis by apache.
the class LinearTransformBuilder method toString.
/**
* Returns a string representation of this builder for debugging purpose.
*
* @return a string representation of this builder.
*/
@Debug
@Override
public String toString() {
final StringBuilder buffer = new StringBuilder(Classes.getShortClassName(this)).append('[');
if (sources != null) {
buffer.append(sources[0].length).append(" points");
}
buffer.append(']');
if (transform != null) {
final String lineSeparator = System.lineSeparator();
buffer.append(':').append(lineSeparator);
final TableAppender table = new TableAppender(buffer, " ");
table.setMultiLinesCells(true);
table.append(Matrices.toString(transform.getMatrix())).nextColumn();
table.append(lineSeparator).append(" ").append(Vocabulary.format(Vocabulary.Keys.Correlation)).append(" =").nextColumn();
table.append(Matrices.create(correlation.length, 1, correlation).toString());
try {
table.flush();
} catch (IOException e) {
// Should never happen since we wrote into a StringBuilder.
throw new AssertionError(e);
}
}
return buffer.toString();
}
use of org.apache.sis.util.Debug 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;
}
use of org.apache.sis.util.Debug in project sis by apache.
the class NormalizedProjection method getParameterValues.
/**
* Returns a copy of non-linear internal parameter values of this {@code NormalizedProjection}.
* The returned group contains at least the {@link #eccentricity} parameter value.
* Some subclasses add more non-linear parameters, but most of them do not because many parameters
* like the <cite>scale factor</cite> or the <cite>false easting/northing</cite> are handled by the
* {@linkplain ContextualParameters#getMatrix (de)normalization affine transforms} instead.
*
* <div class="note"><b>Note:</b>
* This method is mostly for {@linkplain org.apache.sis.io.wkt.Convention#INTERNAL debugging purposes}
* since the isolation of non-linear parameters in this class is highly implementation dependent.
* Most GIS applications will instead be interested in the {@linkplain #getContextualParameters()
* contextual parameters}.</div>
*
* @return a copy of the internal parameter values for this normalized projection.
*/
@Debug
@Override
public ParameterValueGroup getParameterValues() {
final ParameterValueGroup group = getParameterDescriptors().createValue();
group.parameter("eccentricity").setValue(eccentricity);
final String[] names = getInternalParameterNames();
final double[] values = getInternalParameterValues();
for (int i = 0; i < names.length; i++) {
group.parameter(names[i]).setValue(values[i]);
}
return group;
}
use of org.apache.sis.util.Debug 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;
}
}
use of org.apache.sis.util.Debug in project sis by apache.
the class EllipsoidToCentricTransform method getParameterValues.
/**
* Returns a copy of internal parameter values of this {@code EllipsoidToCentricTransform} transform.
* The returned group contains parameter values for the number of dimensions and the eccentricity.
*
* <div class="note"><b>Note:</b>
* this method is mostly for {@linkplain org.apache.sis.io.wkt.Convention#INTERNAL debugging purposes}
* since the isolation of non-linear parameters in this class is highly implementation dependent.
* Most GIS applications will instead be interested in the {@linkplain #getContextualParameters()
* contextual parameters}.</div>
*
* @return a copy of the internal parameter values for this transform.
*/
@Debug
@Override
public ParameterValueGroup getParameterValues() {
final Parameters pg = Parameters.castOrWrap(getParameterDescriptors().createValue());
pg.getOrCreate(ECCENTRICITY).setValue(sqrt(eccentricitySquared));
pg.parameter("target").setValue(getTargetType());
pg.getOrCreate(DIMENSION).setValue(getSourceDimensions());
return pg;
}
Aggregations