svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.mapcontext / org.gvsig.fmap.mapcontext.api / src / main / java / org / gvsig / fmap / mapcontext / layers / LayerDrawEvent.java @ 44369
History | View | Annotate | Download (4.16 KB)
1 | 40559 | jjdelcerro | /**
|
---|---|---|---|
2 | * gvSIG. Desktop Geographic Information System.
|
||
3 | *
|
||
4 | * Copyright (C) 2007-2013 gvSIG Association.
|
||
5 | *
|
||
6 | * This program is free software; you can redistribute it and/or
|
||
7 | * modify it under the terms of the GNU General Public License
|
||
8 | * as published by the Free Software Foundation; either version 3
|
||
9 | * of the License, or (at your option) any later version.
|
||
10 | *
|
||
11 | * This program is distributed in the hope that it will be useful,
|
||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
14 | * GNU General Public License for more details.
|
||
15 | *
|
||
16 | * You should have received a copy of the GNU General Public License
|
||
17 | * along with this program; if not, write to the Free Software
|
||
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||
19 | * MA 02110-1301, USA.
|
||
20 | *
|
||
21 | * For any additional information, do not hesitate to contact us
|
||
22 | * at info AT gvsig.com, or visit our website www.gvsig.com.
|
||
23 | */
|
||
24 | 40435 | jjdelcerro | package org.gvsig.fmap.mapcontext.layers; |
25 | |||
26 | import java.awt.Graphics2D; |
||
27 | |||
28 | import org.gvsig.fmap.mapcontext.ViewPort; |
||
29 | 43253 | fdiaz | import org.gvsig.fmap.mapcontext.events.FMapEventBase; |
30 | 40435 | jjdelcerro | import org.gvsig.fmap.mapcontext.layers.vectorial.GraphicLayer; |
31 | |||
32 | |||
33 | /**
|
||
34 | * <p>The <code>LayerDrawEvent</code> class represents an event produced on a layer about a drawing change.</p>
|
||
35 | * <p>This event can be a notification before or after a {@link FLayer FLayer}, {@link FLayers FLayers}, or
|
||
36 | * {@link GraphicLayer GraphicLayer} is drawn.</p>
|
||
37 | */
|
||
38 | 43253 | fdiaz | public class LayerDrawEvent extends FMapEventBase { |
39 | 40435 | jjdelcerro | /**
|
40 | * <p>The view port the information for drawing the layer in which this event has been produced.</p>
|
||
41 | */
|
||
42 | ViewPort vp; |
||
43 | 43253 | fdiaz | |
44 | 40435 | jjdelcerro | /**
|
45 | * <p>Reference to an object for rendering 2D on the Java(tm) platform.</p>
|
||
46 | */
|
||
47 | Graphics2D g;
|
||
48 | 43253 | fdiaz | |
49 | 40435 | jjdelcerro | /**
|
50 | * <p>Reference to the layer where this event has been produced.</p>
|
||
51 | */
|
||
52 | FLayer lyr; |
||
53 | 43253 | fdiaz | |
54 | 40435 | jjdelcerro | /**
|
55 | * Public constant that identifies the kind of <code>LayerDrawEvent</code> as an event produced
|
||
56 | * before drawing on a {@link FLayer FLayer} or {@link FLayers FLayers}.
|
||
57 | */
|
||
58 | public static final int LAYER_BEFORE_DRAW = 101; |
||
59 | 43253 | fdiaz | |
60 | 40435 | jjdelcerro | /**
|
61 | * Public constant that identifies the kind of <code>LayerDrawEvent</code> as an event produced
|
||
62 | * after drawing on a {@link FLayer FLayer} or {@link FLayers FLayers}.
|
||
63 | */
|
||
64 | public static final int LAYER_AFTER_DRAW = 102; |
||
65 | 43253 | fdiaz | |
66 | 40435 | jjdelcerro | /**
|
67 | * Public constant that identifies the kind of <code>LayerDrawEvent</code> as an event produced
|
||
68 | * before drawing on a {@link GraphicLayer GraphicLayer}.
|
||
69 | */
|
||
70 | public static final int GRAPHICLAYER_BEFORE_DRAW = 103; |
||
71 | 43253 | fdiaz | |
72 | 40435 | jjdelcerro | /**
|
73 | * Public constant that identifies the kind of <code>LayerDrawEvent</code> as an event produced
|
||
74 | * after drawing on a {@link GraphicLayer GraphicLayer}.
|
||
75 | */
|
||
76 | public static final int GRAPHICLAYER_AFTER_DRAW = 104; |
||
77 | |||
78 | /**
|
||
79 | * <p>Creates a new layer draw event with all necessary information.</p>
|
||
80 | 43253 | fdiaz | *
|
81 | 40435 | jjdelcerro | * @param lyr layer in which the event has been produced
|
82 | * @param g object for rendering 2D on the Java(tm) platform
|
||
83 | * @param vp object with information for drawing the layer in which this event has been produced
|
||
84 | * @param eventType identifies the kind of this event: {@linkplain #LAYER_BEFORE_DRAW}, {@linkplain #LAYER_AFTER_DRAW},
|
||
85 | * {@linkplain #GRAPHICLAYER_BEFORE_DRAW} or {@linkplain #GRAPHICLAYER_AFTER_DRAW}.
|
||
86 | */
|
||
87 | public LayerDrawEvent(FLayer lyr, Graphics2D g, ViewPort vp, int eventType) { |
||
88 | this.lyr = lyr;
|
||
89 | this.g = g;
|
||
90 | this.vp = vp;
|
||
91 | setEventType(eventType); |
||
92 | } |
||
93 | 43253 | fdiaz | |
94 | 40435 | jjdelcerro | /**
|
95 | * <p>Returns an object for rendering 2-dimensional shapes, text and images on the Java(tm) platform.</p>
|
||
96 | 43253 | fdiaz | *
|
97 | 40435 | jjdelcerro | * @return object for rendering 2D on the Java(tm) platform
|
98 | */
|
||
99 | public Graphics2D getGraphics() { |
||
100 | return g;
|
||
101 | } |
||
102 | 43253 | fdiaz | |
103 | 40435 | jjdelcerro | /**
|
104 | * <p>Returns the view port the information for drawing the layer in which this event has been produced.</p>
|
||
105 | 43253 | fdiaz | *
|
106 | 40435 | jjdelcerro | * @return object with information for drawing the layer in which this event has been produced
|
107 | */
|
||
108 | public ViewPort getViewPort() {
|
||
109 | return vp;
|
||
110 | } |
||
111 | |||
112 | /**
|
||
113 | 43253 | fdiaz | * <p>Returns a reference to the layer where this event has been produced.</p>
|
114 | *
|
||
115 | 40435 | jjdelcerro | * @return layer in which this event has been produced
|
116 | */
|
||
117 | public FLayer getLayer() {
|
||
118 | return lyr;
|
||
119 | } |
||
120 | } |