Statistics
| Revision:

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

History | View | Annotate | Download (8.57 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
/* gvSIG. Geographic Information System of the Valencian Government
25
*
26
* Copyright (C) 2007-2008 Infrastructures and Transports Department
27
* of the Valencian Government (CIT)
28
* 
29
* This program is free software; you can redistribute it and/or
30
* modify it under the terms of the GNU General Public License
31
* as published by the Free Software Foundation; either version 2
32
* of the License, or (at your option) any later version.
33
* 
34
* This program is distributed in the hope that it will be useful,
35
* but WITHOUT ANY WARRANTY; without even the implied warranty of
36
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
37
* GNU General Public License for more details.
38
* 
39
* You should have received a copy of the GNU General Public License
40
* along with this program; if not, write to the Free Software
41
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
42
* MA  02110-1301, USA.
43
* 
44
*/
45

    
46
/*
47
* AUTHORS (In addition to CIT):
48
* 2009 {Iver T.I.}   {Task}
49
*/
50
 
51
package org.gvsig.fmap.mapcontrol;
52

    
53
import java.util.Map;
54
import java.util.prefs.Preferences;
55
import javax.swing.tree.TreeModel;
56
import org.cresques.cts.IProjection;
57
import org.gvsig.fmap.geom.Geometry;
58

    
59
import org.gvsig.fmap.mapcontext.MapContext;
60
import org.gvsig.fmap.mapcontext.layers.FLayers;
61
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
62
import org.gvsig.fmap.mapcontrol.swing.dynobject.LayersDynObjectSetComponent;
63
import org.gvsig.fmap.mapcontrol.tools.snapping.snappers.ISnapper;
64
import org.gvsig.tools.dynobject.DynObject;
65
import org.gvsig.tools.dynobject.DynObjectSet;
66

    
67
/**
68
 * <p>
69
 * This class is the manager of the MapControl library. It is used to
70
 * manage all the properties related with the drawing of objects 
71
 * in a map, including default symbols used to draw objects
72
 * in a map, the tolerance used by the selection or edition tools...
73
 * </p>
74
 * <p>
75
 * It also holds the implementations of the {@link MapControlDrawer}'s, 
76
 * that is the responsible to draw graphical objects in a map.
77
 * </p> 
78
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
79
 */
80
public interface MapControlManager {
81

    
82
        public MapControl createJMapControlPanel(MapContext mapContext) throws MapControlCreationException;
83
          
84
    public void addMapControlCreationListener(MapControlCreationListener listener);
85
        
86
        /**
87
         * Register a <code>MapControlDrawer</code> by name.
88
         * @param name
89
         * Name of the <code>MapControlDrawer</code>.
90
         * @param mapControolDrawerClass
91
         * Class used to draw graphical objects on a map.
92
         */
93
        public void registerMapControlDrawer(String name, Class mapControolDrawerClass);
94
        
95
        /**
96
         * Creates a <code>MapControlDrawer</code> from a name.
97
         * @param name
98
         * Name of the <code>MapControlDrawer</code>.
99
         * @return
100
         * A <code>MapControlDrawer</code>.
101
         * @throws MapControlCreationException
102
         */
103
        public MapControlDrawer createMapControlDrawer(String name) throws MapControlCreationException;
104
        
105
        /**
106
         * It registers the default implementation for the <code>MapControlDrawer</code>.
107
         * @param mapControlDrawerClass
108
         * A <code>MapControlDrawer</code>. 
109
         */
110
        public void registerDefaultMapControlDrawer(Class mapControlDrawerClass);
111
        
112
        /**
113
         * It returns the default implementation for the <code>MapControlDrawer</code>.
114
         * @return
115
         * The default <code>MapControlDrawer</code>.
116
         * @throws MapControlCreationException
117
         */
118
        public MapControlDrawer createDefaultMapControlDrawer() throws MapControlCreationException;
119
        
120
        /**
121
         * Returns a snapper in a concrete position;
122
         * @param index
123
         * Snapper position.
124
         * @return
125
         * A snapper. 
126
         */
127
        public ISnapper getSnapperAt(int index);
128
        
129
        /**
130
         * Returns the number of registered snappers.
131
         * @return
132
         * The number of registered snappers.
133
         */
134
        public int getSnapperCount();
135
        
136
        /**
137
         * Add a snapper.
138
         * @param snapper
139
         */
140
        public void registerSnapper(String name, Class snapperClass);
141
        
142
        
143
        public Preferences getEditionPreferences();
144
        
145
        /**
146
         * Tolerance (in pixels) that has to be used by the tools
147
         * that use snapping.
148
         * @return
149
         * The distance in pixels.
150
         */
151
        public int getTolerance();
152
        
153
        /**
154
         * Sets the tolerance (in pixels) that has to be used by the
155
         * tools that use snapping.
156
         * @param tolerance
157
         * The tolerance to apply
158
         */
159
        public void setTolerance(int tolerance);
160
        
161
        /**
162
         * Sets the symbol that has to be used to draw a geometry when
163
         * it is selected.
164
         * @param selectionSymbol
165
         * The symbol to apply.
166
         * @deprecated the symbol for edition is the selection symbol
167
         */
168
        public void setSelectionSymbol(ISymbol selectionSymbol);
169
        
170
        /**
171
         * Gets the symbol used to draw the selected geometries.
172
         * @return
173
         * The symbol used to draw the selected geometries.
174
         * @deprecated the symbol for edition is the selection symbol
175
         */
176
        public ISymbol getSelectionSymbol();
177
        
178
        /**
179
         * Sets the symbol that has to be used to draw a geometry that
180
         * represent the axis of a geometry.
181
         * @param axisReferencesSymbol
182
         * The symbol to apply.
183
         */
184
        public void setAxisReferenceSymbol(ISymbol axisReferencesSymbol);
185
        
186
        /**
187
         * Gets the symbol used to draw the axis of a geometry.
188
         * @return
189
         * The symbol used to draw the axis of a geometry.
190
         */
191
        public ISymbol getAxisReferenceSymbol();
192
        
193
        /**
194
         * Sets the symbol that has to be used to draw a geometry when
195
         * it is selected.
196
         * @param geometrySelectionSymbol
197
         * The symbol to apply.
198
         */
199
        public void setGeometrySelectionSymbol(ISymbol geometrySelectionSymbol);
200
        
201
        /**
202
         * Gets the symbol used to draw the selected geometries.
203
         * @return
204
         * The symbol used to draw the selected geometries.
205
         */
206
        public ISymbol getGeometrySelectionSymbol();
207
        
208
        /**
209
         * Sets the symbol that has to be used to draw the handlers.
210
         * @param handlerSymbol
211
         * The symbol to apply.
212
         */
213
        public void setHandlerSymbol(ISymbol handlerSymbol);
214
        
215
        /**
216
         * Gets the symbol used to draw the handlers.
217
         * @return
218
         * The symbol used to draw the handlers.
219
         */
220
        public ISymbol getHandlerSymbol();
221

    
222
    /**
223
     * Creates a readonly component to view information of a set of layers. The
224
     * information must be provided as a set of {@link DynObject}s, through a
225
     * {@link DynObjectSet}.
226
     * 
227
     * @param layerName2InfoByPoint
228
     *            the map of {@link DynObjectSet} for each layer.
229
     * @return the component to view the information
230
     */
231
    public LayersDynObjectSetComponent createLayersDynObjectSetComponent(
232
        Map<String, DynObjectSet> layerName2InfoByPoint);
233

    
234
    /**
235
     * Creates a component to view information of a set of layers. The
236
     * information must be provided as a set of {@link DynObject}s, through a
237
     * {@link DynObjectSet}.
238
     * 
239
     * @param layerName2InfoByPoint
240
     *            the map of {@link DynObjectSet} for each layer.
241
     * @param writable
242
     *            if the DynObjects loaded must be able to be edited
243
     * @return the component to view the information
244
     */
245
    public LayersDynObjectSetComponent createLayersDynObjectSetComponent(
246
        Map<String, DynObjectSet> layerName2InfoByPoint, boolean writable);
247
    
248
    /**
249
     * Create a TreeModel based in the MapControl's layers.
250
     * 
251
     * @param mapContext
252
     * @return the TreeModel 
253
     */
254
    public TreeModel createLayersTreeModel(MapContext mapContext);
255
    
256
    /**
257
     * Create a TreeModel based in the layers collection.
258
     * @param layers the layers collection to use for create the TreeModel
259
     * @return the TreeModel
260
     */
261
    public TreeModel createLayersTreeModel(FLayers layers);
262
    
263
    /**
264
     * Create a TreeModel based in the layers collection of all project's views.
265
     * @return the TreeModel
266
     */
267
    public TreeModel createCompoundLayersTreeModel();
268

    
269
    public double perimeter(Geometry geom, IProjection proj, int distanceUnits);
270
    
271
    public double area(Geometry geom, IProjection proj, int areaUnits);
272
}
273