use of com.sldeditor.ui.detail.config.base.GroupConfigInterface in project sldeditor by robward-scisys.
the class VOGeoServerTextSymbolizer2 method updateSymbol.
/**
* Update symbol.
*
* @param textSymbolizer the text symbolizer
*/
/*
* (non-Javadoc)
*
* @see com.sldeditor.ui.detail.vendor.geoserver.VendorOptionInterface#updateSymbol(org.geotools.styling.TextSymbolizer)
*/
@Override
public void updateSymbol(TextSymbolizer textSymbolizer) {
GroupConfigInterface fillGroup = getGroup(GroupIdEnum.VO_TEXTSYMBOLIZER_2_FILL);
GroupConfigInterface strokeGroup = getGroup(GroupIdEnum.VO_TEXTSYMBOLIZER_2_STROKE);
GroupConfigInterface group = null;
if (textSymbolizer instanceof TextSymbolizer2) {
TextSymbolizer2 textSymbol2 = (TextSymbolizer2) textSymbolizer;
Expression featureDescription = fieldConfigVisitor.getExpression(FieldIdEnum.VO_TEXTSYMBOLIZER_2_FEATURE_DESCRIPTION);
if (!featureDescription.toString().isEmpty()) {
textSymbol2.setFeatureDescription(featureDescription);
}
Expression snippet = fieldConfigVisitor.getExpression(FieldIdEnum.VO_TEXTSYMBOLIZER_2_SNIPPET);
if (!snippet.toString().isEmpty()) {
textSymbol2.setSnippet(snippet);
}
// Extract OtherText
OtherText otherText = null;
group = getGroup(GroupIdEnum.VO_TEXTSYMBOLIZER_2_OTHERTEXT);
if (group != null) {
if (group.isPanelEnabled()) {
String target = fieldConfigVisitor.getText(FieldIdEnum.VO_TEXTSYMBOLIZER_2_OTHERTEXT_TARGET);
Expression text = fieldConfigVisitor.getExpression(FieldIdEnum.VO_TEXTSYMBOLIZER_2_OTHERTEXT_TEXT);
if (!target.isEmpty() && !text.toString().isEmpty()) {
otherText = new OtherTextImpl();
otherText.setTarget(target);
otherText.setText(text);
}
}
}
textSymbol2.setOtherText(otherText);
// Graphic
Graphic graphic = null;
group = getGroup(GroupIdEnum.VO_TEXTSYMBOLIZER_2_GRAPHIC);
if (group.isPanelEnabled()) {
Expression symbolType = fieldConfigVisitor.getExpression(FieldIdEnum.VO_TEXTSYMBOLIZER_2_SYMBOL_TYPE);
boolean hasFill = (fillGroup == null) ? false : fillGroup.isPanelEnabled();
boolean hasStroke = (strokeGroup == null) ? false : strokeGroup.isPanelEnabled();
Expression size = fieldConfigVisitor.getExpression(FieldIdEnum.VO_TEXTSYMBOLIZER_2_SIZE);
Expression rotation = fieldConfigVisitor.getExpression(FieldIdEnum.VO_TEXTSYMBOLIZER_2_ANGLE);
List<GraphicalSymbol> symbols = symbolTypeFactory.getValue(fieldConfigManager, symbolType, hasFill, hasStroke, selectedFillPanelId);
AnchorPoint anchor = null;
Displacement displacement = null;
graphic = getStyleFactory().graphic(symbols, null, size, rotation, anchor, displacement);
if (!symbols.isEmpty()) {
boolean overallOpacity = (symbols.get(0) instanceof ExternalGraphic);
if (overallOpacity) {
Expression opacity = fieldConfigVisitor.getExpression(FieldIdEnum.VO_TEXTSYMBOLIZER_2_OVERALL_OPACITY);
graphic.setOpacity(opacity);
}
}
}
textSymbol2.setGraphic(graphic);
}
}
use of com.sldeditor.ui.detail.config.base.GroupConfigInterface in project sldeditor by robward-scisys.
the class VOGeoServerFTSComposite method populate.
/*
* (non-Javadoc)
*
* @see
* com.sldeditor.ui.detail.vendor.geoserver.VendorOptionInterface#populate(org.geotools.styling.
* FeatureTypeStyle)
*/
@Override
public void populate(FeatureTypeStyle featureTypeStyle) {
Map<String, String> options = featureTypeStyle.getOptions();
String compositeString = options.get(FeatureTypeStyle.COMPOSITE);
String name = null;
double opacity = DEFAULT_COMPOSITE_OPACITY;
if (compositeString != null) {
String[] components = compositeString.split(",");
FieldConfigEnum optionData = (FieldConfigEnum) fieldConfigVisitor.getFieldConfig(FieldIdEnum.VO_FTS_COMPOSITE_OPTION);
if (optionData.isValidOption(components[0])) {
name = components[0];
}
if (components.length == 2) {
try {
opacity = Double.valueOf(components[1]);
} catch (Exception e) {
// Do nothing and revert to default
}
}
}
fieldConfigVisitor.populateComboBoxField(FieldIdEnum.VO_FTS_COMPOSITE_OPTION, name);
fieldConfigVisitor.populateDoubleField(FieldIdEnum.VO_FTS_COMPOSITE_OPACITY, opacity);
GroupConfigInterface groupPanel = getGroup(GroupIdEnum.VO_FTS_COMPOSITE);
groupPanel.enable(compositeString != null);
}
use of com.sldeditor.ui.detail.config.base.GroupConfigInterface in project sldeditor by robward-scisys.
the class VOGeoServerFTSComposite method updateSymbol.
/*
* (non-Javadoc)
*
* @see
* com.sldeditor.ui.detail.vendor.geoserver.VendorOptionInterface#updateSymbol(org.geotools.
* styling.FeatureTypeStyle)
*/
@Override
public void updateSymbol(FeatureTypeStyle featureTypeStyle) {
Map<String, String> options = featureTypeStyle.getOptions();
GroupConfigInterface groupPanel = getGroup(GroupIdEnum.VO_FTS_COMPOSITE);
if (groupPanel.isPanelEnabled()) {
ValueComboBoxData name = fieldConfigVisitor.getComboBox(FieldIdEnum.VO_FTS_COMPOSITE_OPTION);
double opacity = fieldConfigVisitor.getDouble(FieldIdEnum.VO_FTS_COMPOSITE_OPACITY);
StringBuilder composite = new StringBuilder();
composite.append(name.getKey());
if (!(Math.abs(opacity - DEFAULT_COMPOSITE_OPACITY) < 0.0001)) {
// Don't add to string if the opacity is set to the default
composite.append(",");
composite.append(opacity);
}
options.put(FeatureTypeStyle.COMPOSITE, composite.toString());
} else {
options.remove(FeatureTypeStyle.COMPOSITE);
}
}
use of com.sldeditor.ui.detail.config.base.GroupConfigInterface in project sldeditor by robward-scisys.
the class VOGeoServerFTSRuleEvaluation method updateSymbol.
/*
* (non-Javadoc)
*
* @see
* com.sldeditor.ui.detail.vendor.geoserver.VendorOptionInterface#updateSymbol(org.geotools.
* styling.FeatureTypeStyle)
*/
@Override
public void updateSymbol(FeatureTypeStyle featureTypeStyle) {
Map<String, String> options = featureTypeStyle.getOptions();
GroupConfigInterface groupPanel = getGroup(GroupIdEnum.VO_FTS_RULE_EVALUATION);
if (groupPanel.isPanelEnabled()) {
ValueComboBoxData value = fieldConfigVisitor.getComboBox(FieldIdEnum.VO_FTS_RULE_EVALUATION_OPTION);
options.put(FeatureTypeStyle.KEY_EVALUATION_MODE, value.getKey());
} else {
options.remove(FeatureTypeStyle.KEY_EVALUATION_MODE);
}
}
use of com.sldeditor.ui.detail.config.base.GroupConfigInterface in project sldeditor by robward-scisys.
the class VOGeoServerFTSRuleEvaluation method populate.
/*
* (non-Javadoc)
*
* @see
* com.sldeditor.ui.detail.vendor.geoserver.VendorOptionInterface#populate(org.geotools.styling.
* FeatureTypeStyle)
*/
@Override
public void populate(FeatureTypeStyle featureTypeStyle) {
Map<String, String> options = featureTypeStyle.getOptions();
String compositeBaseString = options.get(FeatureTypeStyle.KEY_EVALUATION_MODE);
String value = DEFAULT_COMPOSITE_RULE_EVALUATION;
if ((compositeBaseString != null) && (compositeBaseString.equals(FeatureTypeStyle.VALUE_EVALUATION_MODE_ALL) || compositeBaseString.equals(FeatureTypeStyle.VALUE_EVALUATION_MODE_FIRST))) {
value = compositeBaseString;
}
fieldConfigVisitor.populateComboBoxField(FieldIdEnum.VO_FTS_RULE_EVALUATION_OPTION, value);
GroupConfigInterface groupPanel = getGroup(GroupIdEnum.VO_FTS_RULE_EVALUATION);
groupPanel.enable(compositeBaseString != null);
}
Aggregations