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 @ 44601
History | View | Annotate | Download (7.06 KB)
1 | 40558 | jjdelcerro | /**
|
---|---|---|---|
2 | * gvSIG. Desktop Geographic Information System.
|
||
3 | 40435 | jjdelcerro | *
|
4 | 40558 | jjdelcerro | * Copyright (C) 2007-2013 gvSIG Association.
|
5 | 40435 | jjdelcerro | *
|
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 | 40558 | jjdelcerro | * as published by the Free Software Foundation; either version 3
|
9 | 40435 | jjdelcerro | * 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 | 40558 | jjdelcerro | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 | * MA 02110-1301, USA.
|
||
20 | 40435 | jjdelcerro | *
|
21 | 40558 | jjdelcerro | * For any additional information, do not hesitate to contact us
|
22 | * at info AT gvsig.com, or visit our website www.gvsig.com.
|
||
23 | 40435 | jjdelcerro | */
|
24 | package org.gvsig.app.extension; |
||
25 | |||
26 | 40723 | jldominguez | import org.gvsig.andami.IconThemeHelper; |
27 | 40435 | jjdelcerro | 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 | 42506 | jjdelcerro | import org.gvsig.app.project.documents.view.legend.gui.GeneralLayerPropertiesPage.GeneralLayerPropertiesPageFactory; |
44 | 40435 | jjdelcerro | 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 | 43392 | jjdelcerro | import org.gvsig.app.project.documents.view.legend.gui.legendactions.LoadLegendAction; |
53 | import org.gvsig.app.project.documents.view.legend.gui.legendactions.SaveLegendAction; |
||
54 | 40435 | jjdelcerro | import org.gvsig.fmap.geom.Geometry; |
55 | import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
||
56 | 42506 | jjdelcerro | import org.gvsig.fmap.mapcontrol.MapControlLocator; |
57 | import org.gvsig.propertypage.PropertiesPageManager; |
||
58 | 40435 | jjdelcerro | import org.gvsig.symbology.swing.SymbologySwingLocator; |
59 | 41400 | jjdelcerro | import org.gvsig.symbology.swing.SymbologySwingManager; |
60 | 40435 | jjdelcerro | |
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 | 41400 | jjdelcerro | public void initialize() { |
69 | // modules for symbol editor
|
||
70 | SymbologySwingManager symbologySwingManager = SymbologySwingLocator.getSwingManager(); |
||
71 | 40435 | jjdelcerro | |
72 | 41400 | jjdelcerro | 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 | 40435 | jjdelcerro | |
79 | 43152 | fdiaz | //FIXME
|
80 | 41400 | jjdelcerro | 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 | 40435 | jjdelcerro | |
85 | 41400 | jjdelcerro | 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 | 40435 | jjdelcerro | |
90 | 43152 | fdiaz | // legends available
|
91 | 41400 | jjdelcerro | symbologySwingManager.registerLegendEditor(Quantities.class); |
92 | symbologySwingManager.registerLegendEditor(Features.class); |
||
93 | symbologySwingManager.registerLegendEditor(Categories.class); |
||
94 | symbologySwingManager.registerLegendEditor(MultipleAttributes.class); |
||
95 | 40435 | jjdelcerro | |
96 | 41400 | jjdelcerro | symbologySwingManager.registerLegendEditor(SingleSymbol.class); |
97 | symbologySwingManager.registerLegendEditor(VectorialInterval.class); |
||
98 | symbologySwingManager.registerLegendEditor(VectorialUniqueValue.class); |
||
99 | 40435 | jjdelcerro | |
100 | 41400 | jjdelcerro | // labeling strategies (inverse order to the wanted to be shown)
|
101 | symbologySwingManager.registerLabelingEditor(AttrInTableLabeling.class); |
||
102 | |||
103 | 42506 | jjdelcerro | // Registry property page of layers
|
104 | PropertiesPageManager propertiesPageManager = MapControlLocator.getPropertiesPageManager(); |
||
105 | propertiesPageManager.registerFactory(new GeneralLayerPropertiesPageFactory());
|
||
106 | 43152 | fdiaz | |
107 | 42506 | jjdelcerro | // Registry old style property page of layers
|
108 | // These must be updated to use "PropertiesPage" instead of "ThemeManagerWindow"
|
||
109 | 42507 | jjdelcerro | // Do not use this procedure more!!!
|
110 | 41400 | jjdelcerro | 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 | 43392 | jjdelcerro | symbologySwingManager.addOptionalActionToLegendsPanel(new LoadLegendAction());
|
117 | symbologySwingManager.addOptionalActionToLegendsPanel(new SaveLegendAction());
|
||
118 | |||
119 | 41400 | jjdelcerro | registerIcons(); |
120 | } |
||
121 | |||
122 | 40435 | jjdelcerro | @Override
|
123 | public void postInitialize() { |
||
124 | super.postInitialize();
|
||
125 | 43152 | fdiaz | |
126 | 40435 | jjdelcerro | SymbologySwingLocator.getSwingManager().setColorTablesFactory( |
127 | ApplicationLocator.getManager().getColorTablesFactory()); |
||
128 | } |
||
129 | |||
130 | private void registerIcons(){ |
||
131 | 40723 | jldominguez | IconThemeHelper.registerIcon("preferences", "symbology-preferences", this); |
132 | 40435 | jjdelcerro | } |
133 | |||
134 | public void execute(String actionCommand) { |
||
135 | |||
136 | } |
||
137 | |||
138 | public boolean isEnabled() { |
||
139 | 41264 | jjdelcerro | return false; |
140 | 40435 | jjdelcerro | } |
141 | |||
142 | public boolean isVisible() { |
||
143 | 41264 | jjdelcerro | return false; |
144 | 40435 | jjdelcerro | } |
145 | |||
146 | public IPreference[] getPreferencesPages() { |
||
147 | return new IPreference[] { |
||
148 | new CartographicSupportPage(), new SymbologyPage() |
||
149 | }; |
||
150 | } |
||
151 | } |