root / branches / gvSIG_19_ext3D_osgVP_2_2_0 / extensions / ext3Dgui / src / org / gvsig / gvsig3dgui / layer / properties / PropertiesTocMenuEntry3D.java @ 32103
History | View | Annotate | Download (5.3 KB)
1 |
/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007 IVER T.I. and Generalitat Valenciana.
|
4 |
*
|
5 |
* This program is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License
|
7 |
* as published by the Free Software Foundation; either version 2
|
8 |
* of the License, or (at your option) any later version.
|
9 |
*
|
10 |
* This program is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
*
|
15 |
* You should have received a copy of the GNU General Public License
|
16 |
* along with this program; if not, write to the Free Software
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
18 |
*/
|
19 |
|
20 |
|
21 |
package org.gvsig.gvsig3dgui.layer.properties; |
22 |
|
23 |
import org.gvsig.exceptions.BaseException; |
24 |
import org.gvsig.gui.beans.panelGroup.PanelGroupManager; |
25 |
import org.gvsig.gui.beans.panelGroup.tabbedPanel.TabbedPanel; |
26 |
import org.gvsig.gvsig3dgui.view.View3D; |
27 |
|
28 |
import com.iver.ai2.gvsig3d.map3d.layers.Layer3DProps; |
29 |
import com.iver.andami.PluginServices; |
30 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
31 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
32 |
import com.iver.cit.gvsig.panelGroup.PanelGroupDialog; |
33 |
import com.iver.cit.gvsig.panelGroup.loaders.PanelGroupLoaderFromExtensionPoint; |
34 |
import com.iver.cit.gvsig.project.documents.view.toc.AbstractTocContextMenuAction; |
35 |
import com.iver.cit.gvsig.project.documents.view.toc.ITocItem; |
36 |
|
37 |
|
38 |
/**
|
39 |
* Entrada en del men� contextual del TOC correspondiente al cuadro de
|
40 |
* propiedades 3D
|
41 |
*
|
42 |
* @author �ngel Fraile Gri��n. (angel.fraile@iver.es)
|
43 |
*/
|
44 |
|
45 |
public class PropertiesTocMenuEntry3D extends AbstractTocContextMenuAction { |
46 |
|
47 |
|
48 |
|
49 |
static private PropertiesTocMenuEntry3D singleton = null; |
50 |
private PanelGroupDialog properties = null; |
51 |
private FLayer lyr = null; |
52 |
|
53 |
/**
|
54 |
* Nadie puede crear una instancia a esta clase �nica, hay que usar el
|
55 |
* getSingleton()
|
56 |
*/
|
57 |
private PropertiesTocMenuEntry3D() {
|
58 |
} |
59 |
|
60 |
/**
|
61 |
* Devuelve un objeto unico a dicha clase
|
62 |
*
|
63 |
* @return
|
64 |
*/
|
65 |
static public PropertiesTocMenuEntry3D getSingleton() { |
66 |
if (singleton == null) |
67 |
singleton = new PropertiesTocMenuEntry3D();
|
68 |
return singleton;
|
69 |
} |
70 |
|
71 |
/*
|
72 |
* (non-Javadoc)
|
73 |
*
|
74 |
* @see com.iver.cit.gvsig.project.documents.contextMenu.AbstractContextMenuAction#getGroup()
|
75 |
*/
|
76 |
public String getGroup() { |
77 |
return PluginServices.getText(this, "Layer3D"); |
78 |
} |
79 |
|
80 |
/*
|
81 |
* (non-Javadoc)
|
82 |
*
|
83 |
* @see com.iver.cit.gvsig.project.documents.contextMenu.AbstractContextMenuAction#getGroupOrder()
|
84 |
*/
|
85 |
public int getGroupOrder() { |
86 |
return 60; |
87 |
} |
88 |
|
89 |
/*
|
90 |
* (non-Javadoc)
|
91 |
*
|
92 |
* @see com.iver.cit.gvsig.project.documents.contextMenu.AbstractContextMenuAction#getOrder()
|
93 |
*/
|
94 |
public int getOrder() { |
95 |
return 0; |
96 |
} |
97 |
|
98 |
/*
|
99 |
* (non-Javadoc)
|
100 |
*
|
101 |
* @see com.iver.cit.gvsig.project.documents.IContextMenuAction#getText()
|
102 |
*/
|
103 |
public String getText() { |
104 |
return (PluginServices.getText(this, "Propiedades_3D")); |
105 |
} |
106 |
|
107 |
/**
|
108 |
* Enable options
|
109 |
* Is enabled when a view 3D is selected
|
110 |
*/
|
111 |
public boolean isEnabled(ITocItem item, FLayer[] selectedItems) { |
112 |
|
113 |
com.iver.andami.ui.mdiManager.IWindow f = PluginServices |
114 |
.getMDIManager().getActiveWindow(); |
115 |
// Only isEnable = true, where the view has a view3D.
|
116 |
if (f instanceof View3D) { |
117 |
if ((selectedItems == null) || (selectedItems.length != 1)) |
118 |
return false; |
119 |
else
|
120 |
return true; |
121 |
} |
122 |
return false; |
123 |
} |
124 |
|
125 |
/**
|
126 |
* Visibility options
|
127 |
* Is visible when a view 3D is selected
|
128 |
*
|
129 |
*/
|
130 |
public boolean isVisible(ITocItem item, FLayer[] selectedItems) { |
131 |
boolean visible;
|
132 |
if ((selectedItems == null) || (selectedItems.length != 1)) |
133 |
return false; |
134 |
Layer3DProps prop3D; |
135 |
prop3D = Layer3DProps.getLayer3DProps(selectedItems[0]);
|
136 |
visible = (prop3D == null) ? false : true; |
137 |
com.iver.andami.ui.mdiManager.IWindow f = PluginServices |
138 |
.getMDIManager().getActiveWindow(); |
139 |
// Only isEnable = true, where the view has a view3D.
|
140 |
if (f instanceof View3D) { |
141 |
return visible;
|
142 |
} |
143 |
return false; |
144 |
} |
145 |
|
146 |
/**
|
147 |
* Gestiona la apertura del di�logo de propiedades 3D cuando se pulsa la
|
148 |
* opci�n asignando a este las propiedades iniciales.
|
149 |
*/
|
150 |
public void execute(ITocItem item, FLayer[] selectedItems) { |
151 |
|
152 |
if ((selectedItems == null) || (selectedItems.length != 1)) |
153 |
return;
|
154 |
|
155 |
lyr = selectedItems[0];
|
156 |
|
157 |
try {
|
158 |
PanelGroupManager manager = PanelGroupManager.getManager(); |
159 |
|
160 |
manager.registerPanelGroup(TabbedPanel.class); |
161 |
manager.setDefaultType(TabbedPanel.class); |
162 |
|
163 |
TabbedPanel panelGroup = (TabbedPanel) manager.getPanelGroup(lyr); |
164 |
PanelGroupLoaderFromExtensionPoint loader = new PanelGroupLoaderFromExtensionPoint(
|
165 |
"PropertiesDialog3D");
|
166 |
|
167 |
properties = new PanelGroupDialog(lyr.getName(), PluginServices.getText(this, "Propiedades_3D"), |
168 |
550, 450, (byte) (WindowInfo.MODELESSDIALOG |
169 |
| WindowInfo.RESIZABLE | WindowInfo.MAXIMIZABLE), |
170 |
panelGroup); |
171 |
properties.loadPanels(loader); |
172 |
PluginServices.getMDIManager().addWindow(properties); |
173 |
} catch (BaseException be) {
|
174 |
System.out.println(be.getLocalizedMessageStack());
|
175 |
} catch (Exception e) { |
176 |
e.printStackTrace(); |
177 |
} |
178 |
} |
179 |
} |