use of com.revolsys.swing.map.layer.record.style.GeometryStyle in project com.revolsys.open by revolsys.
the class GeometryStyleRenderer method newIcon.
@Override
public Icon newIcon() {
final AbstractRecordLayer layer = getLayer();
if (layer == null) {
return ICON;
} else {
final GeometryStyle geometryStyle = getStyle();
Shape shape = null;
final DataType geometryDataType = layer.getGeometryType();
if (DataTypes.POINT.equals(geometryDataType) || DataTypes.MULTI_POINT.equals(geometryDataType)) {
return this.style.getMarker().newIcon(geometryStyle);
} else if (DataTypes.LINE_STRING.equals(geometryDataType) || DataTypes.MULTI_LINE_STRING.equals(geometryDataType)) {
shape = GeometryStylePreview.getLineShape(16);
} else if (DataTypes.POLYGON.equals(geometryDataType) || DataTypes.MULTI_POLYGON.equals(geometryDataType)) {
shape = getPolygonShape();
} else {
return ICON;
}
final BufferedImage image = new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB);
final Graphics2D graphics = image.createGraphics();
graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
if (DataTypes.POLYGON.equals(geometryDataType) || DataTypes.MULTI_POLYGON.equals(geometryDataType)) {
graphics.setPaint(geometryStyle.getPolygonFill());
graphics.fill(shape);
}
final Color color = geometryStyle.getLineColor();
graphics.setColor(color);
graphics.draw(shape);
graphics.dispose();
return new ImageIcon(image);
}
}
use of com.revolsys.swing.map.layer.record.style.GeometryStyle in project com.revolsys.open by revolsys.
the class ArcGisRestServerRecordLayer method newSimpleLineStyle.
private GeometryStyle newSimpleLineStyle(final MapEx symbol) {
final double lineWidth = symbol.getDouble("width", 1.0);
final Color lineColor = getColor(symbol);
final GeometryStyle style = GeometryStyle.line(lineColor, lineWidth);
final String dashStyle = symbol.getString("style");
if (LINE_STYLE_PATTERNS.containsKey(dashStyle)) {
final List<Double> dashArray = LINE_STYLE_PATTERNS.get(dashStyle);
if (dashArray == null) {
style.setLineWidth(Quantities.getQuantity(0, CustomUnits.PIXEL));
} else if (!dashArray.isEmpty()) {
style.setLineDashArray(dashArray);
}
}
return style;
}
use of com.revolsys.swing.map.layer.record.style.GeometryStyle in project com.revolsys.open by revolsys.
the class ArcGisRestServerRecordLayer method newSimpleFillRenderer.
private AbstractRecordLayerRenderer newSimpleFillRenderer(final MapEx symbol) {
final MapEx outline = symbol.getValue("outline");
final GeometryStyle style;
if (outline == null) {
style = new GeometryStyle();
style.setLineWidth(Quantities.getQuantity(0, CustomUnits.PIXEL));
} else {
style = newSimpleLineStyle(outline);
}
final Color fillColor = getColor(symbol);
style.setPolygonFill(fillColor);
return new GeometryStyleRenderer(this, style);
}
use of com.revolsys.swing.map.layer.record.style.GeometryStyle in project com.revolsys.open by revolsys.
the class GridLayerRenderer method newIcon.
public Icon newIcon() {
final GeometryStyle geometryStyle = getGeometryStyle();
final BufferedImage image = new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB);
final Graphics2D graphics = image.createGraphics();
this.textStyle.drawTextIcon(graphics, 8);
final Color color = geometryStyle.getLineColor();
graphics.setColor(color);
graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
final Shape shape = new Rectangle2D.Double(0, 0, 15, 15);
graphics.draw(shape);
graphics.dispose();
return new ImageIcon(image);
}
Aggregations