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


Java LineSymbolizer类代码示例

本文整理汇总了Java中org.geotools.styling.LineSymbolizer的典型用法代码示例。如果您正苦于以下问题:Java LineSymbolizer类的具体用法?Java LineSymbolizer怎么用?Java LineSymbolizer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: convert

import org.geotools.styling.LineSymbolizer; //导入依赖的package包/类
@Override
public void convert(Rule rule, JsonElement element, String layerName, int transparency) {
    if(element == null) return;
    if(rule == null) return;

    JsonObject obj = element.getAsJsonObject();
    @SuppressWarnings("unused")
    int style = getInt(obj, CommonSymbolKeys.STYLE);

    List<Symbolizer> symbolizerList = rule.symbolizers();

    List<Stroke> strokeList = convert(obj);

    Stroke stroke = null;

    if(!strokeList.isEmpty())
    {
        stroke = strokeList.get(0);
    }

    LineSymbolizer lineSymbolizer = styleFactory.createLineSymbolizer(stroke, null);

    symbolizerList.add(lineSymbolizer);
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:25,代码来源:SimpleLineSymbol.java

示例2: convert

import org.geotools.styling.LineSymbolizer; //导入依赖的package包/类
/**
 * Convert.
 *
 * @param rule the rule
 * @param element the element
 * @param layerName the layer name
 * @param transparency the transparency
 */
@Override
public void convert(Rule rule, JsonElement element, String layerName, int transparency) {
    if(rule == null) return;
    if(element == null) return;

    JsonObject obj = element.getAsJsonObject();

    List<Symbolizer> symbolizerList = rule.symbolizers();

    List<Stroke> strokeList = convert(obj);

    Stroke stroke = null;

    if(!strokeList.isEmpty())
    {
        stroke = strokeList.get(0);
    }

    LineSymbolizer lineSymbolizer = styleFactory.createLineSymbolizer(stroke, null);

    symbolizerList.add(lineSymbolizer);
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:31,代码来源:CartographicLineSymbol.java

示例3: getSampleFeatureForRule

import org.geotools.styling.LineSymbolizer; //导入依赖的package包/类
/**
 * Returns a sample feature for the given rule, with the following criteria: - if a sample is
 * given in input is returned in output - if a sample is not given in input, scan the rule
 * symbolizers to find the one with the max dimensionality, and return a sample for that
 * dimensionality.
 * 
 * @param featureType featureType used to create a sample, if none is given as input
 * @param sample feature sample to be returned as is in output, if defined
 * @param rule rule containing symbolizers to scan for max dimensionality
 *
 */
private Feature getSampleFeatureForRule(FeatureType featureType, Feature sample,
        final Rule rule) {
    Symbolizer[] symbolizers = rule.getSymbolizers();
    // if we don't have a sample as input, we need to create a sampleFeature
    // looking at the requested symbolizers (we chose the one with the max
    // dimensionality and create a congruent sample)
    if (sample == null) {
        int dimensionality = 1;
        for (int sIdx = 0; sIdx < symbolizers.length; sIdx++) {
            final Symbolizer symbolizer = symbolizers[sIdx];
            if (LineSymbolizer.class.isAssignableFrom(symbolizer.getClass())) {
                dimensionality = 2;
            }
            if (PolygonSymbolizer.class.isAssignableFrom(symbolizer.getClass())) {
                dimensionality = 3;
            }
        }
        return createSampleFeature(featureType, dimensionality);
    } else {
        return sample;
    }
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:34,代码来源:SLDEditorBufferedImageLegendGraphicBuilder.java

示例4: visit

import org.geotools.styling.LineSymbolizer; //导入依赖的package包/类
/**
 * (non-Javadoc)
 * 
 * @see org.geotools.styling.visitor.DuplicatingStyleVisitor#visit(org.geotools.styling.LineSymbolizer)
 */
public void visit(LineSymbolizer line) {
    LineSymbolizer copy = sf.getDefaultLineSymbolizer();

    copy.setGeometry(copy(LineString.class, line.getGeometry()));

    copy.setUnitOfMeasure(line.getUnitOfMeasure());
    copy.setStroke(copy(line.getStroke()));
    copy.getOptions().putAll(line.getOptions());
    copy.setPerpendicularOffset(line.getPerpendicularOffset());

    if (STRICT && !copy.equals(line)) {
        throw new IllegalStateException(
                "Was unable to duplicate provided LineSymbolizer:" + line);
    }
    pages.push(copy);
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:22,代码来源:ExtractAttributes.java

示例5: visit

import org.geotools.styling.LineSymbolizer; //导入依赖的package包/类
/**
 * (non-Javadoc)
 * 
 * @see org.geotools.styling.visitor.DuplicatingStyleVisitor#visit(org.geotools.styling.LineSymbolizer)
 */
public void visit(LineSymbolizer line) {
    LineSymbolizer copy = sf.getDefaultLineSymbolizer();

    copy.setGeometry(copy(line.getGeometry()));

    copy.setUnitOfMeasure(line.getUnitOfMeasure());
    copy.setStroke(copy(line.getStroke()));
    copy.getOptions().putAll(line.getOptions());
    copy.setPerpendicularOffset(line.getPerpendicularOffset());

    if (STRICT && !copy.equals(line)) {
        throw new IllegalStateException(
                "Was unable to duplicate provided LineSymbolizer:" + line);
    }
    pages.push(copy);
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:22,代码来源:RuleRenderVisitor.java

示例6: defaultString

import org.geotools.styling.LineSymbolizer; //导入依赖的package包/类
/**
 * Default string.
 *
 * @param symbol the symbol
 * @return the string
 */
private String defaultString(Symbolizer symbol) {
    String name = "";

    if (symbol instanceof PointSymbolizer) {
        name = DEFAULT_MARKER_NAME;
    } else if (symbol instanceof TextSymbolizer) {
        name = DEFAULT_TEXT_NAME;
    } else if (symbol instanceof LineSymbolizer) {
        name = DEFAULT_LINE_NAME;
    } else if (symbol instanceof PolygonSymbolizer) {
        name = DEFAULT_POLYGON_NAME;
    } else if (symbol instanceof RasterSymbolizer) {
        name = DEFAULT_RASTER_NAME;
    }
    return name;
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:23,代码来源:SymbolizerTreeItem.java

示例7: populate

import org.geotools.styling.LineSymbolizer; //导入依赖的package包/类
@Override
public void populate(SelectedSymbol selectedSymbol) {

    if (selectedSymbol != null) {
        LineSymbolizer lineSymbolizer = (LineSymbolizer) selectedSymbol.getSymbolizer();
        if (lineSymbolizer != null) {
            populateStandardData(lineSymbolizer);

            fieldConfigVisitor.populateField(FieldIdEnum.PERPENDICULAR_OFFSET,
                    lineSymbolizer.getPerpendicularOffset());

            fieldConfigVisitor.populateField(FieldIdEnum.GEOMETRY,
                    lineSymbolizer.getGeometry());
        }
    }
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:17,代码来源:LineSymbolizerDetails.java

示例8: updateSymbol

import org.geotools.styling.LineSymbolizer; //导入依赖的package包/类
/**
 * Update symbol.
 */
private void updateSymbol() {
    if (!Controller.getInstance().isPopulating()) {
        Expression perpendicularOffset = fieldConfigVisitor
                .getExpression(FieldIdEnum.PERPENDICULAR_OFFSET);
        Expression geometryField = ExtractGeometryField.getGeometryField(fieldConfigVisitor);

        StandardData standardData = getStandardData();

        LineSymbolizer lineSymbolizer = (LineSymbolizer) SelectedSymbol.getInstance()
                .getSymbolizer();

        if (lineSymbolizer != null) {
            lineSymbolizer.setName(standardData.name);
            lineSymbolizer.setDescription(standardData.description);
            lineSymbolizer.setUnitOfMeasure(standardData.unit);

            lineSymbolizer.setGeometry(geometryField);

            lineSymbolizer.setPerpendicularOffset(perpendicularOffset);

            this.fireUpdateSymbol();
        }
    }
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:28,代码来源:LineSymbolizerDetails.java

示例9: getStroke

import org.geotools.styling.LineSymbolizer; //导入依赖的package包/类
/**
 * Gets the stroke.
 *
 * @param symbolizer the symbolizer
 * @return the stroke
 */
/*
 * (non-Javadoc)
 * 
 * @see com.sldeditor.ui.tree.SLDTreeLeafInterface#getStroke(org.opengis.style.Symbolizer)
 */
@Override
public Stroke getStroke(Symbolizer symbolizer) {
    Stroke stroke = null;

    if (symbolizer instanceof LineSymbolizer) {
        LineSymbolizer line = (LineSymbolizer) symbolizer;

        if (line != null) {
            stroke = line.getStroke();
        }
    }

    return stroke;
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:26,代码来源:SLDTreeLeafLine.java

示例10: removeStroke

import org.geotools.styling.LineSymbolizer; //导入依赖的package包/类
/**
 * Removes the stroke.
 *
 * @param symbolizer the symbolizer
 */
/*
 * (non-Javadoc)
 * 
 * @see com.sldeditor.ui.tree.leaf.SLDTreeLeafInterface#removeStroke(org.opengis.style.Symbolizer)
 */
@Override
public void removeStroke(Symbolizer symbolizer) {
    if (symbolizer instanceof LineSymbolizer) {
        LineSymbolizer line = (LineSymbolizer) symbolizer;

        if (line != null) {
            line.setStroke(null);
        }
    }
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:21,代码来源:SLDTreeLeafLine.java

示例11: createStroke

import org.geotools.styling.LineSymbolizer; //导入依赖的package包/类
/**
 * Creates the stroke.
 *
 * @param symbolizer the symbolizer
 */
/*
 * (non-Javadoc)
 * 
 * @see com.sldeditor.ui.tree.leaf.SLDTreeLeafInterface#createStroke(org.opengis.style.Symbolizer)
 */
@Override
public void createStroke(Symbolizer symbolizer) {
    if (symbolizer instanceof LineSymbolizer) {
        LineSymbolizer line = (LineSymbolizer) symbolizer;

        if (line != null) {
            line.setStroke(styleFactory.getDefaultStroke());
        }
    }
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:21,代码来源:SLDTreeLeafLine.java

示例12: testHasFill

import org.geotools.styling.LineSymbolizer; //导入依赖的package包/类
/**
 * Test method for
 * {@link com.sldeditor.common.tree.leaf.SLDTreeLeafFactory#hasFill(org.opengis.style.Symbolizer)}.
 */
@Test
public void testHasFill() {
    PolygonSymbolizer polygonSymbolizer = DefaultSymbols.createDefaultPolygonSymbolizer();
    PointSymbolizer pointSymbolizer = DefaultSymbols.createDefaultPointSymbolizer();
    //CHECKSTYLE:OFF
    LineSymbolizer lineSymbolizer = DefaultSymbols.createDefaultLineSymbolizer();
    TextSymbolizer textSymbolizer = DefaultSymbols.createDefaultTextSymbolizer();
    //CHECKSTYLE:ON

    assertFalse(SLDTreeLeafFactory.getInstance().hasFill(null));
    assertTrue(SLDTreeLeafFactory.getInstance().hasFill(polygonSymbolizer));
    assertTrue(SLDTreeLeafFactory.getInstance().hasFill(pointSymbolizer));
    assertFalse(SLDTreeLeafFactory.getInstance().hasFill(lineSymbolizer));
    assertFalse(SLDTreeLeafFactory.getInstance().hasFill(textSymbolizer));
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:20,代码来源:SLDTreeLeafFactoryTest.java

示例13: testHasStroke

import org.geotools.styling.LineSymbolizer; //导入依赖的package包/类
/**
 * 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));
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:20,代码来源:SLDTreeLeafFactoryTest.java

示例14: testGetFill

import org.geotools.styling.LineSymbolizer; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:22,代码来源:SLDTreeLeafFactoryTest.java

示例15: testGetStroke

import org.geotools.styling.LineSymbolizer; //导入依赖的package包/类
/**
 * Test method for
 * {@link com.sldeditor.common.tree.leaf.SLDTreeLeafFactory#getStroke(org.opengis.style.Symbolizer)}.
 */
@Test
public void testGetStroke() {
    PolygonSymbolizer polygonSymbolizer = DefaultSymbols.createDefaultPolygonSymbolizer();
    //CHECKSTYLE:OFF
    PointSymbolizer pointSymbolizer = DefaultSymbols.createDefaultPointSymbolizer();
    LineSymbolizer lineSymbolizer = DefaultSymbols.createDefaultLineSymbolizer();
    TextSymbolizer textSymbolizer = DefaultSymbols.createDefaultTextSymbolizer();
    //CHECKSTYLE:ON

    assertNull(SLDTreeLeafFactory.getInstance().getStroke(null));
    assertTrue(SLDTreeLeafFactory.getInstance().getStroke(polygonSymbolizer) != null);
    assertTrue(SLDTreeLeafFactory.getInstance().getStroke(lineSymbolizer) != null);

    // Returns default stroke
    assertTrue(SLDTreeLeafFactory.getInstance().getStroke(pointSymbolizer) != null);
    assertTrue(SLDTreeLeafFactory.getInstance().getStroke(textSymbolizer) != null);
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:22,代码来源:SLDTreeLeafFactoryTest.java


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