原因是在org.geotools.renderer.lite.StreamingRenderer中的process函数:
/**
* @param rf
* @param feature
* @param fts
* @param layerId
*/
private void process(RenderableFeature rf, LiteFeatureTypeStyle fts,
NumberRange scaleRange, AffineTransform at,
CoordinateReferenceSystem destinationCrs, String layerId)
throws Exception {
boolean doElse = true;
Rule[] elseRuleList = fts.elseRules;
Rule[] ruleList = fts.ruleList;
Rule r;
Filter filter;
Graphics2D graphics = fts.graphics;
// applicable rules
final int length = ruleList.length;
for (int t = 0; t < length; t++) {
r = ruleList[t];
filter = r.getFilter();
if (filter == null || filter.evaluate(rf.content)) {
doElse = false;
processSymbolizers(graphics, rf, r.symbolizers(), scaleRange, at, destinationCrs, layerId);
}
}
if (doElse) {
final int elseLength = elseRuleList.length;
for (int tt = 0; tt < elseLength; tt++) {
r = elseRuleList[tt];
//这里应该像上面一样再通过filter过滤一下:filter = r.getFilter(); if (filter == null || filter.evaluate(rf.content)) {}
processSymbolizers(graphics, rf, r.symbolizers(), scaleRange,
at, destinationCrs, layerId);
}
}
}