本文整理汇总了Java中org.geotools.styling.LineSymbolizer.setStroke方法的典型用法代码示例。如果您正苦于以下问题:Java LineSymbolizer.setStroke方法的具体用法?Java LineSymbolizer.setStroke怎么用?Java LineSymbolizer.setStroke使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.geotools.styling.LineSymbolizer
的用法示例。
在下文中一共展示了LineSymbolizer.setStroke方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: 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);
}
示例3: 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);
}
}
}
示例4: 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());
}
}
}
示例5: createDefaultLineFeatureTypeStyle
import org.geotools.styling.LineSymbolizer; //导入方法依赖的package包/类
private FeatureTypeStyle createDefaultLineFeatureTypeStyle(String strokeWidth, String strokeColor, String opacity){
StyleFactory sf = CommonFactoryFinder.getStyleFactory(new Hints(Hints.KEY_RENDERING, Hints.VALUE_RENDER_SPEED));
FilterFactory filterFactory = new FilterFactoryImpl();
Stroke lineStroke = sf.getDefaultStroke();
lineStroke.setWidth(filterFactory.literal(new Integer(strokeWidth)));
lineStroke.setColor(filterFactory.literal(strokeColor));
lineStroke.setOpacity(filterFactory.literal(opacity));
LineSymbolizer lineSymbolizer = sf.createLineSymbolizer();
lineSymbolizer.setStroke(lineStroke);
Rule lineRule = sf.createRule();
lineRule.symbolizers().add(lineSymbolizer);
FeatureTypeStyle lineFeatureTypeStyle = sf.createFeatureTypeStyle(new Rule[]{lineRule});
return lineFeatureTypeStyle;
}
示例6: getLinesStyle
import org.geotools.styling.LineSymbolizer; //导入方法依赖的package包/类
/**
* Create style for a lines layer.
*
* @param schema
* @return a line style.
*/
public static Style getLinesStyle( SimpleFeatureType schema ) {
Style style = SLD.createSimpleStyle(schema);
Rule origRule = style.featureTypeStyles().get(0).rules().get(0);
Symbolizer symbolizer = origRule.symbolizers().get(0);
LineSymbolizer lineSymbolizer = (LineSymbolizer) symbolizer;
Stroke stroke = lineSymbolizer.getStroke();
if (stroke == null) {
stroke = sf.createStroke(ff.literal("#0000FF"), ff.literal("2"), ff.literal("1"));
} else {
stroke.setColor(ff.literal("#0000FF"));
stroke.setWidth(ff.literal("2"));
stroke.setOpacity(ff.literal("1"));
}
lineSymbolizer.setStroke(stroke);
return style;
}
示例7: testCreateStroke
import org.geotools.styling.LineSymbolizer; //导入方法依赖的package包/类
/**
* Test method for {@link com.sldeditor.common.tree.leaf.SLDTreeLeafLine#createStroke(org.opengis.style.Symbolizer)}.
*/
@Test
public void testCreateStroke() {
SLDTreeLeafLine leaf = new SLDTreeLeafLine();
LineSymbolizer lineSymbolizer = DefaultSymbols.createDefaultLineSymbolizer();
lineSymbolizer.setStroke(null);
leaf.createStroke(lineSymbolizer);
assertTrue(lineSymbolizer.getStroke() != null);
}
示例8: createSimpleLineRule
import org.geotools.styling.LineSymbolizer; //导入方法依赖的package包/类
/**
* Creates a simple {@link Rule} for a line.
*
* @param color
* the color.
* @param width
* the line width.
* @return the rule.
*/
public static Rule createSimpleLineRule( Color color, float width ) {
LineSymbolizer lineSymbolizer = Utilities.sf.createLineSymbolizer();
lineSymbolizer.setStroke(Utilities.sf.createStroke(
Utilities.ff.literal("#" + Integer.toHexString(color.getRGB() & 0xffffff)), Utilities.ff.literal(width)));
Rule rule = Utilities.sf.createRule();
rule.setName("New rule");
rule.symbolizers().add(lineSymbolizer);
return rule;
}
示例9: setHasStroke
import org.geotools.styling.LineSymbolizer; //导入方法依赖的package包/类
public void setHasStroke(boolean hasStroke) {
this.hasStroke = hasStroke;
if (hasStroke) {
checkStrokeExists();
} else {
stroke = null;
LineSymbolizer lineSymbolizer = (LineSymbolizer) getSymbolizer();
lineSymbolizer.setStroke(null);
}
}
示例10: checkStrokeExists
import org.geotools.styling.LineSymbolizer; //导入方法依赖的package包/类
protected void checkStrokeExists() {
if (stroke == null) {
if (strokeColor == null) {
strokeColor = DEFAULT_COLOR;
}
if (strokeWidth == null) {
strokeWidth = DEFAULT_WIDTH;
}
stroke = sf.createStroke(ff.literal(strokeColor), ff.literal(strokeWidth));
LineSymbolizer lineSymbolizer = (LineSymbolizer) getSymbolizer();
lineSymbolizer.setStroke(stroke);
strokeGraphicStroke = stroke.getGraphicStroke();
}
}
示例11: createDefaultLineRule
import org.geotools.styling.LineSymbolizer; //导入方法依赖的package包/类
/**
* Creates a default {@link Rule} for a line.
*
* @return the default rule.
*/
public static Rule createDefaultLineRule() {
LineSymbolizer lineSymbolizer = sf.createLineSymbolizer();
lineSymbolizer.setStroke(
sf.createStroke(ff.literal("#" + Integer.toHexString(Color.BLACK.getRGB() & 0xffffff)), ff.literal(1)));
Rule rule = sf.createRule();
rule.setName("New rule");
rule.symbolizers().add(lineSymbolizer);
return rule;
}
示例12: convert
import org.geotools.styling.LineSymbolizer; //导入方法依赖的package包/类
@Override
public void convert(Rule rule, JsonElement element, String layerName, int transparency) {
if(rule == null) return;
if(element == null) return;
JsonArray layerArray = element.getAsJsonArray();
List<Symbolizer> symbolizerList = rule.symbolizers();
if(layerArray.size() > 0)
{
for(int index = 0; index < layerArray.size(); index ++)
{
JsonObject obj = layerArray.get(index).getAsJsonObject();
// Handle fills
List<Symbolizer> createdSymbolizerList = SymbolManager.getInstance().getFillSymbol(layerName, obj.get(MultiLayerFillSymbolKeys.FILL), transparency);
if(symbolizerList != null)
{
symbolizerList.addAll(createdSymbolizerList);
}
// Handle strokes
JsonElement jsonOutlineElement = obj.get(MultiLayerFillSymbolKeys.OUTLINE);
List<Stroke> strokeList = SymbolManager.getInstance().getStrokeList(jsonOutlineElement);
if(strokeList != null)
{
List<Symbolizer> createdLineSymbolizerList = new ArrayList<Symbolizer>();
for(Stroke stroke : strokeList)
{
LineSymbolizer lineSymbol = styleFactory.createLineSymbolizer();
lineSymbol.setStroke(stroke);
createdLineSymbolizerList.add(lineSymbol);
}
symbolizerList.addAll(createdLineSymbolizerList);
}
}
}
}
示例13: updateSymbol
import org.geotools.styling.LineSymbolizer; //导入方法依赖的package包/类
/**
* Update symbol.
*/
private void updateSymbol() {
if (!Controller.getInstance().isPopulating()) {
Stroke stroke = getStroke();
if (symbolizer instanceof PointSymbolizer) {
PointSymbolizer pointSymbol = (PointSymbolizer) symbolizer;
Graphic graphic = pointSymbol.getGraphic();
GraphicalSymbol symbol = graphic.graphicalSymbols().get(0);
if (symbol instanceof MarkImpl) {
MarkImpl markerSymbol = (MarkImpl) symbol;
markerSymbol.setStroke(stroke);
SelectedSymbol.getInstance().replaceSymbolizer(pointSymbol);
this.fireUpdateSymbol();
}
} else if (symbolizer instanceof LineSymbolizer) {
LineSymbolizer lineSymbol = (LineSymbolizer) symbolizer;
lineSymbol.setStroke(stroke);
SelectedSymbol.getInstance().replaceSymbolizer(lineSymbol);
this.fireUpdateSymbol();
} else if (symbolizer instanceof PolygonSymbolizer) {
PolygonSymbolizer polygonSymbol = (PolygonSymbolizer) symbolizer;
polygonSymbol.setStroke(stroke);
SelectedSymbol.getInstance().replaceSymbolizer(polygonSymbol);
this.fireUpdateSymbol();
}
}
}
示例14: createDefaultLineSymbolizer
import org.geotools.styling.LineSymbolizer; //导入方法依赖的package包/类
/**
* Creates the default line symbolizer.
*
* @return the line symbolizer
*/
public static LineSymbolizer createDefaultLineSymbolizer() {
Stroke stroke = styleFactory.createStroke(ff.literal(DEFAULT_LINE_COLOUR), ff.literal(2));
LineSymbolizer lineSymbolizer = styleFactory.createLineSymbolizer();
lineSymbolizer.setStroke(stroke);
return lineSymbolizer;
}
示例15: createTestLine
import org.geotools.styling.LineSymbolizer; //导入方法依赖的package包/类
/**
* Creates the test line.
*
* @param url the url
* @return the styled layer descriptor
*/
private StyledLayerDescriptor createTestLine(URL url) {
StyleBuilder sb = new StyleBuilder();
StyleFactory styleFactory = sb.getStyleFactory();
StyledLayerDescriptor sld = styleFactory.createStyledLayerDescriptor();
NamedLayer namedLayer = styleFactory.createNamedLayer();
sld.addStyledLayer(namedLayer);
Style style = styleFactory.createStyle();
namedLayer.addStyle(style);
List<FeatureTypeStyle> ftsList = style.featureTypeStyles();
FeatureTypeStyle fts = styleFactory.createFeatureTypeStyle();
ftsList.add(fts);
Rule rule = styleFactory.createRule();
fts.rules().add(rule);
LineSymbolizer line = styleFactory.createLineSymbolizer();
rule.symbolizers().add(line);
Graphic graphicFill = createGraphic(url, styleFactory);
Graphic graphicStroke = createGraphic(url, styleFactory);
Stroke stroke = styleFactory.createStroke(null, null, null, null, null, null, null,
graphicFill, graphicStroke);
line.setStroke(stroke);
return sld;
}