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

History | View | Annotate | Download (8.35 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

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

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

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

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

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