String name = DEFAULT_GEOMETRY;
Stroke stroke = null;
Fill fill = null;
Graphic graphic = null;
TextSymbolizer text = null;
LabelPlacement placement = null;
List<Rule> rules = fts.rules();
if (rules.size() > 1) {
// simple mode trimms away all but the first rule
Rule keepRule = rules.get(0);
rules.clear();
rules.add(keepRule);
}
this.mode = determineMode(schema, true);
if (mode == Mode.NONE) {
pointMode.setSelection(false);
polyMode.setSelection(false);
lineMode.setSelection(false);
} else if (mode == Mode.LINE) {
lineMode.setSelection(true);
LineSymbolizer sym = SLDs.lineSymbolizer(fts);
stroke = SLDs.stroke(sym);
placement = SLDs.getPlacement(SLDs.ALIGN_LEFT, SLDs.ALIGN_MIDDLE, 0);
name = sym == null ? null : sym.getGeometryPropertyName();
} else if (mode == Mode.POLYGON) {
polyMode.setSelection(true);
PolygonSymbolizer sym = SLDs.polySymbolizer(fts);
stroke = SLDs.stroke(sym);
fill = SLDs.fill(sym);
placement = SLDs.getPlacement(SLDs.ALIGN_CENTER, SLDs.ALIGN_MIDDLE, 0);
name = sym == null ? null : sym.getGeometryPropertyName();
} else if (mode == Mode.POINT || mode == Mode.ALL) { // default to handling as Point
pointMode.setSelection(true);
PointSymbolizer sym = SLDs.pointSymbolizer(fts);
stroke = SLDs.stroke(sym);
fill = SLDs.fill(sym);
graphic = SLDs.graphic(sym);
placement = SLDs.getPlacement(SLDs.ALIGN_LEFT, SLDs.ALIGN_MIDDLE, 0);
name = sym == null ? null : sym.getGeometryPropertyName();
}
text = SLDs.textSymbolizer(fts);
if (text != null && placement != null) {
text.setLabelPlacement(placement);
}
if (name == null) {
name = DEFAULT_GEOMETRY;
geometryName.getCombo().setText(name);