Statistics
| Revision:

root / branches / v2_0_0_prep / libraries / libFMap_controls / src / org / gvsig / fmap / mapcontrol / MapControlManager.java @ 36004

History | View | Annotate | Download (6.54 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
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 2
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
*/
22

    
23
/*
24
* AUTHORS (In addition to CIT):
25
* 2009 {Iver T.I.}   {Task}
26
*/
27
 
28
package org.gvsig.fmap.mapcontrol;
29

    
30
import java.util.Map;
31
import java.util.prefs.Preferences;
32

    
33
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
34
import org.gvsig.fmap.mapcontrol.swing.dynobject.LayersDynObjectSetComponent;
35
import org.gvsig.fmap.mapcontrol.tools.snapping.snappers.ISnapper;
36
import org.gvsig.tools.dynobject.DynObject;
37
import org.gvsig.tools.dynobject.DynObjectSet;
38

    
39
/**
40
 * <p>
41
 * This class is the manager of the MapControl library. It is used to
42
 * manage all the properties related with the drawing of objects 
43
 * in a map, including default symbols used to draw objects
44
 * in a map, the tolerance used by the selection or edition tools...
45
 * </p>
46
 * <p>
47
 * It also holds the implementations of the {@link MapControlDrawer}'s, 
48
 * that is the responsible to draw graphical objects in a map.
49
 * </p> 
50
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
51
 */
52
public interface MapControlManager {
53

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

    
192
    /**
193
     * Creates a readonly component to view information of a set of layers. The
194
     * information must be provided as a set of {@link DynObject}s, through a
195
     * {@link DynObjectSet}.
196
     * 
197
     * @param layerName2InfoByPoint
198
     *            the map of {@link DynObjectSet} for each layer.
199
     * @return the component to view the information
200
     */
201
    public LayersDynObjectSetComponent createLayersDynObjectSetComponent(
202
        Map<String, DynObjectSet> layerName2InfoByPoint);
203

    
204
    /**
205
     * Creates a component to view information of a set of layers. The
206
     * information must be provided as a set of {@link DynObject}s, through a
207
     * {@link DynObjectSet}.
208
     * 
209
     * @param layerName2InfoByPoint
210
     *            the map of {@link DynObjectSet} for each layer.
211
     * @param writable
212
     *            if the DynObjects loaded must be able to be edited
213
     * @return the component to view the information
214
     */
215
    public LayersDynObjectSetComponent createLayersDynObjectSetComponent(
216
        Map<String, DynObjectSet> layerName2InfoByPoint, boolean writable);
217
}
218