Statistics
| Revision:

root / trunk / extensions / extTopology / src / com / iver / cit / gvsig / geoprocess / impl / polygonbuild / gui / PolygonBuildGeoprocessPanel.java @ 32785

History | View | Annotate | Download (5.37 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 21235 2008-06-05 14:08:38Z 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.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
import com.iver.cit.gvsig.geoprocess.impl.polygonbuild.IPolygonBuildGeoprocessUserEntries;
75

    
76
public class PolygonBuildGeoprocessPanel extends AbstractGeoprocessGridbagPanel
77
        implements IPolygonBuildGeoprocessUserEntries{
78

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

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

    
186
        protected void processLayerComboBoxStateChange(ItemEvent e) {
187
        }
188

    
189
}
190