Statistics
| Revision:

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 @ 43142

History | View | Annotate | Download (7.05 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.GeneralLayerPropertiesPage.GeneralLayerPropertiesPageFactory;
45
import org.gvsig.app.project.documents.view.legend.gui.InformationLayerPropertiesPageFactory;
46
import org.gvsig.app.project.documents.view.legend.gui.LabelingManager;
47
import org.gvsig.app.project.documents.view.legend.gui.LegendManager;
48
import org.gvsig.app.project.documents.view.legend.gui.MultipleAttributes;
49
import org.gvsig.app.project.documents.view.legend.gui.Quantities;
50
import org.gvsig.app.project.documents.view.legend.gui.SingleSymbol;
51
import org.gvsig.app.project.documents.view.legend.gui.ThemeManagerWindow;
52
import static org.gvsig.app.project.documents.view.legend.gui.ThemeManagerWindow.addPage;
53
import org.gvsig.app.project.documents.view.legend.gui.VectorialInterval;
54
import org.gvsig.app.project.documents.view.legend.gui.VectorialUniqueValue;
55
import org.gvsig.fmap.geom.Geometry;
56
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
57
import org.gvsig.fmap.mapcontrol.MapControlLocator;
58
import org.gvsig.propertypage.PropertiesPageManager;
59
import org.gvsig.symbology.swing.SymbologySwingLocator;
60
import org.gvsig.symbology.swing.SymbologySwingManager;
61

    
62
/**
63
 * Extension for enable the symbology. It only installs the core symbology.
64
 * @author jaume dominguez faus - jaume.dominguez@iver.es
65
 *
66
 */
67
public class BasicSymbologyExtension extends Extension implements IPreferenceExtension{
68

    
69
    public void initialize() {
70
        // modules for symbol editor
71
        SymbologySwingManager symbologySwingManager = SymbologySwingLocator.getSwingManager();
72

    
73
        symbologySwingManager.registerSymbolEditor(SimpleFill.class, Geometry.TYPES.SURFACE);
74
        symbologySwingManager.registerSymbolEditor(SimpleMarker.class, Geometry.TYPES.POINT);
75
        symbologySwingManager.registerSymbolEditor(SimpleLine.class, Geometry.TYPES.CURVE);
76
        symbologySwingManager.registerSymbolEditor(SimpleFill.class, Geometry.TYPES.MULTISURFACE);
77
        symbologySwingManager.registerSymbolEditor(SimpleMarker.class, Geometry.TYPES.MULTIPOINT);
78
        symbologySwingManager.registerSymbolEditor(SimpleLine.class, Geometry.TYPES.MULTICURVE);
79

    
80
        //FIXME 
81
        symbologySwingManager.registerSymbolEditor(PictureMarker.class, Geometry.TYPES.POINT);
82
        symbologySwingManager.registerSymbolEditor(PictureLine.class, Geometry.TYPES.CURVE);
83
        symbologySwingManager.registerSymbolEditor(PictureFill.class, Geometry.TYPES.SURFACE);
84
        symbologySwingManager.registerSymbolEditor(MarkerFill.class, Geometry.TYPES.SURFACE);
85

    
86
        symbologySwingManager.registerSymbolEditor(PictureMarker.class, Geometry.TYPES.MULTIPOINT);
87
        symbologySwingManager.registerSymbolEditor(PictureLine.class, Geometry.TYPES.MULTICURVE);
88
        symbologySwingManager.registerSymbolEditor(PictureFill.class, Geometry.TYPES.MULTISURFACE);
89
        symbologySwingManager.registerSymbolEditor(MarkerFill.class, Geometry.TYPES.MULTISURFACE);
90

    
91
        // legends available 
92
        symbologySwingManager.registerLegendEditor(Quantities.class);
93
        symbologySwingManager.registerLegendEditor(Features.class);
94
        symbologySwingManager.registerLegendEditor(Categories.class);
95
        symbologySwingManager.registerLegendEditor(MultipleAttributes.class);
96

    
97
        symbologySwingManager.registerLegendEditor(SingleSymbol.class);
98
        symbologySwingManager.registerLegendEditor(VectorialInterval.class);
99
        symbologySwingManager.registerLegendEditor(VectorialUniqueValue.class);
100

    
101
        // labeling strategies (inverse order to the wanted to be shown)
102
        symbologySwingManager.registerLabelingEditor(AttrInTableLabeling.class);
103

    
104
        // Registry property page of layers
105
        PropertiesPageManager propertiesPageManager = MapControlLocator.getPropertiesPageManager();
106
        propertiesPageManager.registerFactory(new GeneralLayerPropertiesPageFactory());
107
        propertiesPageManager.registerFactory(new InformationLayerPropertiesPageFactory());
108
        
109
        // Registry old style property page of layers
110
        // These must be updated to use "PropertiesPage" instead of "ThemeManagerWindow"
111
        // Do not use this procedure more!!!
112
        ThemeManagerWindow.addPage(LegendManager.class);
113
        ThemeManagerWindow.addPage(LabelingManager.class);
114

    
115
        ThemeManagerWindow.setTabEnabledForLayer(LegendManager.class, FLyrVect.class, true);
116
        ThemeManagerWindow.setTabEnabledForLayer(LabelingManager.class, FLyrVect.class, true);
117

    
118
        registerIcons();
119
    }
120

    
121
        @Override
122
        public void postInitialize() {
123
                super.postInitialize();
124
                
125
                SymbologySwingLocator.getSwingManager().setColorTablesFactory(
126
                                ApplicationLocator.getManager().getColorTablesFactory());
127
        }
128

    
129
        private void registerIcons(){
130
            IconThemeHelper.registerIcon("preferences", "symbology-preferences", this);
131
        }
132

    
133
        public void execute(String actionCommand) {
134

    
135
        }
136

    
137
        public boolean isEnabled() {
138
                return false;
139
        }
140

    
141
        public boolean isVisible() {
142
                return false;
143
        }
144

    
145
        public IPreference[] getPreferencesPages() {
146
                return new IPreference[] {
147
                        new CartographicSupportPage(), new SymbologyPage()
148
                };
149
        }
150
}