Statistics
| Revision:

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

History | View | Annotate | Download (19 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
        private String tempScreenshotimage;
186

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

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

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

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

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

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

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

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

    
269
                        topPanel.add(lblFileName, gridBagConstraints);
270

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

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

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

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

    
305
                }
306
                return topPanel;
307
        }
308

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
509
        public ISymbol getLayer() {
510
                // this method builds the new symbol and returns it to the legend
511
                // manager
512
                try {
513
                        Object3DMarkerSymbol symbol = null;
514

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

    
532
                        
533
                        return symbol;
534
                } catch (IOException e) {
535
                        return SymbologyFactory.getWarningSymbol(PluginServices.getText(
536
                                        this, "failed_acessing_files"), null,
537
                                        SymbolDrawingException.UNSUPPORTED_SET_OF_SETTINGS);
538
                }
539

    
540
        }
541

    
542
        public void refreshControls(ISymbol layer) {
543

    
544
                // this method gets the simbol from the legend manager
545

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

    
559
                        this.setFilePath(fileName);
560

    
561
                } catch (IndexOutOfBoundsException ioEx) {
562
                        NotificationManager.addWarning("Symbol layer index out of bounds",
563
                                        ioEx);
564
                } catch (ClassCastException ccEx) {
565
                        NotificationManager.addWarning("Illegal casting from "
566
                                        + layer.getClassName() + " to "
567
                                        + getSymbolClass().getName() + ".", ccEx);
568
                }
569
        }
570

    
571
        public String getName() {
572
                return "Object 3D symbol";
573

    
574
        }
575

    
576
        public JPanel[] getTabs() {
577
                return tabs.toArray(new JPanel[tabs.size()]);
578
        }
579

    
580
        public Class getSymbolClass() {
581
                return Object3DMarkerSymbol.class;
582
        }
583

    
584
        public EditorTool[] getEditorTools() {
585
                return null;
586

    
587
        }
588

    
589
        public void actionPerformed(ActionEvent e) {
590
                fireSymbolChangedEvent();
591
        }
592

    
593
}