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 @ 40558
History | View | Annotate | Download (8.23 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.PluginServices; |
77 |
import org.gvsig.andami.plugins.Extension; |
78 |
import org.gvsig.andami.preferences.IPreference; |
79 |
import org.gvsig.andami.preferences.IPreferenceExtension; |
80 |
import org.gvsig.app.ApplicationLocator; |
81 |
import org.gvsig.app.gui.preferencespage.CartographicSupportPage; |
82 |
import org.gvsig.app.gui.preferencespage.SymbologyPage; |
83 |
import org.gvsig.app.gui.styling.MarkerFill; |
84 |
import org.gvsig.app.gui.styling.PictureFill; |
85 |
import org.gvsig.app.gui.styling.PictureLine; |
86 |
import org.gvsig.app.gui.styling.PictureMarker; |
87 |
import org.gvsig.app.gui.styling.SimpleFill; |
88 |
import org.gvsig.app.gui.styling.SimpleLine; |
89 |
import org.gvsig.app.gui.styling.SimpleMarker; |
90 |
import org.gvsig.app.gui.styling.SimpleText; |
91 |
import org.gvsig.app.gui.styling.SymbolEditor; |
92 |
import org.gvsig.app.project.documents.view.legend.gui.AttrInTableLabeling; |
93 |
import org.gvsig.app.project.documents.view.legend.gui.Categories; |
94 |
import org.gvsig.app.project.documents.view.legend.gui.Features; |
95 |
import org.gvsig.app.project.documents.view.legend.gui.General; |
96 |
import org.gvsig.app.project.documents.view.legend.gui.LabelingManager; |
97 |
import org.gvsig.app.project.documents.view.legend.gui.LegendManager; |
98 |
import org.gvsig.app.project.documents.view.legend.gui.MultipleAttributes; |
99 |
import org.gvsig.app.project.documents.view.legend.gui.Quantities; |
100 |
import org.gvsig.app.project.documents.view.legend.gui.SingleSymbol; |
101 |
import org.gvsig.app.project.documents.view.legend.gui.ThemeManagerWindow; |
102 |
import org.gvsig.app.project.documents.view.legend.gui.VectorialInterval; |
103 |
import org.gvsig.app.project.documents.view.legend.gui.VectorialUniqueValue; |
104 |
import org.gvsig.fmap.geom.Geometry; |
105 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
106 |
import org.gvsig.symbology.swing.SymbologySwingLocator; |
107 |
|
108 |
/**
|
109 |
* Extension for enable the symbology. It only installs the core symbology.
|
110 |
* @author jaume dominguez faus - jaume.dominguez@iver.es
|
111 |
*
|
112 |
*/
|
113 |
public class BasicSymbologyExtension extends Extension implements IPreferenceExtension{ |
114 |
// private SymbologyLibrary simbologyLibrary;
|
115 |
// private SymbologyDefaultImplLibrary simbologyDefaultImplLibrary;
|
116 |
|
117 |
public void initialize() { |
118 |
// modules for symbol editor
|
119 |
SymbolEditor.addSymbolEditorPanel(SimpleFill.class, Geometry.TYPES.SURFACE); |
120 |
SymbolEditor.addSymbolEditorPanel(SimpleMarker.class, Geometry.TYPES.POINT); |
121 |
SymbolEditor.addSymbolEditorPanel(SimpleLine.class, Geometry.TYPES.CURVE); |
122 |
SymbolEditor.addSymbolEditorPanel(SimpleFill.class, Geometry.TYPES.MULTISURFACE); |
123 |
SymbolEditor.addSymbolEditorPanel(SimpleMarker.class, Geometry.TYPES.MULTIPOINT); |
124 |
SymbolEditor.addSymbolEditorPanel(SimpleLine.class, Geometry.TYPES.MULTICURVE); |
125 |
|
126 |
//FIXME
|
127 |
SymbolEditor.addSymbolEditorPanel(PictureMarker.class, Geometry.TYPES.POINT); |
128 |
SymbolEditor.addSymbolEditorPanel(PictureLine.class, Geometry.TYPES.CURVE); |
129 |
SymbolEditor.addSymbolEditorPanel(PictureFill.class, Geometry.TYPES.SURFACE); |
130 |
SymbolEditor.addSymbolEditorPanel(MarkerFill.class, Geometry.TYPES.SURFACE); |
131 |
|
132 |
SymbolEditor.addSymbolEditorPanel(PictureMarker.class, Geometry.TYPES.MULTIPOINT); |
133 |
SymbolEditor.addSymbolEditorPanel(PictureLine.class, Geometry.TYPES.MULTICURVE); |
134 |
SymbolEditor.addSymbolEditorPanel(PictureFill.class, Geometry.TYPES.MULTISURFACE); |
135 |
SymbolEditor.addSymbolEditorPanel(MarkerFill.class, Geometry.TYPES.MULTISURFACE); |
136 |
|
137 |
// pages
|
138 |
ThemeManagerWindow.addPage(General.class); |
139 |
ThemeManagerWindow.addPage(LegendManager.class); |
140 |
ThemeManagerWindow.addPage(LabelingManager.class); |
141 |
|
142 |
ThemeManagerWindow.setTabEnabledForLayer(General.class, FLyrVect.class, true);
|
143 |
ThemeManagerWindow.setTabEnabledForLayer(LegendManager.class, FLyrVect.class, true);
|
144 |
ThemeManagerWindow.setTabEnabledForLayer(LabelingManager.class, FLyrVect.class, true);
|
145 |
// labeling strategies (inverse order to the wanted to be shown)
|
146 |
LabelingManager.addLabelingStrategy(AttrInTableLabeling.class); |
147 |
|
148 |
// legends available in the legend page
|
149 |
LegendManager.addLegendPage(Quantities.class); |
150 |
LegendManager.addLegendPage(Features.class); |
151 |
LegendManager.addLegendPage(Categories.class); |
152 |
LegendManager.addLegendPage(MultipleAttributes.class); |
153 |
|
154 |
LegendManager.addLegendPage(SingleSymbol.class); |
155 |
LegendManager.addLegendPage(VectorialInterval.class); |
156 |
LegendManager.addLegendPage(VectorialUniqueValue.class); |
157 |
|
158 |
// LegendManager.addLegendDriver(FMapGVLDriver.class);
|
159 |
registerIcons(); |
160 |
} |
161 |
|
162 |
@Override
|
163 |
public void postInitialize() { |
164 |
super.postInitialize();
|
165 |
|
166 |
SymbologySwingLocator.getSwingManager().setColorTablesFactory( |
167 |
ApplicationLocator.getManager().getColorTablesFactory()); |
168 |
} |
169 |
|
170 |
private void registerIcons(){ |
171 |
// PluginServices.getIconTheme().registerDefault(
|
172 |
// "chain",
|
173 |
// this.getClass().getClassLoader().getResource("images/chain.png")
|
174 |
// );
|
175 |
// PluginServices.getIconTheme().registerDefault(
|
176 |
// "broken-chain",
|
177 |
// this.getClass().getClassLoader().getResource("images/broken-chain.png")
|
178 |
// );
|
179 |
// PluginServices.getIconTheme().registerDefault(
|
180 |
// "underline-icon",
|
181 |
// this.getClass().getClassLoader().getResource("images/underlined.png")
|
182 |
// );
|
183 |
// PluginServices.getIconTheme().registerDefault(
|
184 |
// "italic-icon",
|
185 |
// this.getClass().getClassLoader().getResource("images/italic.png")
|
186 |
// );
|
187 |
// PluginServices.getIconTheme().registerDefault(
|
188 |
// "bold-icon",
|
189 |
// this.getClass().getClassLoader().getResource("images/bold.png")
|
190 |
// );
|
191 |
// PluginServices.getIconTheme().registerDefault(
|
192 |
// "symbol-pref",
|
193 |
// this.getClass().getClassLoader().getResource("images/QuantitiesByCategory.png"));
|
194 |
|
195 |
} |
196 |
|
197 |
public void execute(String actionCommand) { |
198 |
|
199 |
} |
200 |
|
201 |
public boolean isEnabled() { |
202 |
return true; // or whatever |
203 |
} |
204 |
|
205 |
public boolean isVisible() { |
206 |
return true; // or whatever |
207 |
} |
208 |
|
209 |
public IPreference[] getPreferencesPages() { |
210 |
return new IPreference[] { |
211 |
new CartographicSupportPage(), new SymbologyPage() |
212 |
}; |
213 |
} |
214 |
} |