Statistics
| Revision:

svn-gvsig-desktop / trunk / libraries / lib3DMap-share / src / main / java / com / iver / ai2 / gvsig3d / legend / Object3DMarker.java @ 23168

History | View | Annotate | Download (18.7 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2005 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
 *   Av. Blasco Ib??ez, 50
24
 *   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.gvsig3d.legend;
42

    
43
import java.awt.Checkbox;
44
import java.awt.Component;
45
import java.awt.Dimension;
46
import java.awt.Font;
47
import java.awt.GridBagConstraints;
48
import java.awt.GridBagLayout;
49
import java.awt.event.ActionEvent;
50
import java.awt.event.ActionListener;
51
import java.io.File;
52
import java.io.FileNotFoundException;
53
import java.io.IOException;
54
import java.util.ArrayList;
55
import java.util.Iterator;
56
import java.util.List;
57

    
58
import javax.swing.JButton;
59
import javax.swing.JCheckBox;
60
import javax.swing.JFileChooser;
61
import javax.swing.JLabel;
62
import javax.swing.JOptionPane;
63
import javax.swing.JPanel;
64
import javax.swing.JTextField;
65
import javax.swing.filechooser.FileFilter;
66

    
67
import org.gvsig.osgvp.Node;
68
import org.gvsig.osgvp.Vec3;
69
import org.gvsig.osgvp.osgDB;
70
import org.gvsig.osgvp.exceptions.node.LoadNodeException;
71
import org.gvsig.osgvp.viewer.IViewerContainer;
72
import org.gvsig.osgvp.viewer.ViewerFactory;
73

    
74
import com.iver.ai2.gvsig3d.resources.MyFileFilter3D;
75
import com.iver.andami.PluginServices;
76
import com.iver.andami.messages.NotificationManager;
77
import com.iver.cit.gvsig.fmap.core.SymbologyFactory;
78
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol;
79
import com.iver.cit.gvsig.fmap.core.symbols.SymbolDrawingException;
80
import com.iver.cit.gvsig.gui.styling.AbstractTypeSymbolEditor;
81
import com.iver.cit.gvsig.gui.styling.EditorTool;
82
import com.iver.cit.gvsig.gui.styling.Mask;
83
import com.iver.cit.gvsig.gui.styling.SymbolEditor;
84

    
85
/**
86
 * PictureMarker allows the user to store and modify the properties that define
87
 * a <b>picture marker symbol</b>.
88
 * <p>
89
 * <p>
90
 * This functionality is carried out thanks to a tab (simple marker)which is
91
 * included in the panel to edit the properities of a symbol (SymbolEditor)how
92
 * is explained in AbstractTypeSymbolEditor.
93
 * <p>
94
 * First of all, in the above mentioned tab the user will have options to change
95
 * the files from where the pictures for the symbol are taken (one for the
96
 * symbol when it is not selected in the map and the other when it is done).
97
 * <p>
98
 * <p>
99
 * Secondly, the user will have options to modify the pictures which had been
100
 * selected before (width and offset) .
101
 * 
102
 *@see AbstractTypeSymbolEditor
103
 *@author jaume dominguez faus - jaume.dominguez@iver.es
104
 */
105
public class Object3DMarker extends AbstractTypeSymbolEditor implements
106
                ActionListener {
107
        protected ArrayList<JPanel> tabs = new ArrayList<JPanel>();
108
        protected Mask mask;
109
        protected JLabel lblFileName;
110
        protected JLabel lblSelFileName;
111
        private JButton btn;
112
        private File fileOSG;
113
        private String filePath = "";
114
        
115
        private static String lastPath = "";
116

    
117
        public String getFilePath() {
118
                return filePath;
119
        }
120

    
121
        public void setFilePath(String filePath) {
122
                this.filePath = filePath;
123
        }
124

    
125
        private ActionListener chooseAction = new ActionListener() {
126

    
127

    
128
                public void actionPerformed(ActionEvent e) {
129

    
130
                        JFileChooser jfc = new JFileChooser(lastPath);
131
                        jfc.removeChoosableFileFilter(jfc.getAcceptAllFileFilter());
132
                        
133
                        
134
                        List filterListFile =  new ArrayList<MyFileFilter3D>();
135
                        
136
                        filterListFile.add(new MyFileFilter3D("ive",
137
                                        PluginServices.getText(this, "Ficheros *.ive"), "ive"));
138
                        filterListFile.add(new MyFileFilter3D("3ds",
139
                                        PluginServices.getText(this, "Ficheros *.3ds"), "3ds"));
140
                        filterListFile.add(new MyFileFilter3D("obj",
141
                                        PluginServices.getText(this, "Ficheros *.obj"), "obj"));
142
                        filterListFile.add(new MyFileFilter3D("osg",
143
                                        PluginServices.getText(this, "Ficheros *.osg"), "osg"));
144

    
145
                        Iterator iter = filterListFile.iterator();
146
                        while (iter.hasNext()) {
147
                                jfc.addChoosableFileFilter((FileFilter) iter.next());
148
                        }
149

    
150
                        if (jfc.showOpenDialog((Component) PluginServices.getMainFrame()) == JFileChooser.APPROVE_OPTION) {
151

    
152
                                fileOSG = jfc.getSelectedFile();
153
                                if (fileOSG.exists()) {// file don't exists in the directory.
154

    
155
                                        MyFileFilter3D filter = (MyFileFilter3D) jfc
156
                                                        .getFileFilter();
157
                                        fileOSG = filter.normalizeExtension(fileOSG);
158
                                        filePath = fileOSG.getAbsolutePath();
159
                                        filePathTextField.setText(filePath);
160
                                        updatePreview();
161
                                        lastPath = fileOSG.getPath();
162
                                } else {
163
                                        JOptionPane.showMessageDialog(null,
164
                                                        "El fichero no existe.", "Fichero no encontrado",
165
                                                        JOptionPane.WARNING_MESSAGE);
166
                                        return;
167
                                }
168
                        }// If aprove option.
169

    
170
                }
171

    
172
        };
173
        private IViewerContainer _canvas3d;
174
        private JPanel topPanel;
175
        private JPanel leftBottomPanel;
176
        private JPanel rigthBottomPanel;
177
        private JTextField rotationTextFieldX;
178
        private JTextField scaleTextFieldX;
179
        private JTextField rotationTextFieldZ;
180
        private JTextField rotationTextFieldY;
181
        private JTextField scaleTextFieldY;
182
        private JTextField scaleTextFieldZ;
183
        private JTextField filePathTextField;
184
        private JCheckBox autorotate;
185

    
186
        public Object3DMarker(SymbolEditor owner) {
187
                super(owner);
188
                initialize();
189
                
190
        
191
        }
192

    
193
        
194
        @Override
195
        protected void finalize() throws Throwable {
196
                // TODO Auto-generated method stub
197
                super.finalize();
198
                // this part is for test
199
                ViewerFactory.getInstance().stopAnimator();
200
                _canvas3d.dispose();
201
                ///////////////////////////
202
        }
203

    
204
        /**
205
         * Initializes the parameters that define a picturmarker.To do it, a tab is
206
         * created inside the SymbolEditor panel with default values for the
207
         * different attributes of the picture marker.
208
         */
209

    
210
        private void initialize() {
211
                JPanel myTab = new JPanel(new GridBagLayout());
212
                myTab.setName("3D Object");
213

    
214
                // Top panel
215
                GridBagConstraints topPanelConstrain = new GridBagConstraints();
216
                topPanelConstrain.gridx = 0;
217
                topPanelConstrain.gridy = 0;
218
                topPanelConstrain.gridwidth = 2;
219
                topPanelConstrain.fill = GridBagConstraints.BOTH;
220
                topPanelConstrain.weightx = 1.0;
221
                topPanelConstrain.weighty = 1.0;
222
                myTab.add(getTopPanel(), topPanelConstrain);
223

    
224
                // bottom left panel
225
                GridBagConstraints leftBottomPanelConstrain = new GridBagConstraints();
226
                leftBottomPanelConstrain.gridx = 0;
227
                leftBottomPanelConstrain.gridy = 1;
228
                leftBottomPanelConstrain.fill = GridBagConstraints.BOTH;
229
                leftBottomPanelConstrain.weightx = 0.5;
230
                leftBottomPanelConstrain.weighty = 1.0;
231
                myTab.add(getLeftBottomPanel(), leftBottomPanelConstrain);
232

    
233
                // Bottom right panel
234
                GridBagConstraints rigthBottomPanelConstrain = new GridBagConstraints();
235
                rigthBottomPanelConstrain.gridx = 1;
236
                rigthBottomPanelConstrain.gridy = 1;
237
                rigthBottomPanelConstrain.fill = GridBagConstraints.BOTH;
238
                rigthBottomPanelConstrain.weightx = 0.5;
239
                rigthBottomPanelConstrain.weighty = 1.0;
240
                myTab.add(getRigthBottomPanel(), rigthBottomPanelConstrain);
241
                
242
        
243
                tabs.add(myTab);
244
                
245
                
246
                PluginServices core = PluginServices.getPluginServices("com.iver.core");
247
                if (core!= null){
248
                        if (core.getPersistentXML().contains("DataFolder")){
249
                                
250
                                lastPath = core.getPersistentXML().getStringProperty("DataFolder");
251
                        }
252
                }
253
        }
254

    
255
        private JPanel getTopPanel() {
256
                if (topPanel == null) {
257
                        topPanel = new JPanel(new GridBagLayout());
258
                        // topPanel.setBorder(new LineBorder(Color.gray));
259
                        GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints();
260
                        gridBagConstraints.gridx = 0;
261
                        gridBagConstraints.gridy = 0;
262
                        gridBagConstraints.anchor = GridBagConstraints.WEST;
263
                        gridBagConstraints.insets = new java.awt.Insets(2, 5, 2, 5);
264
                        // picture file label
265
                        lblFileName = new JLabel("Seleccione fihero :");
266
//                        lblFileName.setFont(lblFileName.getFont().deriveFont(Font.BOLD));
267

    
268
                        topPanel.add(lblFileName, gridBagConstraints);
269

    
270
                        gridBagConstraints = new java.awt.GridBagConstraints();
271
                        gridBagConstraints.gridx = 0;
272
                        gridBagConstraints.gridy = 1;
273
                        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
274
                        gridBagConstraints.insets = new java.awt.Insets(2, 5, 2, 5);
275
                        gridBagConstraints.weightx = 0.75;
276

    
277
                        filePathTextField = new JTextField();
278
                        topPanel.add(filePathTextField, gridBagConstraints);
279

    
280
                        gridBagConstraints.gridx = 1;
281
                        gridBagConstraints.gridy = 1;
282
                        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
283
                        gridBagConstraints.weightx = 0.25;
284
                        gridBagConstraints.insets = new java.awt.Insets(2, 5, 2, 5);
285

    
286
                        // button browse
287
                        btn = new JButton(PluginServices.getText(this, "browse"));
288
                        btn.addActionListener(chooseAction);
289
                        
290
                        topPanel.add(btn, gridBagConstraints);
291
                        
292
                        gridBagConstraints.gridx = 0;
293
                        gridBagConstraints.gridy = 2;
294
                        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
295
//                        gridBagConstraints.weightx = 0.25;
296
                        
297
                        autorotate = new JCheckBox();
298
                        autorotate.setSelected(false);
299
                        autorotate.setText("Autorotate");
300
                        
301
                        
302
                        topPanel.add(autorotate, gridBagConstraints);
303

    
304
                }
305
                return topPanel;
306
        }
307

    
308
        public JCheckBox getAutorotate() {
309
                return autorotate;
310
        }
311

    
312
        public void setAutorotate(JCheckBox autorotate) {
313
                this.autorotate = autorotate;
314
        }
315

    
316
        private JPanel getLeftBottomPanel() {
317
                if (leftBottomPanel == null) {
318
                        leftBottomPanel = new JPanel(new GridBagLayout());
319
                        // leftBottomPanel.setBorder(new LineBorder(Color.gray));
320

    
321
                        Component transLabel = new JLabel("Transformaciones :");
322
                        transLabel.setName("jLabel1"); // NOI18N
323
                        GridBagConstraints gridBagConstraints = new GridBagConstraints();
324
                        gridBagConstraints.gridx = 0;
325
                        gridBagConstraints.gridy = 0;
326
                        gridBagConstraints.gridwidth = 2;
327
                        gridBagConstraints.anchor = GridBagConstraints.WEST;
328
                        leftBottomPanel.add(transLabel, gridBagConstraints);
329

    
330
                        // Scale X
331
                        Component scaleXLabel = new JLabel("Escalado ");
332
                        scaleXLabel.setName("jLabel2"); // NOI18N
333
                        gridBagConstraints = new java.awt.GridBagConstraints();
334
                        gridBagConstraints.gridx = 0;
335
                        gridBagConstraints.gridy = 1;
336
                        gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 10);
337
                        leftBottomPanel.add(scaleXLabel, gridBagConstraints);
338

    
339
                        scaleTextFieldX = new JTextField();
340
                        // scaleTextFieldX.setName(); // NOI18N
341
                        scaleTextFieldX.setText("0");
342
                        gridBagConstraints = new java.awt.GridBagConstraints();
343
                        gridBagConstraints.gridx = 1;
344
                        gridBagConstraints.gridy = 1;
345
                        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
346
                        gridBagConstraints.weightx = 1.0;
347
                        gridBagConstraints.insets = new java.awt.Insets(2, 5, 2, 5);
348
                        leftBottomPanel.add(scaleTextFieldX, gridBagConstraints);
349

    
350
                        // Rotation Y
351
                        Component scaleYLabel = new JLabel("Rotacion X");
352
                        scaleYLabel.setName("jLabel5"); // NOI18N
353
                        gridBagConstraints = new java.awt.GridBagConstraints();
354
                        gridBagConstraints.gridx = 0;
355
                        gridBagConstraints.gridy = 2;
356
                        gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 10);
357
                        leftBottomPanel.add(scaleYLabel, gridBagConstraints);
358

    
359
                        scaleTextFieldY = new JTextField();
360
//                        scaleTextFieldY.setName("0"); // NOI18N
361
                        scaleTextFieldY.setText("0");
362
                        gridBagConstraints = new java.awt.GridBagConstraints();
363
                        gridBagConstraints.gridx = 1;
364
                        gridBagConstraints.gridy = 2;
365
                        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
366
                        gridBagConstraints.weightx = 1.0;
367
                        gridBagConstraints.insets = new java.awt.Insets(2, 5, 2, 5);
368
                        leftBottomPanel.add(scaleTextFieldY, gridBagConstraints);
369

    
370
                        // Rotation Z
371
                        Component scaleZLabel = new JLabel("Rotacion X");
372
                        scaleZLabel.setName("jLabel5"); // NOI18N
373
                        gridBagConstraints = new java.awt.GridBagConstraints();
374
                        gridBagConstraints.gridx = 0;
375
                        gridBagConstraints.gridy = 3;
376
                        gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 10);
377
                        leftBottomPanel.add(scaleZLabel, gridBagConstraints);
378

    
379
                        scaleTextFieldZ = new JTextField();
380
//                        scaleTextFieldZ.setName("0"); // NOI18N
381
                        scaleTextFieldZ.setText("0");
382
                        gridBagConstraints = new java.awt.GridBagConstraints();
383
                        gridBagConstraints.gridx = 1;
384
                        gridBagConstraints.gridy = 3;
385
                        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
386
                        gridBagConstraints.weightx = 1.0;
387
                        gridBagConstraints.insets = new java.awt.Insets(2, 5, 2, 5);
388
                        leftBottomPanel.add(scaleTextFieldZ, gridBagConstraints);
389

    
390
                        // Rotation X
391
                        Component rotationXLabel = new JLabel("Rotacion X");
392
                        rotationXLabel.setName("jLabel5"); // NOI18N
393
                        gridBagConstraints = new java.awt.GridBagConstraints();
394
                        gridBagConstraints.gridx = 0;
395
                        gridBagConstraints.gridy = 4;
396
                        gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 10);
397
                        leftBottomPanel.add(rotationXLabel, gridBagConstraints);
398

    
399
                        rotationTextFieldX = new JTextField();
400
//                        rotationTextFieldX.setName("0"); // NOI18N
401
                        rotationTextFieldX.setText("0");
402
                        gridBagConstraints = new java.awt.GridBagConstraints();
403
                        gridBagConstraints.gridx = 1;
404
                        gridBagConstraints.gridy = 4;
405
                        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
406
                        gridBagConstraints.weightx = 1.0;
407
                        gridBagConstraints.insets = new java.awt.Insets(2, 5, 2, 5);
408
                        leftBottomPanel.add(rotationTextFieldX, gridBagConstraints);
409

    
410
                        // Rotation Y
411
                        Component rotationYLabel = new JLabel("Rotacion Y");
412
                        rotationYLabel.setName("jLabel3"); // NOI18N
413
                        gridBagConstraints = new java.awt.GridBagConstraints();
414
                        gridBagConstraints.gridx = 0;
415
                        gridBagConstraints.gridy = 5;
416
                        gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 10);
417
                        leftBottomPanel.add(rotationYLabel, gridBagConstraints);
418

    
419
                        rotationTextFieldY = new JTextField();
420
                        rotationTextFieldY.setName("0"); // NOI18N
421
                        rotationTextFieldY.setText("0");
422
                        gridBagConstraints = new java.awt.GridBagConstraints();
423
                        gridBagConstraints.gridx = 1;
424
                        gridBagConstraints.gridy = 5;
425
                        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
426
                        gridBagConstraints.weightx = 1.0;
427
                        gridBagConstraints.insets = new java.awt.Insets(2, 5, 2, 5);
428
                        leftBottomPanel.add(rotationTextFieldY, gridBagConstraints);
429

    
430
                        // Rotation Z
431
                        Component rotationZlabel = new JLabel("Rotacion Z");
432
                        rotationZlabel.setName("jLabel4"); // NOI18N
433
                        gridBagConstraints = new java.awt.GridBagConstraints();
434
                        gridBagConstraints.gridx = 0;
435
                        gridBagConstraints.gridy = 6;
436
                        gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 10);
437
                        leftBottomPanel.add(rotationZlabel, gridBagConstraints);
438

    
439
                        rotationTextFieldZ = new JTextField();
440
//                        rotationTextFieldZ.setName("0"); // NOI18N
441
                        rotationTextFieldZ.setText("0");
442
                        gridBagConstraints = new java.awt.GridBagConstraints();
443
                        gridBagConstraints.gridx = 1;
444
                        gridBagConstraints.gridy = 6;
445
                        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
446
                        gridBagConstraints.weightx = 1.0;
447
                        gridBagConstraints.insets = new java.awt.Insets(2, 5, 2, 5);
448
                        leftBottomPanel.add(rotationTextFieldZ, gridBagConstraints);
449
                }
450
                return leftBottomPanel;
451
        }
452

    
453
        private JPanel getRigthBottomPanel() {
454
                if (rigthBottomPanel == null) {
455
                        rigthBottomPanel = new JPanel(new GridBagLayout());
456
                        // rigthBottomPanel.setBorder(new LineBorder(Color.gray));
457
                        GridBagConstraints constrain = new GridBagConstraints();
458
                        constrain.gridx = 0;
459
                        constrain.gridy = 0;
460
                        constrain.anchor = GridBagConstraints.WEST;
461
                        // selection picture file
462
                        lblSelFileName = new JLabel("Preview:");
463
                        rigthBottomPanel.add(lblSelFileName, constrain);
464

    
465
                        int size = 150;
466
                        JPanel aux3 = new JPanel();
467
                        aux3.setPreferredSize(new Dimension(size, size));
468
                        _canvas3d = ViewerFactory.getInstance().createViewer(
469
                                        ViewerFactory.VIEWER_TYPE.CANVAS_VIEWER, null);
470
                        ViewerFactory.getInstance().startAnimator();
471

    
472
                        _canvas3d.setSize(size, size);
473
                        
474
                        updatePreview();
475

    
476
                        constrain.gridx = 0;
477
                        constrain.gridy = 1;
478
                        aux3.add((Component) _canvas3d);
479
                        rigthBottomPanel.add(aux3, constrain);
480
                        
481
                        
482
                }
483
                return rigthBottomPanel;
484
        }
485
        
486
        
487
        private void updatePreview(){
488
                try {
489
                        Node node = null;
490
                        if (this.getFilePath() == "") {
491
                                node = osgDB.readNodeFile("D:/modelos3d/cow.ive");
492
                        } else {
493
                                node = osgDB.readNodeFile(filePath);
494
                        }
495
                        _canvas3d.getOSGViewer().setSceneData(node);
496
                } catch (LoadNodeException e) {
497
                        // TODO Auto-generated catch block
498
                        e.printStackTrace();
499
                } catch (FileNotFoundException e) {
500
                        // TODO Auto-generated catch block
501
                        e.printStackTrace();
502
                }
503
        }
504

    
505
        public ISymbol getLayer() {
506
                // this method builds the new symbol and returns it to the legend
507
                // manager
508
                try {
509
                        Object3DMarkerSymbol symbol = null;
510

    
511
                        if (this.getFilePath().equals(""))
512
                                symbol = null;
513
                        else {
514
                                symbol = new Object3DMarkerSymbol(this.getFilePath());
515
                                symbol.setScale(new Vec3(Double.parseDouble(scaleTextFieldX
516
                                                .getText()), Double.parseDouble(scaleTextFieldY
517
                                                .getText()), Double.parseDouble(scaleTextFieldZ
518
                                                .getText())));
519
                                symbol.setRotation(new Vec3(Double
520
                                                .parseDouble(rotationTextFieldX.getText()), Double
521
                                                .parseDouble(rotationTextFieldY.getText()), Double
522
                                                .parseDouble(rotationTextFieldZ.getText())));
523
                                
524
                                symbol.setAutoRotate(autorotate.isSelected());
525
                        }
526

    
527
                        
528
                        return symbol;
529
                } catch (IOException e) {
530
                        return SymbologyFactory.getWarningSymbol(PluginServices.getText(
531
                                        this, "failed_acessing_files"), null,
532
                                        SymbolDrawingException.UNSUPPORTED_SET_OF_SETTINGS);
533
                }
534

    
535
        }
536

    
537
        public void refreshControls(ISymbol layer) {
538

    
539
                // this method gets the simbol from the legend manager
540

    
541
                Object3DMarkerSymbol sym;
542
                try {
543
                        String fileName = null;
544
                        if (layer == null) {
545
                                // initialize defaults
546
                                System.err.println(getClass().getName()
547
                                                + ":: should be unreachable code");
548
                                fileName = "-";
549
                        } else {
550
                                sym = (Object3DMarkerSymbol) layer;
551
                                fileName = sym.getObject3DPath();
552
                        }
553

    
554
                        this.setFilePath(fileName);
555

    
556
                } catch (IndexOutOfBoundsException ioEx) {
557
                        NotificationManager.addWarning("Symbol layer index out of bounds",
558
                                        ioEx);
559
                } catch (ClassCastException ccEx) {
560
                        NotificationManager.addWarning("Illegal casting from "
561
                                        + layer.getClassName() + " to "
562
                                        + getSymbolClass().getName() + ".", ccEx);
563
                }
564
        }
565

    
566
        public String getName() {
567
                return "Object 3D symbol";
568

    
569
        }
570

    
571
        public JPanel[] getTabs() {
572
                return tabs.toArray(new JPanel[tabs.size()]);
573
        }
574

    
575
        public Class getSymbolClass() {
576
                return Object3DMarkerSymbol.class;
577
        }
578

    
579
        public EditorTool[] getEditorTools() {
580
                return null;
581

    
582
        }
583

    
584
        public void actionPerformed(ActionEvent e) {
585
                fireSymbolChangedEvent();
586
        }
587

    
588
}