svn-gvsig-desktop / tags / v2_0_0_Build_2023 / applications / appgvSIG / src / org / gvsig / app / extension / BasicSymbologyExtension.java @ 34331
History | View | Annotate | Download (8.9 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
|
4 |
*
|
5 |
* This program is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License
|
7 |
* as published by the Free Software Foundation; either version 2
|
8 |
* of the License, or (at your option) any later version.
|
9 |
*
|
10 |
* This program is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
*
|
15 |
* You should have received a copy of the GNU General Public License
|
16 |
* along with this program; if not, write to the Free Software
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
18 |
*
|
19 |
* For more information, contact:
|
20 |
*
|
21 |
* Generalitat Valenciana
|
22 |
* Conselleria d'Infraestructures i Transport
|
23 |
* Av. Blasco Ib??ez, 50
|
24 |
* 46010 VALENCIA
|
25 |
* SPAIN
|
26 |
*
|
27 |
* +34 963862235
|
28 |
* gvsig@gva.es
|
29 |
* www.gvsig.gva.es
|
30 |
*
|
31 |
* or
|
32 |
*
|
33 |
* IVER T.I. S.A
|
34 |
* Salamanca 50
|
35 |
* 46005 Valencia
|
36 |
* Spain
|
37 |
*
|
38 |
* +34 963163400
|
39 |
* dac@iver.es
|
40 |
*/
|
41 |
|
42 |
/* CVS MESSAGES:
|
43 |
*
|
44 |
* $Id: AdvancedSymbologyExtension.java 16205 2007-11-08 16:33:35Z jdominguez $
|
45 |
* $Log: AdvancedSymbologyExtension.java,v $
|
46 |
* Revision 1.12 2007/09/19 15:34:59 jaume
|
47 |
* removed unnecessary imports
|
48 |
*
|
49 |
* Revision 1.11 2007/09/17 09:11:28 jaume
|
50 |
* order of the elements inverted
|
51 |
*
|
52 |
* Revision 1.10 2007/09/13 11:37:09 jvidal
|
53 |
* *** empty log message ***
|
54 |
*
|
55 |
* Revision 1.9 2007/09/04 10:53:10 caballero
|
56 |
* show page
|
57 |
*
|
58 |
* Revision 1.8 2007/08/09 10:39:04 jaume
|
59 |
* first round of found bugs fixed
|
60 |
*
|
61 |
* Revision 1.7 2007/08/01 13:03:31 jaume
|
62 |
* plugable symbol editor
|
63 |
*
|
64 |
* Revision 1.6 2007/05/22 12:17:12 jaume
|
65 |
* *** empty log message ***
|
66 |
*
|
67 |
* Revision 1.5 2007/05/17 09:32:37 jaume
|
68 |
* *** empty log message ***
|
69 |
*
|
70 |
* Revision 1.4 2007/03/21 08:03:03 jaume
|
71 |
* refactored to use ISymbol instead of FSymbol
|
72 |
*
|
73 |
* Revision 1.3 2007/03/13 16:57:35 jaume
|
74 |
* Added MultiVariable legend
|
75 |
*
|
76 |
* Revision 1.2 2007/03/09 11:25:00 jaume
|
77 |
* Advanced symbology (start committing)
|
78 |
*
|
79 |
* Revision 1.1.2.4 2007/02/21 07:35:14 jaume
|
80 |
* *** empty log message ***
|
81 |
*
|
82 |
* Revision 1.1.2.3 2007/02/12 15:14:41 jaume
|
83 |
* refactored interval legend and added graduated symbol legend
|
84 |
*
|
85 |
* Revision 1.1.2.2 2007/02/01 17:47:12 jaume
|
86 |
* *** empty log message ***
|
87 |
*
|
88 |
* Revision 1.1.2.1 2007/02/01 12:12:41 jaume
|
89 |
* theme manager window and all its components are now dynamic
|
90 |
*
|
91 |
*/
|
92 |
package org.gvsig.app.extension; |
93 |
|
94 |
import org.gvsig.andami.PluginServices; |
95 |
import org.gvsig.andami.plugins.Extension; |
96 |
import org.gvsig.andami.preferences.IPreference; |
97 |
import org.gvsig.andami.preferences.IPreferenceExtension; |
98 |
import org.gvsig.app.ApplicationLocator; |
99 |
import org.gvsig.app.gui.preferencespage.CartographicSupportPage; |
100 |
import org.gvsig.app.gui.preferencespage.SymbologyPage; |
101 |
import org.gvsig.app.gui.styling.MarkerFill; |
102 |
import org.gvsig.app.gui.styling.PictureFill; |
103 |
import org.gvsig.app.gui.styling.PictureLine; |
104 |
import org.gvsig.app.gui.styling.PictureMarker; |
105 |
import org.gvsig.app.gui.styling.SimpleFill; |
106 |
import org.gvsig.app.gui.styling.SimpleLine; |
107 |
import org.gvsig.app.gui.styling.SimpleMarker; |
108 |
import org.gvsig.app.gui.styling.SimpleText; |
109 |
import org.gvsig.app.gui.styling.SymbolEditor; |
110 |
import org.gvsig.app.project.documents.view.legend.gui.AttrInTableLabeling; |
111 |
import org.gvsig.app.project.documents.view.legend.gui.Categories; |
112 |
import org.gvsig.app.project.documents.view.legend.gui.Features; |
113 |
import org.gvsig.app.project.documents.view.legend.gui.General; |
114 |
import org.gvsig.app.project.documents.view.legend.gui.LabelingManager; |
115 |
import org.gvsig.app.project.documents.view.legend.gui.LegendManager; |
116 |
import org.gvsig.app.project.documents.view.legend.gui.MultipleAttributes; |
117 |
import org.gvsig.app.project.documents.view.legend.gui.Quantities; |
118 |
import org.gvsig.app.project.documents.view.legend.gui.SingleSymbol; |
119 |
import org.gvsig.app.project.documents.view.legend.gui.ThemeManagerWindow; |
120 |
import org.gvsig.app.project.documents.view.legend.gui.VectorialInterval; |
121 |
import org.gvsig.app.project.documents.view.legend.gui.VectorialUniqueValue; |
122 |
import org.gvsig.fmap.geom.Geometry; |
123 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
124 |
import org.gvsig.symbology.swing.SymbologySwingLocator; |
125 |
|
126 |
/**
|
127 |
* Extension for enable the symbology. It only installs the core symbology.
|
128 |
* @author jaume dominguez faus - jaume.dominguez@iver.es
|
129 |
*
|
130 |
*/
|
131 |
public class BasicSymbologyExtension extends Extension implements IPreferenceExtension{ |
132 |
// private SymbologyLibrary simbologyLibrary;
|
133 |
// private SymbologyDefaultImplLibrary simbologyDefaultImplLibrary;
|
134 |
|
135 |
public void initialize() { |
136 |
// // Simbology initialization
|
137 |
// simbologyLibrary = new SymbologyLibrary();
|
138 |
// simbologyLibrary.initialize();
|
139 |
//
|
140 |
// simbologyDefaultImplLibrary = new SymbologyDefaultImplLibrary();
|
141 |
// simbologyDefaultImplLibrary.initialize();
|
142 |
|
143 |
// Install required features
|
144 |
|
145 |
// modules for symbol editor
|
146 |
SymbolEditor.addSymbolEditorPanel(SimpleFill.class, Geometry.TYPES.SURFACE); |
147 |
SymbolEditor.addSymbolEditorPanel(SimpleMarker.class, Geometry.TYPES.POINT); |
148 |
SymbolEditor.addSymbolEditorPanel(SimpleLine.class, Geometry.TYPES.CURVE); |
149 |
SymbolEditor.addSymbolEditorPanel(SimpleText.class, Geometry.TYPES.TEXT); |
150 |
SymbolEditor.addSymbolEditorPanel(SimpleFill.class, Geometry.TYPES.MULTISURFACE); |
151 |
SymbolEditor.addSymbolEditorPanel(SimpleMarker.class, Geometry.TYPES.MULTIPOINT); |
152 |
SymbolEditor.addSymbolEditorPanel(SimpleLine.class, Geometry.TYPES.MULTICURVE); |
153 |
|
154 |
//FIXME
|
155 |
SymbolEditor.addSymbolEditorPanel(PictureMarker.class, Geometry.TYPES.POINT); |
156 |
SymbolEditor.addSymbolEditorPanel(PictureLine.class, Geometry.TYPES.CURVE); |
157 |
SymbolEditor.addSymbolEditorPanel(PictureFill.class, Geometry.TYPES.SURFACE); |
158 |
SymbolEditor.addSymbolEditorPanel(MarkerFill.class, Geometry.TYPES.SURFACE); |
159 |
|
160 |
SymbolEditor.addSymbolEditorPanel(PictureMarker.class, Geometry.TYPES.MULTIPOINT); |
161 |
SymbolEditor.addSymbolEditorPanel(PictureLine.class, Geometry.TYPES.MULTICURVE); |
162 |
SymbolEditor.addSymbolEditorPanel(PictureFill.class, Geometry.TYPES.MULTISURFACE); |
163 |
SymbolEditor.addSymbolEditorPanel(MarkerFill.class, Geometry.TYPES.MULTISURFACE); |
164 |
|
165 |
// pages
|
166 |
ThemeManagerWindow.addPage(General.class); |
167 |
ThemeManagerWindow.addPage(LegendManager.class); |
168 |
ThemeManagerWindow.addPage(LabelingManager.class); |
169 |
|
170 |
ThemeManagerWindow.setTabEnabledForLayer(General.class, FLyrVect.class, true);
|
171 |
ThemeManagerWindow.setTabEnabledForLayer(LegendManager.class, FLyrVect.class, true);
|
172 |
ThemeManagerWindow.setTabEnabledForLayer(LabelingManager.class, FLyrVect.class, true);
|
173 |
// labeling strategies (inverse order to the wanted to be shown)
|
174 |
LabelingManager.addLabelingStrategy(AttrInTableLabeling.class); |
175 |
|
176 |
// legends available in the legend page
|
177 |
LegendManager.addLegendPage(Quantities.class); |
178 |
LegendManager.addLegendPage(Features.class); |
179 |
LegendManager.addLegendPage(Categories.class); |
180 |
LegendManager.addLegendPage(MultipleAttributes.class); |
181 |
|
182 |
LegendManager.addLegendPage(SingleSymbol.class); |
183 |
LegendManager.addLegendPage(VectorialInterval.class); |
184 |
LegendManager.addLegendPage(VectorialUniqueValue.class); |
185 |
|
186 |
// LegendManager.addLegendDriver(FMapGVLDriver.class);
|
187 |
registerIcons(); |
188 |
} |
189 |
|
190 |
@Override
|
191 |
public void postInitialize() { |
192 |
super.postInitialize();
|
193 |
|
194 |
SymbologySwingLocator.getSwingManager().setColorTablesFactory( |
195 |
ApplicationLocator.getManager().getColorTablesFactory()); |
196 |
|
197 |
|
198 |
// simbologyLibrary.postInitialize();
|
199 |
// simbologyDefaultImplLibrary.postInitialize();
|
200 |
} |
201 |
|
202 |
private void registerIcons(){ |
203 |
PluginServices.getIconTheme().registerDefault( |
204 |
"chain",
|
205 |
this.getClass().getClassLoader().getResource("images/chain.png") |
206 |
); |
207 |
PluginServices.getIconTheme().registerDefault( |
208 |
"broken-chain",
|
209 |
this.getClass().getClassLoader().getResource("images/broken-chain.png") |
210 |
); |
211 |
PluginServices.getIconTheme().registerDefault( |
212 |
"underline-icon",
|
213 |
this.getClass().getClassLoader().getResource("images/underlined.png") |
214 |
); |
215 |
PluginServices.getIconTheme().registerDefault( |
216 |
"italic-icon",
|
217 |
this.getClass().getClassLoader().getResource("images/italic.png") |
218 |
); |
219 |
PluginServices.getIconTheme().registerDefault( |
220 |
"bold-icon",
|
221 |
this.getClass().getClassLoader().getResource("images/bold.png") |
222 |
); |
223 |
PluginServices.getIconTheme().registerDefault( |
224 |
"symbol-pref",
|
225 |
this.getClass().getClassLoader().getResource("images/QuantitiesByCategory.png")); |
226 |
|
227 |
} |
228 |
|
229 |
public void execute(String actionCommand) { |
230 |
|
231 |
} |
232 |
|
233 |
public boolean isEnabled() { |
234 |
return true; // or whatever |
235 |
} |
236 |
|
237 |
public boolean isVisible() { |
238 |
return true; // or whatever |
239 |
} |
240 |
|
241 |
public IPreference[] getPreferencesPages() { |
242 |
return new IPreference[] { |
243 |
new CartographicSupportPage(), new SymbologyPage() |
244 |
}; |
245 |
} |
246 |
} |