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;
}
}
}
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;
}
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;
}
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();
}
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);
}
}
Aggregations