use of org.geotools.styling.TextSymbolizer in project sldeditor by robward-scisys.
the class SLDTreeTools method addNewText.
/**
* Adds the new text symbolizer.
*/
public void addNewText() {
if (symbolTree == null) {
return;
}
// Store current state of the SLD before the add
Object oldValueObj = sldWriter.encodeSLD(null, SelectedSymbol.getInstance().getSld());
TextSymbolizer newTextSymbolizer = DefaultSymbols.createDefaultTextSymbolizer();
DefaultMutableTreeNode ruleNode = getRuleTreeNode();
SelectedSymbol.getInstance().addSymbolizerToRule(newTextSymbolizer);
DefaultMutableTreeNode newNode = sldTree.addObject(ruleNode, newTextSymbolizer, true);
// Select the item just added
if (newNode != null) {
SLDTreeManager.getInstance().rebuildTree((SLDTree) sldTree);
TreePath newPath = getPath(newNode);
symbolTree.setSelectionPath(newPath);
// 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 org.geotools.styling.TextSymbolizer in project sldeditor by robward-scisys.
the class SLDTreeLeafFactoryTest method testUpdateStroke.
/**
* Test method for
* {@link com.sldeditor.common.tree.leaf.SLDTreeLeafFactory#updateStroke(boolean, org.opengis.style.Symbolizer)}.
*/
@Test
public void testUpdateStroke() {
assertNull(SLDTreeLeafFactory.getInstance().updateStroke(true, null));
PolygonSymbolizer polygonSymbolizer = DefaultSymbols.createDefaultPolygonSymbolizer();
assertEquals(SLDTreeLeafFactory.getInstance().updateStroke(false, polygonSymbolizer), styleFactory.getDefaultStroke());
assertTrue(SLDTreeLeafFactory.getInstance().updateStroke(true, polygonSymbolizer) != null);
PointSymbolizer pointSymbolizer = DefaultSymbols.createDefaultPointSymbolizer();
assertEquals(SLDTreeLeafFactory.getInstance().updateStroke(false, pointSymbolizer), styleFactory.getDefaultStroke());
assertTrue(SLDTreeLeafFactory.getInstance().updateStroke(true, pointSymbolizer) != null);
LineSymbolizer lineSymbolizer = DefaultSymbols.createDefaultLineSymbolizer();
assertEquals(SLDTreeLeafFactory.getInstance().updateStroke(false, lineSymbolizer), styleFactory.getDefaultStroke());
assertEquals(SLDTreeLeafFactory.getInstance().updateStroke(true, lineSymbolizer), styleFactory.getDefaultStroke());
TextSymbolizer textSymbolizer = DefaultSymbols.createDefaultTextSymbolizer();
assertEquals(SLDTreeLeafFactory.getInstance().updateStroke(false, textSymbolizer), styleFactory.getDefaultStroke());
assertEquals(SLDTreeLeafFactory.getInstance().updateStroke(true, textSymbolizer), styleFactory.getDefaultStroke());
}
use of org.geotools.styling.TextSymbolizer in project sldeditor by robward-scisys.
the class SLDTreeLeafFactoryTest method testGetFill.
/**
* Test method for
* {@link com.sldeditor.common.tree.leaf.SLDTreeLeafFactory#getFill(org.opengis.style.Symbolizer)}.
*/
@Test
public void testGetFill() {
PolygonSymbolizer polygonSymbolizer = DefaultSymbols.createDefaultPolygonSymbolizer();
PointSymbolizer pointSymbolizer = DefaultSymbols.createDefaultPointSymbolizer();
// CHECKSTYLE:OFF
LineSymbolizer lineSymbolizer = DefaultSymbols.createDefaultLineSymbolizer();
TextSymbolizer textSymbolizer = DefaultSymbols.createDefaultTextSymbolizer();
// CHECKSTYLE:ON
assertNull(SLDTreeLeafFactory.getInstance().getFill(null));
assertTrue(SLDTreeLeafFactory.getInstance().getFill(polygonSymbolizer) != null);
assertTrue(SLDTreeLeafFactory.getInstance().getFill(pointSymbolizer) != null);
// Returns default fill
assertTrue(SLDTreeLeafFactory.getInstance().getFill(lineSymbolizer) != null);
assertTrue(SLDTreeLeafFactory.getInstance().getFill(textSymbolizer) != null);
}
use of org.geotools.styling.TextSymbolizer in project sldeditor by robward-scisys.
the class SLDTreeLeafFactoryTest method testHasStroke.
/**
* Test method for
* {@link com.sldeditor.common.tree.leaf.SLDTreeLeafFactory#hasStroke(org.opengis.style.Symbolizer)}.
*/
@Test
public void testHasStroke() {
PolygonSymbolizer polygonSymbolizer = DefaultSymbols.createDefaultPolygonSymbolizer();
PointSymbolizer pointSymbolizer = DefaultSymbols.createDefaultPointSymbolizer();
// CHECKSTYLE:OFF
LineSymbolizer lineSymbolizer = DefaultSymbols.createDefaultLineSymbolizer();
TextSymbolizer textSymbolizer = DefaultSymbols.createDefaultTextSymbolizer();
// CHECKSTYLE:ON
assertFalse(SLDTreeLeafFactory.getInstance().hasStroke(null));
assertTrue(SLDTreeLeafFactory.getInstance().hasStroke(polygonSymbolizer));
assertFalse(SLDTreeLeafFactory.getInstance().hasStroke(pointSymbolizer));
assertTrue(SLDTreeLeafFactory.getInstance().hasStroke(lineSymbolizer));
assertFalse(SLDTreeLeafFactory.getInstance().hasStroke(textSymbolizer));
}
use of org.geotools.styling.TextSymbolizer in project sldeditor by robward-scisys.
the class SLDTreeLeafTextTest method testRemoveStroke.
/**
* Test method for {@link com.sldeditor.common.tree.leaf.SLDTreeLeafText#removeStroke(org.opengis.style.Symbolizer)}.
*/
@Test
public void testRemoveStroke() {
SLDTreeLeafText leaf = new SLDTreeLeafText();
TextSymbolizer textSymbolizer = DefaultSymbols.createDefaultTextSymbolizer();
leaf.removeStroke(textSymbolizer);
// Does nothing
}
Aggregations