source: josm/trunk/src/org/openstreetmap/josm/gui/layer/MapViewPaintable.java@ 10300

Last change on this file since 10300 was 10300, checked in by Don-vip, 8 years ago

sonar - Performance - Method passes constant String of length 1 to character overridden method + add unit tests/javadoc

  • Property svn:eol-style set to native
File size: 2.1 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.layer;
3
4import java.awt.Graphics2D;
5
6import org.openstreetmap.josm.data.Bounds;
7import org.openstreetmap.josm.gui.MapView;
8
9/**
10 * This is a component that can be painted on the map view.
11 * <p>
12 * You might want to extend {@link AbstractMapViewPaintable} to ease implementation of this.
13 * <p>
14 * That class allows you to listen to paintable change events. Those methods may be moved here some time in the future.
15 */
16public interface MapViewPaintable {
17
18 /**
19 * This event is fired whenever the paintable got invalidated and needs repainting some time in the future.
20 * <p>
21 * Note: We might add an area in the future.
22 *
23 * @author Michael Zangl
24 */
25 class PaintableInvalidationEvent {
26 private final MapViewPaintable paintable;
27
28 /**
29 * Creates a new {@link PaintableInvalidationEvent}
30 * @param paintable The paintable that is invalidated.
31 */
32 public PaintableInvalidationEvent(MapViewPaintable paintable) {
33 this.paintable = paintable;
34 }
35
36 /**
37 * Gets the layer that was invalidated.
38 * @return The layer.
39 */
40 public MapViewPaintable getLayer() {
41 return paintable;
42 }
43
44 @Override
45 public String toString() {
46 return "LayerInvalidationEvent [layer=" + paintable + ']';
47 }
48 }
49
50 /**
51 * This is a listener that listens to {@link PaintableInvalidationEvent}s
52 * @author Michael Zangl
53 */
54 interface PaintableInvalidationListener {
55 /**
56 * Called whenever a {@link PaintableInvalidationEvent} is fired. This might be called from any thread.
57 * @param event The event
58 */
59 void paintablInvalidated(PaintableInvalidationEvent event);
60 }
61
62 /**
63 * Paint the dataset using the engine set.
64 * @param g Graphics
65 * @param mv The object that can translate GeoPoints to screen coordinates.
66 * @param bbox Bounding box
67 */
68 void paint(Graphics2D g, MapView mv, Bounds bbox);
69}
Note: See TracBrowser for help on using the repository browser.