Search in sources :

Example 1 with Marker

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);
}
Also used : AbstractMarker(com.revolsys.swing.map.layer.record.style.marker.AbstractMarker) ImageMarker(com.revolsys.swing.map.layer.record.style.marker.ImageMarker) Marker(com.revolsys.swing.map.layer.record.style.marker.Marker) ShapeMarker(com.revolsys.swing.map.layer.record.style.marker.ShapeMarker)

Example 2 with Marker

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);
}
Also used : AbstractMarker(com.revolsys.swing.map.layer.record.style.marker.AbstractMarker) ImageMarker(com.revolsys.swing.map.layer.record.style.marker.ImageMarker) Marker(com.revolsys.swing.map.layer.record.style.marker.Marker) ShapeMarker(com.revolsys.swing.map.layer.record.style.marker.ShapeMarker)

Example 3 with 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);
        }
    }
}
Also used : BaseCloseable(com.revolsys.io.BaseCloseable) Paint(java.awt.Paint) Marker(com.revolsys.swing.map.layer.record.style.marker.Marker)

Example 4 with Marker

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);
}
Also used : Marker(com.revolsys.swing.map.layer.record.style.marker.Marker) Graphics2D(java.awt.Graphics2D)

Example 5 with Marker

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;
}
Also used : Marker(com.revolsys.swing.map.layer.record.style.marker.Marker) MarkerStyle(com.revolsys.swing.map.layer.record.style.MarkerStyle)

Aggregations

Marker (com.revolsys.swing.map.layer.record.style.marker.Marker)6 ShapeMarker (com.revolsys.swing.map.layer.record.style.marker.ShapeMarker)3 AbstractMarker (com.revolsys.swing.map.layer.record.style.marker.AbstractMarker)2 ImageMarker (com.revolsys.swing.map.layer.record.style.marker.ImageMarker)2 BaseCloseable (com.revolsys.io.BaseCloseable)1 MarkerStyle (com.revolsys.swing.map.layer.record.style.MarkerStyle)1 Graphics2D (java.awt.Graphics2D)1 Paint (java.awt.Paint)1 ArrayList (java.util.ArrayList)1