Search in sources :

Example 6 with ColorMapEntry

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

the class MultipleColourMapEntry method parseList.

/**
 * Parses the list.
 *
 * @param entries the entries
 */
public void parseList(List<ColorMapEntry> entries) {
    firstEntry = entries.get(0);
    String labelValue = firstEntry.getLabel();
    String opacityValue = firstEntry.getOpacity().toString();
    String quantityValue = firstEntry.getQuantity().toString();
    String colourValue = firstEntry.getColor().toString();
    for (ColorMapEntry entry : entries) {
        if (labelValue.compareTo(entry.getLabel().toString()) != 0) {
            labelMultipleValue = false;
        }
        if (opacityValue.compareTo(entry.getOpacity().toString()) != 0) {
            opacityMultipleValue = false;
        }
        if (quantityValue.compareTo(entry.getQuantity().toString()) != 0) {
            quantityMultipleValue = false;
        }
        if (colourValue.compareTo(entry.getColor().toString()) != 0) {
            colourMultipleValue = false;
        }
    }
}
Also used : ColorMapEntry(org.geotools.styling.ColorMapEntry)

Example 7 with ColorMapEntry

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

the class MultipleColourMapEntry method getColourMapEntry.

/**
 * Gets the colour map entry.
 *
 * @return the colour map entry
 */
public ColorMapEntry getColourMapEntry() {
    ColorMapEntry entry = new ColorMapEntryImpl();
    if (firstEntry != null) {
        entry.setLabel(labelMultipleValue ? firstEntry.getLabel() : null);
        entry.setOpacity(opacityMultipleValue ? firstEntry.getOpacity() : null);
        entry.setQuantity(quantityMultipleValue ? firstEntry.getQuantity() : null);
        entry.setColor(colourMultipleValue ? firstEntry.getColor() : null);
    }
    return entry;
}
Also used : ColorMapEntryImpl(org.geotools.styling.ColorMapEntryImpl) ColorMapEntry(org.geotools.styling.ColorMapEntry)

Example 8 with ColorMapEntry

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

the class ColourMapModel method createColourMapEntry.

/**
 * Creates the colour map entry.
 *
 * @param data the data
 * @return the color map entry
 */
private ColorMapEntry createColourMapEntry(ColourMapData data) {
    ColorMapEntry entry = new ColorMapEntryImpl();
    entry.setColor(data.getColourExpression());
    entry.setOpacity(data.getOpacity());
    entry.setQuantity(data.getQuantity());
    entry.setLabel(data.getLabel());
    return entry;
}
Also used : ColorMapEntryImpl(org.geotools.styling.ColorMapEntryImpl) ColorMapEntry(org.geotools.styling.ColorMapEntry)

Example 9 with ColorMapEntry

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

the class ColourMapModel method populate.

/**
 * Populate.
 *
 * @param value the value
 */
public void populate(ColorMap value) {
    colourMapList.clear();
    for (ColorMapEntry colourMapEntry : value.getColorMapEntries()) {
        Expression colourExpression = colourMapEntry.getColor();
        Expression opacityExpression = colourMapEntry.getOpacity();
        Expression quantityExpression = colourMapEntry.getQuantity();
        String label = colourMapEntry.getLabel();
        ColourMapData data = new ColourMapData();
        data.setColour(colourExpression);
        data.setOpacity(opacityExpression);
        data.setQuantity(quantityExpression);
        data.setLabel(label);
        colourMapList.add(data);
    }
    this.fireTableDataChanged();
}
Also used : Expression(org.opengis.filter.expression.Expression) ColorMapEntry(org.geotools.styling.ColorMapEntry)

Example 10 with ColorMapEntry

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

the class ColourMapEntryPanel method setSelectedEntry.

/**
 * Sets the selected entry.
 *
 * @param entries the new selected entry
 */
public void setSelectedEntry(List<ColorMapEntry> entries) {
    if (entries == null) {
        setVisible(false);
    } else if (entries.size() == 1) {
        setVisible(true);
        ColorMapEntry entry = entries.get(0);
        label.populateField(entry.getLabel());
        opacity.populate(entry.getOpacity());
        colour.populate(entry.getColor());
        quantity.populate(entry.getQuantity());
        for (FieldConfigBase field : fieldList) {
            field.showOptionField(false);
        }
        applyButton.setEnabled(false);
    } else if (entries.size() > 1) {
        setVisible(true);
        MultipleColourMapEntry multipleValues = new MultipleColourMapEntry();
        multipleValues.parseList(entries);
        ColorMapEntry entry = multipleValues.getColourMapEntry();
        // Label
        String labelValue = "";
        if (entry.getLabel() != null) {
            labelValue = entry.getLabel();
        }
        label.populateField(labelValue);
        label.setOptionFieldValue(entry.getLabel() != null);
        // Opacity
        opacity.populate(entry.getOpacity());
        opacity.setOptionFieldValue(entry.getOpacity() != null);
        // Colour
        colour.populate(entry.getColor());
        colour.setOptionFieldValue(entry.getColor() != null);
        // Quantity
        quantity.populate(entry.getQuantity());
        quantity.setOptionFieldValue(entry.getQuantity() != null);
        for (FieldConfigBase field : fieldList) {
            field.showOptionField(true);
        }
        applyButton.setEnabled(false);
    } else {
        setVisible(false);
    }
}
Also used : FieldConfigBase(com.sldeditor.ui.detail.config.FieldConfigBase) FieldConfigString(com.sldeditor.ui.detail.config.FieldConfigString) ColorMapEntry(org.geotools.styling.ColorMapEntry)

Aggregations

ColorMapEntry (org.geotools.styling.ColorMapEntry)11 ColorMapEntryImpl (org.geotools.styling.ColorMapEntryImpl)5 ArrayList (java.util.ArrayList)3 ColorMapImpl (org.geotools.styling.ColorMapImpl)3 ColorMap (org.geotools.styling.ColorMap)2 Test (org.junit.Test)2 ColourRampConfigPanel (com.sldeditor.colourramp.ColourRampConfigPanel)1 FieldIdEnum (com.sldeditor.common.xml.ui.FieldIdEnum)1 GraphicPanelFieldManager (com.sldeditor.ui.detail.GraphicPanelFieldManager)1 FieldConfigBase (com.sldeditor.ui.detail.config.FieldConfigBase)1 FieldConfigCommonData (com.sldeditor.ui.detail.config.FieldConfigCommonData)1 FieldConfigPopulation (com.sldeditor.ui.detail.config.FieldConfigPopulation)1 FieldConfigString (com.sldeditor.ui.detail.config.FieldConfigString)1 FieldConfigColourMap (com.sldeditor.ui.detail.config.colourmap.FieldConfigColourMap)1 MultipleColourMapEntry (com.sldeditor.ui.detail.config.colourmap.MultipleColourMapEntry)1 FieldPanel (com.sldeditor.ui.widgets.FieldPanel)1 Geometry (com.vividsolutions.jts.geom.Geometry)1 ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1 IOException (java.io.IOException)1