use of org.geotools.styling.LinePlacementImpl in project sldeditor by robward-scisys.
the class TextSymbolizerDetails method populate.
/**
* Populate.
*
* @param selectedSymbol the selected symbol
*/
/*
* (non-Javadoc)
*
* @see com.sldeditor.ui.iface.PopulateDetailsInterface#populate(com.sldeditor.ui.detail.selectedsymbol.SelectedSymbol)
*/
@Override
public void populate(SelectedSymbol selectedSymbol) {
if (selectedSymbol != null) {
TextSymbolizer textSymbolizer = (TextSymbolizer) selectedSymbol.getSymbolizer();
if (textSymbolizer != null) {
populateStandardData(textSymbolizer);
//
// Geometry
//
fieldConfigVisitor.populateField(FieldIdEnum.GEOMETRY, textSymbolizer.getGeometry());
//
// Label
//
fieldConfigVisitor.populateField(FieldIdEnum.LABEL, textSymbolizer.getLabel());
// Font
Font font = textSymbolizer.getFont();
GroupConfigInterface group = getGroup(GroupIdEnum.FONT);
group.enable(font != null);
if (font != null) {
fieldConfigVisitor.populateFontField(FieldIdEnum.FONT_FAMILY, font);
fieldConfigVisitor.populateField(FieldIdEnum.FONT_WEIGHT, font.getWeight());
fieldConfigVisitor.populateField(FieldIdEnum.FONT_STYLE, font.getStyle());
fieldConfigVisitor.populateField(FieldIdEnum.FONT_SIZE, font.getSize());
}
fieldConfigVisitor.populateFontField(FieldIdEnum.FONT_PREVIEW, font);
// Fill
Fill fill = (FillImpl) textSymbolizer.getFill();
if (fill != null) {
fieldConfigVisitor.populateField(FieldIdEnum.FILL_COLOUR, fill.getColor());
fieldConfigVisitor.populateField(FieldIdEnum.TEXT_OPACITY, fill.getOpacity());
}
// Halo
Halo halo = textSymbolizer.getHalo();
group = getGroup(GroupIdEnum.HALO);
group.enable(halo != null);
if (halo != null) {
Fill haloFill = halo.getFill();
fieldConfigVisitor.populateField(FieldIdEnum.HALO_COLOUR, haloFill.getColor());
fieldConfigVisitor.populateField(FieldIdEnum.HALO_RADIUS, halo.getRadius());
} else {
fieldConfigVisitor.populateField(FieldIdEnum.HALO_COLOUR, (Expression) null);
fieldConfigVisitor.populateField(FieldIdEnum.HALO_RADIUS, (Expression) null);
}
group = getGroup(GroupIdEnum.PLACEMENT);
if (group != null) {
MultiOptionGroup labelPlacementGroup = (MultiOptionGroup) group;
LabelPlacement placement = textSymbolizer.getLabelPlacement();
if (placement instanceof PointPlacementImpl) {
PointPlacementImpl pointPlacement = (PointPlacementImpl) placement;
labelPlacementGroup.setOption(GroupIdEnum.POINTPLACEMENT);
Expression anchorPointX = null;
Expression anchorPointY = null;
AnchorPoint anchorPoint = pointPlacement.getAnchorPoint();
if (anchorPoint != null) {
anchorPointX = anchorPoint.getAnchorPointX();
anchorPointY = anchorPoint.getAnchorPointY();
} else {
// Use the defaults as non specified
anchorPointX = defaultPointPlacementAnchorPointX;
anchorPointY = defaultPointPlacementAnchorPointY;
}
fieldConfigVisitor.populateField(FieldIdEnum.ANCHOR_POINT_H, anchorPointX);
fieldConfigVisitor.populateField(FieldIdEnum.ANCHOR_POINT_V, anchorPointY);
Displacement displacement = pointPlacement.getDisplacement();
if (displacement == null) {
displacement = DisplacementImpl.DEFAULT;
}
fieldConfigVisitor.populateField(FieldIdEnum.DISPLACEMENT_X, displacement.getDisplacementX());
fieldConfigVisitor.populateField(FieldIdEnum.DISPLACEMENT_Y, displacement.getDisplacementY());
fieldConfigVisitor.populateField(FieldIdEnum.ANGLE, pointPlacement.getRotation());
} else if (placement instanceof LinePlacementImpl) {
LinePlacementImpl linePlacement = (LinePlacementImpl) placement;
labelPlacementGroup.setOption(GroupIdEnum.LINEPLACEMENT);
fieldConfigVisitor.populateField(FieldIdEnum.GAP, linePlacement.getGap());
fieldConfigVisitor.populateField(FieldIdEnum.INITIAL_GAP, linePlacement.getInitialGap());
fieldConfigVisitor.populateField(FieldIdEnum.PERPENDICULAR_OFFSET, linePlacement.getPerpendicularOffset());
fieldConfigVisitor.populateBooleanField(FieldIdEnum.GENERALISED_LINE, linePlacement.isGeneralizeLine());
fieldConfigVisitor.populateBooleanField(FieldIdEnum.ALIGN, linePlacement.isAligned());
fieldConfigVisitor.populateBooleanField(FieldIdEnum.REPEATED, linePlacement.isRepeated());
}
}
if (vendorOptionTextFactory != null) {
vendorOptionTextFactory.populate(textSymbolizer);
}
}
}
}
Aggregations