use of org.geotools.styling.MarkImpl 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 org.geotools.styling.MarkImpl in project sldeditor by robward-scisys.
the class WindBarbDetails method getWellKnownName.
/**
* Gets the well known name.
*
* @param symbolizer the symbolizer
* @return the well known name
*/
private Expression getWellKnownName(Symbolizer symbolizer) {
Expression wellKnownName = null;
if (symbolizer instanceof PointSymbolizerImpl) {
PointSymbolizerImpl point = (PointSymbolizerImpl) symbolizer;
List<GraphicalSymbol> graphicalSymbolList = point.getGraphic().graphicalSymbols();
if ((graphicalSymbolList != null) && !graphicalSymbolList.isEmpty()) {
GraphicalSymbol graphicalSymbol = graphicalSymbolList.get(0);
if (graphicalSymbol instanceof MarkImpl) {
MarkImpl mark = (MarkImpl) graphicalSymbol;
wellKnownName = mark.getWellKnownName();
}
}
}
return wellKnownName;
}
use of org.geotools.styling.MarkImpl in project sldeditor by robward-scisys.
the class FieldConfigWKT method accept.
/**
* Accept.
*
* @param symbol the symbol
* @return true, if successful
*/
@Override
public boolean accept(GraphicalSymbol symbol) {
if (symbol != null) {
if (symbol instanceof MarkImpl) {
MarkImpl marker = (MarkImpl) symbol;
Expression expression = marker.getWellKnownName();
if (expression instanceof LiteralExpressionImpl) {
LiteralExpressionImpl lExpression = (LiteralExpressionImpl) expression;
Object value = lExpression.getValue();
if (value instanceof String) {
String valueString = (String) value;
if (valueString.startsWith(WKT_PREFIX)) {
return true;
}
}
}
}
}
return false;
}
use of org.geotools.styling.MarkImpl in project sldeditor by robward-scisys.
the class FieldConfigArrow 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)) {
if (symbol instanceof Mark) {
MarkImpl markerSymbol = (MarkImpl) symbol;
FillImpl fill = markerSymbol.getFill();
if (fill != null) {
Expression expFillColour = fill.getColor();
Expression expFillColourOpacity = fill.getOpacity();
FieldConfigBase field = fieldConfigManager.get(FieldIdEnum.FILL_COLOUR);
if (field != null) {
field.populate(expFillColour);
}
field = fieldConfigManager.get(FieldIdEnum.OVERALL_OPACITY);
if (field != null) {
field.populate(expFillColourOpacity);
}
}
if (arrowPanel != null) {
arrowPanel.populateExpression(markerSymbol.getWellKnownName().toString());
}
if (multiOptionPanel != null) {
multiOptionPanel.setSelectedItem(ARROW_SYMBOL_KEY);
}
}
}
}
Aggregations