Statistics
| Revision:

svn-gvsig-desktop / trunk / extensions / ext3Dgui / src / org / gvsig / gvsig3dgui / view / ViewProperties3D.java @ 22559

History | View | Annotate | Download (19.5 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 21960 jcampos
package org.gvsig.gvsig3dgui.view;
42 15361 afraile
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 21943 jcampos
import org.gvsig.gvsig3d.map3d.layers.FLayers3D;
68 21960 jcampos
import org.gvsig.gvsig3dgui.ProjectView3D;
69 20900 jcampos
import org.gvsig.osgvp.planets.Planet;
70 15361 afraile
71 22186 afraile
import com.iver.ai2.gvsig3d.map3d.layers.Layer3DProps;
72 15361 afraile
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 22559 jcampos
//                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 22186 afraile
                                if((cs[i] instanceof JLabel) && (i == 1)){
363
                                    ((JLabel)cs[i]).setText("EPSG:23030");
364
                                    IProjection proj= CRSFactory.getCRS("EPSG:23030");
365
                                        view3D.setProjection(proj);
366
                                }
367 20355 afraile
                                cs[i].setEnabled(true);
368
                        }
369
        }
370
371
372
        // Projection options disabled in spherical view.
373
        protected void isNotEnable() {
374
                Component[] cs=jPanelProj.getComponents();
375
                if (cs != null)
376
                        for (int i = 0; i < cs.length; i++) {
377
                                if((cs[i] instanceof JLabel) && (i == 1)){
378
                                    ((JLabel)cs[i]).setText("EPSG:4326");
379
                                    IProjection proj= CRSFactory.getCRS("EPSG:4326");
380
                                        view3D.setProjection(proj);
381
                                }
382
                                cs[i].setEnabled(false);
383
                        }
384
        }
385
386 18330 jcampos
        /**
387
         * Method to inicialize the radio button group
388
         *
389
         * @return the radio button group
390
         */
391
        private ButtonGroup getRadioButonGroupProjection() {
392
                if (radioButtonGroupProjection == null) {
393 15361 afraile
394 18330 jcampos
395
                        Action prespectiveAction = new AbstractAction("perspective") {
396
                                // See above
397
                                public void actionPerformed(ActionEvent evt) {
398
                                        // Active prespective mode into View 3D
399
//                                        view3D.getCanvas3d().getOSGViewer().setProjectionMatrixAsPerspective(arg0, arg1, arg2, arg3);
400
                                        if (!(view3D.isPrespectiveModeActive())){
401
                                                view3D.setActivePrespectiveMode(true);
402
                                        }
403
                                }
404
                        };
405
                        Action orthoAction = new AbstractAction("ortho") {
406
                                // See above
407
                                public void actionPerformed(ActionEvent evt) {
408
                                        // Active ortho mode into View 3D
409
                                        if (view3D.isPrespectiveModeActive()){
410
                                                view3D.setActivePrespectiveMode(false);
411
                                        }
412
//                                        view3D.getCanvas3d().getOSGViewer().setProjectionMatrixAsOrtho(-10, 10, -10, 10, 1, 1000);
413
                                }
414
                        };
415
416
                        // Create the radio buttons using the actions
417
                        JRadioButton ortho = new JRadioButton(orthoAction);
418
                        JRadioButton prespective = new JRadioButton(prespectiveAction);
419
420
                        // Inicialize the button properties
421
                        ortho.setName("ortho");
422
                        ortho.setText(PluginServices.getText(this, "Ortho"));
423
                        ortho.setSelected(false);
424
                        prespective.setName("prespective");
425
                        prespective.setText(PluginServices.getText(this, "Prespective"));
426
                        prespective.setSelected(true);
427
428
429
                        // Associate the two buttons with a button group
430
                        radioButtonGroupProjection = new ButtonGroup();
431
                        radioButtonGroupProjection.add(prespective);
432
                        radioButtonGroupProjection.add(ortho);
433
                }
434
435
                return radioButtonGroupProjection;
436
        }
437
438 15361 afraile
        private javax.swing.JLabel getLblColor() {
439
                if (lblColor == null) {
440
                        lblColor = new javax.swing.JLabel();
441
                        lblColor.setText("");
442
                        lblColor.setPreferredSize(new java.awt.Dimension(30, 16));
443
                         Color theColor = view3D.getBackGroundColor();
444
445
                        if (theColor == null)
446
                                theColor = Color.WHITE;
447
                        lblColor.setBackground(theColor);
448
                        lblColor.setOpaque(true);
449
                }
450
451
                return lblColor;
452
        }
453
454
        private JButton getBtnColor() {
455
                if (btnColor == null) {
456
                        btnColor = new JButton();
457
458
                        btnColor.setText("...");
459
460
                        btnColor.addActionListener(new java.awt.event.ActionListener() {
461
462
463
                                public void actionPerformed(java.awt.event.ActionEvent e) {
464
                                        Color ret = JColorChooser.showDialog(ViewProperties3D.this,
465
                                                        PluginServices.getText(this, "Select_Color"), lblColor.getBackground());
466
467
                                        if (ret != null) {
468
                                                lblColor.setBackground(ret);
469
                                                backColor = ret;
470
                                        } else
471
                                                lblColor.setBackground(Color.WHITE);
472
                                }
473
                        });
474
                }
475
476
                return btnColor;
477
        }
478
479
480
        private javax.swing.JScrollPane getJScrollPane() {
481
                if (jScrollPane == null) {
482
                        jScrollPane = new javax.swing.JScrollPane();
483
                        //jScrollPane.setSize(new java.awt.Dimension(340, 70));
484
                        jScrollPane.setViewportView(getTxtComments());
485
                        jScrollPane.setPreferredSize(new java.awt.Dimension(340, 70));
486
                }
487
488
                return jScrollPane;
489
        }
490
491
        private javax.swing.JTextArea getTxtComments() {
492
                if (txtComments == null) {
493
                        txtComments = new javax.swing.JTextArea();
494
                        txtComments.setRows(1);
495
                        txtComments.setColumns(28);
496
                }
497
498
                return txtComments;
499
        }
500
501
502
        private GridBagLayoutPanel getOkCancelPanel() {
503
                if (okCancelPanel == null) {
504
                        ActionListener okAction, cancelAction;
505
                        okAction = new java.awt.event.ActionListener() {
506
                                public void actionPerformed(java.awt.event.ActionEvent e) {
507
                                        view3D.setName(txtName.getText());
508
                                        view3D.setCreationDate(txtDate.getText());
509
                                        view3D.setOwner(txtOwner.getText());
510
                                        view3D.setComment(txtComments.getText());
511
                                        view3D.setBackGroundColor(backColor);
512
                                        // TODO: poner la exageracion vertical
513
//                                        view3D.set)
514
//                                        setVerticalExaggeration();
515
                                        setVerticalEx(Float.parseFloat(verEx.getText()));
516
                                        view3D.setVerticalExaggeration(Float.parseFloat(verEx.getText()));
517
                                        PluginServices.getMDIManager().closeWindow(ViewProperties3D.this);
518
                                }
519
                        };
520
                        cancelAction = new java.awt.event.ActionListener() {
521
                                public void actionPerformed(java.awt.event.ActionEvent e) {
522
                                        PluginServices.getMDIManager().closeWindow(ViewProperties3D.this);
523
                                }
524
                        };
525
526
                        okCancelPanel = new GridBagLayoutPanel();
527
                        okCancelPanel.setAlignmentX(GridBagLayoutPanel.RIGHT_ALIGNMENT);
528
                        okButton = new JButton();
529 18330 jcampos
                        okButton.setText(PluginServices.getText(this, "Accept"));
530 15361 afraile
                        okButton.addActionListener(okAction);
531
                        cancelButton = new JButton();
532 18330 jcampos
                        cancelButton.setText(PluginServices.getText(this, "Cancel"));
533 15361 afraile
                        cancelButton.addActionListener(cancelAction);
534
535
                        okCancelPanel.addComponent(okButton,cancelButton);
536
                }
537
                return okCancelPanel;
538
        }
539
540
541
542
543
        public Object getWindowModel() {
544
                // TODO Auto-generated method stub
545
                return view3D;
546
        }
547
548
        public WindowInfo getWindowInfo() {
549
                WindowInfo m_viewinfo = new WindowInfo();
550
                m_viewinfo.setTitle(PluginServices.getText(this, "view_3D_properties"));
551
                m_viewinfo.setHeight(height);
552
                m_viewinfo.setWidth(width);
553
                return m_viewinfo;
554
        }
555
556
        public boolean isEditable() {
557
                return editable;
558
        }
559
560
        public void setEditable(boolean editable) {
561
                this.editable = editable;
562
        }
563
564
        public void setVerticalEx(float exa){
565
566
                SingleLayerIterator lyrIterator = new SingleLayerIterator((FLayers3D)view3D.getMapContext().getLayers());
567
                while (lyrIterator.hasNext()) {
568
                        FLayer lyr = lyrIterator.next();
569
570
                        Layer3DProps props = Layer3DProps.getLayer3DProps(lyr);
571
                        int type = props.getType();
572
                        if (exa != props.getVerticalEx()){
573
                                if (type == Layer3DProps.layer3DElevation){
574 15373 afraile
                                        int order = props.getPlanetOrder();
575 15361 afraile
                                        props.setVerticalEx(exa);
576
                                        view3D.getPlanet().setVerticalExaggerationLayer(order, props.getVerticalEx());
577
                                } else if (type == Layer3DProps.layer3DVector){
578 15373 afraile
                                        int order = props.getPlanetOrder();
579 15361 afraile
                                        props.setVerticalEx(exa);
580
                                }
581
                        }
582
583
584
                }
585
        }
586 18575 jcampos
587
        private CRSSelectPanel getJPanelProj() {
588 20355 afraile
        //        IProjection  proj;
589
        //if (bole == true) {
590
                 if( this.editable){
591
                        proj= CRSFactory.getCRS("EPSG:4326");
592
                        view3D.setProjection(proj);
593
                 }
594
                else
595
                        proj = view3D.getProjection();
596
597
598
                jPanelProj = CRSSelectPanel.getPanel(proj);
599
                jPanelProj.setPreferredSize(new java.awt.Dimension(330,35));
600
601
602
                jPanelProj.addActionListener(new java.awt.event.ActionListener() {
603
                        public void actionPerformed(java.awt.event.ActionEvent e) {
604
                                if (jPanelProj.isOkPressed()) {
605
//                                        IProjection projectionSelected = jPanelProj.getCurProj();
606
//                                        System.out.println("Proyecci?n seleccionada.: " + projectionSelected.getAbrev());
607 18575 jcampos
//                                                if (!jPanelProj.getCurProj().isProjected()) {
608
////                                                        if (getCmbMapUnits().getItemCount()==MapContext.NAMES.length) {
609
////                                                                getCmbMapUnits().addItem(PluginServices.getText(this, Attributes.DEGREES));
610
////                                                        }
611
//                                                        getCmbMapUnits().setSelectedItem(PluginServices.getText(this, Attributes.DEGREES));
612
//                                                        getCmbMapUnits().setEnabled(false);
613
//                                                }else {
614
//                                                        if (getCmbMapUnits().getSelectedItem().equals(PluginServices.getText(this, Attributes.DEGREES))) {
615
//                                                                getCmbMapUnits().setSelectedIndex(1);
616
//                                                                getCmbMapUnits().setEnabled(true);
617
//                                                        }
618
////                                                        if (!(getCmbMapUnits().getItemCount()==MapContext.NAMES.length)) {
619
////                                                                getCmbMapUnits().removeItem(PluginServices.getText(this, Attributes.DEGREES));
620
////                                                        }
621
//                                                }
622 20355 afraile
623
                                                //New projection selected.
624
                                                view3D.setProjection(jPanelProj.getCurProj());
625 18575 jcampos
                                }
626 20355 afraile
                        }
627
                });
628
629
                Component[] cs=jPanelProj.getComponents();
630
                // Projection options disabled in spherical view.
631
                if(view3D.getPlanetType() == Planet.CoordinateSystemType.GEOCENTRIC){
632
                        for (int i = 0; i < cs.length; i++) {
633
                                cs[i].setEnabled(false);
634
                        }
635 18575 jcampos
                }
636 20355 afraile
                // Projection options disabled in flat view.
637
                else
638
                        for (int i = 0; i < cs.length; i++) {
639
                                cs[i].setEnabled(false);
640
                                if((cs[i] instanceof JLabel) && (i == 1)){
641
                                        IProjection projectionSelected = jPanelProj.getCurProj();
642
                                    ((JLabel)cs[i]).setText(projectionSelected.getAbrev());
643
644
645
                                }
646
                        }
647
648 18575 jcampos
                return jPanelProj;
649
        }
650 15361 afraile
651
}