use of com.revolsys.swing.map.layer.record.style.marker.Marker in project com.revolsys.open by revolsys.
the class MarkerStyle method setMarker.
public void setMarker(final Marker marker) {
final Marker oldMarker = this.marker;
final String oldMarkerType = this.markerType;
this.marker = getWithDefault(marker, ELLIPSE);
if (marker != null && marker.isUseMarkerType()) {
this.markerType = marker.getMarkerType();
} else {
this.markerType = "ellipse";
}
firePropertyChange("marker", oldMarker, this.marker);
firePropertyChange("markerType", oldMarkerType, this.markerType);
}
use of com.revolsys.swing.map.layer.record.style.marker.Marker in project com.revolsys.open by revolsys.
the class MarkerStyle method setMarkerType.
public void setMarkerType(final String markerType) {
final Object oldValue = this.markerType;
this.markerType = getWithDefault(markerType, "ellipse");
firePropertyChange("markerType", oldValue, this.markerType);
final Marker marker = SymbolLibrary.newMarker(markerType);
setMarker(marker);
}
use of com.revolsys.swing.map.layer.record.style.marker.Marker in project com.revolsys.open by revolsys.
the class MarkerStyleRenderer method renderMarker.
/**
* Point must be in the same geometry factory as the view.
*
* @param viewport
* @param graphics
* @param point
* @param style
*/
public static void renderMarker(final Viewport2D viewport, final Graphics2D graphics, Point point, final MarkerStyle style, final double orientation) {
point = getGeometry(viewport, point);
if (Property.hasValue(point)) {
final Paint paint = graphics.getPaint();
try (BaseCloseable transformClosable = viewport.setUseModelCoordinates(graphics, false)) {
final Marker marker = style.getMarker();
final double x = point.getX();
final double y = point.getY();
marker.render(viewport, graphics, style, x, y, orientation);
} catch (final Throwable e) {
Logs.debug(MarkerStyleRenderer.class, "Unable to render marker: " + style, e);
} finally {
graphics.setPaint(paint);
}
}
}
use of com.revolsys.swing.map.layer.record.style.marker.Marker in project com.revolsys.open by revolsys.
the class MarkerStylePreview method paintComponent.
@Override
protected void paintComponent(final Graphics g) {
super.paintComponent(g);
final Graphics2D graphics = (Graphics2D) g;
graphics.setPaint(WebColors.LightGray);
graphics.drawLine(50, 0, 50, 100);
graphics.drawLine(0, 50, 100, 50);
graphics.translate(50, 50);
final Marker marker = this.markerStyle.getMarker();
try {
marker.render(null, graphics, this.markerStyle, 0, 0, 0);
} catch (final Throwable e) {
Logs.error(this, e);
}
graphics.translate(-50, -50);
}
use of com.revolsys.swing.map.layer.record.style.marker.Marker in project com.revolsys.open by revolsys.
the class AbstractSymbol method getIcon.
@Override
public Icon getIcon() {
if (this.icon == null) {
final Marker marker = newMarker();
this.icon = marker.newIcon(new MarkerStyle());
}
return this.icon;
}
Aggregations