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 @ 47784
History | View | Annotate | Download (7.06 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 |
package org.gvsig.app.extension; |
25 |
|
26 |
import org.gvsig.andami.IconThemeHelper; |
27 |
import org.gvsig.andami.plugins.Extension; |
28 |
import org.gvsig.andami.preferences.IPreference; |
29 |
import org.gvsig.andami.preferences.IPreferenceExtension; |
30 |
import org.gvsig.app.ApplicationLocator; |
31 |
import org.gvsig.app.gui.preferencespage.CartographicSupportPage; |
32 |
import org.gvsig.app.gui.preferencespage.SymbologyPage; |
33 |
import org.gvsig.app.gui.styling.MarkerFill; |
34 |
import org.gvsig.app.gui.styling.PictureFill; |
35 |
import org.gvsig.app.gui.styling.PictureLine; |
36 |
import org.gvsig.app.gui.styling.PictureMarker; |
37 |
import org.gvsig.app.gui.styling.SimpleFill; |
38 |
import org.gvsig.app.gui.styling.SimpleLine; |
39 |
import org.gvsig.app.gui.styling.SimpleMarker; |
40 |
import org.gvsig.app.project.documents.view.legend.gui.AttrInTableLabeling; |
41 |
import org.gvsig.app.project.documents.view.legend.gui.Categories; |
42 |
import org.gvsig.app.project.documents.view.legend.gui.Features; |
43 |
import org.gvsig.app.project.documents.view.legend.gui.GeneralLayerPropertiesPage.GeneralLayerPropertiesPageFactory; |
44 |
import org.gvsig.app.project.documents.view.legend.gui.LabelingManager; |
45 |
import org.gvsig.app.project.documents.view.legend.gui.LegendManager; |
46 |
import org.gvsig.app.project.documents.view.legend.gui.MultipleAttributes; |
47 |
import org.gvsig.app.project.documents.view.legend.gui.Quantities; |
48 |
import org.gvsig.app.project.documents.view.legend.gui.SingleSymbol; |
49 |
import org.gvsig.app.project.documents.view.legend.gui.ThemeManagerWindow; |
50 |
import org.gvsig.app.project.documents.view.legend.gui.VectorialInterval; |
51 |
import org.gvsig.app.project.documents.view.legend.gui.VectorialUniqueValue; |
52 |
import org.gvsig.app.project.documents.view.legend.gui.legendactions.LoadLegendAction; |
53 |
import org.gvsig.app.project.documents.view.legend.gui.legendactions.SaveLegendAction; |
54 |
import org.gvsig.fmap.geom.Geometry; |
55 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
56 |
import org.gvsig.fmap.mapcontrol.MapControlLocator; |
57 |
import org.gvsig.propertypage.PropertiesPageManager; |
58 |
import org.gvsig.symbology.swing.SymbologySwingLocator; |
59 |
import org.gvsig.symbology.swing.SymbologySwingManager; |
60 |
|
61 |
/**
|
62 |
* Extension for enable the symbology. It only installs the core symbology.
|
63 |
* @author jaume dominguez faus - jaume.dominguez@iver.es
|
64 |
*
|
65 |
*/
|
66 |
public class BasicSymbologyExtension extends Extension implements IPreferenceExtension{ |
67 |
|
68 |
public void initialize() { |
69 |
// modules for symbol editor
|
70 |
SymbologySwingManager symbologySwingManager = SymbologySwingLocator.getSwingManager(); |
71 |
|
72 |
symbologySwingManager.registerSymbolEditor(SimpleFill.class, Geometry.TYPES.SURFACE); |
73 |
symbologySwingManager.registerSymbolEditor(SimpleMarker.class, Geometry.TYPES.POINT); |
74 |
symbologySwingManager.registerSymbolEditor(SimpleLine.class, Geometry.TYPES.CURVE); |
75 |
symbologySwingManager.registerSymbolEditor(SimpleFill.class, Geometry.TYPES.MULTISURFACE); |
76 |
symbologySwingManager.registerSymbolEditor(SimpleMarker.class, Geometry.TYPES.MULTIPOINT); |
77 |
symbologySwingManager.registerSymbolEditor(SimpleLine.class, Geometry.TYPES.MULTICURVE); |
78 |
|
79 |
//FIXME
|
80 |
symbologySwingManager.registerSymbolEditor(PictureMarker.class, Geometry.TYPES.POINT); |
81 |
symbologySwingManager.registerSymbolEditor(PictureLine.class, Geometry.TYPES.CURVE); |
82 |
symbologySwingManager.registerSymbolEditor(PictureFill.class, Geometry.TYPES.SURFACE); |
83 |
symbologySwingManager.registerSymbolEditor(MarkerFill.class, Geometry.TYPES.SURFACE); |
84 |
|
85 |
symbologySwingManager.registerSymbolEditor(PictureMarker.class, Geometry.TYPES.MULTIPOINT); |
86 |
symbologySwingManager.registerSymbolEditor(PictureLine.class, Geometry.TYPES.MULTICURVE); |
87 |
symbologySwingManager.registerSymbolEditor(PictureFill.class, Geometry.TYPES.MULTISURFACE); |
88 |
symbologySwingManager.registerSymbolEditor(MarkerFill.class, Geometry.TYPES.MULTISURFACE); |
89 |
|
90 |
// legends available
|
91 |
symbologySwingManager.registerLegendEditor(Quantities.class); |
92 |
symbologySwingManager.registerLegendEditor(Features.class); |
93 |
symbologySwingManager.registerLegendEditor(Categories.class); |
94 |
symbologySwingManager.registerLegendEditor(MultipleAttributes.class); |
95 |
|
96 |
symbologySwingManager.registerLegendEditor(SingleSymbol.class); |
97 |
symbologySwingManager.registerLegendEditor(VectorialInterval.class); |
98 |
symbologySwingManager.registerLegendEditor(VectorialUniqueValue.class); |
99 |
|
100 |
// labeling strategies (inverse order to the wanted to be shown)
|
101 |
symbologySwingManager.registerLabelingEditor(AttrInTableLabeling.class); |
102 |
|
103 |
// Registry property page of layers
|
104 |
PropertiesPageManager propertiesPageManager = MapControlLocator.getPropertiesPageManager(); |
105 |
propertiesPageManager.registerFactory(new GeneralLayerPropertiesPageFactory());
|
106 |
|
107 |
// Registry old style property page of layers
|
108 |
// These must be updated to use "PropertiesPage" instead of "ThemeManagerWindow"
|
109 |
// Do not use this procedure more!!!
|
110 |
ThemeManagerWindow.addPage(LegendManager.class); |
111 |
ThemeManagerWindow.addPage(LabelingManager.class); |
112 |
|
113 |
ThemeManagerWindow.setTabEnabledForLayer(LegendManager.class, FLyrVect.class, true);
|
114 |
ThemeManagerWindow.setTabEnabledForLayer(LabelingManager.class, FLyrVect.class, true);
|
115 |
|
116 |
symbologySwingManager.addOptionalActionToLegendsPanel(new LoadLegendAction());
|
117 |
symbologySwingManager.addOptionalActionToLegendsPanel(new SaveLegendAction());
|
118 |
|
119 |
registerIcons(); |
120 |
} |
121 |
|
122 |
@Override
|
123 |
public void postInitialize() { |
124 |
super.postInitialize();
|
125 |
|
126 |
SymbologySwingLocator.getSwingManager().setColorTablesFactory( |
127 |
ApplicationLocator.getManager().getColorTablesFactory()); |
128 |
} |
129 |
|
130 |
private void registerIcons(){ |
131 |
IconThemeHelper.registerIcon("preferences", "symbology-preferences", this); |
132 |
} |
133 |
|
134 |
public void execute(String actionCommand) { |
135 |
|
136 |
} |
137 |
|
138 |
public boolean isEnabled() { |
139 |
return false; |
140 |
} |
141 |
|
142 |
public boolean isVisible() { |
143 |
return false; |
144 |
} |
145 |
|
146 |
public IPreference[] getPreferencesPages() { |
147 |
return new IPreference[] { |
148 |
new CartographicSupportPage(), new SymbologyPage() |
149 |
}; |
150 |
} |
151 |
} |