use of com.sldeditor.ui.detail.config.FieldConfigBase in project sldeditor by robward-scisys.
the class FieldConfigTTF method getValue.
/**
* Gets the value.
*
* @param fieldConfigManager the field config manager
* @param symbolType the symbol type
* @param fillEnabled the fill enabled
* @param strokeEnabled the stroke enabled
* @return the value
*/
@Override
public List<GraphicalSymbol> getValue(GraphicPanelFieldManager fieldConfigManager, Expression symbolType, boolean fillEnabled, boolean strokeEnabled) {
List<GraphicalSymbol> symbolList = new ArrayList<GraphicalSymbol>();
Expression wellKnownName = null;
if ((getConfigField() != null) && (fieldConfigManager != null)) {
wellKnownName = getConfigField().getExpression();
if (wellKnownName != null) {
Stroke stroke = null;
Fill fill = null;
if (fillEnabled) {
Expression expFillColour = null;
Expression expFillColourOpacity = null;
FieldConfigBase field = fieldConfigManager.get(fillFieldConfig.getColour());
if (field != null) {
FieldConfigColour colourField = (FieldConfigColour) field;
expFillColour = colourField.getColourExpression();
}
field = fieldConfigManager.get(fillFieldConfig.getOpacity());
if (field != null) {
expFillColourOpacity = field.getExpression();
}
fill = getStyleFactory().createFill(expFillColour, expFillColourOpacity);
}
// Size
Expression expSize = null;
// Rotation
Expression expRotation = null;
Mark mark = getStyleFactory().createMark(wellKnownName, stroke, fill, expSize, expRotation);
symbolList.add(mark);
}
}
return symbolList;
}
use of com.sldeditor.ui.detail.config.FieldConfigBase in project sldeditor by robward-scisys.
the class FieldConfigWindBarbs method getValue.
/**
* Gets the value.
*
* @param fieldConfigManager the field config manager
* @param symbolType the symbol type
* @param fillEnabled the fill enabled
* @param strokeEnabled the stroke enabled
* @return the value
*/
@Override
public List<GraphicalSymbol> getValue(GraphicPanelFieldManager fieldConfigManager, Expression symbolType, boolean fillEnabled, boolean strokeEnabled) {
List<GraphicalSymbol> symbolList = new ArrayList<GraphicalSymbol>();
Expression wellKnownName = null;
if ((getConfigField() != null) && (fieldConfigManager != null)) {
wellKnownName = getConfigField().getExpression();
if (wellKnownName != null) {
Expression expFillColour = null;
Expression expFillColourOpacity = null;
FieldConfigBase field = fieldConfigManager.get(FieldIdEnum.FILL_COLOUR);
if (field != null) {
FieldConfigColour colourField = (FieldConfigColour) field;
expFillColour = colourField.getColourExpression();
}
Stroke stroke = null;
Fill fill = getStyleFactory().createFill(expFillColour, expFillColourOpacity);
Expression size = null;
Expression rotation = null;
Mark mark = getStyleFactory().createMark(wellKnownName, stroke, fill, size, rotation);
symbolList.add(mark);
}
}
return symbolList;
}
use of com.sldeditor.ui.detail.config.FieldConfigBase in project sldeditor by robward-scisys.
the class FieldConfigArrow method getValue.
/**
* Gets the value.
*
* @param fieldConfigManager the field config manager
* @param symbolType the symbol type
* @param fillEnabled the fill enabled
* @param strokeEnabled the stroke enabled
* @return the value
*/
@Override
public List<GraphicalSymbol> getValue(GraphicPanelFieldManager fieldConfigManager, Expression symbolType, boolean fillEnabled, boolean strokeEnabled) {
List<GraphicalSymbol> symbolList = new ArrayList<GraphicalSymbol>();
if (fieldConfigManager != null) {
Expression wellKnownName = null;
if (getConfigField() != null) {
wellKnownName = getConfigField().getExpression();
if (wellKnownName != null) {
// Stroke colour
FieldConfigBase field = null;
Stroke stroke = null;
if (strokeEnabled && (strokeFieldConfig != null)) {
Expression expStrokeColour = null;
Expression expStrokeColourOpacity = null;
field = fieldConfigManager.get(strokeFieldConfig.getColour());
if (field != null) {
if (field instanceof FieldConfigColour) {
FieldConfigColour colourField = (FieldConfigColour) field;
expStrokeColour = colourField.getColourExpression();
}
}
field = fieldConfigManager.get(strokeFieldConfig.getOpacity());
if (field != null) {
expStrokeColourOpacity = field.getExpression();
}
stroke = getStyleFactory().createStroke(expStrokeColour, expStrokeColourOpacity);
}
// Fill colour
Fill fill = null;
if (fillEnabled && (fillFieldConfig != null)) {
Expression expFillColour = null;
Expression expFillColourOpacity = null;
field = fieldConfigManager.get(fillFieldConfig.getColour());
if (field != null) {
if (field instanceof FieldConfigColour) {
FieldConfigColour colourField = (FieldConfigColour) field;
expFillColour = colourField.getColourExpression();
}
}
field = fieldConfigManager.get(fillFieldConfig.getOpacity());
if (field != null) {
expFillColourOpacity = field.getExpression();
}
fill = getStyleFactory().createFill(expFillColour, expFillColourOpacity);
}
field = fieldConfigManager.get(FieldIdEnum.STROKE_WIDTH);
if (field != null) {
Expression strokeWidth = field.getExpression();
stroke.setWidth(strokeWidth);
}
Expression symbolSize = null;
field = fieldConfigManager.get(FieldIdEnum.STROKE_SYMBOL_SIZE);
if (field != null) {
symbolSize = field.getExpression();
}
Expression rotation = null;
Mark mark = getStyleFactory().createMark(wellKnownName, stroke, fill, symbolSize, rotation);
symbolList.add(mark);
}
}
}
return symbolList;
}
use of com.sldeditor.ui.detail.config.FieldConfigBase 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);
}
}
}
}
use of com.sldeditor.ui.detail.config.FieldConfigBase in project sldeditor by robward-scisys.
the class FieldConfigDateTest method testCreateCopy.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.FieldConfigDate#createCopy(com.sldeditor.ui.detail.config.FieldConfigBase)}.
*/
@Test
public void testCreateCopy() {
boolean valueOnly = true;
class TestFieldConfigDate extends FieldConfigDate {
public TestFieldConfigDate(FieldConfigCommonData commonData) {
super(commonData);
}
public FieldConfigPopulate callCreateCopy(FieldConfigBase fieldConfigBase) {
return createCopy(fieldConfigBase);
}
}
TestFieldConfigDate field = new TestFieldConfigDate(new FieldConfigCommonData(Geometry.class, FieldIdEnum.NAME, "label", valueOnly));
FieldConfigDate copy = (FieldConfigDate) field.callCreateCopy(null);
assertNull(copy);
copy = (FieldConfigDate) field.callCreateCopy(field);
assertEquals(field.getFieldId(), copy.getFieldId());
assertTrue(field.getLabel().compareTo(copy.getLabel()) == 0);
assertEquals(field.isValueOnly(), copy.isValueOnly());
}
Aggregations