use of org.geotools.styling.PointSymbolizer in project hale by halestudio.
the class SimplePointStylePage method createControl.
/**
* @see IDialogPage#createControl(Composite)
*/
@Override
public void createControl(Composite parent) {
// create new controls
Composite page = new Composite(parent, SWT.NONE);
RowLayout layout = new RowLayout(SWT.HORIZONTAL);
page.setLayout(layout);
Style style = getParent().getStyle();
PointSymbolizer point = null;
try {
Symbolizer[] symbolizers = SLD.symbolizers(style);
for (Symbolizer symbol : symbolizers) {
if (symbol instanceof LineSymbolizer) {
point = (PointSymbolizer) symbol;
break;
}
}
} catch (Exception e) {
// ignore
}
if (point == null) {
point = styleBuilder.createPointSymbolizer();
}
pointEditor = new PointSymbolizerEditor(page, point);
setControl(page);
}
use of org.geotools.styling.PointSymbolizer in project hale by halestudio.
the class StyledInstanceMarker method strokeStyle.
/**
* retrieves the stroke for the map marker
*
* @param rule a certain rule to apply, maybe null
* @param context the InstanceWayPoint, wich gets marked
*/
private synchronized void strokeStyle(Rule rule, InstanceWaypoint context) {
// retrieve stroke
Stroke stroke = null;
for (int i = 0; rule != null && stroke == null && i < rule.getSymbolizers().length; i++) {
if (rule.getSymbolizers()[i] instanceof LineSymbolizer) {
stroke = SLD.stroke((LineSymbolizer) rule.getSymbolizers()[i]);
} else if (rule.getSymbolizers()[i] instanceof PolygonSymbolizer) {
stroke = SLD.stroke((PolygonSymbolizer) rule.getSymbolizers()[i]);
} else if (rule.getSymbolizers()[i] instanceof PointSymbolizer) {
stroke = SLD.stroke((PointSymbolizer) rule.getSymbolizers()[i]);
}
}
// if we have a stroke now
if (stroke != null) {
// XXX is there any Geotools stroke to AWT stroke lib/code
// somewhere?!
// XXX have a look at the renderer code (StreamingRenderer)
// stroke color
Color sldColor = SLD.color(stroke);
double opacity = SLD.opacity(stroke);
if (Double.isNaN(opacity)) {
// fall back to default opacity
opacity = StyleHelper.DEFAULT_FILL_OPACITY;
}
if (sldColor != null) {
styleStrokeColor = new Color(sldColor.getRed(), sldColor.getGreen(), sldColor.getBlue(), (int) (opacity * 255));
} else {
styleStrokeColor = super.getBorderColor(context);
}
// stroke width
int strokeWidth = SLD.width(stroke);
if (strokeWidth == SLD.NOTFOUND) {
// fall back to default width
strokeWidth = StylePreferences.getDefaultWidth();
}
styleStroke = new BasicStroke(strokeWidth);
} else {
styleStroke = null;
styleStrokeColor = null;
}
}
Aggregations