createSizeDimMeas method
Creates a {@link CoordinateSequence} of the specified size and dimension with measure support. For this to be useful, the {@link CoordinateSequence} implementation must be mutable.
If the requested dimension or measures are larger than the CoordinateSequence implementation can provide, then a sequence of maximum possible dimension should be created. An error should not be thrown.
@param size the number of coordinates in the sequence @param dimension the dimension of the coordinates in the sequence (if user-specifiable, otherwise ignored) @param measures the number of measures of the coordinates in the sequence (if user-specifiable, otherwise ignored)
Implementation
CoordinateSequence createSizeDimMeas(int size, int dimension, int measures) {
int spatial = dimension - measures;
if (measures > 1) {
measures = 1; // clip measures
//throw IllegalArgumentException("measures must be <= 1");
}
if ((spatial) > 3) {
spatial = 3; // clip spatial dimension
//throw IllegalArgumentException("spatial dimension must be <= 3");
}
if (spatial < 2) spatial = 2; // handle bogus spatial dimension
return CoordinateArraySequence.fromSizeDimensionMeasures(
size, spatial + measures, measures);
}