use of com.sldeditor.ui.detail.config.FieldConfigBase in project sldeditor by robward-scisys.
the class FieldConfigMarker method setValue.
/**
* Sets the value.
*
* @param symbolizerType the symbolizer type
* @param fieldConfigManager the field config manager
* @param multiOptionPanel the multi option panel
* @param graphic the graphic
* @param symbol the symbol
*/
@Override
public void setValue(Class<?> symbolizerType, GraphicPanelFieldManager fieldConfigManager, FieldConfigSymbolType multiOptionPanel, Graphic graphic, GraphicalSymbol symbol) {
if ((symbol != null) && (fieldConfigManager != null)) {
MarkImpl markerSymbol = (MarkImpl) symbol;
Expression wellKnownNameExpression = markerSymbol.getWellKnownName();
if (wellKnownNameExpression instanceof LiteralExpressionImpl) {
LiteralExpressionImpl literal = (LiteralExpressionImpl) wellKnownNameExpression;
FieldConfigBase field = fieldConfigManager.get(symbolSelectionField);
if (field != null) {
field.populate(literal);
}
Expression expFillColour = null;
Expression expFillOpacity = null;
Expression expStrokeColour = null;
Expression expStrokeOpacity = null;
Expression expStrokeWidth = null;
// Which opacity attribute do we use?
if (symbol instanceof MarkImpl) {
MarkImpl markSymbol = (MarkImpl) symbol;
Fill fill = markSymbol.getFill();
if (fill != null) {
expFillColour = fill.getColor();
if (!isOverallOpacity(symbolizerType)) {
expFillOpacity = fill.getOpacity();
}
}
Stroke stroke = markSymbol.getStroke();
if (stroke != null) {
expStrokeColour = stroke.getColor();
if (!isOverallOpacity(symbolizerType)) {
expStrokeOpacity = stroke.getOpacity();
}
expStrokeWidth = stroke.getWidth();
}
}
if (isOverallOpacity(symbolizerType)) {
FieldConfigBase opacity = fieldConfigManager.get(FieldIdEnum.OVERALL_OPACITY);
if (opacity != null) {
opacity.populate(graphic.getOpacity());
}
}
FieldConfigBase opacity = fieldConfigManager.get(fillFieldConfig.getOpacity());
if (opacity != null) {
opacity.populate(expFillOpacity);
}
opacity = fieldConfigManager.get(strokeFieldConfig.getOpacity());
if (opacity != null) {
opacity.populate(expStrokeOpacity);
}
Class<?> panelId = getCommonData().getPanelId();
GroupConfigInterface fillGroup = fieldConfigManager.getGroup(panelId, fillFieldConfig.getGroup());
GroupConfigInterface strokeGroup = fieldConfigManager.getGroup(panelId, strokeFieldConfig.getGroup());
if ((fillGroup == null) || (strokeGroup == null)) {
return;
}
if (literal.toString().startsWith(GEOSERVER_MARKER_PREFIX)) {
fillGroup.enable(expStrokeColour != null);
FieldConfigBase fillColour = fieldConfigManager.get(fillFieldConfig.getColour());
if (fillColour != null) {
fillColour.populate(expStrokeColour);
}
opacity = fieldConfigManager.get(fillFieldConfig.getOpacity());
if (opacity != null) {
opacity.populate(expStrokeOpacity);
}
strokeGroup.enable(false);
} else {
fillGroup.enable(expFillColour != null);
FieldConfigBase fillColour = fieldConfigManager.get(fillFieldConfig.getColour());
if (fillColour != null) {
fillColour.populate(expFillColour);
}
strokeGroup.enable(expStrokeColour != null);
FieldConfigBase strokeColour = fieldConfigManager.get(strokeFieldConfig.getColour());
if (strokeColour != null) {
strokeColour.populate(expStrokeColour);
}
FieldConfigBase strokeWidth = fieldConfigManager.get(FieldIdEnum.STROKE_FILL_WIDTH);
if (strokeWidth != null) {
strokeWidth.populate(expStrokeWidth);
}
}
}
}
}
use of com.sldeditor.ui.detail.config.FieldConfigBase in project sldeditor by robward-scisys.
the class SymbolTypeFactory method setSolidFill.
/**
* Sets the solid fill.
*
* @param fieldConfigManager the field config manager
* @param expFillColour the exp fill colour
* @param expFillColourOpacity the exp fill colour opacity
*/
public void setSolidFill(GraphicPanelFieldManager fieldConfigManager, Expression expFillColour, Expression expFillColourOpacity) {
if (symbolTypeField != null) {
FieldConfigBase field = fieldConfigManager.get(this.selectionComboBox);
Literal expression = ff.literal(SOLID_FILL_VALUE);
field.populate(expression);
markerField.setSolidFill(fieldConfigManager, expFillColour, expFillColourOpacity);
}
}
use of com.sldeditor.ui.detail.config.FieldConfigBase in project sldeditor by robward-scisys.
the class FieldConfigFilename method getFill.
/**
* Gets the fill.
*
* @param graphicFill the graphic fill
* @param fieldConfigManager the field config manager
* @return the fill
*/
@Override
public Fill getFill(GraphicFill graphicFill, GraphicPanelFieldManager fieldConfigManager) {
if (fieldConfigManager == null) {
return null;
}
Fill fill = null;
FieldConfigBase fieldConfig = fieldConfigManager.get(FieldIdEnum.OVERALL_OPACITY);
if (fieldConfig != null) {
Expression fillColour = null;
Expression fillColourOpacity = null;
if (fieldConfig instanceof FieldConfigColour) {
fillColourOpacity = ((FieldConfigColour) fieldConfig).getColourOpacityExpression();
} else {
fillColourOpacity = fieldConfig.getExpression();
}
fill = getStyleFactory().fill(graphicFill, fillColour, fillColourOpacity);
}
return fill;
}
use of com.sldeditor.ui.detail.config.FieldConfigBase in project sldeditor by robward-scisys.
the class FieldConfigFilename method externalGraphicValueUpdated.
/**
* External graphic value updated.
*/
@Override
public void externalGraphicValueUpdated() {
setCachedExpression(generateExpression());
checkSymbolIsValid();
FieldConfigBase parent = getParent();
if (parent != null) {
parent.valueUpdated();
}
}
use of com.sldeditor.ui.detail.config.FieldConfigBase in project sldeditor by robward-scisys.
the class GroupConfig method enableSubGroups.
/**
* Enable sub groups.
*
* @param enabled the enabled
*/
private void enableSubGroups(boolean enabled) {
for (FieldConfigBase field : getFieldConfigList()) {
CurrentFieldState fieldState = field.getFieldState();
fieldState.setGroupSelected(enabled);
field.setFieldState(fieldState);
}
for (GroupConfigInterface subGroup : subGroupList) {
subGroup.enable(enabled);
}
}
Aggregations