Revision 31735
trunk/extensions/extGraph/config/text.properties | ||
---|---|---|
167 | 167 |
please_check_them_or_increase_tolerance=Por favor, reviselos o incremente la tolerancia. |
168 | 168 |
Please_enter_max_cost_MST=Por favor, introduzca el coste m\u00E1ximo para calcular el \u00E1rbol de recubrimiento m\u00EDnimo |
169 | 169 |
please_introduce_some_costs=Por favor, introduzca alg\u00FAn coste |
170 |
Please_select_a_valid_file=Por favor, seleccione un fichero v\u00E1lido. |
|
170 | 171 |
point_not_on_the_network=El punto no est\u00E1 sobre la red. |
171 | 172 |
point_symbols=S\u00EDmbolos para puntos |
172 | 173 |
polygon_symbols=S\u00EDmbolos para pol\u00EDgonos |
trunk/extensions/extGraph/config/text_en.properties | ||
---|---|---|
175 | 175 |
please_check_them_or_increase_tolerance=Please, check them or increase tolerance. |
176 | 176 |
Please_enter_max_cost_MST=Please, input max cost to calculate Minimum Spanning Tree |
177 | 177 |
please_introduce_some_costs=Please, introduce some cost |
178 |
Please_select_a_valid_file=Please, select a valid file. |
|
178 | 179 |
point_not_on_the_network=Point is NOT on the network. |
179 | 180 |
point_symbols=Point symbols |
180 | 181 |
polygon_symbols=Polygon symbols |
trunk/extensions/extGraph/src/org/gvsig/graph/ODMatrixExtension.java | ||
---|---|---|
41 | 41 |
package org.gvsig.graph; |
42 | 42 |
|
43 | 43 |
import java.awt.Component; |
44 |
import java.io.BufferedWriter; |
|
45 | 44 |
import java.io.File; |
46 |
import java.io.IOException; |
|
47 | 45 |
import java.util.ArrayList; |
48 | 46 |
|
49 | 47 |
import javax.swing.JOptionPane; |
... | ... | |
55 | 53 |
import org.gvsig.graph.core.NetworkUtils; |
56 | 54 |
import org.gvsig.graph.gui.ODMatrixTask; |
57 | 55 |
import org.gvsig.graph.gui.OdMatrixControlPanel; |
58 |
import org.gvsig.graph.solvers.OneToManySolver; |
|
59 | 56 |
|
60 | 57 |
import com.iver.andami.PluginServices; |
61 |
import com.iver.andami.messages.NotificationManager; |
|
62 | 58 |
import com.iver.andami.plugins.Extension; |
63 | 59 |
import com.iver.andami.ui.mdiManager.IWindow; |
64 | 60 |
import com.iver.cit.gvsig.fmap.MapContext; |
... | ... | |
66 | 62 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
67 | 63 |
import com.iver.cit.gvsig.fmap.layers.FLyrVect; |
68 | 64 |
import com.iver.cit.gvsig.fmap.layers.SingleLayerIterator; |
69 |
import com.iver.cit.gvsig.project.documents.gui.IDocumentWindow; |
|
70 | 65 |
import com.iver.cit.gvsig.project.documents.view.gui.View; |
71 | 66 |
|
72 | 67 |
/** |
... | ... | |
148 | 143 |
|
149 | 144 |
File selectedFile = new File(ctrlDlg.getGeneratedFile()); |
150 | 145 |
|
146 |
|
|
151 | 147 |
selectedWriter = odMatrixWriters.get(ctrlDlg.getFileFormat()); |
152 | 148 |
|
153 | 149 |
ODMatrixTask task = new ODMatrixTask(net, originFlags, destinationFlags, |
... | ... | |
174 | 170 |
|
175 | 171 |
|
176 | 172 |
} |
177 |
|
|
178 |
/** |
|
179 |
* @deprecated Use ODMatrixTask instead (to allow cancel the dialog and see progress |
|
180 |
* @param net |
|
181 |
* @param originFlags |
|
182 |
* @param destinationFlags |
|
183 |
* @param generatedFile |
|
184 |
*/ |
|
185 |
private void calculateOdMatrix(Network net, GvFlag[] originFlags, GvFlag[] destinationFlags, File generatedFile) { |
|
186 |
try { |
|
187 |
selectedWriter.openFile(generatedFile); |
|
188 |
// output.setByteOrder(ByteOrder.LITTLE_ENDIAN); |
|
189 |
|
|
190 |
OneToManySolver solver = new OneToManySolver(); |
|
191 |
solver.setNetwork(net); |
|
192 |
solver.putDestinationsOnNetwork(destinationFlags); |
|
193 |
for (int i=0; i < originFlags.length; i++) |
|
194 |
{ |
|
195 |
|
|
196 |
solver.setSourceFlag(originFlags[i]); |
|
197 |
long t1 = System.currentTimeMillis(); |
|
198 |
|
|
199 |
solver.calculate(); |
|
200 |
long t2 = System.currentTimeMillis(); |
|
201 |
System.out.println("Punto " + i + " de " + originFlags.length + ". " + (t2-t1) + " msecs."); |
|
202 |
// Escribe el resultado |
|
203 |
// idNodo1 idNodo2 tiempo distancia |
|
204 |
|
|
205 |
for (int j=0; j < destinationFlags.length; j++) |
|
206 |
{ |
|
207 |
selectedWriter.saveDist(i, j, destinationFlags[j].getCost() |
|
208 |
, destinationFlags[j].getAccumulatedLength()); |
|
209 |
} |
|
210 |
long t3 = System.currentTimeMillis(); |
|
211 |
System.out.println("T. de escritura: " + (t3-t2) + " msecs."); |
|
212 |
|
|
213 |
} |
|
214 |
solver.removeDestinationsFromNetwork(destinationFlags); |
|
215 |
selectedWriter.closeFile(); |
|
216 |
net.removeFlags(); |
|
217 |
JOptionPane.showMessageDialog((Component) PluginServices.getMainFrame(), |
|
218 |
PluginServices.getText(this,"fichero_generado")); |
|
219 |
} catch (IOException e) { |
|
220 |
// TODO Auto-generated catch block |
|
221 |
e.printStackTrace(); |
|
222 |
} catch (GraphException e) { |
|
223 |
// TODO Auto-generated catch block |
|
224 |
e.printStackTrace(); |
|
225 |
} |
|
226 |
} |
|
227 |
|
|
228 | 173 |
|
229 | 174 |
public boolean isEnabled() { |
230 | 175 |
IWindow window = PluginServices.getMDIManager().getActiveWindow(); |
trunk/extensions/extGraph/src/org/gvsig/graph/gui/OdMatrixControlPanel.java | ||
---|---|---|
14 | 14 |
import javax.swing.DefaultComboBoxModel; |
15 | 15 |
import javax.swing.JFileChooser; |
16 | 16 |
import javax.swing.JFrame; |
17 |
import javax.swing.JOptionPane; |
|
17 | 18 |
import javax.swing.JPanel; |
18 | 19 |
import javax.swing.UIManager; |
19 | 20 |
import javax.swing.UnsupportedLookAndFeelException; |
... | ... | |
208 | 209 |
btnSelectFile.setBounds(new Rectangle(425, 90, 28, 21)); |
209 | 210 |
btnSelectFile.addActionListener(new java.awt.event.ActionListener() { |
210 | 211 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
211 |
System.out.println("actionPerformed()"); // TODO |
|
212 |
// Auto-generated |
|
213 |
// Event stub |
|
214 |
// actionPerformed() |
|
215 |
} |
|
216 |
}); |
|
217 |
btnSelectFile.addActionListener(new java.awt.event.ActionListener() { |
|
218 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
219 | 212 |
JFileChooser dlg = new JFileChooser(); |
220 | 213 |
if (dlg.showSaveDialog((Component) PluginServices.getMainFrame()) == JFileChooser.APPROVE_OPTION) |
221 | 214 |
{ |
... | ... | |
223 | 216 |
} |
224 | 217 |
} |
225 | 218 |
}); |
226 |
btnSelectFile.addActionListener(new java.awt.event.ActionListener() { |
|
227 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
228 |
|
|
229 |
} |
|
230 |
}); |
|
231 | 219 |
btnOk.setText(_T("OK")); |
232 | 220 |
btnOk.setBounds(new Rectangle(107, 305, 136, 26)); |
233 | 221 |
btnOk.addActionListener(new java.awt.event.ActionListener() { |
... | ... | |
267 | 255 |
} |
268 | 256 |
|
269 | 257 |
private void btnOkActionPerformed(java.awt.event.ActionEvent evt) { |
258 |
if (getGeneratedFile().equalsIgnoreCase("")) |
|
259 |
{ |
|
260 |
JOptionPane.showMessageDialog((Component) PluginServices.getMDIManager().getActiveWindow(), |
|
261 |
PluginServices.getText(null, "Please_select_a_valid_file")); |
|
262 |
return; |
|
263 |
} |
|
264 |
|
|
270 | 265 |
okPressed = true; |
271 | 266 |
closeWindow(); |
272 | 267 |
} |
trunk/extensions/extGraph/src/org/gvsig/graph/gui/ODMatrixTask.java | ||
---|---|---|
68 | 68 |
} |
69 | 69 |
|
70 | 70 |
public void run() throws Exception { |
71 |
try { |
|
71 |
try {
|
|
72 | 72 |
selectedWriter.openFile(generatedFile); |
73 | 73 |
|
74 | 74 |
OneToManySolver solver = new OneToManySolver(); |
Also available in: Unified diff