当前位置: 首页>>代码示例>>Java>>正文


Java Symbolizer.setName方法代码示例

本文整理汇总了Java中org.geotools.styling.Symbolizer.setName方法的典型用法代码示例。如果您正苦于以下问题:Java Symbolizer.setName方法的具体用法?Java Symbolizer.setName怎么用?Java Symbolizer.setName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.geotools.styling.Symbolizer的用法示例。


在下文中一共展示了Symbolizer.setName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testGetTreeString

import org.geotools.styling.Symbolizer; //导入方法依赖的package包/类
/**
 * Test method for
 * {@link com.sldeditor.ui.tree.item.SymbolizerTreeItem#getTreeString(java.lang.Object)}.
 */
@Test
public void testGetTreeString() {
    SymbolizerTreeItem item = new SymbolizerTreeItem();
    String actualValue = item.getTreeString(null, null);
    assertNull(actualValue);

    Symbolizer pointSymbolizer = DefaultSymbols.createDefaultPointSymbolizer();
    actualValue = item.getTreeString(null, pointSymbolizer);
    String expectedValue = Localisation.getString(SLDTreeTools.class, "TreeItem.newMarker");
    assertTrue(actualValue.compareTo(expectedValue) == 0);

    pointSymbolizer.setName(null);
    actualValue = item.getTreeString(null, pointSymbolizer);
    expectedValue = Localisation.getString(SLDTreeTools.class, "TreeItem.marker");
    assertTrue(actualValue.compareTo(expectedValue) == 0);

    Symbolizer lineSymbolizer = DefaultSymbols.createDefaultLineSymbolizer();
    actualValue = item.getTreeString(null, lineSymbolizer);
    expectedValue = Localisation.getString(SLDTreeTools.class, "TreeItem.line");
    assertTrue(actualValue.compareTo(expectedValue) == 0);

    Symbolizer polygonSymbolizer = DefaultSymbols.createDefaultPolygonSymbolizer();
    actualValue = item.getTreeString(null, polygonSymbolizer);
    expectedValue = Localisation.getString(SLDTreeTools.class, "TreeItem.polygon");
    assertTrue(actualValue.compareTo(expectedValue) == 0);

    Symbolizer textSymbolizer = DefaultSymbols.createDefaultTextSymbolizer();
    actualValue = item.getTreeString(null, textSymbolizer);
    expectedValue = Localisation.getString(SLDTreeTools.class, "TreeItem.newText");
    assertTrue(actualValue.compareTo(expectedValue) == 0);

    textSymbolizer.setName("");
    actualValue = item.getTreeString(null, textSymbolizer);
    expectedValue = Localisation.getString(SLDTreeTools.class, "TreeItem.text");
    assertTrue(actualValue.compareTo(expectedValue) == 0);

    Symbolizer rasterSymbolizer = DefaultSymbols.createDefaultRasterSymbolizer();
    actualValue = item.getTreeString(null, rasterSymbolizer);
    expectedValue = Localisation.getString(SLDTreeTools.class, "TreeItem.raster");
    assertTrue(actualValue.compareTo(expectedValue) == 0);
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:46,代码来源:SymbolizerTreeItemTest.java

示例2: testGetTreeStringImageOutline

import org.geotools.styling.Symbolizer; //导入方法依赖的package包/类
/**
 * Test method for
 * {@link com.sldeditor.ui.tree.item.SymbolizerTreeItem#getTreeString(java.lang.Object)}. 
 * 
 * <p>NOTE:
 * Code just returns image outline prefix regardless of symbolizer type, doesn't just restrict
 * to line and polygon
 */
@Test
public void testGetTreeStringImageOutline() {
    SymbolizerTreeItem item = new SymbolizerTreeItem();
    String actualValue = item.getTreeString(null, null);
    assertNull(actualValue);
    Symbolizer parentRasterSymbolizer = DefaultSymbols.createDefaultRasterSymbolizer();
    DefaultMutableTreeNode treeNode = new DefaultMutableTreeNode();
    treeNode.setUserObject(parentRasterSymbolizer);
    DefaultMutableTreeNode symbolizerNode = new DefaultMutableTreeNode();
    treeNode.add(symbolizerNode);

    Symbolizer pointSymbolizer = DefaultSymbols.createDefaultPointSymbolizer();
    actualValue = item.getTreeString(symbolizerNode, pointSymbolizer);
    String expectedValue = String.format("%s - %s",
            Localisation.getString(SLDTreeTools.class, "TreeItem.imageOutline"),
            Localisation.getString(SLDTreeTools.class, "TreeItem.newMarker"));

    assertTrue(actualValue.compareTo(expectedValue) == 0);

    pointSymbolizer.setName(null);
    actualValue = item.getTreeString(symbolizerNode, pointSymbolizer);
    expectedValue = String.format("%s - %s",
            Localisation.getString(SLDTreeTools.class, "TreeItem.imageOutline"),
            Localisation.getString(SLDTreeTools.class, "TreeItem.marker"));
    assertTrue(actualValue.compareTo(expectedValue) == 0);

    Symbolizer lineSymbolizer = DefaultSymbols.createDefaultLineSymbolizer();
    actualValue = item.getTreeString(symbolizerNode, lineSymbolizer);
    expectedValue = String.format("%s - %s",
            Localisation.getString(SLDTreeTools.class, "TreeItem.imageOutline"),
            Localisation.getString(SLDTreeTools.class, "TreeItem.line"));
    assertTrue(actualValue.compareTo(expectedValue) == 0);

    Symbolizer polygonSymbolizer = DefaultSymbols.createDefaultPolygonSymbolizer();
    actualValue = item.getTreeString(symbolizerNode, polygonSymbolizer);
    expectedValue = String.format("%s - %s",
            Localisation.getString(SLDTreeTools.class, "TreeItem.imageOutline"),
            Localisation.getString(SLDTreeTools.class, "TreeItem.polygon"));
    assertTrue(actualValue.compareTo(expectedValue) == 0);

    Symbolizer textSymbolizer = DefaultSymbols.createDefaultTextSymbolizer();
    actualValue = item.getTreeString(symbolizerNode, textSymbolizer);
    expectedValue = String.format("%s - %s",
            Localisation.getString(SLDTreeTools.class, "TreeItem.imageOutline"),
            Localisation.getString(SLDTreeTools.class, "TreeItem.newText"));
    assertTrue(actualValue.compareTo(expectedValue) == 0);

    textSymbolizer.setName("");
    actualValue = item.getTreeString(symbolizerNode, textSymbolizer);
    expectedValue = String.format("%s - %s",
            Localisation.getString(SLDTreeTools.class, "TreeItem.imageOutline"),
            Localisation.getString(SLDTreeTools.class, "TreeItem.text"));
    assertTrue(actualValue.compareTo(expectedValue) == 0);

    Symbolizer rasterSymbolizer = DefaultSymbols.createDefaultRasterSymbolizer();
    actualValue = item.getTreeString(symbolizerNode, rasterSymbolizer);
    expectedValue = String.format("%s - %s",
            Localisation.getString(SLDTreeTools.class, "TreeItem.imageOutline"),
            Localisation.getString(SLDTreeTools.class, "TreeItem.raster"));
    assertTrue(actualValue.compareTo(expectedValue) == 0);

    // Try an invalid node
    actualValue = item.getTreeString(treeNode, rasterSymbolizer);
    expectedValue = Localisation.getString(SLDTreeTools.class, "TreeItem.raster");
    assertTrue(actualValue.compareTo(expectedValue) == 0);
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:75,代码来源:SymbolizerTreeItemTest.java


注:本文中的org.geotools.styling.Symbolizer.setName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。