Statistics
| Revision:

root / trunk / extensions / extSymbology / src / org / gvsig / symbology / gui / layerproperties / ProportionalSymbols.java @ 22867

History | View | Annotate | Download (19.4 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 org.gvsig.symbology.gui.layerproperties;
42

    
43
import java.awt.BorderLayout;
44
import java.awt.Color;
45
import java.awt.Dimension;
46
import java.awt.FlowLayout;
47
import java.awt.event.ActionEvent;
48
import java.awt.event.ActionListener;
49
import java.sql.Types;
50

    
51
import javax.swing.BorderFactory;
52
import javax.swing.DefaultComboBoxModel;
53
import javax.swing.ImageIcon;
54
import javax.swing.JComboBox;
55
import javax.swing.JLabel;
56
import javax.swing.JPanel;
57

    
58
import org.apache.log4j.Logger;
59
import org.gvsig.gui.beans.swing.GridBagLayoutPanel;
60
import org.gvsig.gui.beans.swing.JBlank;
61
import org.gvsig.gui.beans.swing.JIncrementalNumberField;
62
import org.gvsig.symbology.fmap.rendering.ProportionalSymbolsLegend;
63
import org.gvsig.symbology.fmap.symbols.MarkerFillSymbol;
64

    
65
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
66
import com.hardcode.gdbms.engine.data.DataSource;
67
import com.hardcode.gdbms.engine.values.Value;
68
import com.hardcode.gdbms.engine.values.ValueFactory;
69
import com.iver.andami.PluginServices;
70
import com.iver.andami.messages.NotificationManager;
71
import com.iver.cit.gvsig.fmap.core.FShape;
72
import com.iver.cit.gvsig.fmap.core.SymbologyFactory;
73
import com.iver.cit.gvsig.fmap.core.styles.IMarkerFillPropertiesStyle;
74
import com.iver.cit.gvsig.fmap.core.symbols.ILineSymbol;
75
import com.iver.cit.gvsig.fmap.core.symbols.IMarkerSymbol;
76
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol;
77
import com.iver.cit.gvsig.fmap.core.symbols.SimpleLineSymbol;
78
import com.iver.cit.gvsig.fmap.core.symbols.SimpleMarkerSymbol;
79
import com.iver.cit.gvsig.fmap.layers.FLayer;
80
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
81
import com.iver.cit.gvsig.fmap.layers.SelectableDataSource;
82
import com.iver.cit.gvsig.fmap.layers.layerOperations.AlphanumericData;
83
import com.iver.cit.gvsig.fmap.layers.layerOperations.ClassifiableVectorial;
84
import com.iver.cit.gvsig.fmap.rendering.ILegend;
85
import com.iver.cit.gvsig.project.documents.view.legend.gui.ILegendPanel;
86
import com.iver.cit.gvsig.project.documents.view.legend.gui.JSymbolPreviewButton;
87
import com.iver.cit.gvsig.project.documents.view.legend.gui.Quantities;
88

    
89

    
90
/**
91
 * Implements the panel for the legend of proportional symbols.In the interface will be
92
 * options to select the value field, the normalization field (if the user wants to use it) and
93
 * options to select the symbol an its minimum and maximum size.
94
 *
95
 * Also there will be possible to select a background symbol (only when the shapetype of the layer is
96
 * polygonal).
97
 *
98
 * @author jaume dominguez faus - jaume.dominguez@iver.es
99
 */
100
public class ProportionalSymbols extends JPanel implements ILegendPanel{
101
        private static final long serialVersionUID = 7394720230276170902L;
102
        private JPanel symbolPanel;
103
        private JPanel backgroundPanel;
104
        private JSymbolPreviewButton tmplateSymbol;
105
        private JSymbolPreviewButton backSymbol;
106
        private JComboBox cmbValue;
107
        private JComboBox cmbNormalization;
108
        private JIncrementalNumberField txtMinSize;
109
        private JIncrementalNumberField txtMaxSize;
110
        private static Logger logger = Logger.getLogger(ProportionalSymbols.class.getName());
111
        private ClassifiableVectorial myLayer;
112
        private ProportionalSymbolsLegend auxLegend;
113
        private ProportionalSymbolsLegend theLegend;
114
        private String[] fieldNames;
115
        private int templateShapeType = 0 ;
116
        private String noNormalization = PluginServices.getText(this, "none");
117
        private boolean useNormalization = true;
118

    
119
        /**
120
         * Default constructor
121
         */
122
        public ProportionalSymbols() {
123
                initialize();
124
        }
125

    
126
        /**
127
         * This method initializes this
128
         */
129
        private void initialize() {
130

    
131
                setLayout(new BorderLayout());
132
                JPanel aux = new JPanel(new BorderLayout());
133

    
134
                JPanel fieldsPanel = new JPanel(new FlowLayout());
135
                fieldsPanel.setBorder(BorderFactory.
136
                                createTitledBorder(null,
137
                                                PluginServices.getText(this, "fields")));
138
                fieldsPanel.setPreferredSize(new Dimension(300,60));
139

    
140
                cmbValue = new JComboBox();
141
                cmbValue.setActionCommand("VALUE_SELECTED");
142

    
143
                cmbNormalization = new JComboBox();
144
                cmbNormalization.setActionCommand("NORMALIZATION_SELECTED");
145

    
146
                fieldsPanel.add(new JLabel(PluginServices.getText(this, "value")+":" ));
147
                fieldsPanel.add(cmbValue);
148

    
149
                fieldsPanel.add(new JLabel(PluginServices.getText(this, "normalization")+":" ));
150
                fieldsPanel.add(cmbNormalization);
151

    
152

    
153
                symbolPanel = new JPanel(new FlowLayout(FlowLayout.LEADING, 3,2));
154
                symbolPanel.setBorder(BorderFactory.
155
                                createTitledBorder(null,
156
                                                PluginServices.getText(this, "symbol")));
157

    
158
                GridBagLayoutPanel aux2 = new GridBagLayoutPanel();
159
                aux2.addComponent(new JLabel(PluginServices.getText(this, "size")));
160
                aux2.addComponent(new JBlank(10,10));
161
                aux2.addComponent(PluginServices.getText(this, "from")+":",
162
                                getTxtMinSize());
163
                aux2.addComponent(PluginServices.getText(this, "to")+":",
164
                                getTxtMaxSize());
165

    
166
                JPanel templatePanel = new JPanel();
167
                templatePanel.setBorder(BorderFactory.createTitledBorder(null,
168
                                PluginServices.getText(this, "template")));
169
                templatePanel.add(getTemplSymbol());
170
                symbolPanel.add(new JBlank(10,10));
171
                symbolPanel.add(aux2);
172
                symbolPanel.add(new JBlank(10,10));
173
                symbolPanel.add(templatePanel);
174

    
175
                aux.add(fieldsPanel, BorderLayout.NORTH);
176
                aux.add(symbolPanel, BorderLayout.CENTER);
177

    
178
                this.add(aux, BorderLayout.CENTER);
179

    
180
                cmbValue.addActionListener(action);
181
                cmbNormalization.addActionListener(action);
182
                tmplateSymbol.addActionListener(action);
183
        }
184
        /**
185
         * Creates the panel where the button for the background symbol will be placed
186
         *
187
         * @return JPanel panel
188
         */
189

    
190
        private JPanel getBackgroundPanel() {
191
                backgroundPanel = new JPanel();
192
                backgroundPanel.setBorder(BorderFactory.createTitledBorder(null,
193
                                PluginServices.getText(this, "background")));
194
                backgroundPanel.add(getBtnBackground());
195
                return backgroundPanel;
196
        }
197
        /**
198
         * Creates a JIncrementalNumberField which is used to select the maximum size for the symbol
199
         *
200
         * @return JIncrementalNumberField
201
         */
202
        private JIncrementalNumberField getTxtMaxSize() {
203
                if (txtMaxSize == null) {
204
                        txtMaxSize = new JIncrementalNumberField(String.valueOf(25), 7,0,100,1);
205
                        txtMaxSize.addActionListener(action);
206
                }
207
                return txtMaxSize;
208
        }
209
        /**
210
         * Creates a JIncrementalNumberField which is used to select the minimum size for the symbol
211
         *
212
         * @return JIncrementalNumberField
213
         */
214
        private JIncrementalNumberField getTxtMinSize() {
215
                if (txtMinSize == null) {
216
                        txtMinSize = new JIncrementalNumberField(String.valueOf(3), 7,0,100,1);
217
                        txtMinSize.addActionListener(action);
218
                }
219
                return txtMinSize;
220
        }
221
        /**
222
         * Creates a JSymbolPreviewButton which is used to select the template symbol
223
         *
224
         * @return JSymbolPreviewButton
225
         */
226
        private JSymbolPreviewButton getTemplSymbol() {
227

    
228
                if (tmplateSymbol == null) {
229
                        int templateShapeType = (this.templateShapeType == FShape.POLYGON) ? FShape.POINT : this.templateShapeType;
230
                        tmplateSymbol = new JSymbolPreviewButton(templateShapeType);
231
                }
232
                tmplateSymbol.setPreferredSize(new Dimension(100, 45));
233
                return tmplateSymbol;
234
        }
235
        /**
236
         * Creates a JSymbolPreviewButton which is used to select the background symbol
237
         *
238
         * @return JSymbolPreviewButton
239
         */
240
        private JSymbolPreviewButton getBtnBackground() {
241
                if (backSymbol == null) {
242
                        backSymbol = new JSymbolPreviewButton(FShape.POLYGON);
243
                        backSymbol.setPreferredSize(new Dimension(100, 45));
244
                }
245
                return backSymbol;
246
        }
247
        /**
248
         * Creates a new symbol of an specific shapetype with a concrete size
249
         *
250
         * @param shapeType
251
         * @param size
252
         *
253
         * @return ISymbol symbol created
254
         */
255
        private ISymbol newSymbol(int shapeType, double size) {
256
                if (getTemplSymbol().getSymbol() == null) {
257
                        ISymbol templateSymbol;
258
                        switch (shapeType) {
259
                        case FShape.POINT:
260
                        case FShape.POLYGON:
261
                                templateSymbol = new SimpleMarkerSymbol();
262
                                ((SimpleMarkerSymbol) templateSymbol).setSize(size);
263
                                ((SimpleMarkerSymbol) templateSymbol).setColor(Color.DARK_GRAY);
264
                                break;
265

    
266
                        case FShape.LINE:
267
                                templateSymbol = new SimpleLineSymbol();
268
                                ((SimpleLineSymbol) templateSymbol).setLineWidth(size);
269
                                ((SimpleLineSymbol) templateSymbol).setLineColor(Color.DARK_GRAY);
270
                                break;
271
                        default:
272
                                throw new Error("Unknown symbol type");
273
                        }
274
                        getTemplSymbol().setSymbol(templateSymbol);
275
                        return newSymbol(shapeType, size);
276
                } else {
277
                        // clone symbol
278
                        ISymbol mySymbol = SymbologyFactory.createSymbolFromXML(
279
                                        getTemplSymbol().getSymbol().getXMLEntity(), null);
280

    
281
                        if (mySymbol instanceof ILineSymbol) {
282
                                ILineSymbol lSym = (ILineSymbol) mySymbol;
283
                                lSym.setLineWidth(size);
284

    
285
                        }
286
                        if (mySymbol instanceof IMarkerSymbol) {
287
                                IMarkerSymbol mSym = (IMarkerSymbol) mySymbol;
288
                                mSym.setSize(size);
289
                                if (shapeType == FShape.POLYGON) {
290
                                        // this is to allow using in Polygon layers
291
                                        MarkerFillSymbol fillSymbol = new MarkerFillSymbol();
292
                                        fillSymbol.setOutline(null);
293
                                        fillSymbol.setFillColor(null);
294
                                        fillSymbol.getMarkerFillProperties().
295
                                        setFillStyle(IMarkerFillPropertiesStyle.SINGLE_CENTERED_SYMBOL);
296
                                        fillSymbol.setMarker(mSym);
297
                                }
298
                        }
299
                        return mySymbol;
300
                }
301
        }
302

    
303
        /**
304
         * Fills the comboboxes that are placed in the panel with the classifying field names of the layer
305
         * which contain numerical information
306
         *
307
         */
308
        private void fillFieldNames() {
309
                DataSource rs;
310

    
311
                try {
312
                        rs = ((AlphanumericData) myLayer).getRecordset();
313
                        logger.debug("rs.start()");
314
                        rs.start();
315

    
316
                        int cont = 0;
317
                        for (int i = 0; i < rs.getFieldCount(); i++) {
318
                                if(isNumericField(rs.getFieldType(i)))
319
                                        cont++;
320
                        }
321
                        String[] nomFields = new String[cont];
322

    
323
                        cont = 0;
324
                        for (int i = 0; i < rs.getFieldCount(); i++) {
325
                                if (isNumericField(rs.getFieldType(i))) {
326
                                        nomFields[cont] = rs.getFieldName(i).trim();
327
                                        cont++;
328
                                }
329
                        }
330

    
331
                        rs.stop();
332
                        this.fieldNames = nomFields;
333

    
334
                        DefaultComboBoxModel cMValue = new DefaultComboBoxModel(this.fieldNames);
335
                        DefaultComboBoxModel cMNormalization = new DefaultComboBoxModel(this.fieldNames);
336
                        cmbValue.setModel(cMValue);
337
                        cmbNormalization.setModel(cMNormalization);
338
                        cmbNormalization.addItem(noNormalization);
339

    
340
                } catch (ReadDriverException e) {
341
                        NotificationManager.addError(PluginServices.getText(this, "recovering_recordset"), e);
342
                }
343
        }
344

    
345

    
346
        public void setData(FLayer lyr, ILegend legend) {
347

    
348
                this.myLayer = (ClassifiableVectorial) lyr;
349

    
350
                fillFieldNames();
351

    
352
                try {
353
                        templateShapeType = (this.myLayer.getShapeType() == FShape.POLYGON) ? FShape.POINT : this.myLayer.getShapeType();
354
                        getTemplSymbol().setShapeType(templateShapeType);
355

    
356
                        if(myLayer.getShapeType() == FShape.POLYGON && backgroundPanel == null)
357
                                symbolPanel.add(getBackgroundPanel());
358

    
359
                } catch (ReadDriverException e) {
360
                        NotificationManager.addError(PluginServices.getText(this, "error accessing to the layer"), e);
361
                }
362

    
363
                if (ProportionalSymbolsLegend.class.equals(legend.getClass())) {
364

    
365
                        auxLegend = (ProportionalSymbolsLegend) legend;
366
                        cmbValue.setSelectedItem(auxLegend.getClassifyingFieldNames()[0]);
367
                        ISymbol defSymbol = auxLegend.getDefaultSymbol();
368

    
369
                        if(((ProportionalSymbolsLegend) auxLegend).getUseNormalization())
370
                                cmbNormalization.setSelectedItem(auxLegend.getClassifyingFieldNames()[1]);
371
                        else cmbNormalization.setSelectedItem(noNormalization);
372

    
373
                        txtMaxSize.setDouble(auxLegend.getMaxSize());
374
                        txtMinSize.setDouble(auxLegend.getMinSize());
375

    
376
                        getTemplSymbol().setSymbol(defSymbol);
377

    
378
                        if(((ProportionalSymbolsLegend) auxLegend).getBackgroundSymbol() != null)
379
                                getBtnBackground().setSymbol(((ProportionalSymbolsLegend) auxLegend).getBackgroundSymbol());
380

    
381
                        action.actionPerformed(new ActionEvent(txtMinSize, 0, "no_hace_falta"));
382

    
383
                } else {
384

    
385
                        auxLegend = new ProportionalSymbolsLegend();
386
                        auxLegend.setTemplateShapeType(templateShapeType);
387
                        auxLegend.setDefaultSymbol(newSymbol(templateShapeType, templateShapeType == FShape.LINE ? 3 : 10));
388
                        getTemplSymbol().setSymbol(auxLegend.getDefaultSymbol());
389
                        if(templateShapeType == FShape.LINE) {
390
                                txtMinSize.setDouble(3);
391
                                txtMaxSize.setDouble(3);
392
                        }
393

    
394
                        else {
395
                                txtMinSize.setDouble(10);
396
                                txtMaxSize.setDouble(10);
397
                        }
398
                }
399

    
400
        }
401

    
402

    
403
        public ILegend getLegend() {
404
                theLegend = new ProportionalSymbolsLegend();
405

    
406
                String[] fieldNames = new String[2];
407
                fieldNames[0]= cmbValue.getSelectedItem().toString();
408

    
409
                if(!useNormalization)
410
                        fieldNames[1]= fieldNames[0];
411
                else fieldNames[1]= cmbNormalization.getSelectedItem().toString();
412

    
413
                auxLegend.setTemplateShapeType(templateShapeType);
414
                auxLegend.setValueField(cmbValue.getSelectedItem().toString());
415
                auxLegend.setNormalizationField(cmbNormalization.getSelectedItem().toString());
416
                auxLegend.setUseNormalization(useNormalization);
417

    
418
                auxLegend.setMinSize(txtMinSize.getDouble());
419
                auxLegend.setMaxSize(txtMaxSize.getDouble());
420

    
421
                ISymbol symbol = getTemplSymbol().getSymbol();
422
                symbol.setDescription(getSymbolDescription());
423
                auxLegend.setDefaultSymbol(symbol);
424
                auxLegend.addSymbol(ValueFactory.createValue("defaultSymbol"), symbol);
425

    
426
                auxLegend.setBackgroundSymbol(getBtnBackground().getSymbol());
427
                auxLegend.setClassifyingFieldNames(fieldNames);
428

    
429
                DataSource recordSet = null;
430

    
431

    
432
                try {
433
                        recordSet = ((AlphanumericData) myLayer).getRecordset();
434

    
435
                        for (int i = 0; i < fieldNames.length; i++) {
436
                                double min = 0, max = 0;
437

    
438
                                for (int j = 0; j < recordSet.getRowCount(); j++) {
439
                                        Value val = recordSet.getFieldValue(j, recordSet.getFieldIndexByName(fieldNames[i]));
440
                                        double dob = Double.valueOf(val.toString());
441
                                        if (dob < min) min = dob;
442
                                        if (dob > max) max = dob;
443
                                }
444
                                if(i == 0) {
445
                                        auxLegend.setMinFeature(min);
446
                                        auxLegend.setMaxFeature(max);
447
                                }
448
                        }
449

    
450
                } catch (ReadDriverException e) {
451
                        NotificationManager.addError("error_accessing_to_the_layer",e);
452
                }
453
                theLegend = auxLegend;
454

    
455
                return theLegend;
456
        }
457
        /**
458
         * Creates the String which will be the description of the symbol. If the selected normalization field
459
         * is not "None", then the String created will have this structure ValueField/NormalizationField. Else,
460
         * if the user select "None" for the normalization field,the string will show the ValueField only.
461
         *
462
         * @return String        description for the symbol
463
         */
464

    
465
        private String getSymbolDescription() {
466
                String description = "";
467

    
468
                if (cmbValue.getSelectedItem() != null)
469
                        description += cmbValue.getSelectedItem().toString();
470
                if (cmbNormalization.getSelectedItem().toString().compareTo(noNormalization) != 0 )
471
                        description += " / "+cmbNormalization.getSelectedItem().toString();
472

    
473
                return description;
474
        }
475

    
476
        public String getDescription() {
477
                return PluginServices.getText(this, "draw_quantities_using_symbol_size_to_show_exact_values");
478
        }
479

    
480
        public ImageIcon getIcon() {
481
                // TODO Implement it
482
                return null;
483
        }
484

    
485
        public Class getParentClass() {
486
                return Quantities.class;
487
        }
488

    
489
        public String getTitle() {
490
                return PluginServices.getText(this, "proportional_symbols");
491
        }
492

    
493
        public Class getLegendClass() {
494
                return ProportionalSymbolsLegend.class;
495
        }
496
        /**
497
         * Checks if an specific field contains numerical data
498
         *
499
         * @param fieldType        index of the field
500
         *
501
         * @return boolean        true or false depending on the type of data (numerical or not)
502
         */
503
        private boolean isNumericField(int fieldType) {
504
                switch (fieldType) {
505
                case Types.BIGINT:
506
                case Types.DECIMAL:
507
                case Types.DOUBLE:
508
                case Types.FLOAT:
509
                case Types.INTEGER:
510
                case Types.NUMERIC:
511
                case Types.REAL:
512
                case Types.SMALLINT:
513
                case Types.TINYINT:
514
                        return true;
515
                default:
516
                        return false;
517
                }
518

    
519
        }
520
        public boolean isSuitableFor(FLayer layer) {
521
                if (layer instanceof FLyrVect) {
522
                        FLyrVect lyr = (FLyrVect) layer;
523
                        try {
524
                                if (lyr.getShapeType() == FShape.MULTI)
525
                                        return false;
526

    
527
                                SelectableDataSource sds;
528
                                sds = ((FLyrVect) layer).getRecordset();
529
                                String[] fNames = sds.getFieldNames();
530
                                for (int i = 0; i < fNames.length; i++) {
531
                                        if (isNumericField(sds.getFieldType(i))) {
532
                                                return true;
533
                                        }
534
                                }
535
                        } catch (ReadDriverException e) {
536
                                return false;
537
                        }
538
                }
539
                return false;
540
        }
541

    
542

    
543
        public JPanel getPanel() {
544
                return this;
545
        }
546

    
547

    
548
        private ActionListener action = new ActionListener() {
549

    
550
                public void actionPerformed(ActionEvent e) {
551

    
552
                        if (e.getSource().equals(cmbValue)) {
553
                                JComboBox cb = (JComboBox) e.getSource();
554
                                auxLegend.setValueField(cb.getSelectedItem().toString());
555
                        }
556
                        if (e.getSource().equals(cmbNormalization)) {
557
                                JComboBox cb = (JComboBox) e.getSource();
558
                                if(cb.getSelectedItem().toString().compareTo(noNormalization) == 0) {
559
                                        useNormalization = false;
560
                                        auxLegend.setNormalizationField(cmbValue.getSelectedItem().toString());
561
                                }
562
                                else {
563
                                        useNormalization = true;
564
                                        auxLegend.setNormalizationField(cb.getSelectedItem().toString());
565
                                }
566
                                auxLegend.setUseNormalization(useNormalization);
567
                        }
568
                        if (e.getSource().equals(txtMinSize)) {
569
//                                ISymbol sym = tmplateSymbol.getSymbol();
570
//                                if(sym != null) {
571
//                                        if(sym instanceof ILineSymbol) {
572
//                                                ILineSymbol line = (ILineSymbol)sym;
573
//                                                line.setLineWidth(txtMinSize.getDouble());
574
//                                                tmplateSymbol.setSymbol(line);
575
//                                        }
576
//
577
//                                        if(sym instanceof IMarkerSymbol) {
578
//                                                IMarkerSymbol point = (IMarkerSymbol)sym;
579
//                                                point.setSize(txtMinSize.getDouble());
580
//                                                tmplateSymbol.setSymbol(point);
581
//                                        }
582
//                                        tmplateSymbol.repaint();
583
//                                }
584

    
585
                                if(txtMaxSize.getDouble() < txtMinSize.getDouble())
586
                                        txtMaxSize.setDouble(txtMinSize.getDouble());
587
                        }
588
                        if(e.getSource().equals(txtMaxSize)) {
589
                                if(txtMaxSize.getDouble() < txtMinSize.getDouble())
590
                                        txtMinSize.setDouble(txtMaxSize.getDouble());
591
                        }
592
                        if(e.getSource().equals(tmplateSymbol)) {
593
                                ISymbol sym = tmplateSymbol.getSymbol();
594
                                if(sym != null) {
595
                                        if(sym instanceof ILineSymbol) {
596
                                                ILineSymbol line = (ILineSymbol)sym;
597
                                                txtMinSize.setDouble(((int)line.getLineWidth()));
598
                                                txtMaxSize.setDouble(((int)line.getLineWidth()));
599
                                        }
600

    
601
                                        if(sym instanceof IMarkerSymbol) {
602
                                                IMarkerSymbol point = (IMarkerSymbol)sym;
603
                                                txtMinSize.setDouble(((int)point.getSize()));
604
                                                txtMaxSize.setDouble(((int)point.getSize()));
605
                                        }
606
                                }
607
                        }
608
                }
609
        };
610

    
611
}