Skip to content

Commit

Permalink
add parameter for multiple input transparent colors
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Graca committed Sep 22, 2012
1 parent 3fb7487 commit f4b4a69
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Expand Up @@ -19,6 +19,7 @@
import java.awt.Color; import java.awt.Color;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;


import javax.imageio.ImageWriteParam; import javax.imageio.ImageWriteParam;


Expand All @@ -31,6 +32,7 @@
import org.geotools.parameter.DefaultParameterDescriptor; import org.geotools.parameter.DefaultParameterDescriptor;
import org.geotools.referencing.crs.DefaultEngineeringCRS; import org.geotools.referencing.crs.DefaultEngineeringCRS;
import org.geotools.referencing.factory.epsg.CartesianAuthorityFactory; import org.geotools.referencing.factory.epsg.CartesianAuthorityFactory;
import org.geotools.util.Utilities;
import org.opengis.coverage.grid.Format; import org.opengis.coverage.grid.Format;
import org.opengis.coverage.grid.GridCoverageReader; import org.opengis.coverage.grid.GridCoverageReader;
import org.opengis.coverage.grid.GridCoverageWriter; import org.opengis.coverage.grid.GridCoverageWriter;
Expand Down Expand Up @@ -188,6 +190,10 @@ public abstract class AbstractGridFormat implements Format {
public static final ParameterDescriptor<Color> INPUT_TRANSPARENT_COLOR = new DefaultParameterDescriptor<Color>( public static final ParameterDescriptor<Color> INPUT_TRANSPARENT_COLOR = new DefaultParameterDescriptor<Color>(
"InputTransparentColor", Color.class, null, null); "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 */ /** Control the background color to be used where the input was transparent */
public static final ParameterDescriptor<Color> BACKGROUND_COLOR = new DefaultParameterDescriptor<Color>( public static final ParameterDescriptor<Color> BACKGROUND_COLOR = new DefaultParameterDescriptor<Color>(
"BackgroundColor", Color.class, null, null); "BackgroundColor", Color.class, null, null);
Expand Down
Expand Up @@ -148,6 +148,20 @@ protected Object readResolve() throws ObjectStreamException {
*/ */
private Utilities() { 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 * Returns {@code true} if the given booleans are equals. This overloaded flavor is provided
Expand Down

0 comments on commit f4b4a69

Please sign in to comment.