本文整理汇总了Java中org.geotools.styling.PointSymbolizer.setGraphic方法的典型用法代码示例。如果您正苦于以下问题:Java PointSymbolizer.setGraphic方法的具体用法?Java PointSymbolizer.setGraphic怎么用?Java PointSymbolizer.setGraphic使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.geotools.styling.PointSymbolizer
的用法示例。
在下文中一共展示了PointSymbolizer.setGraphic方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import org.geotools.styling.PointSymbolizer; //导入方法依赖的package包/类
/**
* (non-Javadoc)
*
* @see org.geotools.styling.visitor.DuplicatingStyleVisitor#visit(org.geotools.styling.PointSymbolizer)
*/
public void visit(PointSymbolizer ps) {
PointSymbolizer copy = sf.getDefaultPointSymbolizer();
copy.setGeometry(copy(Point.class, ps.getGeometry()));
copy.setUnitOfMeasure(ps.getUnitOfMeasure());
copy.setGraphic(copy(ps.getGraphic()));
copy.getOptions().putAll(ps.getOptions());
if (STRICT) {
if (!copy.equals(ps)) {
throw new IllegalStateException("Was unable to duplicate provided Graphic:" + ps);
}
}
pages.push(copy);
}
示例2: visit
import org.geotools.styling.PointSymbolizer; //导入方法依赖的package包/类
/**
* (non-Javadoc)
*
* @see org.geotools.styling.visitor.DuplicatingStyleVisitor#visit(org.geotools.styling.PointSymbolizer)
*/
public void visit(PointSymbolizer ps) {
PointSymbolizer copy = sf.getDefaultPointSymbolizer();
copy.setGeometry(copy(ps.getGeometry()));
copy.setUnitOfMeasure(ps.getUnitOfMeasure());
copy.setGraphic(copy(ps.getGraphic()));
copy.getOptions().putAll(ps.getOptions());
if (STRICT) {
if (!copy.equals(ps)) {
throw new IllegalStateException("Was unable to duplicate provided Graphic:" + ps);
}
}
pages.push(copy);
}
示例3: createFill
import org.geotools.styling.PointSymbolizer; //导入方法依赖的package包/类
@Override
public void createFill(Symbolizer symbolizer) {
if (symbolizer instanceof PointSymbolizer) {
PointSymbolizer point = (PointSymbolizer) symbolizer;
if (point != null) {
Graphic graphic = point.getGraphic();
if (graphic == null) {
graphic = styleFactory.createDefaultGraphic();
point.setGraphic(graphic);
}
if (graphic != null) {
if (graphic.graphicalSymbols().isEmpty()) {
Mark mark = styleFactory.getDefaultMark();
graphic.graphicalSymbols().add(mark);
}
}
}
}
}
示例4: createDefaultPointRule
import org.geotools.styling.PointSymbolizer; //导入方法依赖的package包/类
/**
* Creates a default {@link Rule} for a point.
*
* @return the default rule.
*/
public static Rule createDefaultPointRule() {
Graphic graphic = sf.createDefaultGraphic();
Mark circleMark = sf.getCircleMark();
circleMark.setFill(sf.createFill(ff.literal("#" + Integer.toHexString(Color.RED.getRGB() & 0xffffff))));
circleMark.setStroke(sf.createStroke(ff.literal("#" + Integer.toHexString(Color.BLACK.getRGB() & 0xffffff)),
ff.literal(DEFAULT_WIDTH)));
graphic.graphicalSymbols().clear();
graphic.graphicalSymbols().add(circleMark);
graphic.setSize(ff.literal(DEFAULT_SIZE));
PointSymbolizer pointSymbolizer = sf.createPointSymbolizer();
Rule rule = sf.createRule();
rule.setName("New rule");
rule.symbolizers().add(pointSymbolizer);
pointSymbolizer.setGraphic(graphic);
return rule;
}
示例5: featureTypeStyleExample
import org.geotools.styling.PointSymbolizer; //导入方法依赖的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
}
示例6: removeFill
import org.geotools.styling.PointSymbolizer; //导入方法依赖的package包/类
@Override
public void removeFill(Symbolizer symbolizer) {
if (symbolizer instanceof PointSymbolizer) {
PointSymbolizer point = (PointSymbolizer) symbolizer;
if (point != null) {
point.setGraphic(null);
}
}
}
示例7: testHasFill
import org.geotools.styling.PointSymbolizer; //导入方法依赖的package包/类
/**
* Test method for
* {@link com.sldeditor.common.tree.leaf.SLDTreeLeafPoint#hasFill(org.opengis.style.Symbolizer)}.
*/
@Test
public void testHasFill() {
SLDTreeLeafPoint leaf = new SLDTreeLeafPoint();
assertFalse(leaf.hasFill(null));
assertFalse(leaf.hasFill(DefaultSymbols.createDefaultPolygonSymbolizer()));
PointSymbolizer pointSymbolizer = DefaultSymbols.createDefaultPointSymbolizer();
assertTrue(leaf.hasFill(pointSymbolizer));
pointSymbolizer.setGraphic(null);
assertFalse(leaf.hasFill(pointSymbolizer));
}
示例8: testCreateFill
import org.geotools.styling.PointSymbolizer; //导入方法依赖的package包/类
/**
* Test method for
* {@link com.sldeditor.common.tree.leaf.SLDTreeLeafPoint#createFill(org.opengis.style.Symbolizer)}.
*/
@Test
public void testCreateFill() {
SLDTreeLeafPoint leaf = new SLDTreeLeafPoint();
PointSymbolizer pointSymbolizer = DefaultSymbols.createDefaultPointSymbolizer();
pointSymbolizer.setGraphic(null);
leaf.createFill(pointSymbolizer);
assertTrue(pointSymbolizer.getGraphic() != null);
}
示例9: createTestPoint
import org.geotools.styling.PointSymbolizer; //导入方法依赖的package包/类
/**
* Creates the test point.
*
* @param url the url
* @return the styled layer descriptor
*/
private StyledLayerDescriptor createTestPoint(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);
PointSymbolizer point = styleFactory.createPointSymbolizer();
rule.symbolizers().add(point);
Graphic graphic = createGraphic(url, styleFactory);
point.setGraphic(graphic);
return sld;
}