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

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

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

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

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

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

    
230
    /**
231
     * Creates a component to view information of a set of layers. The
232
     * information must be provided as a set of {@link DynObject}s, through a
233
     * {@link DynObjectSet}.
234
     * 
235
     * @param layerName2InfoByPoint
236
     *            the map of {@link DynObjectSet} for each layer.
237
     * @param writable
238
     *            if the DynObjects loaded must be able to be edited
239
     * @return the component to view the information
240
     */
241
    public LayersDynObjectSetComponent createLayersDynObjectSetComponent(
242
        Map<String, DynObjectSet> layerName2InfoByPoint, boolean writable);
243
}
244