Permalink
Browse files

add parameter for multiple input transparent colors

  • Loading branch information...
1 parent 3fb7487 commit f4b4a695f425c1c60c375fe3af1b3b5e34499e2e Sebastian Graca committed Sep 22, 2012
@@ -19,6 +19,7 @@
import java.awt.Color;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import javax.imageio.ImageWriteParam;
@@ -31,6 +32,7 @@
import org.geotools.parameter.DefaultParameterDescriptor;
import org.geotools.referencing.crs.DefaultEngineeringCRS;
import org.geotools.referencing.factory.epsg.CartesianAuthorityFactory;
+import org.geotools.util.Utilities;
import org.opengis.coverage.grid.Format;
import org.opengis.coverage.grid.GridCoverageReader;
import org.opengis.coverage.grid.GridCoverageWriter;
@@ -188,6 +190,10 @@
public static final ParameterDescriptor<Color> INPUT_TRANSPARENT_COLOR = new DefaultParameterDescriptor<Color>(
"InputTransparentColor", Color.class, null, null);
+ /** Control the transparency of the input coverages (allows to set multiple transparent colors). */
+ public static final ParameterDescriptor<Set<Color>> INPUT_TRANSPARENT_COLORS = new DefaultParameterDescriptor<Set<Color>>(
+ "InputTransparentColors", Utilities.<Class<Set<Color>>>cast(Set.class), null, null);
+
/** Control the background color to be used where the input was transparent */
public static final ParameterDescriptor<Color> BACKGROUND_COLOR = new DefaultParameterDescriptor<Color>(
"BackgroundColor", Color.class, null, null);
@@ -148,6 +148,20 @@ protected Object readResolve() throws ObjectStreamException {
*/
private Utilities() {
}
+
+ /**
+ * Casts passed value to inferred type T.
+ *
+ * Can be used to eliminate usge of {@code @SuppressWarnings("unchecked")} in code.
+ *
+ * @param obj an object to be cast to type T.
+ *
+ * @return the object cast to type T.
+ */
+ @SuppressWarnings("unchecked")
+ public static <T> T cast(Object obj) {
+ return (T)obj;
+ }
/**
* Returns {@code true} if the given booleans are equals. This overloaded flavor is provided

0 comments on commit f4b4a69

Please sign in to comment.