Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.app / org.gvsig.app.mainplugin / src / main / java / org / gvsig / app / extension / BasicSymbologyExtension.java @ 40723

History | View | Annotate | Download (7.42 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
/* CVS MESSAGES:
25
*
26
* $Id: AdvancedSymbologyExtension.java 16205 2007-11-08 16:33:35Z jdominguez $
27
* $Log: AdvancedSymbologyExtension.java,v $
28
* Revision 1.12  2007/09/19 15:34:59  jaume
29
* removed unnecessary imports
30
*
31
* Revision 1.11  2007/09/17 09:11:28  jaume
32
* order of the elements inverted
33
*
34
* Revision 1.10  2007/09/13 11:37:09  jvidal
35
* *** empty log message ***
36
*
37
* Revision 1.9  2007/09/04 10:53:10  caballero
38
* show page
39
*
40
* Revision 1.8  2007/08/09 10:39:04  jaume
41
* first round of found bugs fixed
42
*
43
* Revision 1.7  2007/08/01 13:03:31  jaume
44
* plugable symbol editor
45
*
46
* Revision 1.6  2007/05/22 12:17:12  jaume
47
* *** empty log message ***
48
*
49
* Revision 1.5  2007/05/17 09:32:37  jaume
50
* *** empty log message ***
51
*
52
* Revision 1.4  2007/03/21 08:03:03  jaume
53
* refactored to use ISymbol instead of FSymbol
54
*
55
* Revision 1.3  2007/03/13 16:57:35  jaume
56
* Added MultiVariable legend
57
*
58
* Revision 1.2  2007/03/09 11:25:00  jaume
59
* Advanced symbology (start committing)
60
*
61
* Revision 1.1.2.4  2007/02/21 07:35:14  jaume
62
* *** empty log message ***
63
*
64
* Revision 1.1.2.3  2007/02/12 15:14:41  jaume
65
* refactored interval legend and added graduated symbol legend
66
*
67
* Revision 1.1.2.2  2007/02/01 17:47:12  jaume
68
* *** empty log message ***
69
*
70
* Revision 1.1.2.1  2007/02/01 12:12:41  jaume
71
* theme manager window and all its components are now dynamic
72
*
73
*/
74
package org.gvsig.app.extension;
75

    
76
import org.gvsig.andami.IconThemeHelper;
77
import org.gvsig.andami.PluginServices;
78
import org.gvsig.andami.plugins.Extension;
79
import org.gvsig.andami.preferences.IPreference;
80
import org.gvsig.andami.preferences.IPreferenceExtension;
81
import org.gvsig.app.ApplicationLocator;
82
import org.gvsig.app.gui.preferencespage.CartographicSupportPage;
83
import org.gvsig.app.gui.preferencespage.SymbologyPage;
84
import org.gvsig.app.gui.styling.MarkerFill;
85
import org.gvsig.app.gui.styling.PictureFill;
86
import org.gvsig.app.gui.styling.PictureLine;
87
import org.gvsig.app.gui.styling.PictureMarker;
88
import org.gvsig.app.gui.styling.SimpleFill;
89
import org.gvsig.app.gui.styling.SimpleLine;
90
import org.gvsig.app.gui.styling.SimpleMarker;
91
import org.gvsig.app.gui.styling.SimpleText;
92
import org.gvsig.app.gui.styling.SymbolEditor;
93
import org.gvsig.app.project.documents.view.legend.gui.AttrInTableLabeling;
94
import org.gvsig.app.project.documents.view.legend.gui.Categories;
95
import org.gvsig.app.project.documents.view.legend.gui.Features;
96
import org.gvsig.app.project.documents.view.legend.gui.General;
97
import org.gvsig.app.project.documents.view.legend.gui.LabelingManager;
98
import org.gvsig.app.project.documents.view.legend.gui.LegendManager;
99
import org.gvsig.app.project.documents.view.legend.gui.MultipleAttributes;
100
import org.gvsig.app.project.documents.view.legend.gui.Quantities;
101
import org.gvsig.app.project.documents.view.legend.gui.SingleSymbol;
102
import org.gvsig.app.project.documents.view.legend.gui.ThemeManagerWindow;
103
import org.gvsig.app.project.documents.view.legend.gui.VectorialInterval;
104
import org.gvsig.app.project.documents.view.legend.gui.VectorialUniqueValue;
105
import org.gvsig.fmap.geom.Geometry;
106
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
107
import org.gvsig.symbology.swing.SymbologySwingLocator;
108

    
109
/**
110
 * Extension for enable the symbology. It only installs the core symbology.
111
 * @author jaume dominguez faus - jaume.dominguez@iver.es
112
 *
113
 */
114
public class BasicSymbologyExtension extends Extension implements IPreferenceExtension{
115
//        private SymbologyLibrary simbologyLibrary;        
116
//        private SymbologyDefaultImplLibrary simbologyDefaultImplLibrary;
117

    
118
        public void initialize() {
119
                // modules for symbol editor
120
                SymbolEditor.addSymbolEditorPanel(SimpleFill.class, Geometry.TYPES.SURFACE);
121
                SymbolEditor.addSymbolEditorPanel(SimpleMarker.class, Geometry.TYPES.POINT);
122
                SymbolEditor.addSymbolEditorPanel(SimpleLine.class, Geometry.TYPES.CURVE);
123
                SymbolEditor.addSymbolEditorPanel(SimpleFill.class, Geometry.TYPES.MULTISURFACE);
124
                SymbolEditor.addSymbolEditorPanel(SimpleMarker.class, Geometry.TYPES.MULTIPOINT);
125
                SymbolEditor.addSymbolEditorPanel(SimpleLine.class, Geometry.TYPES.MULTICURVE);
126
                
127
                //FIXME 
128
                SymbolEditor.addSymbolEditorPanel(PictureMarker.class, Geometry.TYPES.POINT);
129
                SymbolEditor.addSymbolEditorPanel(PictureLine.class, Geometry.TYPES.CURVE);
130
                SymbolEditor.addSymbolEditorPanel(PictureFill.class, Geometry.TYPES.SURFACE);
131
                SymbolEditor.addSymbolEditorPanel(MarkerFill.class, Geometry.TYPES.SURFACE);
132

    
133
                SymbolEditor.addSymbolEditorPanel(PictureMarker.class, Geometry.TYPES.MULTIPOINT);
134
                SymbolEditor.addSymbolEditorPanel(PictureLine.class, Geometry.TYPES.MULTICURVE);
135
                SymbolEditor.addSymbolEditorPanel(PictureFill.class, Geometry.TYPES.MULTISURFACE);
136
                SymbolEditor.addSymbolEditorPanel(MarkerFill.class, Geometry.TYPES.MULTISURFACE);
137

    
138
                // pages
139
                ThemeManagerWindow.addPage(General.class);
140
                ThemeManagerWindow.addPage(LegendManager.class);
141
                ThemeManagerWindow.addPage(LabelingManager.class);
142

    
143
                ThemeManagerWindow.setTabEnabledForLayer(General.class, FLyrVect.class, true);
144
                ThemeManagerWindow.setTabEnabledForLayer(LegendManager.class, FLyrVect.class, true);
145
                ThemeManagerWindow.setTabEnabledForLayer(LabelingManager.class, FLyrVect.class, true);
146
                // labeling strategies (inverse order to the wanted to be shown)
147
                LabelingManager.addLabelingStrategy(AttrInTableLabeling.class);
148

    
149
                // legends available in the legend page
150
                LegendManager.addLegendPage(Quantities.class);
151
                LegendManager.addLegendPage(Features.class);
152
                LegendManager.addLegendPage(Categories.class);
153
                LegendManager.addLegendPage(MultipleAttributes.class);
154

    
155
                LegendManager.addLegendPage(SingleSymbol.class);
156
                LegendManager.addLegendPage(VectorialInterval.class);
157
                LegendManager.addLegendPage(VectorialUniqueValue.class);
158

    
159
//                LegendManager.addLegendDriver(FMapGVLDriver.class);
160
                registerIcons();
161
        }
162
        
163
        @Override
164
        public void postInitialize() {
165
                super.postInitialize();
166
                
167
                SymbologySwingLocator.getSwingManager().setColorTablesFactory(
168
                                ApplicationLocator.getManager().getColorTablesFactory());
169
        }
170

    
171
        private void registerIcons(){
172
            IconThemeHelper.registerIcon("preferences", "symbology-preferences", this);
173
        }
174

    
175
        public void execute(String actionCommand) {
176

    
177
        }
178

    
179
        public boolean isEnabled() {
180
                return true; // or whatever
181
        }
182

    
183
        public boolean isVisible() {
184
                return true; // or whatever
185
        }
186

    
187
        public IPreference[] getPreferencesPages() {
188
                return new IPreference[] {
189
                        new CartographicSupportPage(), new SymbologyPage()
190
                };
191
        }
192
}