本文整理汇总了Java中org.geotools.styling.Mark.setWellKnownName方法的典型用法代码示例。如果您正苦于以下问题:Java Mark.setWellKnownName方法的具体用法?Java Mark.setWellKnownName怎么用?Java Mark.setWellKnownName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.geotools.styling.Mark
的用法示例。
在下文中一共展示了Mark.setWellKnownName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPointsStyle
import org.geotools.styling.Mark; //导入方法依赖的package包/类
/**
* Create style for a points layer.
*
* @param schema
* @return a point style with labels.
*/
public static Style getPointsStyle( SimpleFeatureType schema ) {
Style style = SLD.createSimpleStyle(schema);
Rule origRule = style.featureTypeStyles().get(0).rules().get(0);
Symbolizer symbolizer = origRule.symbolizers().get(0);
PointSymbolizer pointSymbolizer = (PointSymbolizer) symbolizer;
Graphic graphic = pointSymbolizer.getGraphic();
// size
graphic.setSize(ff.literal("12"));
Mark pointMark = new MarkImpl();
pointMark.setWellKnownName(ff.literal("circle"));
graphic.graphicalSymbols().clear();
graphic.graphicalSymbols().add(pointMark);
Stroke stroke = pointMark.getStroke();
if (stroke == null) {
stroke = sf.createStroke(ff.literal("#940000"), ff.literal("1"), ff.literal("1"));
} else {
stroke.setColor(ff.literal("#940000"));
stroke.setOpacity(ff.literal("1"));
}
pointMark.setStroke(stroke);
Fill fill = pointMark.getFill();
if (fill == null) {
fill = sf.createFill(ff.literal("#FF0000"), ff.literal("0.5"));
} else {
fill.setColor(ff.literal("#FF0000"));
fill.setOpacity(ff.literal("0.5"));
}
pointMark.setFill(fill);
LabelPlacement labelPlacement = sf.createPointPlacement(sf.createAnchorPoint(ff.literal(0.0), ff.literal(0.0)),
sf.createDisplacement(ff.literal(0.0), ff.literal(0.0)), ff.literal(0.0));
Font font = sb.createFont("Arial", false, false, 12); //$NON-NLS-1$
TextSymbolizer textSymbolizer = sf.createTextSymbolizer(//
sf.createFill(ff.literal("#000000")), //
new Font[]{font}, //
null, //
ff.property(DataSource.TIMESTAMP_H), //
labelPlacement, //
null);
origRule.symbolizers().add(textSymbolizer);
// Rule rule = sf.createRule();
// rule.symbolizers().add(pointSymbolizer);
// rule.symbolizers().add(textSymbolizer);
//
// FeatureTypeStyle fts = sf.createFeatureTypeStyle(new Rule[]{rule});
// Style newStyle = sf.createStyle();
// newStyle.featureTypeStyles().add(fts);
return style;
}