本文整理汇总了Java中org.geotools.styling.LineSymbolizer.getStroke方法的典型用法代码示例。如果您正苦于以下问题:Java LineSymbolizer.getStroke方法的具体用法?Java LineSymbolizer.getStroke怎么用?Java LineSymbolizer.getStroke使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.geotools.styling.LineSymbolizer
的用法示例。
在下文中一共展示了LineSymbolizer.getStroke方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: populate
import org.geotools.styling.LineSymbolizer; //导入方法依赖的package包/类
/**
* Populate.
*
* @param selectedSymbol the selected symbol
*/
/*
* (non-Javadoc)
*
* @see com.sldeditor.ui.iface.PopulateDetailsInterface#populate(com.sldeditor.ui.detail.selectedsymbol.SelectedSymbol)
*/
@Override
public void populate(SelectedSymbol selectedSymbol) {
Stroke stroke = null;
if (selectedSymbol != null) {
symbolizer = selectedSymbol.getSymbolizer();
if (symbolizer instanceof PointSymbolizer) {
PointSymbolizer pointSymbolizer = (PointSymbolizer) symbolizer;
Graphic graphic = pointSymbolizer.getGraphic();
List<GraphicalSymbol> graphicalSymbols = graphic.graphicalSymbols();
if (graphicalSymbols.size() > 0) {
GraphicalSymbol symbol = graphicalSymbols.get(0);
if (symbol instanceof MarkImpl) {
MarkImpl markerSymbol = (MarkImpl) symbol;
stroke = markerSymbol.getStroke();
}
}
} else if (symbolizer instanceof LineSymbolizer) {
LineSymbolizer lineSymbol = (LineSymbolizer) symbolizer;
stroke = lineSymbol.getStroke();
} else if (symbolizer instanceof PolygonSymbolizer) {
PolygonSymbolizer polygonSymbol = (PolygonSymbolizer) symbolizer;
stroke = polygonSymbol.getStroke();
}
}
Class<?> symbolizerClass = null;
if (symbolizer != null) {
symbolizerClass = symbolizer.getClass();
}
populateStroke(symbolizerClass, stroke);
}
示例4: LineSymbolizerWrapper
import org.geotools.styling.LineSymbolizer; //导入方法依赖的package包/类
public LineSymbolizerWrapper(Symbolizer symbolizer, RuleWrapper parent) {
super(symbolizer, parent);
initEndPointSymbolizers();
LineSymbolizer lineSymbolizer = (LineSymbolizer) symbolizer;
// offset
Point2D offset = getOffset(lineSymbolizer);
if (offset != null) {
xOffset = String.valueOf(offset.getX());
yOffset = String.valueOf(offset.getY());
} else {
xOffset = DEFAULT_OFFSET;
yOffset = DEFAULT_OFFSET;
}
stroke = lineSymbolizer.getStroke();
if (stroke != null) {
Expression color = stroke.getColor();
strokeColor = expressionToString(color);
Expression width = stroke.getWidth();
strokeWidth = expressionToString(width);
Expression opacity = stroke.getOpacity();
strokeOpacity = expressionToString(opacity);
if (strokeColor == null) {
strokeColor = DEFAULT_COLOR;
stroke.setColor(ff.literal(DEFAULT_COLOR));
}
if (strokeOpacity == null) {
strokeOpacity = DEFAULT_OPACITY;
stroke.setOpacity(ff.literal(DEFAULT_OPACITY));
}
if (strokeWidth == null) {
strokeWidth = DEFAULT_WIDTH;
stroke.setWidth(ff.literal(DEFAULT_WIDTH));
}
strokeGraphicStroke = stroke.getGraphicStroke();
if (strokeGraphicStroke != null) {
List<GraphicalSymbol> graphicalSymbolsList = strokeGraphicStroke.graphicalSymbols();
if (graphicalSymbolsList.size() > 0) {
GraphicalSymbol graphicalSymbol = graphicalSymbolsList.get(0);
if (graphicalSymbol instanceof ExternalGraphic) {
strokeExternalGraphicStroke = (ExternalGraphic) graphicalSymbol;
}
}
}
// dash
float[] dashArray = stroke.getDashArray();
if (dashArray != null) {
dash = getDashString(dashArray);
} else {
dash = ""; //$NON-NLS-1$
}
// dashoffset
dashOffset = stroke.getDashOffset().evaluate(null, String.class);
// line cap
lineCap = stroke.getLineCap().evaluate(null, String.class);
// line join
lineJoin = stroke.getLineJoin().evaluate(null, String.class);
hasStroke = true;
} else {
hasStroke = false;
}
}