Statistics
| Revision:

gvsig-3d / 2.0 / trunk / org.gvsig.gvsig3d.app / org.gvsig.gvsig3d.app.extension / src / main / java / org / gvsig / gvsig3d / app / extension / Gvsig3DExtension.java @ 320

History | View | Annotate | Download (4.46 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
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 2
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
 */
22
package org.gvsig.gvsig3d.app.extension;
23

    
24
import org.gvsig.andami.plugins.Extension;
25
import org.gvsig.app.gui.styling.SymbolSelector;
26
import org.gvsig.app.project.documents.view.legend.gui.ISymbolSelector;
27
import org.gvsig.app.project.documents.view.legend.gui.ThemeManagerWindow;
28
import org.gvsig.fmap.mapcontext.MapContextLocator;
29
import org.gvsig.fmap.mapcontext.layers.FLyrDefault;
30
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
31
import org.gvsig.gui.beans.panelGroup.PanelGroupManager;
32
import org.gvsig.gvsig3d.Gvsig3DManager;
33
import org.gvsig.gvsig3d.app.camera.ProjectCamera;
34
import org.gvsig.gvsig3d.app.gui.panels.Raster3DPanel;
35
import org.gvsig.gvsig3d.app.gui.panels.Vectorial3DPanel;
36
import org.gvsig.gvsig3d.app.gui.styling.SymbolSelector3D;
37
import org.gvsig.gvsig3d.app.gui.toc.Properties3DManager;
38
import org.gvsig.gvsig3d.app.tocmenu.TocRefreshLayer;
39
import org.gvsig.gvsig3d.app.tocmenu.TocTransparencyPanel;
40
import org.gvsig.raster.fmap.layers.DefaultFLyrRaster;
41
import org.gvsig.tools.ToolsLocator;
42
import org.gvsig.tools.extensionpoint.ExtensionPoint;
43
import org.gvsig.tools.extensionpoint.ExtensionPointManager;
44
import org.gvsig.tools.library.LibraryException;
45
import org.gvsig.tools.util.Caller;
46
import org.gvsig.tools.util.impl.DefaultCaller;
47
import org.slf4j.Logger;
48
import org.slf4j.LoggerFactory;
49

    
50
/**
51
 * Andami extension to show Gvsig3D in the application.
52
 * 
53
 * @author AI2
54
 * @version $Id$
55
 */
56
public class Gvsig3DExtension extends Extension {
57

    
58
        // private Gvsig3DManager manager;
59
        // private Gvsig3DSwingManager swingManager;
60

    
61
        private static final Logger LOG = LoggerFactory
62
                        .getLogger(Gvsig3DExtension.class);
63

    
64
        public void initialize() {
65

    
66
                View3DManager.register();
67
                ExtensionPoint exPoint = ToolsLocator.getExtensionPointManager().get(
68
                                "View_TocActions");
69
                exPoint.append("Layer_Refresh", "", new TocRefreshLayer());
70
                exPoint.append("Layer_Transparency", " ", new TocTransparencyPanel());
71

    
72
                //Register Symbol Selector
73
                SymbolSelector.registerSymbolSelector("project.document.view3d", SymbolSelector3D.class);
74
                
75
                // Register other classes persistence with the Caller
76
                Caller caller = new DefaultCaller();
77

    
78
                caller.add(new DefaultView3DDocument.RegisterPersistence());
79
                caller.add(new ProjectCamera.RegisterPersistence());
80

    
81
                /*
82
                 * Do register of all
83
                 */
84
                if (!caller.call()) {
85
                        throw new LibraryException(Gvsig3DExtension.class,
86
                                        caller.getExceptions());
87
                }
88

    
89
                // Add 3D Properties panel to Properties dialog for Vectorial layers
90
                ThemeManagerWindow.addPage(Properties3DManager.class);
91
                // Register the type of layer enabled
92
                ThemeManagerWindow.setTabEnabledForLayer(Properties3DManager.class,
93
                                FLyrVect.class, true);
94
                
95
                PanelGroupManager.getManager().registerPanelGroup(Vectorial3DPanel.class);
96
                PanelGroupManager.getManager().setDefaultType(Vectorial3DPanel.class);
97
                
98
                // Add 3D Properties panel to Raster Properties dialog
99
                ExtensionPointManager extensionPoints = ToolsLocator.getExtensionPointManager();
100
                ExtensionPoint point = extensionPoints.add("RasterSEPropertiesDialog");
101
                point.append("3D", "Raster 3D Properties", Raster3DPanel.class);
102

    
103
        }
104

    
105
        @Override
106
        public void postInitialize() {
107
                // super.postInitialize();
108
                // manager = Gvsig3DLocator.getManager();
109
                // // Asignamos el locator e iniciamos la instancia
110
                // swingManager = Gvsig3DSwingLocator.getSwingManager();
111
                // swingManager.registerWindowManager(new GvSIGGvsig3DWindowManager());
112

    
113
        }
114

    
115
        public void execute(String actionCommand) {
116

    
117
        }
118

    
119
        public void showGvsig3D(Gvsig3DManager manager) {
120

    
121
        }
122

    
123
        public boolean isEnabled() {
124
                return true;
125
        }
126

    
127
        public boolean isVisible() {
128
                return true;
129
        }
130

    
131
}