LabelStyleInfo labelStyleInfo = new LabelStyleInfo();
List<FeatureStyleInfo> featureStyleInfos = new ArrayList<FeatureStyleInfo>();
for (FeatureTypeStyleInfo featureTypeStyleInfo : userStyle.getFeatureTypeStyleList()) {
int styleIndex = 0;
for (RuleInfo ruleInfo : featureTypeStyleInfo.getRuleList()) {
FeatureStyleInfo featureStyleInfo = new FeatureStyleInfo();
if (ruleInfo.getChoice() != null) {
if (ruleInfo.getChoice().ifFilter()) {
featureStyleInfo.setFormula(convertFormula(ruleInfo.getChoice().getFilter(), featureInfo));
}
}
for (SymbolizerTypeInfo symbolizerTypeInfo : ruleInfo.getSymbolizerList()) {
if (symbolizerTypeInfo instanceof PointSymbolizerInfo) {
PointSymbolizerInfo pointInfo = (PointSymbolizerInfo) symbolizerTypeInfo;
convertSymbol(featureStyleInfo, pointInfo);
} else if (symbolizerTypeInfo instanceof LineSymbolizerInfo) {
LineSymbolizerInfo lineInfo = (LineSymbolizerInfo) symbolizerTypeInfo;
convertStroke(featureStyleInfo, lineInfo.getStroke());
} else if (symbolizerTypeInfo instanceof PolygonSymbolizerInfo) {
PolygonSymbolizerInfo polygonInfo = (PolygonSymbolizerInfo) symbolizerTypeInfo;
convertFill(featureStyleInfo, polygonInfo.getFill());
convertStroke(featureStyleInfo, polygonInfo.getStroke());
} else if (symbolizerTypeInfo instanceof TextSymbolizerInfo) {
TextSymbolizerInfo textInfo = (TextSymbolizerInfo) symbolizerTypeInfo;
labelStyleInfo.setFontStyle(convertFont(textInfo.getFont()));
for (ExpressionInfo expr : textInfo.getLabel().getExpressionList()) {
labelStyleInfo.setLabelAttributeName(expr.getValue());
}
convertFontFill(labelStyleInfo.getFontStyle(), textInfo.getFill());
FeatureStyleInfo background = new FeatureStyleInfo();
if (textInfo.getHalo() != null) {
convertFill(background, textInfo.getHalo().getFill());
}
labelStyleInfo.setBackgroundStyle(background);
}