Statistics
| Revision:

root / trunk / extensions / ext3Dgui / src / com / iver / ai2 / gvsig3dgui / view / ViewProperties3D.java @ 20900

History | View | Annotate | Download (19.3 KB)

1 15587 rgaitan
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2 15361 afraile
 *
3
 * Copyright (C) 2004 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
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23 15587 rgaitan
 *   Av. Blasco Ib??ez, 50
24 15361 afraile
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41
package com.iver.ai2.gvsig3dgui.view;
42
43
import java.awt.Color;
44 20355 afraile
import java.awt.Component;
45 15361 afraile
import java.awt.Dimension;
46
import java.awt.Insets;
47
import java.awt.event.ActionEvent;
48
import java.awt.event.ActionListener;
49
import java.util.Enumeration;
50
51
import javax.swing.AbstractAction;
52
import javax.swing.Action;
53
import javax.swing.BorderFactory;
54
import javax.swing.ButtonGroup;
55
import javax.swing.JColorChooser;
56
import javax.swing.JLabel;
57
import javax.swing.JPanel;
58
import javax.swing.JRadioButton;
59
import javax.swing.JScrollPane;
60
import javax.swing.JTabbedPane;
61
import javax.swing.JTextArea;
62
import javax.swing.JTextField;
63
64 18575 jcampos
import org.cresques.cts.IProjection;
65 15361 afraile
import org.gvsig.gui.beans.swing.GridBagLayoutPanel;
66
import org.gvsig.gui.beans.swing.JButton;
67 20900 jcampos
import org.gvsig.osgvp.planets.Planet;
68 15361 afraile
69
import com.iver.ai2.gvsig3d.map3d.layers.FLayers3D;
70
import com.iver.ai2.gvsig3d.map3d.layers.Layer3DProps;
71
import com.iver.ai2.gvsig3dgui.ProjectView3D;
72
import com.iver.andami.PluginServices;
73
import com.iver.andami.ui.mdiManager.SingletonWindow;
74
import com.iver.andami.ui.mdiManager.WindowInfo;
75 18575 jcampos
import com.iver.cit.gvsig.fmap.crs.CRSFactory;
76 15361 afraile
import com.iver.cit.gvsig.fmap.layers.FLayer;
77
import com.iver.cit.gvsig.fmap.layers.SingleLayerIterator;
78
import com.iver.cit.gvsig.gui.panels.CRSSelectPanel;
79
import com.iver.cit.gvsig.project.documents.view.IProjectView;
80
81
/**
82
 * Dialogo donde se muestran las propiedades de una vista
83
 *
84 15587 rgaitan
 * @author Fernando Gonz?lez Cort?s
85 15361 afraile
 */
86
public class ViewProperties3D extends GridBagLayoutPanel implements
87
                SingletonWindow {
88
89
        private ProjectView3D view3D;
90
91
        private JTextField txtName;
92
93
        private JTextField txtDate;
94
95
        private JTextField txtOwner;
96
97
        private CRSSelectPanel jPanelProj;
98
99
        private JPanel jPanelSelectProjection;
100
101 18330 jcampos
        private ButtonGroup radioButtonGroupTypePlanet;
102
103
        private ButtonGroup radioButtonGroupProjection;
104 15361 afraile
105 18575 jcampos
        private int width = 390;
106 15361 afraile
107 18575 jcampos
        private int height = 330;
108 15361 afraile
109
        private JButton btnColor;
110
111
        private JLabel lblColor;
112
113
        private GridBagLayoutPanel panelColor;
114
115
        private JScrollPane jScrollPane;
116
117
        private JTextArea txtComments;
118
119
        private Color backColor;
120
121
        private GridBagLayoutPanel okCancelPanel;
122
123
        private boolean editable;
124
125
        private JButton okButton;
126
127
        private JButton cancelButton;
128
129
        private JTextField verEx;
130
131
        private JTabbedPane pestanya;
132
133 18330 jcampos
        private JPanel jPanelSelectProjectionView;
134 20355 afraile
135
        private IProjection  proj;
136 18330 jcampos
137 15361 afraile
        /**
138
         * This is the default constructor
139
         *
140
         * @param f
141
         *            Frame padre del dialogo
142
         * @param v
143
         *            Vista que se representa
144
         */
145
        public ViewProperties3D(IProjectView v, boolean edit) {
146
                view3D = (ProjectView3D) v;
147 20355 afraile
                proj = view3D.getProjection();
148
                view3D.getMapContext().setProjection(proj);
149 15361 afraile
                setEditable(edit);
150
                initialize();
151
        }
152
153
        /**
154
         * This method initializes this
155
         */
156
        private void initialize() {
157
                // Inicialize component
158
                setName(PluginServices.getText(this, "view_3D_properties"));
159
                // Introducing the margin
160
                setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
161
                // Dimension of the panel
162
//                setSize(new Dimension(width, height));
163
                this.setPreferredSize(new Dimension(width, height));
164
165
                // ADDING COMPONENTS
166
167
                // Name Component
168
                this.addComponent(PluginServices.getText(this, "Name"), getTxtName(), new Insets(0,10,2,10));
169
                // Date component
170
                this.addComponent(PluginServices.getText(this, "Creation_Date"), getTxtDate(), new Insets(2,10,2,10));
171
                // Owner component
172
                this.addComponent(PluginServices.getText(this, "Owner"), getTxtOwner(), new Insets(2,10,2,10));
173
                // Projection selector (Radio buton group)
174
                this.addComponent(PluginServices.getText(this, "Proyection_Select"),
175
                                getJPanelSelectProjection(), new Insets(2,10,2,10));
176 18575 jcampos
//                this.addComponent(PluginServices.getText(this, "Proyection_Select"),
177
//                                getJPanelSelectProjectionView(), new Insets(2,10,2,10));
178
                this.addComponent(getJPanelProj());
179 15361 afraile
180
                // Description component
181
                GridBagLayoutPanel aux = new GridBagLayoutPanel();
182
                aux.add(getJScrollPane());
183
                addComponent(new JLabel(PluginServices.getText(this, "Commentaries")),new Insets(2,6,2,6));
184
                addComponent(aux,new Insets(2,6,2,6));
185
186
                // Vertical exaggeration
187
                this.addComponent(PluginServices.getText(this, "Vertical_Exageration"), getVerEx(),new Insets(2,10,2,10));
188
189
                // Color Panel
190
                panelColor = new GridBagLayoutPanel();
191
                panelColor.add(getLblColor());
192
                panelColor.add(getBtnColor());
193
                this.addComponent(PluginServices.getText(this, "Background_Color"), panelColor,new Insets(5,6,5,6));
194
195
196
                // Accept buton
197
                this.addComponent(getOkCancelPanel(),new Insets(2,150,2,0));
198
199
                // Inicialicing default values
200
                this.txtName.setText(PluginServices.getText(this, "Creation_Date"));
201
                txtName.setText(view3D.getName());
202
                txtDate.setText(view3D.getCreationDate());
203
                txtOwner.setText(view3D.getOwner());
204
                txtComments.setText(view3D.getComment());
205
                verEx.setText(Float.toString(view3D.getVerticalExaggeration()));
206
                backColor = view3D.getBackGroundColor();
207 18330 jcampos
208 15361 afraile
        }
209
210
        private javax.swing.JTextField getVerEx() {
211
                if (verEx == null) {
212
                        verEx = new javax.swing.JTextField();
213
                        verEx.setHorizontalAlignment(JTextField.RIGHT);
214
                        verEx.setColumns(2);
215
                        verEx.setPreferredSize(new java.awt.Dimension(10, 23));
216
                }
217
218
                return verEx;
219
        }
220
221
222
223
        private javax.swing.JTextField getTxtName() {
224
                if (txtName == null) {
225
                        txtName = new javax.swing.JTextField();
226
                        txtName.setPreferredSize(new java.awt.Dimension(150, 23));
227
                }
228
229
                return txtName;
230
        }
231
232
        private javax.swing.JTextField getTxtDate() {
233
                if (txtDate == null) {
234
                        txtDate = new javax.swing.JTextField();
235
                        txtDate.setPreferredSize(new java.awt.Dimension(150, 23));
236
                        txtDate.setEditable(false);
237
                        txtDate.setBackground(java.awt.Color.white);
238
                }
239
240
                return txtDate;
241
        }
242
243
        private javax.swing.JTextField getTxtOwner() {
244
                if (txtOwner == null) {
245
                        txtOwner = new javax.swing.JTextField();
246
                        txtOwner.setPreferredSize(new java.awt.Dimension(150, 23));
247
                }
248
249
                return txtOwner;
250
        }
251
252
        private JPanel getJPanelSelectProjection() {
253
                if (jPanelSelectProjection == null) {
254
                        // Create JPanel
255
                        jPanelSelectProjection = new GridBagLayoutPanel();
256
257 18330 jcampos
                        if (radioButtonGroupTypePlanet == null) {
258
                                radioButtonGroupTypePlanet = getRadioButonGroupPlanetType();
259 15361 afraile
                        }
260 18330 jcampos
                        for (Enumeration e = radioButtonGroupTypePlanet.getElements(); e
261 15361 afraile
                                        .hasMoreElements();) {
262
                                JRadioButton b = (JRadioButton) e.nextElement();
263
                                b.setEnabled(isEditable());
264
                                jPanelSelectProjection.add(b, null);
265
                        }
266
267
                }
268
269
                return jPanelSelectProjection;
270
        }
271 18330 jcampos
272
        private JPanel getJPanelSelectProjectionView() {
273
                if (jPanelSelectProjectionView == null) {
274
                        // Create JPanel
275
                        jPanelSelectProjectionView = new GridBagLayoutPanel();
276
277
                        if (radioButtonGroupProjection == null) {
278
                                radioButtonGroupProjection = getRadioButonGroupProjection();
279
                        }
280
                        for (Enumeration e = radioButtonGroupProjection.getElements(); e
281
                                        .hasMoreElements();) {
282
                                JRadioButton b = (JRadioButton) e.nextElement();
283
                                b.setEnabled(isEditable());
284
                                jPanelSelectProjectionView.add(b, null);
285
                        }
286 15361 afraile
287 18330 jcampos
                }
288
289
                return jPanelSelectProjectionView;
290
        }
291
292 15361 afraile
        /**
293
         * Method to inicialize the radio button group
294
         *
295
         * @return the radio button group
296
         */
297 18330 jcampos
        private ButtonGroup getRadioButonGroupPlanetType() {
298
                if (radioButtonGroupTypePlanet == null) {
299 15361 afraile
300
                        // Create an action for each radio button
301
                        Action sphericalAction = new AbstractAction("spherical") {
302
                                // This method is called whenever the radio button is pressed,
303
                                // even if it is already selected; this method is not called
304
                                // if the radio button was selected programmatically
305
                                public void actionPerformed(ActionEvent evt) {
306 15587 rgaitan
                                        view3D.setPlanetType(Planet.CoordinateSystemType.GEOCENTRIC);
307 20355 afraile
308
                                        isNotEnable();// Projection options disabled in spherical view.
309
310 15361 afraile
                                }
311
                        };
312
                        Action flatAction = new AbstractAction("flat") {
313
                                // See above
314
                                public void actionPerformed(ActionEvent evt) {
315 15587 rgaitan
                                        view3D.setPlanetType(Planet.CoordinateSystemType.PROJECTED);
316 20355 afraile
317
                                        isEnable();// Projection options enabled in flat view.
318
319 15361 afraile
                                }
320
                        };
321 18330 jcampos
                        Action orthoAction = new AbstractAction("ortho") {
322
                                // See above
323
                                public void actionPerformed(ActionEvent evt) {
324
                                        view3D.getCanvas3d().getOSGViewer().setProjectionMatrixAsOrtho(-10, 10, -10, 10, 1, 1000);
325
//                                        view3D.setPlanetType(Planet.CoordinateSystemType.PROJECTED);
326
                                }
327
                        };
328 15361 afraile
329
                        // Create the radio buttons using the actions
330
                        JRadioButton spherical = new JRadioButton(sphericalAction);
331
                        JRadioButton flat = new JRadioButton(flatAction);
332 18330 jcampos
                        JRadioButton ortho = new JRadioButton(orthoAction);
333 15361 afraile
334
                        // Inicialize the button properties
335
                        spherical.setName("spherical");
336 18330 jcampos
                        spherical.setText(PluginServices.getText(this, "Spherical"));
337 15361 afraile
                        flat.setName("flat");
338 18330 jcampos
                        flat.setText(PluginServices.getText(this, "Flat"));
339
                        ortho.setName("ortho");
340
                        ortho.setText(PluginServices.getText(this, "Ortho"));
341 15361 afraile
342 15587 rgaitan
                        if (view3D.getPlanetType()== Planet.CoordinateSystemType.GEOCENTRIC)
343 15361 afraile
                                spherical.setSelected(true);
344
                        else
345
                                flat.setSelected(true);
346
347
                        // Associate the two buttons with a button group
348 18330 jcampos
                        radioButtonGroupTypePlanet = new ButtonGroup();
349
                        radioButtonGroupTypePlanet.add(spherical);
350
                        radioButtonGroupTypePlanet.add(flat);
351
//                        radioButtonGroupTypePlanet.add(ortho);
352 15361 afraile
                }
353
354 18330 jcampos
                return radioButtonGroupTypePlanet;
355 15361 afraile
        }
356 18330 jcampos
357 20355 afraile
        // Projection options enabled in flat view.
358
        protected void isEnable() {
359
                Component[] cs=jPanelProj.getComponents();
360
                if (cs != null)
361
                        for (int i = 0; i < cs.length; i++) {
362
                                cs[i].setEnabled(true);
363
                        }
364
        }
365
366
367
        // Projection options disabled in spherical view.
368
        protected void isNotEnable() {
369
                Component[] cs=jPanelProj.getComponents();
370
                if (cs != null)
371
                        for (int i = 0; i < cs.length; i++) {
372
                                if((cs[i] instanceof JLabel) && (i == 1)){
373
                                    ((JLabel)cs[i]).setText("EPSG:4326");
374
                                    IProjection proj= CRSFactory.getCRS("EPSG:4326");
375
                                        view3D.setProjection(proj);
376
                                }
377
                                cs[i].setEnabled(false);
378
                        }
379
        }
380
381 18330 jcampos
        /**
382
         * Method to inicialize the radio button group
383
         *
384
         * @return the radio button group
385
         */
386
        private ButtonGroup getRadioButonGroupProjection() {
387
                if (radioButtonGroupProjection == null) {
388 15361 afraile
389 18330 jcampos
390
                        Action prespectiveAction = new AbstractAction("perspective") {
391
                                // See above
392
                                public void actionPerformed(ActionEvent evt) {
393
                                        // Active prespective mode into View 3D
394
//                                        view3D.getCanvas3d().getOSGViewer().setProjectionMatrixAsPerspective(arg0, arg1, arg2, arg3);
395
                                        if (!(view3D.isPrespectiveModeActive())){
396
                                                view3D.setActivePrespectiveMode(true);
397
                                        }
398
                                }
399
                        };
400
                        Action orthoAction = new AbstractAction("ortho") {
401
                                // See above
402
                                public void actionPerformed(ActionEvent evt) {
403
                                        // Active ortho mode into View 3D
404
                                        if (view3D.isPrespectiveModeActive()){
405
                                                view3D.setActivePrespectiveMode(false);
406
                                        }
407
//                                        view3D.getCanvas3d().getOSGViewer().setProjectionMatrixAsOrtho(-10, 10, -10, 10, 1, 1000);
408
                                }
409
                        };
410
411
                        // Create the radio buttons using the actions
412
                        JRadioButton ortho = new JRadioButton(orthoAction);
413
                        JRadioButton prespective = new JRadioButton(prespectiveAction);
414
415
                        // Inicialize the button properties
416
                        ortho.setName("ortho");
417
                        ortho.setText(PluginServices.getText(this, "Ortho"));
418
                        ortho.setSelected(false);
419
                        prespective.setName("prespective");
420
                        prespective.setText(PluginServices.getText(this, "Prespective"));
421
                        prespective.setSelected(true);
422
423
424
                        // Associate the two buttons with a button group
425
                        radioButtonGroupProjection = new ButtonGroup();
426
                        radioButtonGroupProjection.add(prespective);
427
                        radioButtonGroupProjection.add(ortho);
428
                }
429
430
                return radioButtonGroupProjection;
431
        }
432
433 15361 afraile
        private javax.swing.JLabel getLblColor() {
434
                if (lblColor == null) {
435
                        lblColor = new javax.swing.JLabel();
436
                        lblColor.setText("");
437
                        lblColor.setPreferredSize(new java.awt.Dimension(30, 16));
438
                         Color theColor = view3D.getBackGroundColor();
439
440
                        if (theColor == null)
441
                                theColor = Color.WHITE;
442
                        lblColor.setBackground(theColor);
443
                        lblColor.setOpaque(true);
444
                }
445
446
                return lblColor;
447
        }
448
449
        private JButton getBtnColor() {
450
                if (btnColor == null) {
451
                        btnColor = new JButton();
452
453
                        btnColor.setText("...");
454
455
                        btnColor.addActionListener(new java.awt.event.ActionListener() {
456
457
458
                                public void actionPerformed(java.awt.event.ActionEvent e) {
459
                                        Color ret = JColorChooser.showDialog(ViewProperties3D.this,
460
                                                        PluginServices.getText(this, "Select_Color"), lblColor.getBackground());
461
462
                                        if (ret != null) {
463
                                                lblColor.setBackground(ret);
464
                                                backColor = ret;
465
                                        } else
466
                                                lblColor.setBackground(Color.WHITE);
467
                                }
468
                        });
469
                }
470
471
                return btnColor;
472
        }
473
474
475
        private javax.swing.JScrollPane getJScrollPane() {
476
                if (jScrollPane == null) {
477
                        jScrollPane = new javax.swing.JScrollPane();
478
                        //jScrollPane.setSize(new java.awt.Dimension(340, 70));
479
                        jScrollPane.setViewportView(getTxtComments());
480
                        jScrollPane.setPreferredSize(new java.awt.Dimension(340, 70));
481
                }
482
483
                return jScrollPane;
484
        }
485
486
        private javax.swing.JTextArea getTxtComments() {
487
                if (txtComments == null) {
488
                        txtComments = new javax.swing.JTextArea();
489
                        txtComments.setRows(1);
490
                        txtComments.setColumns(28);
491
                }
492
493
                return txtComments;
494
        }
495
496
497
        private GridBagLayoutPanel getOkCancelPanel() {
498
                if (okCancelPanel == null) {
499
                        ActionListener okAction, cancelAction;
500
                        okAction = new java.awt.event.ActionListener() {
501
                                public void actionPerformed(java.awt.event.ActionEvent e) {
502
                                        view3D.setName(txtName.getText());
503
                                        view3D.setCreationDate(txtDate.getText());
504
                                        view3D.setOwner(txtOwner.getText());
505
                                        view3D.setComment(txtComments.getText());
506
                                        view3D.setBackGroundColor(backColor);
507
                                        // TODO: poner la exageracion vertical
508
//                                        view3D.set)
509
//                                        setVerticalExaggeration();
510
                                        setVerticalEx(Float.parseFloat(verEx.getText()));
511
                                        view3D.setVerticalExaggeration(Float.parseFloat(verEx.getText()));
512
                                        PluginServices.getMDIManager().closeWindow(ViewProperties3D.this);
513
                                }
514
                        };
515
                        cancelAction = new java.awt.event.ActionListener() {
516
                                public void actionPerformed(java.awt.event.ActionEvent e) {
517
                                        PluginServices.getMDIManager().closeWindow(ViewProperties3D.this);
518
                                }
519
                        };
520
521
                        okCancelPanel = new GridBagLayoutPanel();
522
                        okCancelPanel.setAlignmentX(GridBagLayoutPanel.RIGHT_ALIGNMENT);
523
                        okButton = new JButton();
524 18330 jcampos
                        okButton.setText(PluginServices.getText(this, "Accept"));
525 15361 afraile
                        okButton.addActionListener(okAction);
526
                        cancelButton = new JButton();
527 18330 jcampos
                        cancelButton.setText(PluginServices.getText(this, "Cancel"));
528 15361 afraile
                        cancelButton.addActionListener(cancelAction);
529
530
                        okCancelPanel.addComponent(okButton,cancelButton);
531
                }
532
                return okCancelPanel;
533
        }
534
535
536
537
538
        public Object getWindowModel() {
539
                // TODO Auto-generated method stub
540
                return view3D;
541
        }
542
543
        public WindowInfo getWindowInfo() {
544
                WindowInfo m_viewinfo = new WindowInfo();
545
                m_viewinfo.setTitle(PluginServices.getText(this, "view_3D_properties"));
546
                m_viewinfo.setHeight(height);
547
                m_viewinfo.setWidth(width);
548
                return m_viewinfo;
549
        }
550
551
        public boolean isEditable() {
552
                return editable;
553
        }
554
555
        public void setEditable(boolean editable) {
556
                this.editable = editable;
557
        }
558
559
        public void setVerticalEx(float exa){
560
561
                SingleLayerIterator lyrIterator = new SingleLayerIterator((FLayers3D)view3D.getMapContext().getLayers());
562
                while (lyrIterator.hasNext()) {
563
                        FLayer lyr = lyrIterator.next();
564
565
                        Layer3DProps props = Layer3DProps.getLayer3DProps(lyr);
566
                        int type = props.getType();
567
                        if (exa != props.getVerticalEx()){
568
                                if (type == Layer3DProps.layer3DElevation){
569 15373 afraile
                                        int order = props.getPlanetOrder();
570 15361 afraile
                                        props.setVerticalEx(exa);
571
                                        view3D.getPlanet().setVerticalExaggerationLayer(order, props.getVerticalEx());
572
                                } else if (type == Layer3DProps.layer3DVector){
573 15373 afraile
                                        int order = props.getPlanetOrder();
574 15361 afraile
                                        props.setVerticalEx(exa);
575
                                }
576
                        }
577
578
579
                }
580
        }
581 18575 jcampos
582
        private CRSSelectPanel getJPanelProj() {
583 20355 afraile
        //        IProjection  proj;
584
        //if (bole == true) {
585
                 if( this.editable){
586
                        proj= CRSFactory.getCRS("EPSG:4326");
587
                        view3D.setProjection(proj);
588
                 }
589
                else
590
                        proj = view3D.getProjection();
591
592
593
                jPanelProj = CRSSelectPanel.getPanel(proj);
594
                jPanelProj.setPreferredSize(new java.awt.Dimension(330,35));
595
596
597
                jPanelProj.addActionListener(new java.awt.event.ActionListener() {
598
                        public void actionPerformed(java.awt.event.ActionEvent e) {
599
                                if (jPanelProj.isOkPressed()) {
600
//                                        IProjection projectionSelected = jPanelProj.getCurProj();
601
//                                        System.out.println("Proyecci?n seleccionada.: " + projectionSelected.getAbrev());
602 18575 jcampos
//                                                if (!jPanelProj.getCurProj().isProjected()) {
603
////                                                        if (getCmbMapUnits().getItemCount()==MapContext.NAMES.length) {
604
////                                                                getCmbMapUnits().addItem(PluginServices.getText(this, Attributes.DEGREES));
605
////                                                        }
606
//                                                        getCmbMapUnits().setSelectedItem(PluginServices.getText(this, Attributes.DEGREES));
607
//                                                        getCmbMapUnits().setEnabled(false);
608
//                                                }else {
609
//                                                        if (getCmbMapUnits().getSelectedItem().equals(PluginServices.getText(this, Attributes.DEGREES))) {
610
//                                                                getCmbMapUnits().setSelectedIndex(1);
611
//                                                                getCmbMapUnits().setEnabled(true);
612
//                                                        }
613
////                                                        if (!(getCmbMapUnits().getItemCount()==MapContext.NAMES.length)) {
614
////                                                                getCmbMapUnits().removeItem(PluginServices.getText(this, Attributes.DEGREES));
615
////                                                        }
616
//                                                }
617 20355 afraile
618
                                                //New projection selected.
619
                                                view3D.setProjection(jPanelProj.getCurProj());
620 18575 jcampos
                                }
621 20355 afraile
                        }
622
                });
623
624
                Component[] cs=jPanelProj.getComponents();
625
                // Projection options disabled in spherical view.
626
                if(view3D.getPlanetType() == Planet.CoordinateSystemType.GEOCENTRIC){
627
                        for (int i = 0; i < cs.length; i++) {
628
                                cs[i].setEnabled(false);
629
                        }
630 18575 jcampos
                }
631 20355 afraile
                // Projection options disabled in flat view.
632
                else
633
                        for (int i = 0; i < cs.length; i++) {
634
                                cs[i].setEnabled(false);
635
                                if((cs[i] instanceof JLabel) && (i == 1)){
636
                                        IProjection projectionSelected = jPanelProj.getCurProj();
637
                                    ((JLabel)cs[i]).setText(projectionSelected.getAbrev());
638
639
640
                                }
641
                        }
642
643 18575 jcampos
                return jPanelProj;
644
        }
645 15361 afraile
646
}