gvsig-3d / 2.0 / trunk / org.gvsig.gvsig3d.app / org.gvsig.gvsig3d.app.extension / src / main / java / org / gvsig / gvsig3d / app / view / ViewProperties3D.java @ 318
History | View | Annotate | Download (18.4 KB)
1 |
package org.gvsig.gvsig3d.app.view; |
---|---|
2 |
|
3 |
import java.awt.Color; |
4 |
import java.awt.Component; |
5 |
import java.awt.Dimension; |
6 |
import java.awt.GridBagConstraints; |
7 |
import java.awt.GridBagLayout; |
8 |
import java.awt.Insets; |
9 |
import java.awt.event.ActionEvent; |
10 |
import java.awt.event.ActionListener; |
11 |
import java.util.Enumeration; |
12 |
|
13 |
import javax.swing.AbstractAction; |
14 |
import javax.swing.Action; |
15 |
import javax.swing.BorderFactory; |
16 |
import javax.swing.ButtonGroup; |
17 |
import javax.swing.JColorChooser; |
18 |
import javax.swing.JLabel; |
19 |
import javax.swing.JPanel; |
20 |
import javax.swing.JRadioButton; |
21 |
import javax.swing.JScrollPane; |
22 |
import javax.swing.JTextArea; |
23 |
import javax.swing.JTextField; |
24 |
|
25 |
import org.cresques.cts.IProjection; |
26 |
import org.gvsig.andami.PluginServices; |
27 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
28 |
import org.gvsig.andami.ui.mdiManager.SingletonWindow; |
29 |
import org.gvsig.andami.ui.mdiManager.WindowInfo; |
30 |
import org.gvsig.app.gui.panels.CRSSelectPanel; |
31 |
import org.gvsig.app.project.documents.view.ViewDocument; |
32 |
import org.gvsig.app.project.documents.view.gui.AbstractViewPanel; |
33 |
import org.gvsig.fmap.crs.CRSFactory; |
34 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
35 |
import org.gvsig.fmap.mapcontext.layers.SingleLayerIterator; |
36 |
import org.gvsig.gui.beans.swing.GridBagLayoutPanel; |
37 |
import org.gvsig.gui.beans.swing.JButton; |
38 |
import org.gvsig.gvsig3d.app.extension.DefaultView3DDocument; |
39 |
import org.gvsig.gvsig3d.app.extension.DefaultView3DPanel; |
40 |
import org.gvsig.gvsig3d.map3d.Layer3DProps; |
41 |
import org.gvsig.gvsig3d.map3d.layers.FLayers3D; |
42 |
import org.gvsig.osgvp.exceptions.node.ChildIndexOutOfBoundsExceptions; |
43 |
import org.gvsig.osgvp.terrain.HeightfieldLayer; |
44 |
import org.gvsig.osgvp.terrain.Terrain; |
45 |
import org.gvsig.osgvp.terrain.TerrainViewer; |
46 |
|
47 |
/**
|
48 |
* Dialogo donde se muestran las propiedades de una vista
|
49 |
*
|
50 |
* @author AI2
|
51 |
*/
|
52 |
public class ViewProperties3D extends GridBagLayoutPanel implements IWindow { |
53 |
|
54 |
/**
|
55 |
*
|
56 |
*/
|
57 |
private static final long serialVersionUID = 1L; |
58 |
private DefaultView3DDocument _view3D;
|
59 |
private IProjection _proj;
|
60 |
private int _width = 700; |
61 |
private int _height = 600; |
62 |
private Color _backColor; |
63 |
|
64 |
private boolean _editable; |
65 |
private boolean _projectEditable = false; |
66 |
|
67 |
private JTextField txtName; |
68 |
private JTextField txtDate; |
69 |
private JTextField txtOwner; |
70 |
private JTextField verEx; |
71 |
private CRSSelectPanel jPanelProj;
|
72 |
private JPanel jPanelSelectProjection; |
73 |
private ButtonGroup radioButtonGroupTypeTerrain; |
74 |
private ButtonGroup radioButtonGroupProjection; |
75 |
private JButton btnColor; |
76 |
private JLabel lblColor; |
77 |
private GridBagLayoutPanel panelColor;
|
78 |
private JScrollPane jScrollPane; |
79 |
private JTextArea txtComments; |
80 |
private GridBagLayoutPanel okCancelPanel;
|
81 |
private JButton okButton; |
82 |
private JButton cancelButton; |
83 |
private JPanel jPanelSelectProjectionView; |
84 |
|
85 |
/**
|
86 |
* This is the default constructor
|
87 |
*
|
88 |
* @param f
|
89 |
* Frame padre del dialogo
|
90 |
* @param v
|
91 |
* Vista que se representa
|
92 |
*/
|
93 |
public ViewProperties3D(ViewDocument v, boolean edit) { |
94 |
_projectEditable = edit; |
95 |
_view3D = (DefaultView3DDocument) v; |
96 |
_proj = _view3D.getProjection(); |
97 |
setEditable(edit); |
98 |
initialize(); |
99 |
} |
100 |
|
101 |
private void addComponentGridBag(String label, Component component, |
102 |
int position) {
|
103 |
if (label == null) { |
104 |
GridBagConstraints gridBagConstraints = new GridBagConstraints(); |
105 |
gridBagConstraints.gridx = 0;
|
106 |
gridBagConstraints.gridy = position; |
107 |
gridBagConstraints.anchor = GridBagConstraints.EAST;
|
108 |
gridBagConstraints.gridwidth = 2;
|
109 |
gridBagConstraints.insets = new Insets(2, 5, 2, 5); |
110 |
this.add(component, gridBagConstraints);
|
111 |
} else {
|
112 |
GridBagConstraints gridBagConstraints = new GridBagConstraints(); |
113 |
gridBagConstraints.gridx = 0;
|
114 |
gridBagConstraints.gridy = position; |
115 |
gridBagConstraints.anchor = GridBagConstraints.WEST;
|
116 |
gridBagConstraints.insets = new Insets(2, 5, 2, 5); |
117 |
this.add(new JLabel(label), gridBagConstraints); |
118 |
|
119 |
gridBagConstraints = new GridBagConstraints(); |
120 |
gridBagConstraints.gridx = 1;
|
121 |
gridBagConstraints.gridy = position; |
122 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
|
123 |
gridBagConstraints.weightx = 1.0;
|
124 |
gridBagConstraints.insets = new Insets(2, 5, 2, 5); |
125 |
this.add(component, gridBagConstraints);
|
126 |
} |
127 |
} |
128 |
|
129 |
/**
|
130 |
* This method initializes this
|
131 |
*/
|
132 |
private void initialize() { |
133 |
this.setLayout(new GridBagLayout()); |
134 |
|
135 |
// Inicialize component
|
136 |
setName(PluginServices.getText(this, "view_3D_properties")); |
137 |
// Introducing the margin
|
138 |
setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6)); |
139 |
// Dimension of the panel
|
140 |
this.setPreferredSize(new Dimension(_width, _height)); |
141 |
|
142 |
// ADDING COMPONENTS
|
143 |
|
144 |
// Name Component
|
145 |
addComponentGridBag(PluginServices.getText(this, "Name"), getTxtName(), |
146 |
0);
|
147 |
|
148 |
// Date component
|
149 |
addComponentGridBag(PluginServices.getText(this, "Creation_Date"), |
150 |
getTxtDate(), 1);
|
151 |
|
152 |
// Owner component
|
153 |
|
154 |
this.addComponentGridBag(PluginServices.getText(this, "Owner"), |
155 |
getTxtOwner(), 2);
|
156 |
// Projection selector (Radio buton group)
|
157 |
this.addComponentGridBag(
|
158 |
PluginServices.getText(this, "Projection_Select"), |
159 |
getJPanelSelectProjection(), 3);
|
160 |
this.addComponentGridBag(null, getJPanelProj(), 4); |
161 |
|
162 |
// Description component
|
163 |
GridBagConstraints gridBagConstraints = new GridBagConstraints(); |
164 |
gridBagConstraints.gridx = 0;
|
165 |
gridBagConstraints.gridy = 5;
|
166 |
gridBagConstraints.insets = new Insets(2, 5, 2, 5); |
167 |
gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
|
168 |
this.add(new JLabel(PluginServices.getText(this, "Commentaries")), |
169 |
gridBagConstraints); |
170 |
|
171 |
gridBagConstraints = new GridBagConstraints(); |
172 |
gridBagConstraints.gridx = 1;
|
173 |
gridBagConstraints.gridy = 5;
|
174 |
gridBagConstraints.fill = GridBagConstraints.BOTH;
|
175 |
gridBagConstraints.weightx = 1.0;
|
176 |
gridBagConstraints.weighty = 1.0;
|
177 |
gridBagConstraints.insets = new Insets(2, 5, 2, 5); |
178 |
this.add(getJScrollPane(), gridBagConstraints);
|
179 |
|
180 |
// Vertical exaggeration
|
181 |
this.addComponentGridBag(
|
182 |
PluginServices.getText(this, "Vertical_Exageration"), |
183 |
getVerEx(), 6);
|
184 |
|
185 |
// Color Panel
|
186 |
panelColor = new GridBagLayoutPanel();
|
187 |
panelColor.add(getLblColor()); |
188 |
panelColor.add(getBtnColor()); |
189 |
this.addComponentGridBag(
|
190 |
PluginServices.getText(this, "Background_Color"), panelColor, 7); |
191 |
|
192 |
// Accept buton
|
193 |
this.addComponentGridBag(null, getOkCancelPanel(), 8); |
194 |
|
195 |
// Inicialicing default values
|
196 |
this.txtName.setText(PluginServices.getText(this, "Creation_Date")); |
197 |
txtName.setText(_view3D.getName()); |
198 |
txtDate.setText(_view3D.getCreationDate()); |
199 |
txtOwner.setText(_view3D.getOwner()); |
200 |
txtComments.setText(_view3D.getComment()); |
201 |
verEx.setText(Float.toString(_view3D.getVerticalExaggeration()));
|
202 |
_backColor = _view3D.getBackGroundColor(); |
203 |
|
204 |
} |
205 |
|
206 |
private javax.swing.JTextField getVerEx() {
|
207 |
if (verEx == null) { |
208 |
verEx = new javax.swing.JTextField();
|
209 |
verEx.setHorizontalAlignment(JTextField.RIGHT);
|
210 |
verEx.setColumns(2);
|
211 |
verEx.setPreferredSize(new java.awt.Dimension(10, 23)); |
212 |
} |
213 |
|
214 |
return verEx;
|
215 |
} |
216 |
|
217 |
private javax.swing.JTextField getTxtName() {
|
218 |
if (txtName == null) { |
219 |
txtName = new javax.swing.JTextField();
|
220 |
txtName.setPreferredSize(new java.awt.Dimension(150, 23)); |
221 |
} |
222 |
|
223 |
return txtName;
|
224 |
} |
225 |
|
226 |
private javax.swing.JTextField getTxtDate() {
|
227 |
if (txtDate == null) { |
228 |
txtDate = new javax.swing.JTextField();
|
229 |
txtDate.setPreferredSize(new java.awt.Dimension(150, 23)); |
230 |
txtDate.setEditable(false);
|
231 |
txtDate.setBackground(java.awt.Color.white); |
232 |
} |
233 |
|
234 |
return txtDate;
|
235 |
} |
236 |
|
237 |
private javax.swing.JTextField getTxtOwner() {
|
238 |
if (txtOwner == null) { |
239 |
txtOwner = new javax.swing.JTextField();
|
240 |
txtOwner.setPreferredSize(new java.awt.Dimension(150, 23)); |
241 |
} |
242 |
|
243 |
return txtOwner;
|
244 |
} |
245 |
|
246 |
private JPanel getJPanelSelectProjection() { |
247 |
if (jPanelSelectProjection == null) { |
248 |
// Create JPanel
|
249 |
jPanelSelectProjection = new GridBagLayoutPanel();
|
250 |
|
251 |
if (radioButtonGroupTypeTerrain == null) { |
252 |
radioButtonGroupTypeTerrain = getRadioButonGroupTerrainType(); |
253 |
} |
254 |
for (Enumeration e = radioButtonGroupTypeTerrain.getElements(); e |
255 |
.hasMoreElements();) { |
256 |
JRadioButton b = (JRadioButton) e.nextElement(); |
257 |
b.setEnabled(isEditable()); |
258 |
jPanelSelectProjection.add(b, null);
|
259 |
} |
260 |
|
261 |
} |
262 |
|
263 |
return jPanelSelectProjection;
|
264 |
} |
265 |
|
266 |
private JPanel getJPanelSelectProjectionView() { |
267 |
if (jPanelSelectProjectionView == null) { |
268 |
// Create JPanel
|
269 |
jPanelSelectProjectionView = new GridBagLayoutPanel();
|
270 |
|
271 |
if (radioButtonGroupProjection == null) { |
272 |
radioButtonGroupProjection = getRadioButonGroupProjection(); |
273 |
} |
274 |
for (Enumeration e = radioButtonGroupProjection.getElements(); e |
275 |
.hasMoreElements();) { |
276 |
JRadioButton b = (JRadioButton) e.nextElement(); |
277 |
b.setEnabled(isEditable()); |
278 |
jPanelSelectProjectionView.add(b, null);
|
279 |
} |
280 |
|
281 |
} |
282 |
|
283 |
return jPanelSelectProjectionView;
|
284 |
} |
285 |
|
286 |
/**
|
287 |
* Method to inicialize the radio button group
|
288 |
*
|
289 |
* @return the radio button group
|
290 |
*/
|
291 |
private ButtonGroup getRadioButonGroupTerrainType() { |
292 |
if (radioButtonGroupTypeTerrain == null) { |
293 |
|
294 |
// Create an action for each radio button
|
295 |
Action sphericalAction = new AbstractAction("spherical") { |
296 |
// This method is called whenever the radio button is pressed,
|
297 |
// even if it is already selected; this method is not called
|
298 |
// if the radio button was selected programmatically
|
299 |
public void actionPerformed(ActionEvent evt) { |
300 |
_view3D.setTerrainType(Terrain.CoordinateSystemType.GEOCENTRIC); |
301 |
_proj = CRSFactory.getCRS("EPSG:4326");
|
302 |
setComponentProjection(_proj); |
303 |
|
304 |
} |
305 |
}; |
306 |
Action flatAction = new AbstractAction("flat") { |
307 |
// See above
|
308 |
public void actionPerformed(ActionEvent evt) { |
309 |
_view3D.setTerrainType(Terrain.CoordinateSystemType.PROJECTED); |
310 |
_proj = _view3D.getProjection(); |
311 |
setComponentProjection(_proj); |
312 |
} |
313 |
}; |
314 |
Action orthoAction = new AbstractAction("ortho") { |
315 |
// See above
|
316 |
public void actionPerformed(ActionEvent evt) { |
317 |
_view3D.getCanvas3d() |
318 |
.getOSGViewer() |
319 |
.setProjectionMatrixAsOrtho(-10, 10, -10, 10, 1, |
320 |
1000);
|
321 |
} |
322 |
}; |
323 |
|
324 |
// Create the radio buttons using the actions
|
325 |
JRadioButton spherical = new JRadioButton(sphericalAction); |
326 |
JRadioButton flat = new JRadioButton(flatAction); |
327 |
JRadioButton ortho = new JRadioButton(orthoAction); |
328 |
|
329 |
// Inicialize the button properties
|
330 |
spherical.setName("spherical");
|
331 |
spherical.setText(PluginServices.getText(this, "Spherical")); |
332 |
flat.setName("flat");
|
333 |
flat.setText(PluginServices.getText(this, "Flat")); |
334 |
ortho.setName("ortho");
|
335 |
ortho.setText(PluginServices.getText(this, "Ortho")); |
336 |
|
337 |
if (_view3D.getTerrainType() == Terrain.CoordinateSystemType.GEOCENTRIC) {
|
338 |
spherical.setSelected(true);
|
339 |
} else
|
340 |
flat.setSelected(true);
|
341 |
|
342 |
// Associate the two buttons with a button group
|
343 |
radioButtonGroupTypeTerrain = new ButtonGroup(); |
344 |
radioButtonGroupTypeTerrain.add(spherical); |
345 |
radioButtonGroupTypeTerrain.add(flat); |
346 |
|
347 |
} |
348 |
|
349 |
return radioButtonGroupTypeTerrain;
|
350 |
} |
351 |
|
352 |
/**
|
353 |
* Method to inicialize the radio button group
|
354 |
*
|
355 |
* @return the radio button group
|
356 |
*/
|
357 |
private ButtonGroup getRadioButonGroupProjection() { |
358 |
if (radioButtonGroupProjection == null) { |
359 |
|
360 |
Action perspectiveAction = new AbstractAction("perspective") { |
361 |
// See above
|
362 |
public void actionPerformed(ActionEvent evt) { |
363 |
// Active perspective mode into View 3D
|
364 |
if (!(_view3D.isPerspectiveModeActive())) {
|
365 |
_view3D.setActivePerspectiveMode(true);
|
366 |
} |
367 |
} |
368 |
}; |
369 |
Action orthoAction = new AbstractAction("ortho") { |
370 |
// See above
|
371 |
public void actionPerformed(ActionEvent evt) { |
372 |
// Active ortho mode into View 3D
|
373 |
if (_view3D.isPerspectiveModeActive()) {
|
374 |
_view3D.setActivePerspectiveMode(false);
|
375 |
} |
376 |
} |
377 |
}; |
378 |
|
379 |
// Create the radio buttons using the actions
|
380 |
JRadioButton ortho = new JRadioButton(orthoAction); |
381 |
JRadioButton perspective = new JRadioButton(perspectiveAction); |
382 |
|
383 |
// Inicialize the button properties
|
384 |
ortho.setName("ortho");
|
385 |
ortho.setText(PluginServices.getText(this, "Ortho")); |
386 |
ortho.setSelected(false);
|
387 |
perspective.setName("perspective");
|
388 |
perspective.setText(PluginServices.getText(this, "Perspective")); |
389 |
perspective.setSelected(true);
|
390 |
|
391 |
// Associate the two buttons with a button group
|
392 |
radioButtonGroupProjection = new ButtonGroup(); |
393 |
radioButtonGroupProjection.add(perspective); |
394 |
radioButtonGroupProjection.add(ortho); |
395 |
} |
396 |
|
397 |
return radioButtonGroupProjection;
|
398 |
} |
399 |
|
400 |
private javax.swing.JLabel getLblColor() {
|
401 |
if (lblColor == null) { |
402 |
lblColor = new javax.swing.JLabel();
|
403 |
lblColor.setText("");
|
404 |
lblColor.setPreferredSize(new java.awt.Dimension(30, 16)); |
405 |
Color theColor = _view3D.getBackGroundColor();
|
406 |
|
407 |
if (theColor == null) |
408 |
theColor = Color.WHITE;
|
409 |
lblColor.setBackground(theColor); |
410 |
lblColor.setOpaque(true);
|
411 |
} |
412 |
|
413 |
return lblColor;
|
414 |
} |
415 |
|
416 |
private JButton getBtnColor() { |
417 |
if (btnColor == null) { |
418 |
btnColor = new JButton(); |
419 |
|
420 |
btnColor.setText("...");
|
421 |
|
422 |
btnColor.addActionListener(new java.awt.event.ActionListener() {
|
423 |
|
424 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
425 |
Color ret = JColorChooser.showDialog(ViewProperties3D.this, |
426 |
PluginServices.getText(this, "Select_Color"), |
427 |
lblColor.getBackground()); |
428 |
|
429 |
if (ret != null) { |
430 |
lblColor.setBackground(ret); |
431 |
_backColor = ret; |
432 |
} else
|
433 |
lblColor.setBackground(Color.WHITE);
|
434 |
} |
435 |
}); |
436 |
} |
437 |
|
438 |
return btnColor;
|
439 |
} |
440 |
|
441 |
private javax.swing.JScrollPane getJScrollPane() {
|
442 |
if (jScrollPane == null) { |
443 |
jScrollPane = new javax.swing.JScrollPane();
|
444 |
jScrollPane.setViewportView(getTxtComments()); |
445 |
jScrollPane.setPreferredSize(new java.awt.Dimension(340, 70)); |
446 |
} |
447 |
|
448 |
return jScrollPane;
|
449 |
} |
450 |
|
451 |
private javax.swing.JTextArea getTxtComments() {
|
452 |
if (txtComments == null) { |
453 |
txtComments = new javax.swing.JTextArea();
|
454 |
txtComments.setRows(1);
|
455 |
txtComments.setColumns(28);
|
456 |
} |
457 |
|
458 |
return txtComments;
|
459 |
} |
460 |
|
461 |
private GridBagLayoutPanel getOkCancelPanel() {
|
462 |
if (okCancelPanel == null) { |
463 |
ActionListener okAction, cancelAction;
|
464 |
okAction = new java.awt.event.ActionListener() {
|
465 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
466 |
_view3D.setName(txtName.getText()); |
467 |
_view3D.setCreationDate(txtDate.getText()); |
468 |
_view3D.setOwner(txtOwner.getText()); |
469 |
_view3D.setComment(txtComments.getText()); |
470 |
_view3D.setBackGroundColor(_backColor); |
471 |
_proj = jPanelProj.getCurProj(); |
472 |
setVerticalEx(Float.parseFloat(verEx.getText()));
|
473 |
_view3D.setVerticalExaggeration(Float.parseFloat(verEx
|
474 |
.getText())); |
475 |
_view3D.setProjection(_proj); |
476 |
|
477 |
PluginServices.getMDIManager().closeWindow( |
478 |
ViewProperties3D.this); |
479 |
} |
480 |
}; |
481 |
cancelAction = new java.awt.event.ActionListener() {
|
482 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
483 |
PluginServices.getMDIManager().closeWindow( |
484 |
ViewProperties3D.this); |
485 |
} |
486 |
}; |
487 |
|
488 |
okCancelPanel = new GridBagLayoutPanel();
|
489 |
okCancelPanel.setAlignmentX(GridBagLayoutPanel.RIGHT_ALIGNMENT); |
490 |
okButton = new JButton(); |
491 |
okButton.setText(PluginServices.getText(this, "Accept")); |
492 |
okButton.addActionListener(okAction); |
493 |
cancelButton = new JButton(); |
494 |
cancelButton.setEnabled(!isEditable()); |
495 |
cancelButton.setText(PluginServices.getText(this, "Cancel")); |
496 |
cancelButton.addActionListener(cancelAction); |
497 |
|
498 |
okCancelPanel.addComponent(okButton, cancelButton); |
499 |
} |
500 |
return okCancelPanel;
|
501 |
} |
502 |
|
503 |
public Object getWindowModel() { |
504 |
return _view3D;
|
505 |
} |
506 |
|
507 |
public WindowInfo getWindowInfo() {
|
508 |
WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODALDIALOG);
|
509 |
m_viewinfo.setTitle(PluginServices.getText(this, "view_3D_properties")); |
510 |
m_viewinfo.setHeight(_height); |
511 |
m_viewinfo.setWidth(_width); |
512 |
return m_viewinfo;
|
513 |
} |
514 |
|
515 |
public boolean isEditable() { |
516 |
return _editable;
|
517 |
} |
518 |
|
519 |
public void setEditable(boolean editable) { |
520 |
_editable = editable; |
521 |
} |
522 |
|
523 |
public void setVerticalEx(float exa) { |
524 |
|
525 |
// SingleLayerIterator lyrIterator = new SingleLayerIterator(
|
526 |
// (FLayers3D) _view3D.getMapContext().getLayers());
|
527 |
// while (lyrIterator.hasNext()) {
|
528 |
// FLayer lyr = lyrIterator.next();
|
529 |
//
|
530 |
// Object propsObj = lyr.getProperty("3DLayerExtension");
|
531 |
// Layer3DProps props = null;
|
532 |
// if (propsObj != null) {
|
533 |
// try {
|
534 |
// props = (Layer3DProps) propsObj;
|
535 |
// } catch (Exception e) {
|
536 |
// props = null;
|
537 |
// }
|
538 |
// }
|
539 |
//
|
540 |
// int type = props.getType();
|
541 |
// if (exa != props.getVerticalEx()) {
|
542 |
// if (type == Layer3DProps.layer3DElevation) {
|
543 |
// props.setVerticalEx(exa);
|
544 |
// HeightfieldLayer layer = (HeightfieldLayer) props
|
545 |
// .getTerrainLayer();
|
546 |
// if (layer == null)
|
547 |
// return;
|
548 |
// layer.setScaleFactor(exa);
|
549 |
// // _view3D.getTerrain().getLayerManager().updateLayers();
|
550 |
// } else if (type == Layer3DProps.layer3DVector) {
|
551 |
// props.setVerticalEx(exa);
|
552 |
// }
|
553 |
// }
|
554 |
//
|
555 |
// }
|
556 |
|
557 |
if (_view3D.getCanvas3d() != null) { |
558 |
|
559 |
try {
|
560 |
((TerrainViewer) _view3D.getCanvas3d().getOSGViewer()) |
561 |
.getTerrain(0).setVerticalExaggeration(exa);
|
562 |
} catch (ChildIndexOutOfBoundsExceptions e) {
|
563 |
// TODO Auto-generated catch block
|
564 |
e.printStackTrace(); |
565 |
} |
566 |
|
567 |
} |
568 |
|
569 |
} |
570 |
|
571 |
private CRSSelectPanel getJPanelProj() {
|
572 |
|
573 |
IProjection projectionAux = null;
|
574 |
IWindow activeWindow = PluginServices.getMDIManager().getActiveWindow(); |
575 |
if (activeWindow instanceof DefaultView3DPanel) { |
576 |
AbstractViewPanel activeView = (DefaultView3DPanel) activeWindow; |
577 |
projectionAux = activeView.getProjection(); |
578 |
activeView.setProjection(_proj); |
579 |
} |
580 |
|
581 |
jPanelProj = CRSSelectPanel.getPanel(_proj); |
582 |
|
583 |
if (activeWindow instanceof DefaultView3DPanel) { |
584 |
AbstractViewPanel activeView = (DefaultView3DPanel) activeWindow; |
585 |
activeView.setProjection(projectionAux); |
586 |
} |
587 |
|
588 |
jPanelProj.setPreferredSize(new java.awt.Dimension(330, 35)); |
589 |
|
590 |
jPanelProj.addActionListener(new java.awt.event.ActionListener() {
|
591 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
592 |
if (jPanelProj.isOkPressed()) {
|
593 |
// New projection selected.
|
594 |
_view3D.setProjection(jPanelProj.getCurProj()); |
595 |
} |
596 |
} |
597 |
}); |
598 |
|
599 |
Component[] cs = jPanelProj.getComponents(); |
600 |
// Projection options disabled in spherical view.
|
601 |
if (_view3D.getTerrainType() == Terrain.CoordinateSystemType.GEOCENTRIC) {
|
602 |
_proj = CRSFactory.getCRS("EPSG:4326");
|
603 |
for (int i = 0; i < cs.length; i++) { |
604 |
cs[i].setEnabled(false);
|
605 |
} |
606 |
} |
607 |
// Projection options disabled in flat view.
|
608 |
else {
|
609 |
if (!_projectEditable) {
|
610 |
_proj = _view3D.getProjection(); |
611 |
for (int i = 0; i < cs.length; i++) { |
612 |
cs[i].setEnabled(false);
|
613 |
} |
614 |
} |
615 |
} |
616 |
|
617 |
return jPanelProj;
|
618 |
} |
619 |
|
620 |
private void setComponentProjection(IProjection projection) { |
621 |
_proj = projection; |
622 |
this.remove(jPanelProj);
|
623 |
jPanelProj = null;
|
624 |
|
625 |
this.addComponentGridBag(null, getJPanelProj(), 4); |
626 |
this.validate();
|
627 |
|
628 |
} |
629 |
|
630 |
public Object getWindowProfile() { |
631 |
return WindowInfo.PROPERTIES_PROFILE;
|
632 |
} |
633 |
|
634 |
} |