use of com.sldeditor.datasource.RenderSymbolInterface in project sldeditor by robward-scisys.
the class SLDTreeTools method addArrow.
/**
* Adds the arrow.
*
* @param isSourceArrow the is source arrow
*/
private void addArrow(boolean isSourceArrow) {
if (symbolTree == null) {
return;
}
// Store current state of the SLD before the add
Object oldValueObj = sldWriter.encodeSLD(null, SelectedSymbol.getInstance().getSld());
PointSymbolizer pointSymbolizer = DefaultSymbols.createArrow(isSourceArrow);
DefaultMutableTreeNode ruleNode = getRuleTreeNode();
SelectedSymbol.getInstance().addSymbolizerToRule(pointSymbolizer);
DefaultMutableTreeNode newNode = sldTree.addObject(ruleNode, pointSymbolizer, true);
// Select the item just added
if (newNode != null) {
sldTree.addObject(newNode, SLDTreeLeafFactory.getInstance().getFill(pointSymbolizer), true);
SLDTreeManager.getInstance().rebuildTree((SLDTree) sldTree);
// Re-render the symbol
if (renderList != null) {
for (RenderSymbolInterface render : renderList) {
render.renderSymbol();
}
}
// Store current state of the SLD after the add
Object newValueObj = sldWriter.encodeSLD(null, SelectedSymbol.getInstance().getSld());
UndoManager.getInstance().addUndoEvent(new UndoEvent(sldTree.getUndoObject(), getClass().getName(), oldValueObj, newValueObj));
}
}
use of com.sldeditor.datasource.RenderSymbolInterface in project sldeditor by robward-scisys.
the class SLDTreeTools method removeItem.
/**
* Removes the item.
*/
public void removeItem() {
if (symbolTree == null) {
return;
}
TreePath path = symbolTree.getSelectionPath();
if (path == null) {
return;
}
DefaultMutableTreeNode lastNode = (DefaultMutableTreeNode) path.getLastPathComponent();
Object obj = lastNode.getUserObject();
// CHECKSTYLE:OFF
Object oldValueObj = sldWriter.encodeSLD(null, SelectedSymbol.getInstance().getSld());
if (obj instanceof NamedLayer) {
SelectedSymbol.getInstance().removeUserNamedLayer((NamedLayer) obj);
removeTreeNode(lastNode);
} else if (obj instanceof UserLayer) {
SelectedSymbol.getInstance().removeUserNamedLayer((UserLayer) obj);
removeTreeNode(lastNode);
} else if (obj instanceof Style) {
SelectedSymbol.getInstance().removeStyle((Style) obj);
removeTreeNode(lastNode);
} else if (obj instanceof FeatureTypeStyle) {
SelectedSymbol.getInstance().removeFeatureTypeStyle((FeatureTypeStyle) obj);
removeTreeNode(lastNode);
} else if (obj instanceof Rule) {
SelectedSymbol.getInstance().removeRule((Rule) obj);
removeTreeNode(lastNode);
} else if (obj instanceof Symbolizer) {
DefaultMutableTreeNode parentNode = (DefaultMutableTreeNode) lastNode.getParent();
if (parentNode != null) {
if (parentNode.getUserObject() instanceof RasterSymbolizer) {
SelectedSymbol.getInstance().removeRasterImageOutline((RasterSymbolizer) parentNode.getUserObject());
} else {
SelectedSymbol.getInstance().removeSymbolizer((Symbolizer) obj);
}
removeTreeNode(lastNode);
}
} else {
return;
}
SLDTreeManager.getInstance().rebuildTree((SLDTree) sldTree);
// Re-render the symbol
if (renderList != null) {
for (RenderSymbolInterface render : renderList) {
render.renderSymbol();
}
}
Object newValueObj = sldWriter.encodeSLD(null, SelectedSymbol.getInstance().getSld());
UndoManager.getInstance().addUndoEvent(new UndoEvent(sldTree.getUndoObject(), getClass().getName(), oldValueObj, newValueObj));
}
use of com.sldeditor.datasource.RenderSymbolInterface in project sldeditor by robward-scisys.
the class SingleLegendUI method getRendererList.
/**
* Gets the renderer list.
*
* @return the renderer list
*/
private List<RenderSymbolInterface> getRendererList() {
if (rendererList == null) {
rendererList = new ArrayList<>();
RenderSymbolInterface renderer = RenderPanelFactory.getRenderer(SingleLegendUI.class.getName());
rendererList.add(renderer);
rendererList.add(getLegendPanel());
}
return rendererList;
}
use of com.sldeditor.datasource.RenderSymbolInterface in project sldeditor by robward-scisys.
the class SingleSymbolUI method getRendererList.
/**
* Gets the renderer list.
*
* @return the renderer list
*/
private List<RenderSymbolInterface> getRendererList() {
if (rendererList == null) {
rendererList = new ArrayList<>();
RenderSymbolInterface renderer = RenderPanelFactory.getRenderer(SingleSymbolUI.class.getName());
rendererList.add(renderer);
}
return rendererList;
}
use of com.sldeditor.datasource.RenderSymbolInterface in project sldeditor by robward-scisys.
the class RenderPanelFactory method addSLDOutputListener.
/**
* Adds the sld output listener.
*
* @param sldOutput the sld output
*/
public static void addSLDOutputListener(SLDOutputInterface sldOutput) {
for (Entry<String, RenderSymbolInterface> entry : symbolRenderPanelMap.entrySet()) {
RenderSymbolInterface render = entry.getValue();
render.addSLDOutputListener(sldOutput);
}
}
Aggregations