Search in sources :

Example 11 with ContrastEnhancement

use of org.geotools.styling.ContrastEnhancement in project sldeditor by robward-scisys.

the class VOGeoServerContrastEnhancementNormalizeGreyTest method createChannelSelectionError.

/**
 * Creates the channel selection error object.
 *
 * @param styleFactory the style factory
 * @param contrastMethod the contrast method
 * @return the channel selection
 */
private ChannelSelection createChannelSelectionError(StyleFactoryImpl styleFactory, ContrastMethod contrastMethod) {
    ContrastEnhancement contrastEnhancement = (ContrastEnhancement) styleFactory.contrastEnhancement(null, contrastMethod.name());
    FilterFactory ff = CommonFactoryFinder.getFilterFactory();
    Map<String, Expression> options = contrastEnhancement.getOptions();
    options.put("algorithm", ff.literal("TestStretchToMinimumMaximum"));
    options.put("minValue", ff.literal("1.0"));
    options.put("maxValue", ff.literal("5.0"));
    SelectedChannelType channelType = styleFactory.createSelectedChannelType("channel name", contrastEnhancement);
    SelectedChannelType[] channels = new SelectedChannelType[3];
    channels[0] = channelType;
    channels[1] = channelType;
    channels[2] = channelType;
    ChannelSelection channelSelection = styleFactory.createChannelSelection(channels);
    return channelSelection;
}
Also used : SelectedChannelType(org.geotools.styling.SelectedChannelType) ContrastEnhancement(org.geotools.styling.ContrastEnhancement) Expression(org.opengis.filter.expression.Expression) ChannelSelection(org.geotools.styling.ChannelSelection) FilterFactory(org.opengis.filter.FilterFactory)

Example 12 with ContrastEnhancement

use of org.geotools.styling.ContrastEnhancement in project sldeditor by robward-scisys.

the class VOGeoServerContrastEnhancementNormalizeOverallTest method createChannelSelectionError.

/**
 * Creates the channel selection error object.
 *
 * @param styleFactory the style factory
 * @param contrastMethod the contrast method
 * @return the channel selection
 */
private ChannelSelection createChannelSelectionError(StyleFactoryImpl styleFactory, ContrastMethod contrastMethod) {
    ContrastEnhancement contrastEnhancement = (ContrastEnhancement) styleFactory.contrastEnhancement(null, contrastMethod.name());
    FilterFactory ff = CommonFactoryFinder.getFilterFactory();
    Map<String, Expression> options = contrastEnhancement.getOptions();
    options.put("algorithm", ff.literal("TestStretchToMinimumMaximum"));
    options.put("minValue", ff.literal("1.0"));
    options.put("maxValue", ff.literal("5.0"));
    SelectedChannelType channelType = styleFactory.createSelectedChannelType("channel name", contrastEnhancement);
    SelectedChannelType[] channels = new SelectedChannelType[3];
    channels[0] = channelType;
    channels[1] = channelType;
    channels[2] = channelType;
    ChannelSelection channelSelection = styleFactory.createChannelSelection(channels);
    return channelSelection;
}
Also used : SelectedChannelType(org.geotools.styling.SelectedChannelType) ContrastEnhancement(org.geotools.styling.ContrastEnhancement) Expression(org.opengis.filter.expression.Expression) ChannelSelection(org.geotools.styling.ChannelSelection) FilterFactory(org.opengis.filter.FilterFactory)

Example 13 with ContrastEnhancement

use of org.geotools.styling.ContrastEnhancement in project sldeditor by robward-scisys.

the class VOGeoServerContrastEnhancementNormalizeOverallTest method createChannelSelection.

/**
 * Creates the channel selection object.
 *
 * @param styleFactory the style factory
 * @param contrastMethod the contrast method
 * @return the channel selection
 */
private ChannelSelection createChannelSelection(StyleFactoryImpl styleFactory, ContrastMethod contrastMethod) {
    ContrastEnhancement contrastEnhancement = (ContrastEnhancement) styleFactory.contrastEnhancement(null, contrastMethod.name());
    FilterFactory ff = CommonFactoryFinder.getFilterFactory();
    Map<String, Expression> options = contrastEnhancement.getOptions();
    options.put("algorithm", ff.literal("StretchToMinimumMaximum"));
    options.put("minValue", ff.literal("1"));
    options.put("maxValue", ff.literal("5"));
    SelectedChannelType channelType = styleFactory.createSelectedChannelType("channel name", contrastEnhancement);
    SelectedChannelType[] channels = new SelectedChannelType[3];
    channels[0] = channelType;
    channels[1] = channelType;
    channels[2] = channelType;
    ChannelSelection channelSelection = styleFactory.createChannelSelection(channels);
    return channelSelection;
}
Also used : SelectedChannelType(org.geotools.styling.SelectedChannelType) ContrastEnhancement(org.geotools.styling.ContrastEnhancement) Expression(org.opengis.filter.expression.Expression) ChannelSelection(org.geotools.styling.ChannelSelection) FilterFactory(org.opengis.filter.FilterFactory)

Example 14 with ContrastEnhancement

use of org.geotools.styling.ContrastEnhancement in project sldeditor by robward-scisys.

the class VOGeoServerContrastEnhancementNormalizeRedTest method createChannelSelection.

/**
 * Creates the channel selection object.
 *
 * @param styleFactory the style factory
 * @param contrastMethod the contrast method
 * @return the channel selection
 */
private ChannelSelection createChannelSelection(StyleFactoryImpl styleFactory, ContrastMethod contrastMethod) {
    ContrastEnhancement contrastEnhancement = (ContrastEnhancement) styleFactory.contrastEnhancement(null, contrastMethod.name());
    FilterFactory ff = CommonFactoryFinder.getFilterFactory();
    Map<String, Expression> options = contrastEnhancement.getOptions();
    options.put("algorithm", ff.literal("StretchToMinimumMaximum"));
    options.put("minValue", ff.literal("1"));
    options.put("maxValue", ff.literal("5"));
    SelectedChannelType channelType = styleFactory.createSelectedChannelType("channel name", contrastEnhancement);
    SelectedChannelType[] channels = new SelectedChannelType[3];
    channels[0] = channelType;
    channels[1] = channelType;
    channels[2] = channelType;
    ChannelSelection channelSelection = styleFactory.createChannelSelection(channels);
    return channelSelection;
}
Also used : SelectedChannelType(org.geotools.styling.SelectedChannelType) ContrastEnhancement(org.geotools.styling.ContrastEnhancement) Expression(org.opengis.filter.expression.Expression) ChannelSelection(org.geotools.styling.ChannelSelection) FilterFactory(org.opengis.filter.FilterFactory)

Example 15 with ContrastEnhancement

use of org.geotools.styling.ContrastEnhancement in project sldeditor by robward-scisys.

the class RasterSymbolizerDetails method populateContrastEnhancementGroup.

/**
 * Populate contrast enhancement group.
 *
 * @param channelGroup the channel group
 * @param nameField the name field
 * @param contrastGroup the contrast group
 * @param gammaField the gamma field
 * @param methodField the method field
 * @param channelType the channel type
 */
private void populateContrastEnhancementGroup(GroupIdEnum channelGroup, FieldIdEnum nameField, GroupIdEnum contrastGroup, FieldIdEnum gammaField, GroupIdEnum methodField, SelectedChannelType channelType) {
    String name = "";
    if (channelType != null) {
        name = channelType.getChannelName();
    }
    fieldConfigVisitor.populateTextField(nameField, name);
    GroupConfigInterface contrastGrp = getGroup(contrastGroup);
    ContrastEnhancement contrastEnhancement = null;
    if (channelType != null) {
        contrastEnhancement = channelType.getContrastEnhancement();
    }
    contrastGrp.enable(contrastEnhancement != null);
    if (contrastEnhancement != null) {
        fieldConfigVisitor.populateField(gammaField, contrastEnhancement.getGammaValue());
        populateContrastMethod(contrastEnhancement, methodField);
    }
}
Also used : ContrastEnhancement(org.geotools.styling.ContrastEnhancement) GroupConfigInterface(com.sldeditor.ui.detail.config.base.GroupConfigInterface)

Aggregations

ContrastEnhancement (org.geotools.styling.ContrastEnhancement)19 SelectedChannelType (org.geotools.styling.SelectedChannelType)16 ChannelSelection (org.geotools.styling.ChannelSelection)14 Expression (org.opengis.filter.expression.Expression)14 FilterFactory (org.opengis.filter.FilterFactory)12 GroupConfigInterface (com.sldeditor.ui.detail.config.base.GroupConfigInterface)5 MultiOptionGroup (com.sldeditor.ui.detail.config.base.MultiOptionGroup)4 RasterSymbolizer (org.geotools.styling.RasterSymbolizer)4 OptionGroup (com.sldeditor.ui.detail.config.base.OptionGroup)3 GraphicPanelFieldManager (com.sldeditor.ui.detail.GraphicPanelFieldManager)2 RasterSymbolizerDetails (com.sldeditor.ui.detail.RasterSymbolizerDetails)2 FieldConfigString (com.sldeditor.ui.detail.config.FieldConfigString)2 ColorMap (org.geotools.styling.ColorMap)2 FeatureTypeStyle (org.geotools.styling.FeatureTypeStyle)2 NamedLayer (org.geotools.styling.NamedLayer)2 Rule (org.geotools.styling.Rule)2 ShadedRelief (org.geotools.styling.ShadedRelief)2 Style (org.geotools.styling.Style)2 StyleFactoryImpl (org.geotools.styling.StyleFactoryImpl)2 StyledLayerDescriptor (org.geotools.styling.StyledLayerDescriptor)2