Revision 344 2.0/trunk/org.gvsig.gvsig3d.app/org.gvsig.gvsig3d.app.extension/src/main/java/org/gvsig/gvsig3d/app/gui/styling/Object3DSymbolTab.java
Object3DSymbolTab.java | ||
---|---|---|
33 | 33 |
import org.gvsig.osgvp.exceptions.node.LoadNodeException; |
34 | 34 |
import org.gvsig.osgvp.viewer.IViewerContainer; |
35 | 35 |
import org.gvsig.osgvp.viewer.ViewerFactory; |
36 |
import javax.swing.JComboBox; |
|
37 |
import javax.swing.DefaultComboBoxModel; |
|
36 | 38 |
|
37 | 39 |
public class Object3DSymbolTab extends JPanel implements ISymbolSelectorTab { |
38 | 40 |
|
39 | 41 |
private JTextField textField; |
40 | 42 |
|
41 | 43 |
private IViewerContainer _canvas3d; |
44 |
private IViewerContainer _alternateCanvas3d; |
|
42 | 45 |
|
43 | 46 |
private ISimpleMarker3DSymbol _symbol; |
44 | 47 |
private String _nodeURL = ""; |
45 | 48 |
|
46 | 49 |
private JSpinner sizeSpinner; |
47 | 50 |
|
51 |
private JComboBox _comboBox; |
|
52 |
|
|
48 | 53 |
/** |
49 | 54 |
* Create the panel. |
50 | 55 |
*/ |
... | ... | |
56 | 61 |
add(tabbedPane, BorderLayout.CENTER); |
57 | 62 |
|
58 | 63 |
JPanel panel = new JPanel(); |
59 |
tabbedPane.addTab("Node Marker", null, panel, null);
|
|
64 |
tabbedPane.addTab("Marker", null, panel, null); |
|
60 | 65 |
GridBagLayout gbl_panel = new GridBagLayout(); |
61 | 66 |
gbl_panel.columnWidths = new int[] { 175 }; |
62 | 67 |
gbl_panel.rowHeights = new int[] { 180, 70 }; |
... | ... | |
156 | 161 |
JPanel panel_4 = new JPanel(); |
157 | 162 |
tabbedPane.addTab("Collection", null, panel_4, null); |
158 | 163 |
GridBagLayout gbl_panel_4 = new GridBagLayout(); |
159 |
gbl_panel_4.columnWidths = new int[] { 220, 220, 0 };
|
|
160 |
gbl_panel_4.rowHeights = new int[] { 33, 33, 33, 0 };
|
|
161 |
gbl_panel_4.columnWeights = new double[] { 0.0, 0.0, Double.MIN_VALUE };
|
|
162 |
gbl_panel_4.rowWeights = new double[] { 0.0, 0.0, 0.0, Double.MIN_VALUE };
|
|
164 |
gbl_panel_4.columnWidths = new int[] { 175 };
|
|
165 |
gbl_panel_4.rowHeights = new int[] { 250, 45 };
|
|
166 |
gbl_panel_4.columnWeights = new double[] { 1.0 };
|
|
167 |
gbl_panel_4.rowWeights = new double[] { 1.0, 0.0};
|
|
163 | 168 |
panel_4.setLayout(gbl_panel_4); |
169 |
|
|
170 |
JPanel panel_1 = new JPanel(); |
|
171 |
panel_1.setBorder(new TitledBorder(null, "Preview", TitledBorder.LEADING, TitledBorder.TOP, null, null)); |
|
172 |
GridBagConstraints gbc_panel_1 = new GridBagConstraints(); |
|
173 |
gbc_panel_1.insets = new Insets(0, 0, 5, 0); |
|
174 |
gbc_panel_1.fill = GridBagConstraints.BOTH; |
|
175 |
gbc_panel_1.gridx = 0; |
|
176 |
gbc_panel_1.gridy = 0; |
|
177 |
panel_4.add(panel_1, gbc_panel_1); |
|
178 |
panel_1.setLayout(new BorderLayout(0, 0)); |
|
179 |
|
|
180 |
panel_1.add(getAlternateOsgPanel()); |
|
181 |
|
|
182 |
_comboBox = new JComboBox(); |
|
183 |
_comboBox.addActionListener(new ActionListener() { |
|
184 |
public void actionPerformed(ActionEvent arg0) { |
|
185 |
|
|
186 |
switch(_comboBox.getSelectedIndex()){ |
|
187 |
|
|
188 |
case 0: |
|
189 |
_nodeURL=Object3DSymbolTab.class.getResource("/particle/fire.osgb").getPath(); |
|
190 |
break; |
|
191 |
case 1: |
|
192 |
_nodeURL=Object3DSymbolTab.class.getResource("/particle/radial.osgb").getPath(); |
|
193 |
break; |
|
194 |
case 2: |
|
195 |
_nodeURL=Object3DSymbolTab.class.getResource("/particle/space.osgb").getPath(); |
|
196 |
break; |
|
197 |
case 3: |
|
198 |
_nodeURL=Object3DSymbolTab.class.getResource("/particle/trisistema.osgb").getPath(); |
|
199 |
break; |
|
200 |
|
|
201 |
default: |
|
202 |
break; |
|
203 |
|
|
204 |
} |
|
205 |
|
|
206 |
try { |
|
207 |
Node node = osgDB.readNodeFile(_nodeURL); |
|
208 |
_alternateCanvas3d.getOSGViewer().setSceneData(node); |
|
209 |
} catch (LoadNodeException e) { |
|
210 |
// TODO Auto-generated catch block |
|
211 |
e.printStackTrace(); |
|
212 |
} catch (FileNotFoundException e) { |
|
213 |
// TODO Auto-generated catch block |
|
214 |
e.printStackTrace(); |
|
215 |
} |
|
216 |
|
|
217 |
} |
|
218 |
}); |
|
219 |
_comboBox.setModel(new DefaultComboBoxModel(new String[] {"Fire", "Radial", "Space", "Flare"})); |
|
220 |
GridBagConstraints gbc_comboBox = new GridBagConstraints(); |
|
221 |
gbc_comboBox.fill = GridBagConstraints.HORIZONTAL; |
|
222 |
gbc_comboBox.gridx = 0; |
|
223 |
gbc_comboBox.gridy = 1; |
|
224 |
panel_4.add(_comboBox, gbc_comboBox); |
|
164 | 225 |
|
165 |
JRadioButton rdbtnNewRadioButton = new JRadioButton(""); |
|
166 |
GridBagConstraints gbc_rdbtnNewRadioButton = new GridBagConstraints(); |
|
167 |
gbc_rdbtnNewRadioButton.anchor = GridBagConstraints.WEST; |
|
168 |
gbc_rdbtnNewRadioButton.insets = new Insets(0, 0, 5, 5); |
|
169 |
gbc_rdbtnNewRadioButton.gridx = 0; |
|
170 |
gbc_rdbtnNewRadioButton.gridy = 0; |
|
171 |
panel_4.add(rdbtnNewRadioButton, gbc_rdbtnNewRadioButton); |
|
226 |
} |
|
172 | 227 |
|
173 |
JPanel panel_5 = new JPanel(); |
|
174 |
GridBagConstraints gbc_panel_5 = new GridBagConstraints(); |
|
175 |
gbc_panel_5.fill = GridBagConstraints.BOTH; |
|
176 |
gbc_panel_5.insets = new Insets(0, 0, 5, 0); |
|
177 |
gbc_panel_5.gridx = 1; |
|
178 |
gbc_panel_5.gridy = 0; |
|
179 |
panel_4.add(panel_5, gbc_panel_5); |
|
228 |
private JPanel getOsgPanel() { |
|
180 | 229 |
|
181 |
JRadioButton rdbtnNewRadioButton_1 = new JRadioButton(""); |
|
182 |
GridBagConstraints gbc_rdbtnNewRadioButton_1 = new GridBagConstraints(); |
|
183 |
gbc_rdbtnNewRadioButton_1.fill = GridBagConstraints.BOTH; |
|
184 |
gbc_rdbtnNewRadioButton_1.insets = new Insets(0, 0, 5, 5); |
|
185 |
gbc_rdbtnNewRadioButton_1.gridx = 0; |
|
186 |
gbc_rdbtnNewRadioButton_1.gridy = 1; |
|
187 |
panel_4.add(rdbtnNewRadioButton_1, gbc_rdbtnNewRadioButton_1); |
|
230 |
int size = 140; |
|
231 |
JPanel aux3 = new JPanel(); |
|
232 |
aux3.setPreferredSize(new Dimension(size, size)); |
|
188 | 233 |
|
189 |
JPanel panel_6 = new JPanel();
|
|
190 |
GridBagConstraints gbc_panel_6 = new GridBagConstraints();
|
|
191 |
gbc_panel_6.fill = GridBagConstraints.BOTH;
|
|
192 |
gbc_panel_6.insets = new Insets(0, 0, 5, 0);
|
|
193 |
gbc_panel_6.gridx = 1;
|
|
194 |
gbc_panel_6.gridy = 1;
|
|
195 |
panel_4.add(panel_6, gbc_panel_6);
|
|
234 |
if (_canvas3d == null) {
|
|
235 |
_canvas3d = ViewerFactory.getInstance().createViewer(
|
|
236 |
ViewerFactory.VIEWER_TYPE.CANVAS_VIEWER, null);
|
|
237 |
_canvas3d.setSize(size, size);
|
|
238 |
// _canvas3d.getOSGViewer().setClearColor(1.0, 1.0, 1.0, 0.0);
|
|
239 |
ViewerFactory.getInstance().startAnimator();
|
|
240 |
}
|
|
196 | 241 |
|
197 |
JRadioButton rdbtnNewRadioButton_2 = new JRadioButton(""); |
|
198 |
GridBagConstraints gbc_rdbtnNewRadioButton_2 = new GridBagConstraints(); |
|
199 |
gbc_rdbtnNewRadioButton_2.fill = GridBagConstraints.BOTH; |
|
200 |
gbc_rdbtnNewRadioButton_2.insets = new Insets(0, 0, 0, 5); |
|
201 |
gbc_rdbtnNewRadioButton_2.gridx = 0; |
|
202 |
gbc_rdbtnNewRadioButton_2.gridy = 2; |
|
203 |
panel_4.add(rdbtnNewRadioButton_2, gbc_rdbtnNewRadioButton_2); |
|
242 |
loadFile(); |
|
204 | 243 |
|
205 |
JPanel panel_7 = new JPanel(); |
|
206 |
GridBagConstraints gbc_panel_7 = new GridBagConstraints(); |
|
207 |
gbc_panel_7.fill = GridBagConstraints.BOTH; |
|
208 |
gbc_panel_7.gridx = 1; |
|
209 |
gbc_panel_7.gridy = 2; |
|
210 |
panel_4.add(panel_7, gbc_panel_7); |
|
244 |
aux3.add((Component) _canvas3d); |
|
211 | 245 |
|
246 |
return aux3; |
|
212 | 247 |
} |
213 | 248 |
|
214 |
private JPanel getOsgPanel() { |
|
249 |
private JPanel getAlternateOsgPanel() {
|
|
215 | 250 |
|
216 | 251 |
int size = 140; |
217 | 252 |
JPanel aux3 = new JPanel(); |
218 | 253 |
aux3.setPreferredSize(new Dimension(size, size)); |
219 | 254 |
|
220 |
if (_canvas3d == null) {
|
|
221 |
_canvas3d = ViewerFactory.getInstance().createViewer(
|
|
255 |
if (_alternateCanvas3d == null) {
|
|
256 |
_alternateCanvas3d = ViewerFactory.getInstance().createViewer(
|
|
222 | 257 |
ViewerFactory.VIEWER_TYPE.CANVAS_VIEWER, null); |
223 |
_canvas3d.setSize(size, size);
|
|
258 |
_alternateCanvas3d.setSize(size, size);
|
|
224 | 259 |
// _canvas3d.getOSGViewer().setClearColor(1.0, 1.0, 1.0, 0.0); |
225 | 260 |
ViewerFactory.getInstance().startAnimator(); |
226 | 261 |
} |
227 | 262 |
|
228 | 263 |
loadFile(); |
229 | 264 |
|
230 |
aux3.add((Component) _canvas3d);
|
|
265 |
aux3.add((Component) _alternateCanvas3d);
|
|
231 | 266 |
|
232 | 267 |
return aux3; |
233 | 268 |
} |
Also available in: Unified diff