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