return this.parserHelper.createStyle(rules);
}
private Rule createRule(final String jsonKey) {
PJsonObject ruleJson = this.json.getJSONObject(jsonKey);
Filter filter = Filter.INCLUDE;
if (!jsonKey.equals(JSON_FILTER_INCLUDE)) {
try {
filter = ECQL.toFilter(jsonKey, this.styleBuilder.getFilterFactory());
} catch (CQLException e) {
throw new RuntimeException("Error compiling rule filter: " + jsonKey, e);
}
}
PJsonArray symbolizerJsonArray = ruleJson.getJSONArray(JSON_SYMB);
Symbolizer[] symbolizers = new Symbolizer[symbolizerJsonArray.size()];
for (int i = 0; i < symbolizerJsonArray.size(); i++) {
final PJsonObject symbolizerJson = symbolizerJsonArray.getJSONObject(i);
updateSymbolizerProperties(ruleJson, symbolizerJson);
SymbolizerType type = SymbolizerType.valueOf(symbolizerJson.getString(JSON_TYPE).toUpperCase());
symbolizers[i] = type.parseJson(this.parserHelper, symbolizerJson);
if (symbolizers[i] == null) {
throw new RuntimeException("Error creating symbolizer " + symbolizerJson.getString(JSON_TYPE) + " in rule " + jsonKey);
}
}
Map<String, String> ruleValues = buildValuesMap(ruleJson, new PJsonObject(new JSONObject(), "empty"));
double minScale = getScaleDenominator(ruleValues, JSON_MIN_SCALE, Double.MIN_VALUE);
double maxScale = getScaleDenominator(ruleValues, JSON_MAX_SCALE, Double.MAX_VALUE);
final Rule rule = this.styleBuilder.createRule(symbolizers, minScale, maxScale);
rule.setFilter(filter);
return rule;