本文整理汇总了Java中org.geotools.styling.StyleBuilder.createPointSymbolizer方法的典型用法代码示例。如果您正苦于以下问题:Java StyleBuilder.createPointSymbolizer方法的具体用法?Java StyleBuilder.createPointSymbolizer怎么用?Java StyleBuilder.createPointSymbolizer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.geotools.styling.StyleBuilder
的用法示例。
在下文中一共展示了StyleBuilder.createPointSymbolizer方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDefaultPointFeatureTypeStyle
import org.geotools.styling.StyleBuilder; //导入方法依赖的package包/类
private FeatureTypeStyle createDefaultPointFeatureTypeStyle(String radius, String color, String opacity){
Fill pointFill = sf.getDefaultFill();
pointFill.setColor(filterFactory.literal(color));
pointFill.setOpacity(filterFactory.literal(opacity));
Stroke pointStroke = sf.getDefaultStroke();
pointStroke.setWidth(filterFactory.literal(new Integer(DEFAULT_STROKE_WIDTH)));
pointStroke.setColor(filterFactory.literal(DEFAULT_COLOR));
pointStroke.setOpacity(filterFactory.literal(opacity));
StyleBuilder sb = new StyleBuilder();
Mark circle = sb.createMark(StyleBuilder.MARK_CIRCLE, pointFill,pointStroke);
Graphic graph = sb.createGraphic(null, circle, null, Double.parseDouble(opacity), Double.parseDouble(radius) , DEFAULT_POINT_ROTATION);
PointSymbolizer pointSymbolizer = sb.createPointSymbolizer(graph);
Rule pointRule = sf.createRule();
pointRule.symbolizers().add(pointSymbolizer);
FeatureTypeStyle pointFeatureTypeStyle = sf.createFeatureTypeStyle(new Rule[]{pointRule});
return pointFeatureTypeStyle;
}
示例2: featureTypeStyleExample
import org.geotools.styling.StyleBuilder; //导入方法依赖的package包/类
private void featureTypeStyleExample() {
// featureTypeStyleExample start
StyleBuilder styleBuilder = new StyleBuilder();
Style style = styleBuilder.createStyle();
PointSymbolizer pointSymbolizer = styleBuilder.createPointSymbolizer();
Graphic graphic = styleBuilder.createGraphic();
ExternalGraphic external = styleBuilder.createExternalGraphic("file:///C:/images/house.gif",
"image/gif");
graphic.graphicalSymbols().add(external);
graphic.graphicalSymbols().add(styleBuilder.createMark("circle"));
pointSymbolizer.setGraphic(graphic);
Rule rule = styleBuilder.createRule(pointSymbolizer);
FeatureTypeStyle featureTypeStyle = styleBuilder.createFeatureTypeStyle("Feature", rule);
style.featureTypeStyles().add(featureTypeStyle);
// featureTypeStyleExample end
}
示例3: quickPointSymbolizer
import org.geotools.styling.StyleBuilder; //导入方法依赖的package包/类
private void quickPointSymbolizer() {
// quickPointSymbolizer start
// "testPoint" feature type style
StyleBuilder sb = new StyleBuilder();
FilterFactory2 ff = sb.getFilterFactory();
Mark testMark = sb.createMark(sb.attributeExpression("name"), sb.createFill(Color.RED, 0.5),
null);
Graphic graph = sb.createGraphic(null, // An external graphics if needed
new Mark[] { testMark }, // a Mark if not an external graphics
null, // aSymbol
ff.literal(1), // opacity
ff.property("size"), // read from feature "size" attribute
ff.property("rotation")); // rotation, here read into the feature
PointSymbolizer aPointSymbolizer = sb.createPointSymbolizer(graph);
// creation of the style
Style style = sb.createStyle(aPointSymbolizer);
// quickPointSymbolizer end
}
示例4: splatExample
import org.geotools.styling.StyleBuilder; //导入方法依赖的package包/类
private void splatExample() {
// splatExample start
StyleBuilder builder = new StyleBuilder();
FilterFactory2 ff = builder.getFilterFactory();
Graphic splat = builder.createGraphic(null, builder.createMark("splat"), null);
PointSymbolizer symbolizer = builder.createPointSymbolizer(splat);
// builder will fill in all the other classes with defaults
Style style = builder.createStyle(symbolizer);
// splatExample end
}
示例5: quickTextSymbolizer
import org.geotools.styling.StyleBuilder; //导入方法依赖的package包/类
private void quickTextSymbolizer() {
// quickTextSymbolizer start
// "labelPoint" feature type style
StyleBuilder sb = new StyleBuilder();
FilterFactory2 ff = sb.getFilterFactory();
// creation of the TextSymbolizer
AnchorPoint anchorPoint = sb.createAnchorPoint(sb.attributeExpression("X"),
sb.attributeExpression("Y"));
PointPlacement pointPlacement = sb.createPointPlacement(anchorPoint, null,
sb.literalExpression(0));
TextSymbolizer textSymbolizer = sb.createTextSymbolizer(sb.createFill(Color.BLACK), new Font[] {
sb.createFont("Lucida Sans", 10), sb.createFont("Arial", 10) }, sb.createHalo(),
sb.attributeExpression("name"), pointPlacement, null);
// creation of the Point symbolizer
Mark circle = sb.createMark(StyleBuilder.MARK_CIRCLE, Color.RED);
Graphic graph2 = sb.createGraphic(null, circle, null, 1, 4, 0);
PointSymbolizer pointSymbolizer = sb.createPointSymbolizer(graph2);
// creation of the style
Style style = sb.createStyle();
FeatureTypeStyle featureTypeStyle = sb.createFeatureTypeStyle("labelPoint", new Symbolizer[] {
textSymbolizer, pointSymbolizer });
style.featureTypeStyles().add(featureTypeStyle);
// creation of the style
// quickTextSymbolizer end
}
示例6: markTestSLD
import org.geotools.styling.StyleBuilder; //导入方法依赖的package包/类
private void markTestSLD() {
// markTestSLD start
StyleBuilder sb = new StyleBuilder();
FilterFactory ff = sb.getFilterFactory();
Style style = sb.createStyle();
style.setName("MyStyle");
// "testPoint" feature type style
Mark testMark = sb.createMark(sb.attributeExpression("name"), sb.createFill(Color.RED, 0.5),
null);
Graphic graph = sb.createGraphic(null, new Mark[] { testMark }, null, sb.literalExpression(1),
sb.attributeExpression("size"), sb.attributeExpression("rotation"));
style.featureTypeStyles().add(
sb.createFeatureTypeStyle("testPoint", sb.createPointSymbolizer(graph)));
// "labelPoint" feature type style
AnchorPoint anchorPoint = sb.createAnchorPoint(sb.attributeExpression("X"),
sb.attributeExpression("Y"));
PointPlacement pointPlacement = sb.createPointPlacement(anchorPoint, null,
sb.literalExpression(0));
TextSymbolizer textSymbolizer = sb.createTextSymbolizer(sb.createFill(Color.BLACK), new Font[] {
sb.createFont("Lucida Sans", 10), sb.createFont("Arial", 10) }, sb.createHalo(),
sb.attributeExpression("name"), pointPlacement, null);
Mark circle = sb.createMark(StyleBuilder.MARK_CIRCLE, Color.RED);
Graphic graph2 = sb.createGraphic(null, circle, null, 1, 4, 0);
PointSymbolizer pointSymbolizer = sb.createPointSymbolizer(graph2);
style.featureTypeStyles().add(
sb.createFeatureTypeStyle("labelPoint", new Symbolizer[] { textSymbolizer,
pointSymbolizer }));
// markTestSLD end
}
示例7: styleBuilderExample
import org.geotools.styling.StyleBuilder; //导入方法依赖的package包/类
private void styleBuilderExample() throws Exception {
// styleBuilderExample start
//
// We are using the GeoTools StyleBuilder that is helpful for quickly making things
StyleBuilder builder = new StyleBuilder();
FilterFactory2 ff = builder.getFilterFactory();
// RULE 1
// first rule to draw cities
// define a point symbolizer representing a city
Graphic city = builder.createGraphic();
city.setSize(ff.literal(10));
city.graphicalSymbols().add(builder.createExternalGraphic("file:city.svg", "svg")); // svg
// preferred
city.graphicalSymbols().add(builder.createExternalGraphic("file:city.png", "png")); // png next
city.graphicalSymbols().add(
builder.createMark(StyleBuilder.MARK_CIRCLE, Color.BLUE, Color.BLACK, 1));
PointSymbolizer pointSymbolizer = builder.createPointSymbolizer(city, "the_geom");
Rule rule1 = builder.createRule(pointSymbolizer);
rule1.setName("rule1");
rule1.getDescription().setTitle("City");
rule1.getDescription().setAbstract("Rule for drawing cities");
rule1.setFilter(ff.less(ff.property("POPULATION"), ff.literal(50000)));
//
// RULE 2 Default
Graphic dotGraphic = builder.createGraphic(null, builder.createMark(StyleBuilder.MARK_CIRCLE),
null);
PointSymbolizer dotSymbolize = builder.createPointSymbolizer(dotGraphic);
Rule rule2 = builder.createRule(dotSymbolize);
rule2.setIsElseFilter(true);
//
// define feature type styles used to actually define how features are rendered
Rule rules[] = new Rule[] { rule1, rule2 };
FeatureTypeStyle featureTypeStyle = builder.createFeatureTypeStyle("Feature", rules);
//
// create a "user defined" style
Style style = builder.createStyle();
style.setName("style");
style.getDescription().setTitle("User Style");
style.getDescription().setAbstract("Definition of Style");
style.featureTypeStyles().add(featureTypeStyle);
// styleBuilderExample end
}
示例8: createPointSymbolizer
import org.geotools.styling.StyleBuilder; //导入方法依赖的package包/类
private static PointSymbolizer createPointSymbolizer(
StyleBuilder styleBuilder) {
return styleBuilder.createPointSymbolizer();
}