root / trunk / extensions / extGraph_predes / src / com / iver / cit / gvsig / graph / gui / wizard / NetWizard.java @ 8647
History | View | Annotate | Download (6.95 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 |
|
42 |
/* CVS MESSAGES:
|
43 |
*
|
44 |
* $Id: NetWizard.java 8647 2006-11-09 12:51:12Z jaume $
|
45 |
* $Log$
|
46 |
* Revision 1.7 2006-11-09 12:51:12 jaume
|
47 |
* *** empty log message ***
|
48 |
*
|
49 |
* Revision 1.6 2006/11/09 09:01:05 azabala
|
50 |
* *** empty log message ***
|
51 |
*
|
52 |
* Revision 1.5 2006/11/08 20:14:42 azabala
|
53 |
* *** empty log message ***
|
54 |
*
|
55 |
* Revision 1.4 2006/10/25 19:13:55 azabala
|
56 |
* *** empty log message ***
|
57 |
*
|
58 |
* Revision 1.3 2006/10/24 08:04:41 jaume
|
59 |
* *** empty log message ***
|
60 |
*
|
61 |
* Revision 1.2 2006/10/20 12:02:50 jaume
|
62 |
* GUI
|
63 |
*
|
64 |
* Revision 1.1 2006/10/19 15:12:10 jaume
|
65 |
* *** empty log message ***
|
66 |
*
|
67 |
*
|
68 |
*/
|
69 |
package com.iver.cit.gvsig.graph.gui.wizard; |
70 |
|
71 |
import java.sql.Types; |
72 |
import java.util.ArrayList; |
73 |
|
74 |
import javax.swing.ImageIcon; |
75 |
|
76 |
import org.gvsig.gui.beans.wizard.WizardAndami; |
77 |
|
78 |
import com.iver.andami.PluginServices; |
79 |
import com.iver.andami.ui.mdiManager.IWindow; |
80 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
81 |
import com.iver.cit.gvsig.fmap.layers.FLyrVect; |
82 |
|
83 |
public class NetWizard extends WizardAndami implements IWindow{ |
84 |
public final static String[] COST_UNITS = { |
85 |
PluginServices.getText(NetWizard.class, "seconds" ),
|
86 |
PluginServices.getText(NetWizard.class, "hours" ),
|
87 |
PluginServices.getText(NetWizard.class, "minutes" ),
|
88 |
"hh:mm:ss" ,
|
89 |
PluginServices.getText(NetWizard.class, "millimeters" ),
|
90 |
PluginServices.getText(NetWizard.class, "meters" ),
|
91 |
PluginServices.getText(NetWizard.class, "inches" ),
|
92 |
PluginServices.getText(NetWizard.class, "feet" ),
|
93 |
PluginServices.getText(NetWizard.class, "yards" ),
|
94 |
PluginServices.getText(NetWizard.class, "miles" ),
|
95 |
PluginServices.getText(NetWizard.class, "nautic_miles" ),
|
96 |
PluginServices.getText(NetWizard.class, "monetary" ), // unidades monetarias |
97 |
PluginServices.getText(NetWizard.class, "unknown_longitude_units" ),
|
98 |
PluginServices.getText(NetWizard.class, "unknown_time_units" ),
|
99 |
PluginServices.getText(NetWizard.class, "unknown_units" ),
|
100 |
}; // TODO push it to the corresponding geoprocess class
|
101 |
private FLyrVect lyr;
|
102 |
private WindowInfo wi;
|
103 |
private String[] numericLayerFieldNames; |
104 |
private String fieldLength; |
105 |
private Boolean usingCosts; |
106 |
private String costUnit; |
107 |
private String[] layerFieldNames; |
108 |
private String fieldType; |
109 |
private String fieldSense; |
110 |
private String fieldCost; |
111 |
|
112 |
/**
|
113 |
* flag that tells us if user pressed finish button
|
114 |
* or cancel button
|
115 |
* */
|
116 |
private boolean wasFinishPressed = false; |
117 |
|
118 |
public NetWizard(ImageIcon logo, FLyrVect lyr) { |
119 |
super(logo);
|
120 |
this.lyr = lyr;
|
121 |
getWizardComponents().addWizardPanel(new NetPage0(this)); |
122 |
getWizardComponents().addWizardPanel(new NetPage1(this)); |
123 |
// getWizardComponents().addWizardPanel(new NetPage2(this));
|
124 |
// getWizardComponents().addWizardPanel(new NetPage3(this));
|
125 |
// getWizardComponents().addWizardPanel(new NetPage4(this));
|
126 |
getWizardComponents().setFinishAction(new NetFinishAction(this)); |
127 |
getWizardComponents().setCancelAction(new NetCancelAction(this)); |
128 |
} |
129 |
|
130 |
public FLyrVect getLayer(){
|
131 |
return lyr;
|
132 |
} |
133 |
|
134 |
public WindowInfo getWindowInfo() {
|
135 |
if (wi==null) { |
136 |
wi = new WindowInfo(WindowInfo.RESIZABLE | WindowInfo.MODALDIALOG);
|
137 |
wi.setWidth(720);
|
138 |
wi.setHeight(370);
|
139 |
wi.setTitle(PluginServices.getText(this, "create_network") + "..."); |
140 |
} |
141 |
return wi;
|
142 |
} |
143 |
|
144 |
|
145 |
public void setWasFinishPressed(boolean wasFinish){ |
146 |
this.wasFinishPressed = wasFinish;
|
147 |
} |
148 |
|
149 |
public boolean wasFinishPressed(){ |
150 |
return wasFinishPressed;
|
151 |
} |
152 |
|
153 |
public String[] getNumericLayerFieldNames() { |
154 |
if (numericLayerFieldNames == null) { |
155 |
try {
|
156 |
String[] aux = lyr.getRecordset().getFieldNames(); |
157 |
ArrayList temp = new ArrayList(); |
158 |
for (int i = 0; i < aux.length; i++) { |
159 |
switch (lyr.getRecordset().getFieldType(i)) {
|
160 |
case Types.BIGINT: |
161 |
case Types.DECIMAL: |
162 |
case Types.DOUBLE: |
163 |
case Types.FLOAT: |
164 |
case Types.INTEGER: |
165 |
case Types.NUMERIC: |
166 |
case Types.REAL: |
167 |
case Types.SMALLINT: |
168 |
case Types.TINYINT: |
169 |
temp.add(aux[i]); |
170 |
} |
171 |
} |
172 |
numericLayerFieldNames = (String[]) temp.toArray(new String[0]); |
173 |
} catch (Exception e) { |
174 |
return new String[] {PluginServices.getText(this, "invalid_layer")+"!"}; |
175 |
} |
176 |
} |
177 |
return numericLayerFieldNames;
|
178 |
} |
179 |
|
180 |
public String[] getLayerFieldNames() { |
181 |
if (layerFieldNames == null) { |
182 |
try {
|
183 |
layerFieldNames = lyr.getRecordset().getFieldNames(); |
184 |
} catch (Exception e) { |
185 |
return new String[] {PluginServices.getText(this, "invalid_layer")+"!"}; |
186 |
} |
187 |
} |
188 |
return layerFieldNames;
|
189 |
} |
190 |
|
191 |
public void setLengthField(String lengthField) { |
192 |
this.fieldLength = lengthField;
|
193 |
} |
194 |
|
195 |
public void setTypeField(String fieldType) { |
196 |
this.fieldType = fieldType;
|
197 |
} |
198 |
|
199 |
public void setCostField(String fieldCost) { |
200 |
this.fieldCost = fieldCost;
|
201 |
} |
202 |
|
203 |
public void setSenseField(String fieldSense) { |
204 |
this.fieldSense = fieldSense;
|
205 |
} |
206 |
|
207 |
public void setCostsUnit(String costUnit) { |
208 |
this.costUnit = costUnit;
|
209 |
} |
210 |
|
211 |
public void setUsingCosts(Boolean costs) { |
212 |
this.usingCosts = costs;
|
213 |
} |
214 |
|
215 |
public Boolean isUsingCosts() { |
216 |
return usingCosts;
|
217 |
} |
218 |
|
219 |
public String getFieldType() { |
220 |
return this.fieldType; |
221 |
} |
222 |
|
223 |
public String getFieldLength() { |
224 |
return this.fieldLength; |
225 |
} |
226 |
|
227 |
public String getFieldSense() { |
228 |
return this.fieldSense; |
229 |
} |
230 |
|
231 |
public String getFieldCost() { |
232 |
return this.fieldCost; |
233 |
} |
234 |
|
235 |
|
236 |
} |