use of org.geotools.styling.Symbolizer in project sldeditor by robward-scisys.
the class SymbolizerDetailsPanel method getMinimumVersion.
/**
* Gets the minimum version vendor option present in the SLD.
*
* @param parentObj the parent obj
* @param sldObj the sld obj
* @param vendorOptionsPresentList the vendor options present list
*/
public void getMinimumVersion(Object parentObj, Object sldObj, List<VendorOptionPresent> vendorOptionsPresentList) {
Class<?> parentClass = null;
Class<?> classSelected = sldObj.getClass();
if (sldObj instanceof StyledLayerDescriptor) {
// No parent
} else if (sldObj instanceof StyledLayer) {
parentClass = StyledLayerDescriptor.class;
} else if (sldObj instanceof Style) {
parentClass = StyledLayer.class;
} else if (sldObj instanceof FeatureTypeStyle) {
parentClass = Style.class;
} else if (sldObj instanceof Rule) {
parentClass = FeatureTypeStyle.class;
} else if (sldObj instanceof Symbolizer) {
parentClass = Rule.class;
}
internalGetMinimumVersion(parentObj, sldObj, vendorOptionsPresentList, parentClass, classSelected);
if (sldObj instanceof PointSymbolizerImpl) {
PointSymbolizerImpl pointSymbolizer = (PointSymbolizerImpl) sldObj;
parentClass = PointSymbolizerImpl.class;
classSelected = FillImpl.class;
internalGetMinimumVersion(pointSymbolizer, pointSymbolizer.getGraphic(), vendorOptionsPresentList, parentClass, classSelected);
} else if (sldObj instanceof LineSymbolizerImpl) {
LineSymbolizerImpl lineSymbolizer = (LineSymbolizerImpl) sldObj;
parentClass = LineSymbolizerImpl.class;
classSelected = StrokeImpl.class;
internalGetMinimumVersion(lineSymbolizer, lineSymbolizer.getStroke(), vendorOptionsPresentList, parentClass, classSelected);
} else if (sldObj instanceof PolygonSymbolizerImpl) {
PolygonSymbolizerImpl polygonSymbolizer = (PolygonSymbolizerImpl) sldObj;
parentClass = PolygonSymbolizerImpl.class;
classSelected = FillImpl.class;
internalGetMinimumVersion(polygonSymbolizer, polygonSymbolizer.getFill(), vendorOptionsPresentList, parentClass, classSelected);
classSelected = StrokeImpl.class;
internalGetMinimumVersion(polygonSymbolizer, polygonSymbolizer.getStroke(), vendorOptionsPresentList, parentClass, classSelected);
} else if (sldObj instanceof TextSymbolizerImpl) {
TextSymbolizerImpl textSymbolizer = (TextSymbolizerImpl) sldObj;
parentClass = Rule.class;
classSelected = TextSymbolizerImpl.class;
internalGetMinimumVersion(parentObj, textSymbolizer, vendorOptionsPresentList, parentClass, classSelected);
} else if (sldObj instanceof RasterSymbolizerImpl) {
RasterSymbolizerImpl rasterSymbolizer = (RasterSymbolizerImpl) sldObj;
parentClass = Rule.class;
classSelected = RasterSymbolizerImpl.class;
internalGetMinimumVersion(parentObj, rasterSymbolizer, vendorOptionsPresentList, parentClass, classSelected);
}
}
use of org.geotools.styling.Symbolizer in project sldeditor by robward-scisys.
the class RasterSymbolizerDetails method updateSymbol.
/**
* Update symbol.
*/
private void updateSymbol() {
// Contrast enhancement
Expression gammaValueExpression = fieldConfigVisitor.getExpression(FieldIdEnum.RASTER_CONTRAST_GAMMAVALUE);
ContrastEnhancement contrastEnhancement = updateContrastEnhancement(gammaValueExpression);
// Colour map
ColorMap colorMap = updateColourMap();
// Channel selection
ChannelSelection channelSelection = updateEnhancementGroup();
//
// Overlap
//
OverlapBehavior overlapBehavior = updateOverlapBehavior();
//
// Shaded relief
//
ShadedRelief shadedRelief = updateShadedRelief();
Symbolizer symbolizer = null;
StandardData standardData = getStandardData();
Expression opacityExpression = fieldConfigVisitor.getExpression(FieldIdEnum.RASTER_OPACITY);
// Geometry field
Expression geometryField = ExtractGeometryField.getGeometryField(fieldConfigVisitor);
RasterSymbolizer rasterSymbolizer = getStyleFactory().rasterSymbolizer(standardData.getName(), geometryField, standardData.getDescription(), (standardData.getUnit() != null) ? standardData.getUnit().getUnit() : null, opacityExpression, channelSelection, overlapBehavior, colorMap, contrastEnhancement, shadedRelief, symbolizer);
if (vendorOptionRasterFactory != null) {
vendorOptionRasterFactory.updateSymbol(rasterSymbolizer);
}
rasterSymbolizer.setOverlapBehavior(overlapBehavior);
SelectedSymbol.getInstance().replaceSymbolizer(rasterSymbolizer);
this.fireUpdateSymbol();
}
use of org.geotools.styling.Symbolizer in project sldeditor by robward-scisys.
the class StyleDetails method updateSymbol.
/**
* Update symbol.
*/
private void updateSymbol() {
if (!Controller.getInstance().isPopulating()) {
StandardData standardData = getStandardData();
boolean isDefault = fieldConfigVisitor.getBoolean(FieldIdEnum.DEFAULT_STYLE);
Style existingStyle = SelectedSymbol.getInstance().getStyle();
if (existingStyle != null) {
List<org.opengis.style.FeatureTypeStyle> newFTSList = new ArrayList<>();
for (org.opengis.style.FeatureTypeStyle fts : existingStyle.featureTypeStyles()) {
newFTSList.add(fts);
}
Symbolizer defaultSymbolizer = null;
Style newStyle = getStyleFactory().style(standardData.getName(), standardData.getDescription(), isDefault, newFTSList, defaultSymbolizer);
SelectedSymbol.getInstance().replaceStyle(newStyle);
this.fireUpdateSymbol();
}
}
}
use of org.geotools.styling.Symbolizer in project sldeditor by robward-scisys.
the class PointSymbolizerDetails method populate.
/*
* (non-Javadoc)
*
* @see com.sldeditor.ui.iface.PopulateDetailsInterface#populate(com.sldeditor.ui.detail.selectedsymbol.SelectedSymbol)
*/
@Override
public void populate(SelectedSymbol selectedSymbol) {
if (selectedSymbol != null) {
Symbolizer symbolizer = selectedSymbol.getSymbolizer();
populateStandardData(symbolizer);
fieldConfigVisitor.populateField(FieldIdEnum.GEOMETRY, symbolizer.getGeometry());
}
updateSymbol();
}
use of org.geotools.styling.Symbolizer in project sldeditor by robward-scisys.
the class SelectedSymbol method removeSymbolizer.
/**
* Removes the symbolizer.
*
* @param symbolizerToDelete the symbolizer to delete
*/
public void removeSymbolizer(Symbolizer symbolizerToDelete) {
List<Symbolizer> symbolizerList = this.symbolData.getRule().symbolizers();
int indexFound = -1;
int index = 0;
for (Symbolizer symbolizer : symbolizerList) {
if (symbolizer == symbolizerToDelete) {
indexFound = index;
break;
} else {
index++;
}
}
if (indexFound > -1) {
symbolizerList.remove(indexFound);
}
}
Aggregations