Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.fmap.control / src / main / java / org / gvsig / fmap / mapcontrol / MapControlDrawer.java @ 44259

History | View | Annotate | Download (6.28 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
/*
25
 * AUTHORS (In addition to CIT):
26
 * 2009 {Iver T.I.}   {Task}
27
 */
28

    
29
package org.gvsig.fmap.mapcontrol;
30

    
31
import java.awt.Color;
32
import java.awt.Composite;
33
import java.awt.Image;
34
import java.awt.RenderingHints;
35
import java.awt.Stroke;
36
import java.awt.geom.AffineTransform;
37
import java.awt.geom.Point2D;
38

    
39
import org.gvsig.fmap.dal.feature.Feature;
40
import org.gvsig.fmap.geom.Geometry;
41
import org.gvsig.fmap.geom.handler.Handler;
42
import org.gvsig.fmap.mapcontext.ViewPort;
43
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
44

    
45
/**
46
 * <p>
47
 * Represents a class that can write objects in a map like a raster image, a
48
 * {@link Geometry} or other graphical objects. This class doesn't depend of the
49
 * dimension of the map (2D or 3D).
50
 * </p>
51
 * <p>
52
 * The Map Control has to have an instance of this class that can be accessed
53
 * using the {@link MapControl#getMapControlDrawer()} method. When a Map Control
54
 * is created some tools are added to this component using the
55
 * {@link MapControl#addBehavior(String, org.gvsig.fmap.mapcontrol.tools.Behavior.Behavior)}
56
 * method. Some of these tools need to draw some objects in the map and they use
57
 * the MapControlDrawer class to do that.
58
 * </p>
59
 *
60
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
61
 */
62
public interface MapControlDrawer extends PrimitivesDrawer {
63

    
64
    /**
65
     * The <code>ViewPort</code> is used to transform the map
66
     * coordinates in the screen coordinates.
67
     *
68
     * @param viewPort
69
     *            The <code>ViewPort</code>
70
     */
71
    public void setViewPort(ViewPort viewPort);
72

    
73
    /**
74
     * It draws a <code>Geometry</code> on the map using the color
75
     * specified using the {@link #setColor(Color)} method.
76
     *
77
     * @param geometry
78
     *            The <code>Geometry</code> to draw.
79
     */
80
    public void draw(Geometry geometry);
81

    
82
    /**
83
     * It draws a <code>Geometry</code> on the map using a concrete
84
     * symbol.
85
     *
86
     * @param geometry
87
     *            The <code>Geometry</code> to draw.
88
     * @param symbol
89
     *            The symbol used to draw the geometry.
90
     */
91
    public void draw(Geometry geometry, ISymbol symbol);
92

    
93
    /**
94
     * It draws a <code>Geometry</code> on the map using a concrete
95
     * symbol.
96
     *
97
     * @param geometry
98
     *            The <code>Geometry</code> to draw.
99
     * @param symbol
100
     *            The symbol used to draw the geometry.
101
     * @param feature
102
     *            The feature used to draw the geometry.
103
     */
104
    public void draw(Geometry geometry, ISymbol symbol, Feature feature);
105

    
106

    
107
    /**
108
     * It draws the <code>Handler</code>'s that compose a geometry
109
     * on the map.
110
     *
111
     * @param handlers
112
     *            An array of <code>Handler</code>'s.
113
     * @param at
114
     *            A transformation that has to be applied to the
115
     *            <code>Handler</code>'s.
116
     * @param symbol
117
     *            The symbol used to draw the handlers.
118
     */
119
    public void drawHandlers(Handler[] handlers, AffineTransform at,
120
        ISymbol symbol);
121

    
122
    /**
123
     * It draws a line using a concrete symbol.
124
     *
125
     * @param firstPoint
126
     *            The first point of the line.
127
     * @param endPoint
128
     *            The end point of the line.
129
     * @param symbol
130
     *            The symbol used to draw the line.
131
     */
132
    public void drawLine(Point2D firstPoint, Point2D endPoint, ISymbol symbol);
133

    
134
    /**
135
     * It draws an image on a map in a concrete position.
136
     *
137
     * @param img
138
     *            The image to draw.
139
     * @param x
140
     *            The X coordinate,
141
     * @param y
142
     *            The Y coordinate.
143
     */
144
    public void drawImage(Image img, int x, int y);
145

    
146
    /**
147
     * It draws image, applying a transform from image space
148
     * into user space before drawing.
149
     *
150
     * @param img
151
     *            The image to draw.
152
     * @param xform
153
     *            The transform to apply.
154
     */
155
    public void drawImage(Image img, AffineTransform xform);
156

    
157
    /**
158
     * It draws a <code>Handler</code> on the map.
159
     *
160
     * @param handler
161
     *            The <code>Handler</code> to draw.
162
     * @param at
163
     *            A transformation that has to be applied to the
164
     *            <code>Handler</code>.
165
     */
166
    public void drawHandler(Handler handler, AffineTransform at);
167

    
168
    /**
169
     * @param at
170
     */
171
    public void transform(AffineTransform at);
172

    
173
    /**
174
     * @param instance
175
     */
176
    public void setComposite(Composite instance);
177

    
178
    /**
179
     * Replaces the values of all preferences for the rendering algorithms with the specified hints. The existing
180
     * values for all rendering hints are discarded and the new set of known hints and values are initialized
181
     * from the specified Map object. Hint categories include controls for rendering quality and overall time/
182
     * quality trade-off in the rendering process. Refer to the RenderingHints class for definitions of some
183
     * common keys and values.
184
     * @param hints  the rendering hints to be set
185
     */
186
    public void setRenderingHints(RenderingHints hints);
187

    
188
    /**
189
     * Sets the Stroke for the Graphics2D context.
190
     * @param stroke the Stroke object to be used to stroke a Shape during the rendering
191
     */
192
    public void setStroke(Stroke stroke);
193

    
194
    /**
195
     * Cleans the graphics using the image of the MapControl
196
     * @param mapCtrl
197
     */
198
    public void cleanCanvas(MapControl mapCtrl);
199

    
200
}