Statistics
| Revision:

root / trunk / extensions / extGeoprocessingExtensions / src / com / iver / cit / gvsig / geoprocess / impl / topology / polygonbuild / gui / PolygonBuildGeoprocessPanel.java @ 9420

History | View | Annotate | Download (5.16 KB)

1
/*
2
 * Created on 15-dic-2006
3
 *
4
 * gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
5
 *
6
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
7
 *
8
 * This program is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU General Public License
10
 * as published by the Free Software Foundation; either version 2
11
 * of the License, or (at your option) any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program; if not, write to the Free Software
20
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
21
 *
22
 * For more information, contact:
23
 *
24
 *  Generalitat Valenciana
25
 *   Conselleria d'Infraestructures i Transport
26
 *   Av. Blasco Ib??ez, 50
27
 *   46010 VALENCIA
28
 *   SPAIN
29
 *
30
 *      +34 963862235
31
 *   gvsig@gva.es
32
 *      www.gvsig.gva.es
33
 *
34
 *    or
35
 *
36
 *   IVER T.I. S.A
37
 *   Salamanca 50
38
 *   46005 Valencia
39
 *   Spain
40
 *
41
 *   +34 963163400
42
 *   dac@iver.es
43
 */
44
/* CVS MESSAGES:
45
*
46
* $Id: PolygonBuildGeoprocessPanel.java 9420 2006-12-21 17:23:48Z azabala $
47
* $Log$
48
* Revision 1.1  2006-12-21 17:23:27  azabala
49
* *** empty log message ***
50
*
51
* Revision 1.2  2006/12/19 19:29:50  azabala
52
* *** empty log message ***
53
*
54
* Revision 1.1  2006/12/15 19:06:29  azabala
55
* scheleton of polygon build
56
*
57
*
58
*/
59
package com.iver.cit.gvsig.geoprocess.impl.topology.polygonbuild.gui;
60

    
61
import java.awt.GridBagConstraints;
62
import java.awt.Insets;
63
import java.awt.event.ActionEvent;
64
import java.awt.event.ActionListener;
65
import java.awt.event.ItemEvent;
66

    
67
import javax.swing.JCheckBox;
68
import javax.swing.JTextField;
69

    
70
import com.iver.andami.PluginServices;
71
import com.iver.cit.gvsig.fmap.layers.FLayers;
72
import com.iver.cit.gvsig.geoprocess.core.fmap.GeoprocessException;
73
import com.iver.cit.gvsig.geoprocess.core.gui.AbstractGeoprocessGridbagPanel;
74

    
75
public class PolygonBuildGeoprocessPanel extends AbstractGeoprocessGridbagPanel {
76

    
77
        private JCheckBox snapToleranceCb;
78
        private JTextField snapToleranceTf;
79
        
80
        private JCheckBox dangleToleranceCb;
81
        private JTextField dangleToleranceTf;
82
        
83
        
84
        private JCheckBox previousCleanCb;
85
        
86
        
87
        private JCheckBox addGroupOfLyrsCb;
88
        
89
        public PolygonBuildGeoprocessPanel(FLayers layers) {
90
                super(layers, PluginServices.getText(null, "Build_de_poligonos"));
91
        }
92

    
93
        public boolean applySnapTolerance(){
94
                return snapToleranceCb.isSelected();
95
        }
96
        
97
        public double getSnapTolerance() throws GeoprocessException{
98
                try {
99
                        String strDist = this.snapToleranceTf.getText();
100
                        return Double.parseDouble(strDist);
101
                } catch (NumberFormatException ex) {
102
                        throw new GeoprocessException(
103
                                        "Tolerancia de snap introducida no numerica");
104
                }
105
        }
106
        
107
        public boolean applyDangleTolerance(){
108
                return dangleToleranceCb.isSelected();
109
        }
110
        
111
        public double getDangleTolerance() throws GeoprocessException{
112
                try {
113
                        String strDist = this.dangleToleranceTf.getText();
114
                        return Double.parseDouble(strDist);
115
                } catch (NumberFormatException ex) {
116
                        throw new GeoprocessException(
117
                                        "Tolerancia de dangle introducida no numerica");
118
                }
119
        }
120
        
121
        public boolean computeCleanBefore(){
122
                return previousCleanCb.isSelected();
123
        }
124
        
125
        public boolean addGroupOfLyrs(){
126
                return addGroupOfLyrsCb.isSelected();
127
        }
128
        
129
        
130
        protected void addSpecificDesign() {
131
                Insets insets = new Insets(5, 5, 5, 5);
132
                
133
                //snap tolerance
134
                this.snapToleranceCb = new JCheckBox();
135
                this.snapToleranceCb.setText(PluginServices.getText(this,
136
                                "Aplicar_tolerancia_de_snap"));
137
                this.snapToleranceTf = new JTextField(20);
138
                this.snapToleranceTf.setEnabled(false);
139
                this.snapToleranceCb.addActionListener(new ActionListener(){
140
                        public void actionPerformed(ActionEvent arg0) {
141
                                snapToleranceTf.setEnabled(snapToleranceCb.isSelected());
142
                                
143
                        }});
144
                addComponent(snapToleranceCb, 
145
                                snapToleranceTf,
146
                                GridBagConstraints.NONE, 
147
                                insets);
148
                
149
                //dangle tolerance
150
                this.dangleToleranceCb = new JCheckBox();
151
                this.dangleToleranceCb.setText(PluginServices.getText(this,
152
                                "Aplicar_tolerancia_de_dangles"));
153
                this.dangleToleranceTf = new JTextField(20);
154
                this.dangleToleranceTf.setEnabled(false);
155
                this.dangleToleranceCb.addActionListener(new ActionListener(){
156
                        public void actionPerformed(ActionEvent arg0) {
157
                                dangleToleranceTf.setEnabled(dangleToleranceCb.isSelected());
158
                                
159
                        }});
160
                addComponent(dangleToleranceCb, 
161
                                dangleToleranceTf,
162
                                GridBagConstraints.NONE, 
163
                                insets);
164
                //clean previous
165
                this.previousCleanCb = new JCheckBox();
166
                this.previousCleanCb.setText(PluginServices.getText(this,
167
                "Limpiar_topologicamente_la_capa_de_entrada"));
168
                addComponent(previousCleanCb, 
169
                                GridBagConstraints.NONE, 
170
                                insets);
171
                
172
                //add dangles to toc
173
                this.addGroupOfLyrsCb = new JCheckBox();
174
                this.addGroupOfLyrsCb.setText(PluginServices.getText(this,
175
                                "A?adir_al_TOC_geometrias_erroneas"));
176
                addComponent(addGroupOfLyrsCb, 
177
                                GridBagConstraints.NONE, 
178
                                insets);
179
                //FORCE THIS IN ALL GRIDBAGPANEL IMPLEMENTATIONS
180
                initSelectedItemsJCheckBox();
181
                updateNumSelectedFeaturesLabel();
182
        }
183

    
184
        protected void processLayerComboBoxStateChange(ItemEvent e) {
185
        }
186

    
187
}
188