Statistics
| Revision:

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 @ 40559

History | View | Annotate | Download (4.16 KB)

1
/**
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
package org.gvsig.fmap.mapcontext.layers;
25

    
26
import java.awt.Graphics2D;
27

    
28
import org.gvsig.fmap.mapcontext.ViewPort;
29
import org.gvsig.fmap.mapcontext.events.FMapEvent;
30
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
public class LayerDrawEvent extends FMapEvent {
39
        /**
40
         * <p>The view port the information for drawing the layer in which this event has been produced.</p>
41
         */
42
        ViewPort vp;
43
        
44
        /**
45
         * <p>Reference to an object for rendering 2D on the Java(tm) platform.</p>
46
         */
47
        Graphics2D g;
48
        
49
        /**
50
         * <p>Reference to the layer where this event has been produced.</p>
51
         */
52
        FLayer lyr;
53
        
54
        /**
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
        
60
        /**
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
        
66
        /**
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
        
72
        /**
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
         * 
81
         * @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
        
94
        /**
95
         * <p>Returns an object for rendering 2-dimensional shapes, text and images on the Java(tm) platform.</p>
96
         * 
97
         * @return object for rendering 2D on the Java(tm) platform
98
         */
99
        public Graphics2D getGraphics() {
100
                return g;
101
        }
102
        
103
        /**
104
         * <p>Returns the view port the information for drawing the layer in which this event has been produced.</p>
105
         * 
106
         * @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
         * <p>Returns a reference to the layer where this event has been produced.</p> 
114
         * 
115
         * @return layer in which this event has been produced
116
         */
117
        public FLayer getLayer() {
118
                return lyr;
119
        }
120
}