use of org.geotools.styling.Symbolizer in project sldeditor by robward-scisys.
the class SLDExternalImages method externalGraphicSymbolVisitor.
/**
* Find the SLD graphical symbols.
*
* @param resourceLocator the resource locator
* @param sld the sld
* @param externalImageList the external image list
* @param process the process
*/
private static void externalGraphicSymbolVisitor(URL resourceLocator, StyledLayerDescriptor sld, List<String> externalImageList, ProcessGraphicSymbolInterface process) {
if (sld == null) {
return;
}
if (process == null) {
return;
}
for (StyledLayer styledLayer : sld.layers()) {
List<Style> styles = null;
if (styledLayer instanceof NamedLayer) {
NamedLayerImpl namedLayer = (NamedLayerImpl) styledLayer;
styles = namedLayer.styles();
} else if (styledLayer instanceof UserLayer) {
UserLayerImpl userLayer = (UserLayerImpl) styledLayer;
styles = userLayer.userStyles();
}
if (styles != null) {
for (Style style : styles) {
for (FeatureTypeStyle fts : style.featureTypeStyles()) {
for (Rule rule : fts.rules()) {
for (Symbolizer symbolizer : rule.symbolizers()) {
if (symbolizer instanceof PointSymbolizer) {
PointSymbolizer point = (PointSymbolizer) symbolizer;
if (point.getGraphic() != null) {
process.processGraphicalSymbol(resourceLocator, point.getGraphic().graphicalSymbols(), externalImageList);
}
} else if (symbolizer instanceof LineSymbolizer) {
LineSymbolizer line = (LineSymbolizer) symbolizer;
updateStroke(resourceLocator, line.getStroke(), externalImageList, process);
} else if (symbolizer instanceof PolygonSymbolizer) {
PolygonSymbolizer polygon = (PolygonSymbolizer) symbolizer;
updateStroke(resourceLocator, polygon.getStroke(), externalImageList, process);
updateFill(resourceLocator, polygon.getFill(), externalImageList, process);
}
}
}
}
}
}
}
}
use of org.geotools.styling.Symbolizer in project sldeditor by robward-scisys.
the class SelectedSymbol method addImageOutlineSymbolizerToRaster.
/**
* Adds the symbolizer to raster.
*
* @param symbolizer the symbolizer
*/
public void addImageOutlineSymbolizerToRaster(Symbolizer symbolizer) {
Symbolizer selectedSymbolizer = this.symbolData.getSymbolizer();
if (selectedSymbolizer == null) {
ConsoleManager.getInstance().error(this, "symbolizer == null");
} else {
if (selectedSymbolizer instanceof RasterSymbolizer) {
RasterSymbolizer rasterSymbolizer = (RasterSymbolizer) selectedSymbolizer;
rasterSymbolizer.setImageOutline(symbolizer);
}
}
}
use of org.geotools.styling.Symbolizer in project sldeditor by robward-scisys.
the class SelectedSymbol method replaceSymbolizer.
/**
* Replace symbolizer.
*
* @param newSymbolizer the new symbolizer
*/
public void replaceSymbolizer(Symbolizer newSymbolizer) {
if (this.symbolData != null) {
if (this.symbolData.getRule() != null) {
List<Symbolizer> symbolizerList = (List<Symbolizer>) this.symbolData.getRule().symbolizers();
Symbolizer oldSymbolizer = null;
int indexFound = -1;
int index = 0;
for (Symbolizer symbolizer : symbolizerList) {
if (symbolizer == this.symbolData.getSymbolizer()) {
indexFound = index;
oldSymbolizer = symbolizer;
break;
} else {
index++;
}
}
if (indexFound > -1) {
symbolizerList.remove(indexFound);
symbolizerList.add(indexFound, newSymbolizer);
setSymbolizer(newSymbolizer);
}
for (SLDTreeUpdatedInterface listener : treeUpdateListenerList) {
listener.updateNode(oldSymbolizer, newSymbolizer);
}
}
}
}
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 = (List<Symbolizer>) 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);
}
}
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<org.opengis.style.FeatureTypeStyle>();
for (org.opengis.style.FeatureTypeStyle fts : existingStyle.featureTypeStyles()) {
newFTSList.add(fts);
}
Symbolizer defaultSymbolizer = null;
Style newStyle = (Style) getStyleFactory().style(standardData.name, standardData.description, isDefault, newFTSList, defaultSymbolizer);
SelectedSymbol.getInstance().replaceStyle(newStyle);
this.fireUpdateSymbol();
}
}
}
Aggregations