Statistics
| Revision:

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

History | View | Annotate | Download (21.8 KB)

1
package com.iver.ai2.gvsig3d.legend;
2

    
3
import java.awt.BorderLayout;
4
import java.awt.Component;
5
import java.awt.FlowLayout;
6
import java.awt.event.ActionEvent;
7
import java.awt.event.ActionListener;
8
import java.awt.event.ItemEvent;
9
import java.awt.event.ItemListener;
10
import java.awt.event.KeyEvent;
11
import java.awt.event.KeyListener;
12
import java.sql.Types;
13
import java.util.ArrayList;
14
import java.util.Random;
15

    
16
import javax.swing.DefaultComboBoxModel;
17
import javax.swing.ImageIcon;
18
import javax.swing.JCheckBox;
19
import javax.swing.JComboBox;
20
import javax.swing.JLabel;
21
import javax.swing.JOptionPane;
22
import javax.swing.JPanel;
23
import javax.swing.JTextField;
24

    
25
import org.gvsig.gui.beans.swing.JButton;
26
import org.gvsig.raster.datastruct.ColorItem;
27

    
28
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
29
import com.hardcode.gdbms.engine.data.DataSource;
30
import com.hardcode.gdbms.engine.instruction.IncompatibleTypesException;
31
import com.hardcode.gdbms.engine.values.DoubleValue;
32
import com.hardcode.gdbms.engine.values.NullValue;
33
import com.hardcode.gdbms.engine.values.Value;
34
import com.hardcode.gdbms.engine.values.ValueFactory;
35
import com.iver.ai2.gvsig3d.legend.symbols.BaseExtrusionSymbol;
36
import com.iver.ai2.gvsig3d.map3d.layers.Layer3DProps;
37
import com.iver.andami.PluginServices;
38
import com.iver.andami.messages.NotificationManager;
39
import com.iver.cit.gvsig.fmap.core.SymbologyFactory;
40
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol;
41
import com.iver.cit.gvsig.fmap.layers.FLayer;
42
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
43
import com.iver.cit.gvsig.fmap.layers.layerOperations.AlphanumericData;
44
import com.iver.cit.gvsig.fmap.layers.layerOperations.ClassifiableVectorial;
45
import com.iver.cit.gvsig.fmap.rendering.AbstractClassifiedVectorLegend;
46
import com.iver.cit.gvsig.fmap.rendering.ILegend;
47
import com.iver.cit.gvsig.fmap.rendering.LegendContentsChangedListener;
48
import com.iver.cit.gvsig.fmap.rendering.LegendFactory;
49
import com.iver.cit.gvsig.fmap.rendering.NullUniqueValue;
50
import com.iver.cit.gvsig.fmap.rendering.VectorialUniqueValueLegend;
51
import com.iver.cit.gvsig.fmap.rendering.ZSort;
52
import com.iver.cit.gvsig.gui.styling.JComboBoxColorScheme;
53
import com.iver.cit.gvsig.gui.styling.SymbolLevelsWindow;
54
import com.iver.cit.gvsig.project.documents.view.legend.gui.ILegendPanel;
55
import com.iver.cit.gvsig.project.documents.view.legend.gui.SymbolTable;
56

    
57

    
58
/**
59
 * DOCUMENT ME!
60
 *
61
 * @author fjp To change the template for this generated type comment go to
62
 *         Window>Preferences>Java>Code Generation>Code and
63
 *         Comments
64
 */
65
public class ExtrusionLegendPanel extends JPanel implements ILegendPanel,ActionListener,KeyListener,ItemListener {
66
    /**
67
         * 
68
         */
69
        private static final long serialVersionUID = 6470946030927461473L;
70

    
71
        //private static Logger logger = Logger.getLogger(VectorialUniqueValue.class.getName());
72

    
73
    private VectorialUniqueValueLegend theLegend;
74
    private ClassifiableVectorial layer;
75
    private SymbolTableExtrusion symbolTable;
76
    private JComboBox cmbFields;
77
    private JButton btnRemoveAll;
78
    private JButton btnRemove;
79
    private JCheckBox chbUseDefault = null;
80
    private VectorialUniqueValueLegend auxLegend;
81
        private JPanel pnlCenter;
82
        private ZSort zSort;
83
        private JButton btnOpenSymbolLevelsEditor;
84
        private JTextField jtvariable;
85
        private JComboBoxColorScheme cmbColorScheme;
86
        private double extrusionValue = 1;
87
        private JTextField jtfija;
88
        private JCheckBox fixedOption;
89
        private double extrusionFixedValue = 1;
90

    
91
        private Value aux; 
92

    
93
    /**
94
     *
95
     */
96
    public ExtrusionLegendPanel() {
97
        super();
98
        initialize();
99
    }
100

    
101
    /**
102
     * DOCUMENT ME!
103
     */
104
    protected void initialize() {
105
        /* JLabel label = new JLabel();
106
           label.setIcon(new javax.swing.ImageIcon(Abrir.class.getClassLoader().getResource("images/ValoresUnicos.png")));
107
           limagen[1] = new JLabel();
108
           limagen[1] = label; */
109
        JPanel pnlButtons = new JPanel();
110

    
111
        JButton btnAddAll = new JButton(PluginServices.getText(this,
112
                    "Anadir_todos"));
113
        btnAddAll.setActionCommand("ADD_ALL_VALUES");
114
        btnAddAll.addActionListener(this);
115
        pnlButtons.add(btnAddAll);
116

    
117
        JButton btnAdd = new JButton(PluginServices.getText(this, "Anadir"));
118
        btnAdd.setActionCommand("ADD_VALUE");
119
        btnAdd.addActionListener(this);
120
        pnlButtons.add(btnAdd);
121

    
122
        btnRemoveAll = new JButton(PluginServices.getText(this, "Quitar_todos"));
123
        btnRemoveAll.setActionCommand("REMOVE_ALL");
124
        btnRemoveAll.addActionListener(this);
125
        pnlButtons.add(btnRemoveAll);
126

    
127
        btnRemove = new JButton(PluginServices.getText(this, "Quitar"));
128
        btnRemove.setActionCommand("REMOVE");
129
        btnRemove.addActionListener(this);
130
        pnlButtons.add(btnRemove);
131

    
132
//        btnOpenSymbolLevelsEditor = new JButton(PluginServices.getText(this, "symbol_levels"));
133
//        btnOpenSymbolLevelsEditor.addActionListener(this);
134
//        btnOpenSymbolLevelsEditor.setActionCommand("OPEN_SYMBOL_LEVEL_EDITOR");
135
//        pnlButtons.add(btnOpenSymbolLevelsEditor);
136

    
137
                pnlCenter = new JPanel();
138
        pnlCenter.setLayout(new BorderLayout());
139

    
140
        cmbFields = new JComboBox();
141
        cmbFields.setActionCommand("FIELD_SELECTED");
142
        cmbFields.addActionListener(this);
143
        cmbFields.setVisible(true);
144

    
145
        JPanel pnlNorth = new JPanel(new FlowLayout(FlowLayout.LEFT, 20, 0));
146
        JPanel pAux1 = new JPanel();
147

    
148
        JLabel lblFieldClassification = new JLabel(PluginServices.getText(
149
                    this, "Campo_de_clasificacion"));
150
        pAux1.add(lblFieldClassification);
151
        pAux1.add(cmbFields);
152
        pAux1.add(getChbUseDefault(), null);
153
        pnlNorth.add(pAux1);
154

    
155
        pAux1 = new JPanel();
156
        pAux1.add(new JLabel(PluginServices.getText(this, "Nivel_de_extrusion")+":"));
157
        jtvariable = new JTextField(PluginServices.getText(this, "1"),3);
158
        jtvariable.setColumns(3);
159
        jtvariable.setHorizontalAlignment(JTextField.RIGHT); 
160
        jtvariable.setToolTipText(PluginServices.getText(this, "Valor_inicial") + " * " + PluginServices.getText(this, "Nivel_de_extrusion"));
161
        jtvariable.addKeyListener(this);
162
        pAux1.add(jtvariable);
163
        
164
        pnlNorth.add(pAux1);
165
        
166
        pAux1 = new JPanel();
167
        fixedOption = new JCheckBox(PluginServices.getText(this, "Altura_fija")+":",false);
168
        fixedOption.setHorizontalAlignment(JTextField.RIGHT); 
169
        fixedOption.setEnabled(true);
170
        fixedOption.setSelected(false);
171
        pAux1.add(fixedOption);
172
        
173
        jtfija = new JTextField(PluginServices.getText(this, "1"),3);
174
        jtfija.setColumns(10);
175
        jtfija.setHorizontalAlignment(JTextField.RIGHT); 
176
        jtfija.addKeyListener(this);
177
        jtfija.setToolTipText(PluginServices.getText(this, "Valor_inicial")+ " = "+ PluginServices.getText(this, "Altura_fija"));
178
        jtfija.setEnabled(false);
179
        pAux1.add(jtfija);
180
        
181
        pnlNorth.add(pAux1);
182
        
183
        pAux1 = new JPanel();
184
        pAux1.add(new JLabel(PluginServices.getText(this, "color_scheme")+":"));
185
        cmbColorScheme = new JComboBoxColorScheme(false);
186

    
187
//        pAux1.add(cmbColorScheme);
188
//        pnlNorth.add(pAux1);
189
        
190
        fixedOption.addItemListener(this);
191
        this.setLayout(new BorderLayout());
192
        this.add(pnlNorth, BorderLayout.NORTH);
193
        this.add(pnlCenter, BorderLayout.CENTER);
194
        this.add(pnlButtons, BorderLayout.SOUTH);
195

    
196
    }
197

    
198
    /**
199
     * DOCUMENT ME!
200
     */
201
    private void fillTableValues() {
202
        DataSource elRs;
203

    
204
        try {
205
            elRs = ((FLyrVect) layer).getRecordset();
206
           // logger.debug("elRs.start()");
207
            elRs.start();
208

    
209
            int idField = -1;
210
            String fieldName = (String) cmbFields.getSelectedItem();
211
            if (fieldName==null) {
212
                    JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(),PluginServices.getText(this,"no_hay_campo_seleccionado"));
213
                    return;
214
            }
215

    
216
            idField = elRs.getFieldIndexByName(fieldName);
217
            theLegend.setClassifyingFieldNames(new String[] {fieldName});
218

    
219
            //long numReg = elRs.getRowCount();
220
            if (idField == -1) {
221
                NotificationManager.addWarning(
222
                                PluginServices.getText(this, "unrecognized_field_name")+" " + fieldName, null);
223

    
224
                return;
225
            }
226

    
227
            symbolTable.removeAllItems();
228

    
229
            int numSymbols = 0;
230
            ISymbol theSymbol = null;
231

    
232
            //auxLegend=(VectorialUniqueValueLegend)m_lyr.getLegend();
233
//            auxLegend = LegendFactory.createVectorialUniqueValueLegend(layer.getShapeType());
234
            auxLegend = new ExtrusionLegend(layer.getShapeType());
235

    
236

    
237
            //Object resul;
238
            if (chbUseDefault.isSelected()) {
239
                auxLegend.getDefaultSymbol().setDescription("Default");
240
                auxLegend.addSymbol(new NullUniqueValue(),
241
                    auxLegend.getDefaultSymbol());
242
            }
243

    
244
            ColorItem[] colorScheme = cmbColorScheme.getSelectedColors();
245
            Random rand = new Random(System.currentTimeMillis());
246

    
247
            for (int j = 0; j < elRs.getRowCount(); j++) {
248
               Value clave = elRs.getFieldValue(j, idField);
249

    
250
                if (clave instanceof NullValue) {
251
                    continue;
252
                }
253

    
254
                //Comprobar que no esta repetido y no hace falta introducir en el hashtable el campo junto con el simbolo.
255
                if (auxLegend.getSymbolByValue(clave) == null) {
256
                    //si no esta creado el simbolo se crea
257
                    // jaume (moved to ISymbol); theSymbol = new FSymbol(layer.getShapeType());
258
                        theSymbol = SymbologyFactory.
259
                                createDefaultSymbolByShapeType(layer.getShapeType(),
260
                                                colorScheme[rand.nextInt(colorScheme.length)].getColor());
261
                        aux = clave.producto(ValueFactory.createValue(extrusionValue));
262
                    theSymbol.setDescription(aux.toString());
263
                    auxLegend.addSymbol(clave, theSymbol);
264

    
265
                    numSymbols++;
266

    
267
                    if (numSymbols == 100) {
268
                        int resp = JOptionPane.showConfirmDialog(this,
269
                                PluginServices.getText(this,
270
                                    "mas_de_100_simbolos"),
271
                                PluginServices.getText(this, "quiere_continuar"),
272
                                JOptionPane.YES_NO_OPTION,
273
                                JOptionPane.WARNING_MESSAGE);
274

    
275
                        if ((resp == JOptionPane.NO_OPTION) ||
276
                                (resp == JOptionPane.DEFAULT_OPTION)) {
277
                            return;
278
                        }
279
                    }
280
                }
281
            } // for
282

    
283
            
284
            Object[] extrudedValue = auxLegend.getValues();
285
            double defaultValue = 1;
286
            
287
            for (int i = 0; i < extrudedValue.length; i++) {
288
                    if(jtvariable.isEnabled()){
289
                            try {
290
                                         extrudedValue[i] = ((Value)auxLegend.getValues()[i]).producto(ValueFactory.createValue(extrusionValue));
291
                                         theSymbol.setDescription(extrudedValue[i].toString());
292
                                         
293
                                 }catch (IncompatibleTypesException e) {
294
                                         extrudedValue[i] = ValueFactory.createValue(defaultValue);
295
                                         }
296
                    }else
297
                                         extrudedValue[i] = ValueFactory.createValue(extrusionFixedValue);
298
                                 
299
                    
300
            }
301
//            symbolTable.fillTableFromSymbolList(auxLegend.getSymbols(),
302
//                            auxLegend.getValues(), auxLegend.getDescriptions());
303
            
304
            symbolTable.fillTableFromSymbolList(auxLegend.getSymbols(),
305
                                        auxLegend.getValues(), extrudedValue);
306
            elRs.stop();
307
        } catch (ReadDriverException e) {
308
                NotificationManager.addError(PluginServices.getText(this, "recovering_recordset"), e);
309
        } catch (IncompatibleTypesException e) {
310
                        // TODO Auto-generated catch block
311
                        e.printStackTrace();
312
                }
313

    
314
        btnRemoveAll.setEnabled(true);
315
        btnRemove.setEnabled(true);
316

    
317
        //m_bCacheDirty = false;
318
    }
319

    
320
    /**
321
     * A partir de los registros de la tabla, regenera el FRenderer. (No solo
322
     * el symbolList, si no tambi�n el arrayKeys y el defaultRenderer
323
     */
324
    private void fillSymbolListFromTable() {
325
        Value clave;
326
        ISymbol theSymbol;
327

    
328
        // Borramos las anteriores listas:
329

    
330
        boolean bRestoValores = false; // PONERLO EN UN CHECKBOX
331
        int hasta;
332
        String fieldName = (String) cmbFields.getSelectedItem();
333
        theLegend.setClassifyingFieldNames(new String[] {fieldName} );
334
        /////////////////////////////////////////PEPE
335
        FLyrVect m = (FLyrVect) layer;
336
        try {
337
                int fieldType = m.getSource().getRecordset().getFieldType((int)cmbFields.getSelectedIndex());
338
                theLegend.setClassifyingFieldTypes(new int[] {fieldType});
339
        } catch (ReadDriverException e) {
340
                NotificationManager.addError(PluginServices.getText(this, "could_not_setup_legend"), e);
341
        }
342
        /////////////////////////////////////////PEPE
343
        if (bRestoValores) {
344
            hasta = symbolTable.getRowCount() - 1;
345
        } else {
346
            hasta = symbolTable.getRowCount();
347
        }
348

    
349
        for (int row = 0; row < symbolTable.getRowCount(); row++) {
350
            clave = (Value) symbolTable.getFieldValue(row, 0);
351
            DoubleValue extrusion = null;
352
            try{
353
                    extrusion = (DoubleValue) symbolTable.getFieldValue(row, 1);
354
                    theSymbol = new BaseExtrusionSymbol(extrusion.getValue());
355
                theSymbol.setDescription(extrusion.toString());
356
            }
357
            catch (Exception e) {
358
                     theSymbol = new BaseExtrusionSymbol(1);
359
                 theSymbol.setDescription("1");
360
                        }
361
           
362
            theLegend.addSymbol(clave,theSymbol);
363
        }
364

    
365
        if (bRestoValores) {
366
            theSymbol = (ISymbol) symbolTable.getFieldValue(hasta, 0);
367
            theLegend.setDefaultSymbol(theSymbol);
368
        }
369
    }
370

    
371
    /**
372
     * DOCUMENT ME!
373
     */
374
    protected void fillFieldNames() {
375
                DataSource rs = null;
376
                ArrayList nomFields = null;
377

    
378
                try {
379
                        rs = ((AlphanumericData) layer).getRecordset();
380
                        rs.start();
381

    
382
                        nomFields = new ArrayList();
383

    
384
                        int type;
385
                        for (int i = 0; i < rs.getFieldCount(); i++) {
386
                                type = rs.getFieldType(i);
387

    
388
                                if (type == Types.NULL) {
389
                                        continue;
390
                                }
391

    
392
                                if ((type == Types.INTEGER) ||
393
                                                (type == Types.DOUBLE) ||
394
                                                (type == Types.FLOAT) ||
395
                                                (type == Types.BIGINT)) {
396
                                        nomFields.add(rs.getFieldName(i).trim());
397
                                }
398
                        }
399

    
400
                        rs.stop();
401
                } catch (ReadDriverException e) {
402
                        NotificationManager.addError(PluginServices.getText(this, "recovering_recordset"), e);
403
                }
404

    
405
                DefaultComboBoxModel cM = new DefaultComboBoxModel(nomFields.toArray());
406
                cmbFields.setModel(cM);
407

    
408
                symbolTable.removeAllItems();
409
        }
410

    
411
    public void setData(FLayer layer, ILegend legend) {
412
            this.layer = (ClassifiableVectorial) layer;
413
              int shapeType = 0;
414
              try {
415
                      shapeType = this.layer.getShapeType();
416
              } catch (ReadDriverException e) {
417
                    NotificationManager.addError(PluginServices.getText(this, "generating_intervals"), e);
418
                }
419

    
420
              if (symbolTable != null)
421
                      pnlCenter.remove(symbolTable);
422
              symbolTable = new SymbolTableExtrusion(this, SymbolTable.VALUES_TYPE, shapeType);
423
              pnlCenter.add(symbolTable, BorderLayout.CENTER);
424

    
425
        fillFieldNames();
426

    
427
        symbolTable.removeAllItems();
428

    
429
        if (legend instanceof VectorialUniqueValueLegend) {
430
            theLegend = (VectorialUniqueValueLegend) legend;
431
            getChbUseDefault().setSelected(theLegend.isUseDefaultSymbol());
432
            cmbFields.getModel().setSelectedItem(theLegend.getClassifyingFieldNames()[0]);
433
            symbolTable.fillTableFromSymbolList(theLegend.getSymbols(),
434
                                                                                    theLegend.getValues(),
435
                                                                                    theLegend.getDescriptions());
436
            zSort = theLegend.getZSort();
437
        } else {
438
            theLegend = new VectorialUniqueValueLegend(shapeType);
439
        }
440
    }
441

    
442
    /* (non-Javadoc)
443
     * @see com.iver.cit.gvsig.gui.legendmanager.panels.ILegendPanel#getLegend()
444
     */
445
    public ILegend getLegend() {
446
        fillSymbolListFromTable();
447

    
448
        if (auxLegend != null) {
449
                // your settings that are not the set of symbols must be located here
450
                auxLegend.setClassifyingFieldNames(
451
                                new String[] {(String) cmbFields.getSelectedItem()});
452
                auxLegend.setClassifyingFieldTypes(theLegend.getClassifyingFieldTypes());
453
                
454
                LegendContentsChangedListener[] l  = theLegend.getListeners();
455
                for (int i = 0; i < l.length; i++) {
456
                        auxLegend.addLegendListener(l[i]);
457
                        };
458
            
459
            theLegend = auxLegend;
460
        }
461
        theLegend.setZSort(zSort);
462

    
463
        return theLegend;
464
    }
465

    
466
    private JCheckBox getChbUseDefault() {
467
        if (chbUseDefault == null) {
468
            chbUseDefault = new JCheckBox();
469
            chbUseDefault.setSelected(true);
470
            chbUseDefault.addActionListener(new java.awt.event.ActionListener() {
471
                    public void actionPerformed(java.awt.event.ActionEvent e) {
472
                            if (auxLegend==null)auxLegend=theLegend;
473
                            if (chbUseDefault.isSelected()) {
474
                                    addDefault();
475
                            } else {
476
                                    delDefault();
477
                            }
478
                    }
479
            });
480
            chbUseDefault.setText(PluginServices.getText(this, "resto_valores"));
481
        }
482

    
483
        return chbUseDefault;
484
    }
485

    
486
    /**
487
     * A�ade el resto de valores.
488
     */
489
    private void addDefault() {
490
        auxLegend.getDefaultSymbol().setDescription("Default");
491
        auxLegend.addSymbol(new NullUniqueValue(), auxLegend.getDefaultSymbol());
492
        symbolTable.addTableRecord(auxLegend.getDefaultSymbol(),
493
            new NullUniqueValue(), auxLegend.getDefaultSymbol().getDescription());
494
        symbolTable.repaint();
495
    }
496

    
497
    /**
498
     * Elimina el resto de valores que no estan representados por ning�n otro s�mbolo..
499
     */
500
    private void delDefault() {
501
        auxLegend.delSymbol(new NullUniqueValue());
502
        symbolTable.removeRow(new NullUniqueValue());
503
        symbolTable.repaint();
504
    }
505

    
506

    
507
    public void actionPerformed(ActionEvent e) {
508

    
509
            //modificar el combobox de valor
510
            if (e.getActionCommand() == "FIELD_SELECTED") {
511
                    JComboBox cb = (JComboBox) e.getSource();
512
                    String fieldName = (String) cb.getSelectedItem();
513
                    symbolTable.removeAllItems();
514

    
515
            }
516

    
517
            // add all elements by value
518
            if (e.getActionCommand() == "ADD_ALL_VALUES") {
519
                    fillTableValues();
520
            }
521

    
522
            // add only one value
523
            if (e.getActionCommand() == "ADD_VALUE") {
524
                    try {
525
                            symbolTable.addTableRecord(SymbologyFactory.
526
                                            createDefaultSymbolByShapeType(layer.getShapeType()),
527
                                            ValueFactory.createValue(0.0), "0 - 0");
528
                    } catch (ReadDriverException ex) {
529
                            NotificationManager.addError(PluginServices.getText(this, "getting_shape_type"), ex);
530
                    }
531
            }
532

    
533
            //Vacia la tabla
534
            if (e.getActionCommand() == "REMOVE_ALL") {
535
                    symbolTable.removeAllItems();
536
                    theLegend.setZSort(null);
537
                    zSort = null;
538
            }
539

    
540
            //Quitar solo el elemento seleccionado
541
            if (e.getActionCommand() == "REMOVE") {
542
                    symbolTable.removeSelectedRows();
543
            }
544

    
545
            if (e.getActionCommand() == "OPEN_SYMBOL_LEVEL_EDITOR") {
546

    
547
                        if (theLegend != null) {
548
                                ZSort myZSort = ((AbstractClassifiedVectorLegend) getLegend()).getZSort();
549
                                if (myZSort == null) {
550
                                                myZSort = new ZSort(theLegend);
551
                                }
552
                                SymbolLevelsWindow sl = new SymbolLevelsWindow(myZSort);
553
                                PluginServices.getMDIManager().addWindow(sl);
554
                                zSort = sl.getZSort();
555
                                if (auxLegend != null)
556
                                        auxLegend.setZSort(zSort);
557
                        }
558

    
559
            }
560
    }
561

    
562
        public String getDescription() {
563
                return PluginServices.getText(this,PluginServices.getText(this,"info_extrusion"));
564
        }
565

    
566
        public ImageIcon getIcon() {
567
                return null;
568
        }
569

    
570
        public Class getParentClass() {
571
                return null;
572
        }
573

    
574
        public String getTitle() {
575
                return ("<html><b>"+ PluginServices.getText(this,"Extrusion")+ "</b></html>");
576
        }
577

    
578
        public JPanel getPanel() {
579
                return this;
580
        }
581

    
582
        public Class getLegendClass() {
583
                return ExtrusionLegend.class;
584
        }
585

    
586

    
587
        public boolean isSuitableFor(FLayer layer) {
588
                
589
                Layer3DProps props3D = Layer3DProps.getLayer3DProps(layer);
590
                return ((props3D != null) && (props3D.getType() == Layer3DProps.layer3DVector));
591
        }
592

    
593
        public void keyPressed(KeyEvent e) {
594
                // TODO Auto-generated method stub
595
                
596
        }
597

    
598
        public void keyReleased(KeyEvent e) {
599
                
600
                try {
601
                        extrusionValue = new Double(this.jtvariable.getText()).doubleValue();
602
                        extrusionFixedValue = new Double(this.jtfija.getText()).doubleValue();
603
                }
604
                catch (Exception e2) {
605
//                        String s = " ";
606
//                        if(!this.jtvariable.getText().equals(s)) {
607
//                                JOptionPane.showMessageDialog(null, PluginServices.getText(this, "Introduce un dato numerico"),
608
//                                                PluginServices.getText(this, "Dato incorrecto"), JOptionPane.WARNING_MESSAGE);
609
//        
610
//                                jtvariable.setText(Double.toString(extrusionValue));
611
//                                jtfija.setText(Double.toString(extrusionFixedValue));
612
//                        }
613
                }
614
        }
615

    
616
        public void keyTyped(KeyEvent e) {
617
                // TODO Auto-generated method stub
618
                
619
        }
620

    
621
        public void itemStateChanged(ItemEvent e) {
622
                        jtfija.setEnabled(fixedOption.isSelected());
623
                        jtvariable.setEnabled(!fixedOption.isSelected());
624
                
625
        }
626
        
627
}