本文整理了Java中org.geotools.styling.Rule.accept
方法的一些代码示例,展示了Rule.accept
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Rule.accept
方法的具体详情如下:
包路径:org.geotools.styling.Rule
类名称:Rule
方法名:accept
[英]Used to traverse the style data structure.
[中]用于遍历样式数据结构。
代码示例来源:origin: geotools/geotools
public void visit(FeatureTypeStyle fts) {
Rule[] rules = fts.getRules();
for (int i = 0; i < rules.length; i++) {
Rule rule = rules[i];
rule.accept(this);
}
}
代码示例来源:origin: geotools/geotools
@Override
public void visit(FeatureTypeStyle fts) {
for (Rule r : fts.getRules()) {
r.accept(this);
}
}
代码示例来源:origin: geotools/geotools
/**
* Returns true if the ScreenMap optimization can be applied given the current renderer and
* configuration and the style to be applied
*
* @param lfts
* @return
*/
boolean screenMapEnabled(LiteFeatureTypeStyle lfts) {
if (generalizationDistance == 0.0) {
return false;
}
OpacityFinder finder =
new OpacityFinder(
new Class[] {
PointSymbolizer.class, LineSymbolizer.class, PolygonSymbolizer.class
});
for (Rule r : lfts.ruleList) {
r.accept(finder);
}
for (Rule r : lfts.elseRules) {
r.accept(finder);
}
return !finder.hasOpacity;
}
代码示例来源:origin: geotools/geotools
public void visit(FeatureTypeStyle fts) {
Rule[] rules = fts.getRules();
for (int i = 0; i < rules.length; i++) {
if (hasOpacity) {
break;
}
rules[i].accept(this);
}
}
代码示例来源:origin: geotools/geotools
/** @see org.geotools.styling.StyleVisitor#visit(org.geotools.styling.FeatureTypeStyle) */
public void visit(FeatureTypeStyle fts) {
Rule[] rules = fts.getRules();
for (int i = 0; i < rules.length; i++) {
Rule rule = rules[i];
rule.accept(this);
}
}
代码示例来源:origin: geotools/geotools
r.accept(cloner);
Rule copy = (Rule) cloner.getCopy();
if (!Filter.EXCLUDE.equals(copy.getFilter())) {
代码示例来源:origin: geotools/geotools
rule.accept(update);
Rule updatedRule = (Rule) update.getCopy();
featureTypeStyle.rules().set(i, updatedRule);
代码示例来源:origin: geotools/geotools
rule.accept(update);
Rule updatedRule = (Rule) update.getCopy();
featureTypeStyle.rules().set(i, updatedRule);
代码示例来源:origin: geotools/geotools
rule.accept(update);
Rule updatedRule = (Rule) update.getCopy();
featureTypeStyle.rules().set(i, updatedRule);
代码示例来源:origin: geotools/geotools
for (int i = 0; i < length; i++) {
if (rules[i] != null) {
rules[i].accept(this);
rulesCopy[i] = (Rule) pages.pop();
代码示例来源:origin: geotools/geotools
@Test
public void testLineSymbolizer() {
// Try with property
Expression expression = ff.property("attribute");
LineSymbolizer lineSymbolizer = sb.createLineSymbolizer();
lineSymbolizer.setPerpendicularOffset(expression);
Rule r = sb.createRule(lineSymbolizer);
StyleAttributeExtractor extractor = new StyleAttributeExtractor();
r.accept(extractor);
Set<String> atts = extractor.getAttributeNameSet();
assertTrue(atts.contains("attribute"));
assertEquals(1, atts.size());
// Try without property but with a literal value
lineSymbolizer.setPerpendicularOffset(ff.literal(34.12));
extractor = new StyleAttributeExtractor();
r.accept(extractor);
atts = extractor.getAttributeNameSet();
assertEquals(0, atts.size());
}
}
代码示例来源:origin: geotools/geotools
public void visit(FeatureTypeStyle fts) {
start("FeatureTypeStyle");
if ((fts.getName() != null) && (fts.getName().length() > 0)) {
element("Name", fts.getName());
}
if (fts.getDescription() != null && fts.getDescription().getTitle() != null)
element("Title", fts.getDescription().getTitle());
if (fts.getDescription() != null && fts.getDescription().getAbstract() != null)
element("Abstract", fts.getDescription().getAbstract());
if ((fts.featureTypeNames() != null) && (fts.featureTypeNames().size() > 0)) {
element("FeatureTypeName", fts.featureTypeNames().iterator().next().toString());
}
if (fts.getTransformation() != null) {
element("Transformation", fts.getTransformation());
}
String[] sti = fts.getSemanticTypeIdentifiers();
if (sti.length != 1 || !sti[0].equals(SemanticType.ANY.toString())) {
for (int i = 0; i < sti.length; i++) {
element("SemanticTypeIdentifier", sti[i]);
}
}
Rule[] rules = fts.getRules();
for (int i = 0; i < rules.length; i++) {
rules[i].accept(this);
}
encodeVendorOptions(fts.getOptions());
end("FeatureTypeStyle");
}
代码示例来源:origin: geotools/geotools
@Test
public void testPlainFilter() {
Filter f = ff.greater(ff.property("attribute"), ff.literal(10));
Rule r = sb.createRule(sb.createPointSymbolizer());
r.setFilter(f);
StyleAttributeExtractor extractor = new StyleAttributeExtractor();
r.accept(extractor);
Set<String> atts = extractor.getAttributeNameSet();
assertTrue(atts.contains("attribute"));
assertEquals(1, atts.size());
assertTrue(extractor.getDefaultGeometryUsed());
}
代码示例来源:origin: geotools/geotools
@Test
public void testGeometryTransformation() {
PointSymbolizer ps = sb.createPointSymbolizer();
ps.setGeometry(
ff.function(
"offset",
ff.property("the_geom"),
ff.property("offx"),
ff.property("offy")));
Rule r = sb.createRule(ps);
StyleAttributeExtractor extractor = new StyleAttributeExtractor();
r.accept(extractor);
Set<String> atts = extractor.getAttributeNameSet();
assertEquals(3, atts.size());
assertTrue(atts.contains("the_geom"));
assertTrue(atts.contains("offx"));
assertTrue(atts.contains("offy"));
assertFalse(extractor.getDefaultGeometryUsed());
}
代码示例来源:origin: org.geotools/gt-render
public void visit(FeatureTypeStyle fts) {
Rule[] rules = fts.getRules();
for (int i = 0; i < rules.length; i++) {
if (hasOpacity) {
break;
}
rules[i].accept(this);
}
}
代码示例来源:origin: org.geotools/gt-render
public void visit(FeatureTypeStyle fts) {
Rule[] rules = fts.getRules();
for (int i = 0; i < rules.length; i++) {
Rule rule = rules[i];
rule.accept(this);
}
}
代码示例来源:origin: org.geotools/gt-main
@Override
public void visit(FeatureTypeStyle fts) {
for (Rule r : fts.getRules()) {
r.accept(this);
}
}
代码示例来源:origin: geotools/geotools
EnvFunction.setLocalValue("pname", "name");
StyleAttributeExtractor extractor = new StyleAttributeExtractor();
r.accept(extractor);
代码示例来源:origin: geotools/geotools
@Test
public void testRule() throws Exception {
Symbolizer symb1 = sf.createLineSymbolizer(sf.getDefaultStroke(), "geometry");
Symbolizer symb2 =
sf.createPolygonSymbolizer(sf.getDefaultStroke(), sf.getDefaultFill(), "shape");
RasterSymbolizer symb3 = sf.createRasterSymbolizer();
Rule rule = sf.createRule();
rule.setSymbolizers(new Symbolizer[] {symb1, symb2, symb3});
rule.accept(visitor);
Rule clone = (Rule) visitor.getCopy();
assertNotNull(clone);
}
代码示例来源:origin: geotools/geotools
public void testRule() throws Exception {
Symbolizer symb1 = sf.createLineSymbolizer(sf.getDefaultStroke(), "geometry");
Symbolizer symb2 =
sf.createPolygonSymbolizer(sf.getDefaultStroke(), sf.getDefaultFill(), "shape");
Rule rule = sf.createRule();
rule.setSymbolizers(new Symbolizer[] {symb1, symb2});
rule.accept(visitor);
Rule clone = (Rule) visitor.getCopy();
assertCopy(rule, clone);
assertEqualsContract(rule, clone);
symb2 = sf.createPolygonSymbolizer(sf.getDefaultStroke(), sf.getDefaultFill(), "shape");
Rule notEq = sf.createRule();
notEq.setSymbolizers(new Symbolizer[] {symb2});
assertEqualsContract(clone, notEq, rule);
symb1 = sf.createLineSymbolizer(sf.getDefaultStroke(), "geometry");
clone.setSymbolizers(new Symbolizer[] {symb1});
assertTrue(!rule.equals(clone));
}
内容来源于网络,如有侵权,请联系作者删除!