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