Sorry Ian, getting muddle between your proposal text and the subsequent API
change section.

Reviewing both together, you are not just talking about changing from
CodeList values to Strings, you are talking about changing ContrastMethod
to a class ... with a type and some of those types need parameters so you
have a couple of expressions.

Rather than go turtles all the way down (since ContrastMethod was
originally a String of just this nature for ContrastEnhancement) can we
take this back up a notch. I ask this in part due to the change to the
StyleVisitor required by your proposal. We have a lot of style visitors not
all of which are covered by abstract classes.

Going to revise my vote to -1 due to the change to StyleVisitor being too
invasive.

Here is an alternative for discussion:

public interface ContrastEnhancement {

  public static String GAMMA = "GAMMA";
  public static String MIN_VALUE = "minValue"; // used for ConstrastMethod.
NORMALIZE
  public static String MAX_VALUE = "maxValue"; // used for ConstrastMethod.
NORMALIZE
  public static String NORMALIZATION_FACTOR"= "normalizationFactor";
  public static String CORRETION_FACTOR = "correctionFactor";

  public ContrastMethod getMethod(); // Literal value of
getConstrastMethod() or NONE
  public Expression getConstractMethod();
  public Expression getGammaValue(); // short cut for
getParameters().get("GAMMA")
  public Expression getAlgorithm(); // one of StretchToMinimumMaximum,
ClipToMinimumMaximum, ClipToZeroMaximum
  public Map<String, Expression> getParameters();
}

Where ContrastMethod remains a code list:

public final class ContrastMethod extends CodeList<ContrastMethod> {
    public static final ContrastMethod NORMALIZE = new
ContrastMethod("NORMALIZE");
    public static final ContrastMethod HISTOGRAM = new
ContrastMethod("HISTOGRAM");
    public static final ContrastMethod NONE = new ContrastMethod("NONE");
    public static final ContrastMethod LOGARITHMIC = new
ContrastMethod("LOGARITHMIC");
    public static final ContrastMethod EXPONENTIAL = new
ContrastMethod("EXPONENTIAL");
}

Writing this out the result is much less invasive, I think you could
introduce ContrastMethod.NORMALIZE (this is stretch to min /
max), ContrastMethod.NORMALIZE_CLIP (this is clip to min max),
ContrastMethod.NORMALIZE_CLIP_FROM_ZERO (this is eclipse to zero max) and
avoid the getAlgorithm() method completely with no loss of expressive power.

Please consider the above suggestion, it is a shame you were not in the
meeting today - let me know if you would like a quick Skype chat to burn
through this.
------------------------------------------------------------------------------
_______________________________________________
GeoTools-Devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to