svn-gvsig-desktop / trunk / extensions / extGraph_predes / src / com / iver / cit / gvsig / graph / gui / wizard / NetPage0.java @ 9173
History | View | Annotate | Download (5.35 KB)
1 |
/*
|
---|---|
2 |
* Created on 09-nov-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: NetPage0.java 9173 2006-12-04 17:13:39Z fjp $
|
47 |
* $Log$
|
48 |
* Revision 1.9 2006-12-04 17:13:39 fjp
|
49 |
* *** empty log message ***
|
50 |
*
|
51 |
* Revision 1.8 2006/11/13 20:41:08 azabala
|
52 |
* *** empty log message ***
|
53 |
*
|
54 |
* Revision 1.7 2006/11/09 21:08:32 azabala
|
55 |
* *** empty log message ***
|
56 |
*
|
57 |
*
|
58 |
*/
|
59 |
package com.iver.cit.gvsig.graph.gui.wizard; |
60 |
|
61 |
import javax.swing.ButtonGroup; |
62 |
import javax.swing.JEditorPane; |
63 |
import javax.swing.JRadioButton; |
64 |
import javax.swing.JSpinner; |
65 |
import javax.swing.SpinnerNumberModel; |
66 |
|
67 |
import jwizardcomponent.JWizardPanel; |
68 |
|
69 |
import org.gvsig.gui.beans.swing.GridBagLayoutPanel; |
70 |
|
71 |
import com.iver.andami.PluginServices; |
72 |
import com.iver.cit.gvsig.graph.gui.HTMLEditorKit; |
73 |
|
74 |
/**
|
75 |
* First page of the wizard.
|
76 |
* It prevents user of pseudonodes in a linear layer, and offers
|
77 |
* them to launch clean geoprocess to remove pseudonodes.
|
78 |
*
|
79 |
* Also, it offers users to work with a snap tolerance in node definition.
|
80 |
*
|
81 |
* @author alzabord
|
82 |
*
|
83 |
*/
|
84 |
public class NetPage0 extends JWizardPanel { |
85 |
private NetWizard owner;
|
86 |
|
87 |
JRadioButton originalLayerBtn;
|
88 |
JRadioButton cleanedLayerBtn;
|
89 |
JRadioButton originalCoordinatesBtn;
|
90 |
JRadioButton snappedCoordinatesBtn;
|
91 |
JSpinner snapTolerance;
|
92 |
|
93 |
NetPage0(NetWizard wizard) { |
94 |
super(wizard.getWizardComponents());
|
95 |
this.owner = wizard;
|
96 |
initialize(); |
97 |
} |
98 |
|
99 |
|
100 |
public boolean cleanOriginalLayer(){ |
101 |
return cleanedLayerBtn.isSelected();
|
102 |
} |
103 |
|
104 |
public boolean applySnapTolerance(){ |
105 |
return snappedCoordinatesBtn.isSelected();
|
106 |
} |
107 |
|
108 |
public double getSnapTolerance(){ |
109 |
if(applySnapTolerance())
|
110 |
return ((Number) snapTolerance.getValue()).doubleValue(); |
111 |
else
|
112 |
return 0d; |
113 |
} |
114 |
|
115 |
|
116 |
public void next() { |
117 |
super.next();
|
118 |
owner.setCleanOriginalLayer(cleanOriginalLayer()); |
119 |
boolean applySnap = applySnapTolerance();
|
120 |
if(applySnap){
|
121 |
owner.setSnapTolerance(getSnapTolerance()); |
122 |
} |
123 |
owner.setApplySnapTolerance(applySnap); |
124 |
} |
125 |
|
126 |
|
127 |
private void initialize() { |
128 |
// this.setSize(new java.awt.Dimension(319,234));
|
129 |
GridBagLayoutPanel contentPane = new GridBagLayoutPanel();
|
130 |
|
131 |
JEditorPane htmlPanel = new JEditorPane(); |
132 |
htmlPanel.setEditable(false);
|
133 |
htmlPanel.setEditorKit(new HTMLEditorKit()); |
134 |
String layerName = owner.getLayer().getName();
|
135 |
String htmlText = "<p><font face='Arial, Helvetica, sans-serif'>Se va a construir una red para la capa de l?neas " + |
136 |
layerName + |
137 |
" .<br> La presencia de pseudonodos puede originar <br>resultados no deseados. " +
|
138 |
"<img src=\"images/lmust_not_dangle.gif\">" +
|
139 |
"<br> Por favor, marque lo que desea hacer: </font></p>";
|
140 |
htmlPanel.setText(htmlText); |
141 |
contentPane.addComponent(htmlPanel); |
142 |
|
143 |
|
144 |
contentPane.addBlank(); |
145 |
contentPane.addBlank(); |
146 |
contentPane.addBlank(); |
147 |
|
148 |
originalLayerBtn = new JRadioButton(PluginServices.getText(this, "Calcular_la_red_sobre_la_capa_original")); |
149 |
originalLayerBtn.setSelected(true);
|
150 |
|
151 |
cleanedLayerBtn = new JRadioButton(PluginServices.getText(this, "Aplicar_un_CLEAN_sobre_la_capa_original")); |
152 |
|
153 |
ButtonGroup cleanGroup = new ButtonGroup(); |
154 |
cleanGroup.add(originalLayerBtn); |
155 |
cleanGroup.add(cleanedLayerBtn); |
156 |
|
157 |
contentPane.addComponent(originalLayerBtn); |
158 |
contentPane.addComponent(cleanedLayerBtn); |
159 |
|
160 |
contentPane.addBlank(); |
161 |
contentPane.addBlank(); |
162 |
contentPane.addBlank(); |
163 |
|
164 |
originalCoordinatesBtn = new JRadioButton(PluginServices.getText(this, "Trabajar_con_las_coordenadas_originales")); |
165 |
originalCoordinatesBtn.setSelected(true);
|
166 |
|
167 |
snappedCoordinatesBtn = new JRadioButton(PluginServices.getText(this, "Aplicar_tolerancia_de_snap")); |
168 |
SpinnerNumberModel spinnerModel =
|
169 |
new SpinnerNumberModel(0.01, 0d, 100d, 0.01 ); |
170 |
snapTolerance = new JSpinner(spinnerModel); |
171 |
// Disable keyboard edits in the spinner
|
172 |
// JFormattedTextField tf = ((JSpinner.DefaultEditor) snapTolerance
|
173 |
// .getEditor()).getTextField();
|
174 |
// tf.setEditable(false);
|
175 |
// tf.setBackground(Color.white);
|
176 |
|
177 |
ButtonGroup snapGroup = new ButtonGroup(); |
178 |
snapGroup.add(originalCoordinatesBtn); |
179 |
snapGroup.add(snappedCoordinatesBtn); |
180 |
|
181 |
contentPane.addComponent(originalCoordinatesBtn); |
182 |
contentPane.addComponent(snappedCoordinatesBtn, snapTolerance); |
183 |
|
184 |
|
185 |
this.add(contentPane);
|
186 |
} |
187 |
|
188 |
} // @jve:decl-index=0:visual-constraint="10,10"
|