root / branches / v2_0_0_prep / libraries / libFMap_mapcontext / src / org / gvsig / fmap / mapcontext / layers / LayerDrawEvent.java @ 38605
History | View | Annotate | Download (3.2 KB)
1 | 21200 | vcaballero | package org.gvsig.fmap.mapcontext.layers; |
---|---|---|---|
2 | |||
3 | import java.awt.Graphics2D; |
||
4 | |||
5 | import org.gvsig.fmap.mapcontext.ViewPort; |
||
6 | import org.gvsig.fmap.mapcontext.events.FMapEvent; |
||
7 | 30173 | jldominguez | import org.gvsig.fmap.mapcontext.layers.vectorial.GraphicLayer; |
8 | 21200 | vcaballero | |
9 | |||
10 | /**
|
||
11 | * <p>The <code>LayerDrawEvent</code> class represents an event produced on a layer about a drawing change.</p>
|
||
12 | * <p>This event can be a notification before or after a {@link FLayer FLayer}, {@link FLayers FLayers}, or
|
||
13 | * {@link GraphicLayer GraphicLayer} is drawn.</p>
|
||
14 | */
|
||
15 | public class LayerDrawEvent extends FMapEvent { |
||
16 | /**
|
||
17 | * <p>The view port the information for drawing the layer in which this event has been produced.</p>
|
||
18 | */
|
||
19 | ViewPort vp; |
||
20 | |||
21 | /**
|
||
22 | * <p>Reference to an object for rendering 2D on the Java(tm) platform.</p>
|
||
23 | */
|
||
24 | Graphics2D g;
|
||
25 | |||
26 | /**
|
||
27 | * <p>Reference to the layer where this event has been produced.</p>
|
||
28 | */
|
||
29 | FLayer lyr; |
||
30 | |||
31 | /**
|
||
32 | * Public constant that identifies the kind of <code>LayerDrawEvent</code> as an event produced
|
||
33 | * before drawing on a {@link FLayer FLayer} or {@link FLayers FLayers}.
|
||
34 | */
|
||
35 | public static final int LAYER_BEFORE_DRAW = 101; |
||
36 | |||
37 | /**
|
||
38 | * Public constant that identifies the kind of <code>LayerDrawEvent</code> as an event produced
|
||
39 | * after drawing on a {@link FLayer FLayer} or {@link FLayers FLayers}.
|
||
40 | */
|
||
41 | public static final int LAYER_AFTER_DRAW = 102; |
||
42 | |||
43 | /**
|
||
44 | * Public constant that identifies the kind of <code>LayerDrawEvent</code> as an event produced
|
||
45 | * before drawing on a {@link GraphicLayer GraphicLayer}.
|
||
46 | */
|
||
47 | public static final int GRAPHICLAYER_BEFORE_DRAW = 103; |
||
48 | |||
49 | /**
|
||
50 | * Public constant that identifies the kind of <code>LayerDrawEvent</code> as an event produced
|
||
51 | * after drawing on a {@link GraphicLayer GraphicLayer}.
|
||
52 | */
|
||
53 | public static final int GRAPHICLAYER_AFTER_DRAW = 104; |
||
54 | |||
55 | /**
|
||
56 | * <p>Creates a new layer draw event with all necessary information.</p>
|
||
57 | *
|
||
58 | * @param lyr layer in which the event has been produced
|
||
59 | * @param g object for rendering 2D on the Java(tm) platform
|
||
60 | * @param vp object with information for drawing the layer in which this event has been produced
|
||
61 | * @param eventType identifies the kind of this event: {@linkplain #LAYER_BEFORE_DRAW}, {@linkplain #LAYER_AFTER_DRAW},
|
||
62 | * {@linkplain #GRAPHICLAYER_BEFORE_DRAW} or {@linkplain #GRAPHICLAYER_AFTER_DRAW}.
|
||
63 | */
|
||
64 | public LayerDrawEvent(FLayer lyr, Graphics2D g, ViewPort vp, int eventType) { |
||
65 | this.lyr = lyr;
|
||
66 | this.g = g;
|
||
67 | this.vp = vp;
|
||
68 | setEventType(eventType); |
||
69 | } |
||
70 | |||
71 | /**
|
||
72 | * <p>Returns an object for rendering 2-dimensional shapes, text and images on the Java(tm) platform.</p>
|
||
73 | *
|
||
74 | * @return object for rendering 2D on the Java(tm) platform
|
||
75 | */
|
||
76 | public Graphics2D getGraphics() { |
||
77 | return g;
|
||
78 | } |
||
79 | |||
80 | /**
|
||
81 | * <p>Returns the view port the information for drawing the layer in which this event has been produced.</p>
|
||
82 | *
|
||
83 | * @return object with information for drawing the layer in which this event has been produced
|
||
84 | */
|
||
85 | public ViewPort getViewPort() {
|
||
86 | return vp;
|
||
87 | } |
||
88 | |||
89 | /**
|
||
90 | * <p>Returns a reference to the layer where this event has been produced.</p>
|
||
91 | *
|
||
92 | * @return layer in which this event has been produced
|
||
93 | */
|
||
94 | public FLayer getLayer() {
|
||
95 | return lyr;
|
||
96 | } |
||
97 | } |