00001     '***************************************************************  

00002     '* *  

00003     '* GRAFOS http://ttt.upv.es/~arodrigu/grafos/ *  

00004     '* *  

00005     '* Software para la construcción y análisis de grafos *  

00006     '* *  

00007     '* *  

00008     '* (cc) 2003..2005 Alejandro Rodríguez Villalobos *  

00009     '* *  

00010     '* Creative Commons License *  

00011     '* Reconocimiento-NoComercial-CompartirIgual 2.1 *  

00012     '* http://ttt.upv.es/~arodrigu/grafos/http://creativecommons.org/licenses/by-nc-sa/3.0/deed.es*  

       »       *  

00013     '* *  

00014     '***************************************************************  

00015      

00016     'Advertencia: este programa está protegido por las leyes de derechos de autor  

00017     'y otros tratados internacionales. Grafos es un software libre y gratuito. Se  

00018     'distribuye bajo las condiciones:Reconocimiento-NoComercial-CompartirIgual 2.1.  

00019     '(Creative Commons License). La comercialización sin consentimiento del autor  

00020     'de este programa o cualquier parte del mismo, está penada por la ley con  

00021     'severas sanciones civiles y penales, y será objeto de todas las acciones  

00022     'judiciales que correspondan." & vbcrlf & "Grafos incluye la librería lp_solve  

00023     '5.x Copyright 1991, 2005 Free Software Foundation, Inc. bajo licencia LGPL.  

00024      

00025      

00026      

00027     'Importa espacio de nombres de lp_solve5  

00028     Imports Grafos . lpsolve51 

00029      

00030      

00031     'Para las funciones de apertura/escritura de ficheros  

00032     Imports System . IO 

00033     Imports System . Xml 

00034     'Imports System.Runtime.Serialization.Formatters.Soap  

00035     'Imports System.Runtime.Serialization.Formatters.Binary  

00036      

00037      

00038     'pruebas con otro solver  

00039     'Imports Grafos.QSopt1  

00040      

00041      

00042     Public Class Form1 

00043         Inherits System . Windows . Forms . Form 

00044         'declaración global para lp_solve 5  

00045         'Private lpsolve As lpsolve51  

00046      

00047     # Region " Código generado por el Diseñador de Windows Forms " 

00048      




00049         Public Sub New () 

00050             MyBase . New () 

00051      

00052             'El Diseñador de Windows Forms requiere esta llamada.  

00053             InitializeComponent () 

00054      

00055             'Agregar cualquier inicialización después de la llamada a  

       »               InitializeComponent()  

00056      

00057      

00058      

00059             'Inicialización del Solver lp_solver 5  

00060             'lpsolve = New lpsolve51  

00061      

00062             System . Diagnostics . Debug . WriteLine ( CurDir ()) 

00063             'lpsolve.Init(".")  

00064      

00065      

00066      

00067      

00068      

00069      

00070      

00071      

00072         End Sub 

00073      

00074         'Form reemplaza a Dispose para limpiar la lista de componentes.  

00075         Protected Overloads Overrides Sub Dispose ( ByVal disposing As Boolean

00076             If disposing Then 

00077                 If Not ( components Is Nothing ) Then 

00078                     components . Dispose () 

00079                 End If 

00080             End If 

00081             MyBase . Dispose ( disposing

00082         End Sub 

00083      

00084         'Requerido por el Diseñador de Windows Forms  

00085         Private components As System . ComponentModel . IContainer 

00086      

00087         'NOTA: el Diseñador de Windows Forms requiere el siguiente procedimiento  

00088         'Puede modificarse utilizando el Diseñador de Windows Forms.  

00089         'No lo modifique con el editor de código.  

00090         Friend WithEvents MainMenu1 As System . Windows . Forms . MainMenu 

00091         Friend WithEvents MenuItem1 As System . Windows . Forms . MenuItem 

00092         Friend WithEvents mnuEdicion As System . Windows . Forms . MenuItem 

00093         Friend WithEvents mnuFormato As System . Windows . Forms . MenuItem 

00094         Friend WithEvents mnuAnalisis As System . Windows . Forms . MenuItem 

00095         Friend WithEvents MenuItem5 As System . Windows . Forms . MenuItem 

00096         Friend WithEvents mnuArchivoNuevo As System . Windows . Forms . MenuItem 

00097         Friend WithEvents mnuArchivoAbrir As System . Windows . Forms . MenuItem 

00098         Friend WithEvents MenuItem8 As System . Windows . Forms . MenuItem 

00099         Friend WithEvents mnuArchivoGuardar As System . Windows . Forms . MenuItem 

00100         Friend WithEvents mnuArchivoGuardarComo As System . Windows . Forms . MenuItem 

00101         Friend WithEvents MenuItem11 As System . Windows . Forms . MenuItem 

00102         Friend WithEvents mnuArchivoSalir As System . Windows . Forms . MenuItem 

00103         Friend WithEvents mnuEdicionGrafica As System . Windows . Forms . MenuItem 

00104         Friend WithEvents mnuFormatoOpciones As System . Windows . Forms . MenuItem 

00105         Friend WithEvents PictureBox1 As System . Windows . Forms . PictureBox 

00106         Friend WithEvents PanelX As System . Windows . Forms . StatusBarPanel 

00107         Friend WithEvents PanelY As System . Windows . Forms . StatusBarPanel 

00108         Friend WithEvents StatusBar As System . Windows . Forms . StatusBar 

00109         Friend WithEvents Panel1 As System . Windows . Forms . Panel 

00110         Friend WithEvents mnuFormatoRejilla As System . Windows . Forms . MenuItem 




00111         Friend WithEvents mnuFormatoIman As System . Windows . Forms . MenuItem 

00112         Friend WithEvents MenuItem19 As System . Windows . Forms . MenuItem 

00113         Friend WithEvents mnuAyudaAcercade As System . Windows . Forms . MenuItem 

00114         Friend WithEvents mnuArchivoImprimir As System . Windows . Forms . MenuItem 

00115         Friend WithEvents mnuEdicion2 As System . Windows . Forms . MenuItem 

00116         Friend WithEvents PrintDialog1 As System . Windows . Forms . PrintDialog 

00117         Friend WithEvents PrintPreviewDialog1 As System . Windows . Forms .  

       »           PrintPreviewDialog 

00118         Friend WithEvents mnuArchivoConfigurarPag As System . Windows . Forms . MenuItem 

00119         Friend WithEvents PrintDocument1 As System . Drawing . Printing . PrintDocument 

00120         Friend WithEvents PageSetupDialog1 As System . Windows . Forms . PageSetupDialog 

00121         Friend WithEvents mnuArchivoConfigurarImp As System . Windows . Forms . MenuItem 

00122         Friend WithEvents SobreObj As System . Windows . Forms . StatusBarPanel 

00123         Friend WithEvents Nd1 As System . Windows . Forms . StatusBarPanel 

00124         Friend WithEvents Nd2 As System . Windows . Forms . StatusBarPanel 

00125         Friend WithEvents mnuPopUp As System . Windows . Forms . ContextMenu 

00126         Friend WithEvents mnuAñadirNodo As System . Windows . Forms . MenuItem 

00127         Friend WithEvents mnuEditarNodo As System . Windows . Forms . MenuItem 

00128         Friend WithEvents mnuBorrarNodo As System . Windows . Forms . MenuItem 

00129         Friend WithEvents mnuEdicion4 As System . Windows . Forms . MenuItem 

00130         Friend WithEvents mnuAñadirArco As System . Windows . Forms . MenuItem 

00131         Friend WithEvents mnuEdicion8 As System . Windows . Forms . MenuItem 

00132         Friend WithEvents mnuZoomMas As System . Windows . Forms . MenuItem 

00133         Friend WithEvents mnuZoomMenos As System . Windows . Forms . MenuItem 

00134         Friend WithEvents mnuZoomAjustar As System . Windows . Forms . MenuItem 

00135         Friend WithEvents mnuEditarArco As System . Windows . Forms . MenuItem 

00136         Friend WithEvents mnuBorrarArco As System . Windows . Forms . MenuItem 

00137         Friend WithEvents z As System . Windows . Forms . StatusBarPanel 

00138         Friend WithEvents mnuArchivoCopiarImg As System . Windows . Forms . MenuItem 

00139         Friend WithEvents mnuArchivoExportarImg As System . Windows . Forms . MenuItem 

00140         Friend WithEvents TextBox1 As System . Windows . Forms . TextBox 

00141         Friend WithEvents mnuEdicionTabular As System . Windows . Forms . MenuItem 

00142         Friend WithEvents mnuPopTabla As System . Windows . Forms . ContextMenu 

00143         Friend WithEvents mnuTablaBorrarNodo As System . Windows . Forms . MenuItem 

00144         Friend WithEvents mnuTablaAñadirNodo As System . Windows . Forms . MenuItem 

00145         Friend WithEvents mnuTablaTotalNodos As System . Windows . Forms . MenuItem 

00146         Friend WithEvents MenuItem2 As System . Windows . Forms . MenuItem 

00147         Friend WithEvents hfgTabla As AxMSFlexGridLib . AxMSFlexGrid 

00148         Friend WithEvents MenuItem6 As System . Windows . Forms . MenuItem 

00149         Friend WithEvents mnuFormatoCircular As System . Windows . Forms . MenuItem 

00150         Friend WithEvents mnuFormatoAleatorio As System . Windows . Forms . MenuItem 

00151         Friend WithEvents mnuFormatoTablero As System . Windows . Forms . MenuItem 

00152         Friend WithEvents MenuItem3 As System . Windows . Forms . MenuItem 

00153         Friend WithEvents mnuTablaCopiarTabla As System . Windows . Forms . MenuItem 

00154         Friend WithEvents mnuAlinearNodos As System . Windows . Forms . MenuItem 

00155         Friend WithEvents mnuAlinearNodosH As System . Windows . Forms . MenuItem 

00156         Friend WithEvents mnuAlinearNodosV As System . Windows . Forms . MenuItem 

00157         Friend WithEvents mnuAnalisisDijkstra As System . Windows . Forms . MenuItem 

00158         Friend WithEvents mnuAnalisisDijkstraMax As System . Windows . Forms . MenuItem 

00159         Friend WithEvents mnuAnalisisDijkstraCC As System . Windows . Forms . MenuItem 

00160         Friend WithEvents mnuAnalisisDijkstraCM As System . Windows . Forms . MenuItem 

00161         Friend WithEvents MenuItem4 As System . Windows . Forms . MenuItem 

00162         Friend WithEvents MenuItem7 As System . Windows . Forms . MenuItem 

00163         Friend WithEvents mnuAnalisisBellmanFordCmin As System . Windows . Forms . MenuItem 

00164         Friend WithEvents mnuAnalisisBellmanFordCmax As System . Windows . Forms . MenuItem 

00165         Friend WithEvents MenuItem9 As System . Windows . Forms . MenuItem 

00166         Friend WithEvents mnuAnalisisKruskalmin As System . Windows . Forms . MenuItem 

00167         Friend WithEvents mnuAnalisisKruskalmax As System . Windows . Forms . MenuItem 

00168         Friend WithEvents mnuFormatoFlujo As System . Windows . Forms . MenuItem 

00169         Friend WithEvents MenuItem10 As System . Windows . Forms . MenuItem 

00170         Friend WithEvents mnuAnalisisPrimMin As System . Windows . Forms . MenuItem 

00171         Friend WithEvents mnuAnalisisPrimMax As System . Windows . Forms . MenuItem 

00172         Friend WithEvents MenuItem12 As System . Windows . Forms . MenuItem 

00173         Friend WithEvents mnuFormatoAjustar As System . Windows . Forms . MenuItem 

00174         Friend WithEvents mnuFormatoCentrar As System . Windows . Forms . MenuItem 




00175         Friend WithEvents MenuItem15 As System . Windows . Forms . MenuItem 

00176         Friend WithEvents mnuAnalisisFordFulkersonMax As System . Windows . Forms .  

       »           MenuItem 

00177         Friend WithEvents MenuItem13 As System . Windows . Forms . MenuItem 

00178         Friend WithEvents mnuAnalisisFloydWarshallmin As System . Windows . Forms .  

       »           MenuItem 

00179         Friend WithEvents MenuItem14 As System . Windows . Forms . MenuItem 

00180         Friend WithEvents mnuAnalisis_Transbordo As System . Windows . Forms . MenuItem 

00181         'Friend WithEvents mnuAnalisis_Transporte As System.Windows.Forms.MenuItem  

00182         Friend WithEvents mnuAnalisis_TSP As System . Windows . Forms . MenuItem 

00183         Friend WithEvents mnuFormatoOrganico As System . Windows . Forms . MenuItem 

00184         Friend WithEvents mnuFormatoImantar As System . Windows . Forms . MenuItem 

00185         Friend WithEvents mnuArchivoImportarDatos As System . Windows . Forms . MenuItem 

00186         Friend WithEvents mnuArchivoExportarDatos As System . Windows . Forms . MenuItem 

00187         Friend WithEvents MenuItem20 As System . Windows . Forms . MenuItem 

00188         Friend WithEvents mnuArchivoNuevoAleatorio As System . Windows . Forms . MenuItem 

00189         Friend WithEvents filestatusbar As System . Windows . Forms . StatusBarPanel 

00190         Friend WithEvents mnuFormatoAutoRadio As System . Windows . Forms . MenuItem 

00191         Friend WithEvents mnuFormatoAutoTrazo As System . Windows . Forms . MenuItem 

00192         Friend WithEvents MenuItem18 As System . Windows . Forms . MenuItem 




00193         < System . Diagnostics . DebuggerStepThrough ()> Private Sub InitializeComponent () 

00194             Dim resources As System . Resources . ResourceManager = New System . Resources  

       »               . ResourceManager ( GetType ( Form1 )) 

00195             Me . MainMenu1 = New System . Windows . Forms . MainMenu 

00196             Me . MenuItem1 = New System . Windows . Forms . MenuItem 

00197             Me . mnuArchivoNuevo = New System . Windows . Forms . MenuItem 

00198             Me . mnuArchivoNuevoAleatorio = New System . Windows . Forms . MenuItem 

00199             Me . mnuArchivoAbrir = New System . Windows . Forms . MenuItem 

00200             Me . mnuArchivoImportarDatos = New System . Windows . Forms . MenuItem 

00201             Me . MenuItem8 = New System . Windows . Forms . MenuItem 

00202             Me . mnuArchivoGuardar = New System . Windows . Forms . MenuItem 

00203             Me . mnuArchivoGuardarComo = New System . Windows . Forms . MenuItem 

00204             Me . mnuArchivoExportarDatos = New System . Windows . Forms . MenuItem 

00205             Me . MenuItem20 = New System . Windows . Forms . MenuItem 

00206             Me . mnuArchivoCopiarImg = New System . Windows . Forms . MenuItem 

00207             Me . mnuArchivoExportarImg = New System . Windows . Forms . MenuItem 

00208             Me . mnuEdicion2 = New System . Windows . Forms . MenuItem 

00209             Me . mnuArchivoConfigurarImp = New System . Windows . Forms . MenuItem 

00210             Me . mnuArchivoConfigurarPag = New System . Windows . Forms . MenuItem 

00211             Me . mnuArchivoImprimir = New System . Windows . Forms . MenuItem 

00212             Me . MenuItem11 = New System . Windows . Forms . MenuItem 

00213             Me . mnuArchivoSalir = New System . Windows . Forms . MenuItem 

00214             Me . mnuEdicion = New System . Windows . Forms . MenuItem 

00215             Me . mnuEdicionGrafica = New System . Windows . Forms . MenuItem 

00216             Me . mnuEdicionTabular = New System . Windows . Forms . MenuItem 

00217             Me . mnuFormato = New System . Windows . Forms . MenuItem 

00218             Me . mnuFormatoOpciones = New System . Windows . Forms . MenuItem 

00219             Me . MenuItem19 = New System . Windows . Forms . MenuItem 

00220             Me . mnuFormatoRejilla = New System . Windows . Forms . MenuItem 

00221             Me . mnuFormatoIman = New System . Windows . Forms . MenuItem 

00222             Me . MenuItem15 = New System . Windows . Forms . MenuItem 

00223             Me . mnuFormatoCentrar = New System . Windows . Forms . MenuItem 

00224             Me . mnuFormatoAjustar = New System . Windows . Forms . MenuItem 

00225             Me . mnuFormatoImantar = New System . Windows . Forms . MenuItem 

00226             Me . MenuItem18 = New System . Windows . Forms . MenuItem 

00227             Me . mnuFormatoAutoRadio = New System . Windows . Forms . MenuItem 

00228             Me . mnuFormatoAutoTrazo = New System . Windows . Forms . MenuItem 

00229             Me . MenuItem6 = New System . Windows . Forms . MenuItem 

00230             Me . mnuFormatoAleatorio = New System . Windows . Forms . MenuItem 

00231             Me . mnuFormatoCircular = New System . Windows . Forms . MenuItem 

00232             Me . mnuFormatoTablero = New System . Windows . Forms . MenuItem 

00233             Me . mnuFormatoFlujo = New System . Windows . Forms . MenuItem 

00234             Me . mnuFormatoOrganico = New System . Windows . Forms . MenuItem 

00235             Me . mnuAnalisis = New System . Windows . Forms . MenuItem 

00236             Me . mnuAnalisisDijkstra = New System . Windows . Forms . MenuItem 

00237             Me . mnuAnalisisDijkstraMax = New System . Windows . Forms . MenuItem 

00238             Me . MenuItem4 = New System . Windows . Forms . MenuItem 

00239             Me . mnuAnalisisDijkstraCM = New System . Windows . Forms . MenuItem 

00240             Me . mnuAnalisisDijkstraCC = New System . Windows . Forms . MenuItem 

00241             Me . MenuItem7 = New System . Windows . Forms . MenuItem 

00242             Me . mnuAnalisisBellmanFordCmin = New System . Windows . Forms . MenuItem 

00243             Me . mnuAnalisisBellmanFordCmax = New System . Windows . Forms . MenuItem 

00244             Me . MenuItem13 = New System . Windows . Forms . MenuItem 

00245             Me . mnuAnalisisFloydWarshallmin = New System . Windows . Forms . MenuItem 

00246             Me . MenuItem9 = New System . Windows . Forms . MenuItem 

00247             Me . mnuAnalisisKruskalmin = New System . Windows . Forms . MenuItem 

00248             Me . mnuAnalisisKruskalmax = New System . Windows . Forms . MenuItem 

00249             Me . MenuItem10 = New System . Windows . Forms . MenuItem 

00250             Me . mnuAnalisisPrimMin = New System . Windows . Forms . MenuItem 

00251             Me . mnuAnalisisPrimMax = New System . Windows . Forms . MenuItem 

00252             Me . MenuItem12 = New System . Windows . Forms . MenuItem 

00253             Me . mnuAnalisisFordFulkersonMax = New System . Windows . Forms . MenuItem 

00254             Me . MenuItem14 = New System . Windows . Forms . MenuItem 

00255             Me . mnuAnalisis_Transbordo = New System . Windows . Forms . MenuItem 




00256             Me . mnuAnalisis_TSP = New System . Windows . Forms . MenuItem 

00257             Me . MenuItem5 = New System . Windows . Forms . MenuItem 

00258             Me . mnuAyudaAcercade = New System . Windows . Forms . MenuItem 

00259             Me . StatusBar = New System . Windows . Forms . StatusBar 

00260             Me . PanelX = New System . Windows . Forms . StatusBarPanel 

00261             Me . PanelY = New System . Windows . Forms . StatusBarPanel 

00262             Me . SobreObj = New System . Windows . Forms . StatusBarPanel 

00263             Me . Nd1 = New System . Windows . Forms . StatusBarPanel 

00264             Me . Nd2 = New System . Windows . Forms . StatusBarPanel 

00265             Me . z = New System . Windows . Forms . StatusBarPanel 

00266             Me . filestatusbar = New System . Windows . Forms . StatusBarPanel 

00267             Me . PictureBox1 = New System . Windows . Forms . PictureBox 

00268             Me . mnuPopUp = New System . Windows . Forms . ContextMenu 

00269             Me . mnuAñadirNodo = New System . Windows . Forms . MenuItem 

00270             Me . mnuEditarNodo = New System . Windows . Forms . MenuItem 

00271             Me . mnuBorrarNodo = New System . Windows . Forms . MenuItem 

00272             Me . mnuAlinearNodos = New System . Windows . Forms . MenuItem 

00273             Me . mnuAlinearNodosH = New System . Windows . Forms . MenuItem 

00274             Me . mnuAlinearNodosV = New System . Windows . Forms . MenuItem 

00275             Me . mnuEdicion4 = New System . Windows . Forms . MenuItem 

00276             Me . mnuAñadirArco = New System . Windows . Forms . MenuItem 

00277             Me . mnuEditarArco = New System . Windows . Forms . MenuItem 

00278             Me . mnuBorrarArco = New System . Windows . Forms . MenuItem 

00279             Me . mnuEdicion8 = New System . Windows . Forms . MenuItem 

00280             Me . mnuZoomMas = New System . Windows . Forms . MenuItem 

00281             Me . mnuZoomMenos = New System . Windows . Forms . MenuItem 

00282             Me . mnuZoomAjustar = New System . Windows . Forms . MenuItem 

00283             Me . Panel1 = New System . Windows . Forms . Panel 

00284             Me . TextBox1 = New System . Windows . Forms . TextBox 

00285             Me . mnuPopTabla = New System . Windows . Forms . ContextMenu 

00286             Me . mnuTablaAñadirNodo = New System . Windows . Forms . MenuItem 

00287             Me . mnuTablaBorrarNodo = New System . Windows . Forms . MenuItem 

00288             Me . MenuItem2 = New System . Windows . Forms . MenuItem 

00289             Me . mnuTablaTotalNodos = New System . Windows . Forms . MenuItem 

00290             Me . MenuItem3 = New System . Windows . Forms . MenuItem 

00291             Me . mnuTablaCopiarTabla = New System . Windows . Forms . MenuItem 

00292             Me . hfgTabla = New AxMSFlexGridLib . AxMSFlexGrid 

00293             Me . PrintDialog1 = New System . Windows . Forms . PrintDialog 

00294             Me . PrintPreviewDialog1 = New System . Windows . Forms . PrintPreviewDialog 

00295             Me . PrintDocument1 = New System . Drawing . Printing . PrintDocument 

00296             CType ( Me . PanelX , System . ComponentModel . ISupportInitialize ) . BeginInit () 

00297             CType ( Me . PanelY , System . ComponentModel . ISupportInitialize ) . BeginInit () 

00298             CType ( Me . SobreObj , System . ComponentModel . ISupportInitialize ) . BeginInit () 

00299             CType ( Me . Nd1 , System . ComponentModel . ISupportInitialize ) . BeginInit () 

00300             CType ( Me . Nd2 , System . ComponentModel . ISupportInitialize ) . BeginInit () 

00301             CType ( Me . z , System . ComponentModel . ISupportInitialize ) . BeginInit () 

00302             CType ( Me . filestatusbar , System . ComponentModel . ISupportInitialize ) .  

       »               BeginInit () 

00303             Me . Panel1 . SuspendLayout () 

00304             CType ( Me . hfgTabla , System . ComponentModel . ISupportInitialize ) . BeginInit () 

00305             Me . SuspendLayout () 

00306             '  

00307             'MainMenu1  

00308             '  

00309             Me . MainMenu1 . MenuItems . AddRange ( New System . Windows . Forms . MenuItem () { Me .  

       »               MenuItem1 , Me . mnuEdicion , Me . mnuFormato , Me . mnuAnalisis , Me . MenuItem5  

       »               }) 

00310             '  

00311             'MenuItem1  

00312             '  

00313             Me . MenuItem1 . Index =

00314             Me . MenuItem1 . MenuItems . AddRange ( New System . Windows . Forms . MenuItem () { Me .  

       »               mnuArchivoNuevo , Me . mnuArchivoNuevoAleatorio , Me . mnuArchivoAbrir , Me .  

       »               mnuArchivoImportarDatos , Me . MenuItem8 , Me . mnuArchivoGuardar , Me .  

       »               mnuArchivoGuardarComo , Me . mnuArchivoExportarDatos , Me . MenuItem20 , Me .  

       »               mnuArchivoCopiarImg , Me . mnuArchivoExportarImg , Me . mnuEdicion2 , Me .  

       »               mnuArchivoConfigurarImp , Me . mnuArchivoConfigurarPag , Me .  

       »               mnuArchivoImprimir , Me . MenuItem11 , Me . mnuArchivoSalir }) 

00315             Me . MenuItem1 . Text = "&Archivo" 

00316             '  

00317             'mnuArchivoNuevo  

00318             '  

00319             Me . mnuArchivoNuevo . Index =

00320             Me . mnuArchivoNuevo . Shortcut = System . Windows . Forms . Shortcut . CtrlU 

00321             Me . mnuArchivoNuevo . Text = "&Nuevo" 

00322             '  

00323             'mnuArchivoNuevoAleatorio  

00324             '  

00325             Me . mnuArchivoNuevoAleatorio . Index =

00326             Me . mnuArchivoNuevoAleatorio . Text = "Crear alea&torio..." 

00327             '  

00328             'mnuArchivoAbrir  

00329             '  

00330             Me . mnuArchivoAbrir . Index =

00331             Me . mnuArchivoAbrir . Shortcut = System . Windows . Forms . Shortcut . CtrlA 

00332             Me . mnuArchivoAbrir . Text = "&Abrir" 

00333             '  

00334             'mnuArchivoImportarDatos  

00335             '  

00336             Me . mnuArchivoImportarDatos . Enabled = False 

00337             Me . mnuArchivoImportarDatos . Index =

00338             Me . mnuArchivoImportarDatos . Text = "I&mportar datos..." 

00339             '  

00340             'MenuItem8  

00341             '  

00342             Me . MenuItem8 . Index =

00343             Me . MenuItem8 . Text = "-" 

00344             '  

00345             'mnuArchivoGuardar  

00346             '  

00347             Me . mnuArchivoGuardar . Enabled = False 

00348             Me . mnuArchivoGuardar . Index =

00349             Me . mnuArchivoGuardar . Shortcut = System . Windows . Forms . Shortcut . CtrlG 

00350             Me . mnuArchivoGuardar . Text = "&Guardar" 

00351             '  

00352             'mnuArchivoGuardarComo  

00353             '  

00354             Me . mnuArchivoGuardarComo . Enabled = False 

00355             Me . mnuArchivoGuardarComo . Index =

00356             Me . mnuArchivoGuardarComo . Text = "G&uardar como..." 

00357             '  

00358             'mnuArchivoExportarDatos  

00359             '  

00360             Me . mnuArchivoExportarDatos . Enabled = False 

00361             Me . mnuArchivoExportarDatos . Index =

00362             Me . mnuArchivoExportarDatos . Text = "Exportar &datos..." 

00363             '  

00364             'MenuItem20  

00365             '  

00366             Me . MenuItem20 . Index =

00367             Me . MenuItem20 . Text = "-" 

00368             '  

00369             'mnuArchivoCopiarImg  

00370             '  

00371             Me . mnuArchivoCopiarImg . Enabled = False 

00372             Me . mnuArchivoCopiarImg . Index =

00373             Me . mnuArchivoCopiarImg . Shortcut = System . Windows . Forms . Shortcut . CtrlC 

00374             Me . mnuArchivoCopiarImg . Text = "&Copiar imagen" 

00375             '  

00376             'mnuArchivoExportarImg  




00377             '  

00378             Me . mnuArchivoExportarImg . Enabled = False 

00379             Me . mnuArchivoExportarImg . Index = 10 

00380             Me . mnuArchivoExportarImg . Shortcut = System . Windows . Forms . Shortcut . CtrlE 

00381             Me . mnuArchivoExportarImg . Text = "&Exportar imagen..." 

00382             '  

00383             'mnuEdicion2  

00384             '  

00385             Me . mnuEdicion2 . Index = 11 

00386             Me . mnuEdicion2 . Text = "-" 

00387             '  

00388             'mnuArchivoConfigurarImp  

00389             '  

00390             Me . mnuArchivoConfigurarImp . Index = 12 

00391             Me . mnuArchivoConfigurarImp . Text = "C&onfigurar impresora..." 

00392             '  

00393             'mnuArchivoConfigurarPag  

00394             '  

00395             Me . mnuArchivoConfigurarPag . Enabled = False 

00396             Me . mnuArchivoConfigurarPag . Index = 13 

00397             Me . mnuArchivoConfigurarPag . Text = "Con&figurar página..." 

00398             '  

00399             'mnuArchivoImprimir  

00400             '  

00401             Me . mnuArchivoImprimir . Enabled = False 

00402             Me . mnuArchivoImprimir . Index = 14 

00403             Me . mnuArchivoImprimir . Shortcut = System . Windows . Forms . Shortcut . CtrlP 

00404             Me . mnuArchivoImprimir . Text = "&Imprimir..." 

00405             '  

00406             'MenuItem11  

00407             '  

00408             Me . MenuItem11 . Index = 15 

00409             Me . MenuItem11 . Text = "-" 

00410             '  

00411             'mnuArchivoSalir  

00412             '  

00413             Me . mnuArchivoSalir . Index = 16 

00414             Me . mnuArchivoSalir . Text = "&Salir" 

00415             '  

00416             'mnuEdicion  

00417             '  

00418             Me . mnuEdicion . Enabled = False 

00419             Me . mnuEdicion . Index =

00420             Me . mnuEdicion . MenuItems . AddRange ( New System . Windows . Forms . MenuItem () { Me  

       »               . mnuEdicionGrafica , Me . mnuEdicionTabular }) 

00421             Me . mnuEdicion . Text = "&Edición" 

00422             '  

00423             'mnuEdicionGrafica  

00424             '  

00425             Me . mnuEdicionGrafica . Checked = True 

00426             Me . mnuEdicionGrafica . Index =

00427             Me . mnuEdicionGrafica . RadioCheck = True 

00428             Me . mnuEdicionGrafica . Text = "&Gráfica" 

00429             '  

00430             'mnuEdicionTabular  

00431             '  

00432             Me . mnuEdicionTabular . Index =

00433             Me . mnuEdicionTabular . RadioCheck = True 

00434             Me . mnuEdicionTabular . Text = "&Tabular" 

00435             '  

00436             'mnuFormato  

00437             '  

00438             Me . mnuFormato . Enabled = False 

00439             Me . mnuFormato . Index =

00440             Me . mnuFormato . MenuItems . AddRange ( New System . Windows . Forms . MenuItem () { Me  

       »               . mnuFormatoOpciones , Me . MenuItem19 , Me . mnuFormatoRejilla , Me .  

       »               mnuFormatoIman , Me . MenuItem15 , Me . mnuFormatoCentrar , Me .  

       »               mnuFormatoAjustar , Me . mnuFormatoImantar , Me . MenuItem18 , Me .  

       »               mnuFormatoAutoRadio , Me . mnuFormatoAutoTrazo , Me . MenuItem6 , Me .  

       »               mnuFormatoAleatorio , Me . mnuFormatoCircular , Me . mnuFormatoTablero , Me .  

       »               mnuFormatoFlujo , Me . mnuFormatoOrganico }) 

00441             Me . mnuFormato . Text = "&Formato" 

00442             '  

00443             'mnuFormatoOpciones  

00444             '  

00445             Me . mnuFormatoOpciones . Enabled = False 

00446             Me . mnuFormatoOpciones . Index =

00447             Me . mnuFormatoOpciones . Shortcut = System . Windows . Forms . Shortcut . CtrlO 

00448             Me . mnuFormatoOpciones . Text = "&Opciones..." 

00449             '  

00450             'MenuItem19  

00451             '  

00452             Me . MenuItem19 . Index =

00453             Me . MenuItem19 . Text = "-" 

00454             '  

00455             'mnuFormatoRejilla  

00456             '  

00457             Me . mnuFormatoRejilla . Checked = True 

00458             Me . mnuFormatoRejilla . Index =

00459             Me . mnuFormatoRejilla . Shortcut = System . Windows . Forms . Shortcut . CtrlR 

00460             Me . mnuFormatoRejilla . Text = "&Rejilla" 

00461             '  

00462             'mnuFormatoIman  

00463             '  

00464             Me . mnuFormatoIman . Checked = True 

00465             Me . mnuFormatoIman . Index =

00466             Me . mnuFormatoIman . Shortcut = System . Windows . Forms . Shortcut . CtrlI 

00467             Me . mnuFormatoIman . Text = "&Imán" 

00468             '  

00469             'MenuItem15  

00470             '  

00471             Me . MenuItem15 . Index =

00472             Me . MenuItem15 . Text = "-" 

00473             '  

00474             'mnuFormatoCentrar  

00475             '  

00476             Me . mnuFormatoCentrar . Index =

00477             Me . mnuFormatoCentrar . Text = "&Centrar grafo" 

00478             '  

00479             'mnuFormatoAjustar  

00480             '  

00481             Me . mnuFormatoAjustar . Index =

00482             Me . mnuFormatoAjustar . Text = "&Ajustar tapiz" 

00483             '  

00484             'mnuFormatoImantar  

00485             '  

00486             Me . mnuFormatoImantar . Index =

00487             Me . mnuFormatoImantar . Text = "I&mantar" 

00488             '  

00489             'MenuItem18  

00490             '  

00491             Me . MenuItem18 . Index =

00492             Me . MenuItem18 . Text = "-" 

00493             '  

00494             'mnuFormatoAutoRadio  

00495             '  

00496             Me . mnuFormatoAutoRadio . Index =

00497             Me . mnuFormatoAutoRadio . Text = "&1 Auto-radio nodos (valor)" 

00498             '  

00499             'mnuFormatoAutoTrazo  




00500             '  

00501             Me . mnuFormatoAutoTrazo . Index = 10 

00502             Me . mnuFormatoAutoTrazo . Text = "&2 Auto-trazo arcos (coste)" 

00503             '  

00504             'MenuItem6  

00505             '  

00506             Me . MenuItem6 . Index = 11 

00507             Me . MenuItem6 . Text = "-" 

00508             '  

00509             'mnuFormatoAleatorio  

00510             '  

00511             Me . mnuFormatoAleatorio . Index = 12 

00512             Me . mnuFormatoAleatorio . RadioCheck = True 

00513             Me . mnuFormatoAleatorio . Text = "A&leatorio" 

00514             '  

00515             'mnuFormatoCircular  

00516             '  

00517             Me . mnuFormatoCircular . Checked = True 

00518             Me . mnuFormatoCircular . Index = 13 

00519             Me . mnuFormatoCircular . RadioCheck = True 

00520             Me . mnuFormatoCircular . Text = "Circ&ular" 

00521             '  

00522             'mnuFormatoTablero  

00523             '  

00524             Me . mnuFormatoTablero . Index = 14 

00525             Me . mnuFormatoTablero . RadioCheck = True 

00526             Me . mnuFormatoTablero . Text = "&Tablero" 

00527             '  

00528             'mnuFormatoFlujo  

00529             '  

00530             Me . mnuFormatoFlujo . Index = 15 

00531             Me . mnuFormatoFlujo . RadioCheck = True 

00532             Me . mnuFormatoFlujo . Text = "&Flujo" 

00533             '  

00534             'mnuFormatoOrganico  

00535             '  

00536             Me . mnuFormatoOrganico . Index = 16 

00537             Me . mnuFormatoOrganico . Text = "Or&gánico" 

00538             '  

00539             'mnuAnalisis  

00540             '  

00541             Me . mnuAnalisis . Enabled = False 

00542             Me . mnuAnalisis . Index =

00543             Me . mnuAnalisis . MenuItems . AddRange ( New System . Windows . Forms . MenuItem () {  

       »               Me . mnuAnalisisDijkstra , Me . mnuAnalisisDijkstraMax , Me . MenuItem4 , Me .  

       »               mnuAnalisisDijkstraCM , Me . mnuAnalisisDijkstraCC , Me . MenuItem7 , Me .  

       »               mnuAnalisisBellmanFordCmin , Me . mnuAnalisisBellmanFordCmax , Me .  

       »               MenuItem13 , Me . mnuAnalisisFloydWarshallmin , Me . MenuItem9 , Me .  

       »               mnuAnalisisKruskalmin , Me . mnuAnalisisKruskalmax , Me . MenuItem10 , Me .  

       »               mnuAnalisisPrimMin , Me . mnuAnalisisPrimMax , Me . MenuItem12 , Me .  

       »               mnuAnalisisFordFulkersonMax , Me . MenuItem14 , Me . mnuAnalisis_Transbordo  

       »               , Me . mnuAnalisis_TSP }) 

00544             Me . mnuAnalisis . Text = "A&nálisis" 

00545             '  

00546             'mnuAnalisisDijkstra  

00547             '  

00548             Me . mnuAnalisisDijkstra . Enabled = False 

00549             Me . mnuAnalisisDijkstra . Index =

00550             Me . mnuAnalisisDijkstra . Text = "Árbol mínimo - Alg. Dijkstra (Nd1)" 

00551             '  

00552             'mnuAnalisisDijkstraMax  

00553             '  

00554             Me . mnuAnalisisDijkstraMax . Enabled = False 

00555             Me . mnuAnalisisDijkstraMax . Index =

00556             Me . mnuAnalisisDijkstraMax . Text = "Árbol máximo - Alg. Dijkstra (Nd1)" 




00557             '  

00558             'MenuItem4  

00559             '  

00560             Me . MenuItem4 . Index =

00561             Me . MenuItem4 . Text = "-" 

00562             '  

00563             'mnuAnalisisDijkstraCM  

00564             '  

00565             Me . mnuAnalisisDijkstraCM . Enabled = False 

00566             Me . mnuAnalisisDijkstraCM . Index =

00567             Me . mnuAnalisisDijkstraCM . Text = "Camino mínimo - Alg. Dijkstra  

       »               (Nd1-Nd2)" 

00568             '  

00569             'mnuAnalisisDijkstraCC  

00570             '  

00571             Me . mnuAnalisisDijkstraCC . Enabled = False 

00572             Me . mnuAnalisisDijkstraCC . Index =

00573             Me . mnuAnalisisDijkstraCC . Text = "Camino crítico - Alg. Dijkstra  

       »               (Nd1-Nd2)" 

00574             '  

00575             'MenuItem7  

00576             '  

00577             Me . MenuItem7 . Index =

00578             Me . MenuItem7 . Text = "-" 

00579             '  

00580             'mnuAnalisisBellmanFordCmin  

00581             '  

00582             Me . mnuAnalisisBellmanFordCmin . Enabled = False 

00583             Me . mnuAnalisisBellmanFordCmin . Index =

00584             Me . mnuAnalisisBellmanFordCmin . Text = "Camino mínimo - Alg. BellmanFord  

       »               (Nd1-Nd2)" 

00585             '  

00586             'mnuAnalisisBellmanFordCmax  

00587             '  

00588             Me . mnuAnalisisBellmanFordCmax . Enabled = False 

00589             Me . mnuAnalisisBellmanFordCmax . Index =

00590             Me . mnuAnalisisBellmanFordCmax . Text = "Camino máximo - Alg. BellmanFord  

       »               (Nd1-Nd2)" 

00591             '  

00592             'MenuItem13  

00593             '  

00594             Me . MenuItem13 . Index =

00595             Me . MenuItem13 . Text = "-" 

00596             '  

00597             'mnuAnalisisFloydWarshallmin  

00598             '  

00599             Me . mnuAnalisisFloydWarshallmin . Enabled = False 

00600             Me . mnuAnalisisFloydWarshallmin . Index =

00601             Me . mnuAnalisisFloydWarshallmin . Text = "Todos los Caminos mínimos - Alg.  

       »               FloydWarshall" 

00602             '  

00603             'MenuItem9  

00604             '  

00605             Me . MenuItem9 . Index = 10 

00606             Me . MenuItem9 . Text = "-" 

00607             '  

00608             'mnuAnalisisKruskalmin  

00609             '  

00610             Me . mnuAnalisisKruskalmin . Enabled = False 

00611             Me . mnuAnalisisKruskalmin . Index = 11 

00612             Me . mnuAnalisisKruskalmin . Text = "Árbol de valor total mínimo - Alg.  

       »               Kruskal" 

00613             '  

00614             'mnuAnalisisKruskalmax  

00615             '  




00616             Me . mnuAnalisisKruskalmax . Enabled = False 

00617             Me . mnuAnalisisKruskalmax . Index = 12 

00618             Me . mnuAnalisisKruskalmax . Text = "Árbol de valor total máximo - Alg.  

       »               Kruskal" 

00619             '  

00620             'MenuItem10  

00621             '  

00622             Me . MenuItem10 . Index = 13 

00623             Me . MenuItem10 . Text = "-" 

00624             '  

00625             'mnuAnalisisPrimMin  

00626             '  

00627             Me . mnuAnalisisPrimMin . Enabled = False 

00628             Me . mnuAnalisisPrimMin . Index = 14 

00629             Me . mnuAnalisisPrimMin . Text = "Árbol de valor total mínimo - Alg. Prim" 

00630             '  

00631             'mnuAnalisisPrimMax  

00632             '  

00633             Me . mnuAnalisisPrimMax . Enabled = False 

00634             Me . mnuAnalisisPrimMax . Index = 15 

00635             Me . mnuAnalisisPrimMax . Text = "Árbol de valor total máximo - Alg. Prim" 

00636             '  

00637             'MenuItem12  

00638             '  

00639             Me . MenuItem12 . Index = 16 

00640             Me . MenuItem12 . Text = "-" 

00641             '  

00642             'mnuAnalisisFordFulkersonMax  

00643             '  

00644             Me . mnuAnalisisFordFulkersonMax . Enabled = False 

00645             Me . mnuAnalisisFordFulkersonMax . Index = 17 

00646             Me . mnuAnalisisFordFulkersonMax . Text = "Flujo máximo - Alg. FordFulkerson 

       »               (Nd1-Nd2)" 

00647             '  

00648             'MenuItem14  

00649             '  

00650             Me . MenuItem14 . Index = 18 

00651             Me . MenuItem14 . Text = "-" 

00652             '  

00653             'mnuAnalisis_Transbordo  

00654             '  

00655             Me . mnuAnalisis_Transbordo . Enabled = False 

00656             Me . mnuAnalisis_Transbordo . Index = 19 

00657             Me . mnuAnalisis_Transbordo . Text = "Transbordo a coste mínimo - LP  

       »               (equilibrado)" 

00658             '  

00659             'mnuAnalisis_TSP  

00660             '  

00661             Me . mnuAnalisis_TSP . Enabled = False 

00662             Me . mnuAnalisis_TSP . Index = 20 

00663             Me . mnuAnalisis_TSP . Text = "Viajante de Comercio - MILP" 

00664             '  

00665             'MenuItem5  

00666             '  

00667             Me . MenuItem5 . Index =

00668             Me . MenuItem5 . MenuItems . AddRange ( New System . Windows . Forms . MenuItem () { Me .  

       »               mnuAyudaAcercade }) 

00669             Me . MenuItem5 . Text = "Ay&uda" 

00670             '  

00671             'mnuAyudaAcercade  

00672             '  

00673             Me . mnuAyudaAcercade . Index =

00674             Me . mnuAyudaAcercade . Text = "&Acerca de..." 

00675             '  

00676             'StatusBar  




00677             '  

00678             Me . StatusBar . Location = New System . Drawing . Point ( 0 , 346

00679             Me . StatusBar . Name = "StatusBar" 

00680             Me . StatusBar . Panels . AddRange ( New System . Windows . Forms . StatusBarPanel () {  

       »               Me . PanelX , Me . PanelY , Me . SobreObj , Me . Nd1 , Me . Nd2 , Me . z , Me .  

       »               filestatusbar }) 

00681             Me . StatusBar . ShowPanels = True 

00682             Me . StatusBar . Size = New System . Drawing . Size ( 624 , 16

00683             Me . StatusBar . TabIndex =

00684             Me . StatusBar . Text = "StatusBar1" 

00685             '  

00686             'PanelX  

00687             '  

00688             Me . PanelX . BorderStyle = System . Windows . Forms . StatusBarPanelBorderStyle .  

       »               None 

00689             Me . PanelX . MinWidth = 60 

00690             Me . PanelX . Width = 60 

00691             '  

00692             'PanelY  

00693             '  

00694             Me . PanelY . BorderStyle = System . Windows . Forms . StatusBarPanelBorderStyle .  

       »               None 

00695             Me . PanelY . MinWidth = 60 

00696             Me . PanelY . Width = 60 

00697             '  

00698             'SobreObj  

00699             '  

00700             Me . SobreObj . BorderStyle = System . Windows . Forms . StatusBarPanelBorderStyle  

       »               . None 

00701             Me . SobreObj . MinWidth = 120 

00702             Me . SobreObj . Width = 120 

00703             '  

00704             'Nd1  

00705             '  

00706             Me . Nd1 . MinWidth = 100 

00707             '  

00708             'Nd2  

00709             '  

00710             Me . Nd2 . MinWidth = 100 

00711             '  

00712             'z  

00713             '  

00714             Me . z . BorderStyle = System . Windows . Forms . StatusBarPanelBorderStyle . None 

00715             Me . z . MinWidth = 120 

00716             Me . z . Width = 120 

00717             '  

00718             'filestatusbar  

00719             '  

00720             Me . filestatusbar . AutoSize = System . Windows . Forms . StatusBarPanelAutoSize .  

       »               Spring 

00721             Me . filestatusbar . Width = 48 

00722             '  

00723             'PictureBox1  

00724             '  

00725             Me . PictureBox1 . BackColor = System . Drawing . Color . White 

00726             Me . PictureBox1 . BorderStyle = System . Windows . Forms . BorderStyle .  

       »               FixedSingle 

00727             Me . PictureBox1 . ContextMenu = Me . mnuPopUp 

00728             Me . PictureBox1 . Cursor = System . Windows . Forms . Cursors . Cross 

00729             Me . PictureBox1 . Location = New System . Drawing . Point ( 0 , 0

00730             Me . PictureBox1 . Name = "PictureBox1" 

00731             Me . PictureBox1 . Size = New System . Drawing . Size ( 168 , 160

00732             Me . PictureBox1 . SizeMode = System . Windows . Forms . PictureBoxSizeMode .  

       »               CenterImage 

00733             Me . PictureBox1 . TabIndex =




00734             Me . PictureBox1 . TabStop = False 

00735             Me . PictureBox1 . Visible = False 

00736             '  

00737             'mnuPopUp  

00738             '  

00739             Me . mnuPopUp . MenuItems . AddRange ( New System . Windows . Forms . MenuItem () { Me .  

       »               mnuAñadirNodo , Me . mnuEditarNodo , Me . mnuBorrarNodo , Me . mnuAlinearNodos  

       »               , Me . mnuEdicion4 , Me . mnuAñadirArco , Me . mnuEditarArco , Me .  

       »               mnuBorrarArco , Me . mnuEdicion8 , Me . mnuZoomMas , Me . mnuZoomMenos , Me .  

       »               mnuZoomAjustar }) 

00740             '  

00741             'mnuAñadirNodo  

00742             '  

00743             Me . mnuAñadirNodo . Index =

00744             Me . mnuAñadirNodo . Text = "Añadir Nodo" 

00745             '  

00746             'mnuEditarNodo  

00747             '  

00748             Me . mnuEditarNodo . Index =

00749             Me . mnuEditarNodo . Text = "Editar Nodo" 

00750             '  

00751             'mnuBorrarNodo  

00752             '  

00753             Me . mnuBorrarNodo . Index =

00754             Me . mnuBorrarNodo . Text = "Borrar Nodo" 

00755             '  

00756             'mnuAlinearNodos  

00757             '  

00758             Me . mnuAlinearNodos . Index =

00759             Me . mnuAlinearNodos . MenuItems . AddRange ( New System . Windows . Forms . MenuItem

       »               ) { Me . mnuAlinearNodosH , Me . mnuAlinearNodosV }) 

00760             Me . mnuAlinearNodos . Text = "Alinear Nodos" 

00761             '  

00762             'mnuAlinearNodosH  

00763             '  

00764             Me . mnuAlinearNodosH . Index =

00765             Me . mnuAlinearNodosH . Text = "Horizontalmente" 

00766             '  

00767             'mnuAlinearNodosV  

00768             '  

00769             Me . mnuAlinearNodosV . Index =

00770             Me . mnuAlinearNodosV . Text = "Verticalmente" 

00771             '  

00772             'mnuEdicion4  

00773             '  

00774             Me . mnuEdicion4 . Index =

00775             Me . mnuEdicion4 . Text = "-" 

00776             '  

00777             'mnuAñadirArco  

00778             '  

00779             Me . mnuAñadirArco . Index =

00780             Me . mnuAñadirArco . Text = "Añadir Arco" 

00781             '  

00782             'mnuEditarArco  

00783             '  

00784             Me . mnuEditarArco . Index =

00785             Me . mnuEditarArco . Text = "Editar Arco" 

00786             '  

00787             'mnuBorrarArco  

00788             '  

00789             Me . mnuBorrarArco . Index =

00790             Me . mnuBorrarArco . Text = "Borrar Arco" 

00791             '  

00792             'mnuEdicion8  

00793             '  




00794             Me . mnuEdicion8 . Index =

00795             Me . mnuEdicion8 . Text = "-" 

00796             '  

00797             'mnuZoomMas  

00798             '  

00799             Me . mnuZoomMas . Index =

00800             Me . mnuZoomMas . Text = "Zoom +" 

00801             '  

00802             'mnuZoomMenos  

00803             '  

00804             Me . mnuZoomMenos . Index = 10 

00805             Me . mnuZoomMenos . Text = "Zoom -" 

00806             '  

00807             'mnuZoomAjustar  

00808             '  

00809             Me . mnuZoomAjustar . Index = 11 

00810             Me . mnuZoomAjustar . Text = "Zoom ajustado" 

00811             '  

00812             'Panel1  

00813             '  

00814             Me . Panel1 . AutoScroll = True 

00815             Me . Panel1 . AutoScrollMinSize = New System . Drawing . Size ( 20 , 20

00816             Me . Panel1 . BorderStyle = System . Windows . Forms . BorderStyle . Fixed3D 

00817             Me . Panel1 . Controls . Add ( Me . PictureBox1

00818             Me . Panel1 . Controls . Add ( Me . TextBox1

00819             Me . Panel1 . Controls . Add ( Me . hfgTabla

00820             Me . Panel1 . Dock = System . Windows . Forms . DockStyle . Fill 

00821             Me . Panel1 . Font = New System . Drawing . Font ( "Verdana" , 9.75 !, System .  

       »               Drawing . FontStyle . Regular , System . Drawing . GraphicsUnit . Point , CType ( 0  

       »               , Byte )) 

00822             Me . Panel1 . Location = New System . Drawing . Point ( 0 , 0

00823             Me . Panel1 . Name = "Panel1" 

00824             Me . Panel1 . Size = New System . Drawing . Size ( 624 , 346

00825             Me . Panel1 . TabIndex =

00826             '  

00827             'TextBox1  

00828             '  

00829             Me . TextBox1 . AutoSize = False 

00830             Me . TextBox1 . BackColor = System . Drawing . Color . FromArgb ( CType ( 255 , Byte ), 

       »               CType ( 255 , Byte ), CType ( 192 , Byte )) 

00831             Me . TextBox1 . BorderStyle = System . Windows . Forms . BorderStyle . FixedSingle 

00832             Me . TextBox1 . ContextMenu = Me . mnuPopTabla 

00833             Me . TextBox1 . Font = New System . Drawing . Font ( "Verdana" , 9.75 !, System .  

       »               Drawing . FontStyle . Regular , System . Drawing . GraphicsUnit . Point , CType ( 0  

       »               , Byte )) 

00834             Me . TextBox1 . HideSelection = False 

00835             Me . TextBox1 . Location = New System . Drawing . Point ( 432 , 96

00836             Me . TextBox1 . Name = "TextBox1" 

00837             Me . TextBox1 . Size = New System . Drawing . Size ( 88 , 20

00838             Me . TextBox1 . TabIndex =

00839             Me . TextBox1 . Text = "TextBox1" 

00840             Me . TextBox1 . TextAlign = System . Windows . Forms . HorizontalAlignment . Right 

00841             Me . TextBox1 . Visible = False 

00842             '  

00843             'mnuPopTabla  

00844             '  

00845             Me . mnuPopTabla . MenuItems . AddRange ( New System . Windows . Forms . MenuItem () {  

       »               Me . mnuTablaAñadirNodo , Me . mnuTablaBorrarNodo , Me . MenuItem2 , Me .  

       »               mnuTablaTotalNodos , Me . MenuItem3 , Me . mnuTablaCopiarTabla }) 

00846             '  

00847             'mnuTablaAñadirNodo  

00848             '  

00849             Me . mnuTablaAñadirNodo . Index =

00850             Me . mnuTablaAñadirNodo . Text = "Añadir Nodo" 

00851             '  




00852             'mnuTablaBorrarNodo  

00853             '  

00854             Me . mnuTablaBorrarNodo . Index =

00855             Me . mnuTablaBorrarNodo . Text = "Borrar Nodo" 

00856             '  

00857             'MenuItem2  

00858             '  

00859             Me . MenuItem2 . Index =

00860             Me . MenuItem2 . Text = "-" 

00861             '  

00862             'mnuTablaTotalNodos  

00863             '  

00864             Me . mnuTablaTotalNodos . Index =

00865             Me . mnuTablaTotalNodos . Text = "Total Nodos..." 

00866             '  

00867             'MenuItem3  

00868             '  

00869             Me . MenuItem3 . Index =

00870             Me . MenuItem3 . Text = "-" 

00871             '  

00872             'mnuTablaCopiarTabla  

00873             '  

00874             Me . mnuTablaCopiarTabla . Index =

00875             Me . mnuTablaCopiarTabla . Text = "Copiar Tabla" 

00876             '  

00877             'hfgTabla  

00878             '  

00879             Me . hfgTabla . ContainingControl = Me 

00880             Me . hfgTabla . Location = New System . Drawing . Point ( 152 , 64

00881             Me . hfgTabla . Name = "hfgTabla" 

00882             Me . hfgTabla . OcxState = CType ( resources . GetObject ( "hfgTabla.OcxState" ),  

       »               System . Windows . Forms . AxHost . State

00883             Me . hfgTabla . Size = New System . Drawing . Size ( 224 , 144

00884             Me . hfgTabla . TabIndex =

00885             Me . hfgTabla . Visible = False 

00886             '  

00887             'PrintPreviewDialog1  

00888             '  

00889             Me . PrintPreviewDialog1 . AutoScrollMargin = New System . Drawing . Size ( 0 , 0

00890             Me . PrintPreviewDialog1 . AutoScrollMinSize = New System . Drawing . Size ( 0 , 0

00891             Me . PrintPreviewDialog1 . ClientSize = New System . Drawing . Size ( 400 , 300

00892             Me . PrintPreviewDialog1 . Enabled = True 

00893             Me . PrintPreviewDialog1 . Icon = CType ( resources . GetObject (  

       »               "PrintPreviewDialog1.Icon" ), System . Drawing . Icon

00894             Me . PrintPreviewDialog1 . Location = New System . Drawing . Point ( 462 , 17

00895             Me . PrintPreviewDialog1 . MinimumSize = New System . Drawing . Size ( 375 , 250

00896             Me . PrintPreviewDialog1 . Name = "PrintPreviewDialog1" 

00897             Me . PrintPreviewDialog1 . TransparencyKey = System . Drawing . Color . Empty 

00898             Me . PrintPreviewDialog1 . Visible = False 

00899             '  

00900             'PrintDocument1  

00901             '  

00902             '  

00903             'Form1  

00904             '  

00905             Me . AutoScaleBaseSize = New System . Drawing . Size ( 5 , 13

00906             Me . AutoScroll = True 

00907             Me . ClientSize = New System . Drawing . Size ( 624 , 362

00908             Me . Controls . Add ( Me . Panel1

00909             Me . Controls . Add ( Me . StatusBar

00910             Me . Icon = CType ( resources . GetObject ( "$this.Icon" ), System . Drawing . Icon

00911             Me . Menu = Me . MainMenu1 

00912             Me . Name = "Form1" 

00913             Me . StartPosition = System . Windows . Forms . FormStartPosition . CenterScreen 

00914             Me . Text = "Grafos - (cc) 2003..2005 - Alejandro Rodríguez Villalobos " 




00915             Me . WindowState = System . Windows . Forms . FormWindowState . Maximized 

00916             CType ( Me . PanelX , System . ComponentModel . ISupportInitialize ) . EndInit () 

00917             CType ( Me . PanelY , System . ComponentModel . ISupportInitialize ) . EndInit () 

00918             CType ( Me . SobreObj , System . ComponentModel . ISupportInitialize ) . EndInit () 

00919             CType ( Me . Nd1 , System . ComponentModel . ISupportInitialize ) . EndInit () 

00920             CType ( Me . Nd2 , System . ComponentModel . ISupportInitialize ) . EndInit () 

00921             CType ( Me . z , System . ComponentModel . ISupportInitialize ) . EndInit () 

00922             CType ( Me . filestatusbar , System . ComponentModel . ISupportInitialize ) .  

       »               EndInit () 

00923             Me . Panel1 . ResumeLayout ( False

00924             CType ( Me . hfgTabla , System . ComponentModel . ISupportInitialize ) . EndInit () 

00925             Me . ResumeLayout ( False

00926      

00927         End Sub 

00928      

00929     # End Region 

00930      

00931         'Declaraciones de DLLs de Análisis  

00932         Dim WithEvents Dijkstra1 As New Dijkstra . Dijkstra 

00933         Dim WithEvents BellmanFord1 As New BellmanFord . BellmanFord 

00934         Dim WithEvents Kruskal1 As New Kruskal . Kruskal 

00935         Dim WithEvents Prim1 As New Prim . Prim 

00936         Dim WithEvents FordFulkerson1 As New FordFulkerson . FordFulkerson 

00937         Dim WithEvents FloydWarshall1 As New FloydWarshall . FloydWarshall 

00938      

00939         'declaración de ventana de opciones de formato  

00940         Dim WithEvents CajaPropiedades As New Form2 

00941         'declaración de ventana de importar datos  

00942         Dim WithEvents CajaImportar As New frmImportarDatos 

00943         Dim CajaExportar As New frmExportarDatos 

00944         Dim WithEvents CajaNuevoAleatorio As New frmNuevoAleatorio 

00945         'Array donde guardará la solución de las  

00946         'variables de decisión del modelo LP_solve  

00947         Dim SolucionModeloLP () 

00948         Dim TiempoModelado As Long 

00949         'Estructura de árbol para guardar datos XML  

00950         Public EstructuraArbol As New ArrayList 

00951         Public XMLValido As Boolean 

00952      




00953         'Declara la estructura del objeto Nodo  

00954         Public Structure Nodo 

00955             Dim Texto As String 'etiqueta  

00956             Dim Valor As Single 'valor del nodo  

00957             Dim X As Single 'coordenadas  

00958             Dim Y As Single 

00959             Dim Z As Single 

00960             Dim Col As Color   'color de relleno del nodo  

00961             Dim Radio As Single 'radio del nodo  

00962             Dim Grosor As Single 'trazo del nodo  

00963         End Structure 




00964         'Declara la estructura del objeto Arco o relación entre nodos  

00965         Public Structure Arco 

00966             Dim Texto As String 'etiqueta  

00967             Dim Min As Single 'valor de mínimo  

00968             Dim Max As Single 'valor de máximo  

00969             Dim Coste As Single 'valor de coste  

00970             Dim Col As Color 'color del arco  

00971             Dim Grosor As Single 'trazo del arco  

00972             Dim Nd1 As Long 'nodo origen  

00973             Dim Nd2 As Long 'nodo destino  

00974             Dim B As Boolean 'doble flecha si o no  

00975         End Structure 




00976         'Declara la estructura del objeto Grafo  

00977         Public Structure Graf 

00978             Dim Fichero As String  'nombre del fichero  

00979             Dim Extension As String 'extensión del formato de fichero  

00980             Dim Zoom As Single 

00981             Dim Rejilla As Single 

00982             Dim Iman As Boolean 

00983             Dim MostrarRejilla As Boolean 

00984             Dim TapizX As Single 

00985             Dim TapizY As Single 

00986             Dim ColorRejilla As Color 

00987             Dim ColorTapiz As Color 

00988             Dim ImagenTapiz As String 

00989             Dim MostrarImagenTapiz As Boolean 

00990      

00991             'Nodos  

00992             Dim Fuente As Font 

00993             Dim RadioNodo As Single 

00994             Dim TrazoNodo As Single 

00995             Dim ColNodo As Color 

00996             Dim textoNodo As Boolean 

00997             Dim costNodo As Boolean 

00998      

00999             'Arcos  

01000             Dim minArco As Boolean 

01001             Dim maxArco As Boolean 

01002             Dim costArco As Boolean 

01003             Dim ColArco As Color 

01004             Dim TrazoArco As Single 

01005             Dim BArco As Boolean 'bidireccional  

01006      

01007         End Structure 

01008      

01009         'Nodos Seleccionados  

01010         Public Shared Nd1S As Long = - 1 'primer nodo seleccionado  

01011         Public Shared Nd2S As Long = - 1 'segundo nodo seleccionado  

01012         'Arco Seleccionado  

01013         Dim ArcS As Long = - 1 'Arco seleccionado  

01014      

01015         'Coordenadas de creación de un nuevo nodo  

01016         Dim XNuevo , YNuevo As Single 

01017      

01018         'Totales de Nodos y Arcos  

01019         Public Shared TotalNodos As Long 

01020         Public Shared TotalArcos As Long 

01021      

01022         'Crea las colecciones para ambos objetos  

01023         Public Shared Nodos ( 1 ) As Nodo 

01024         Public Shared Arcos ( 1 ) As Arco 

01025         'para copia previo a solución  

01026         Public Shared NodosPrev ( 1 ) As Nodo 

01027         Public Shared ArcosPrev ( 1 ) As Arco 

01028         'para copia de solución  

01029         Public Shared NodosSol ( 1 ) As Nodo 

01030         Public Shared ArcosSol ( 1 ) As Arco 

01031      

01032         'crea objeto grafo  

01033         Public Shared Grafico As Graf 'public shared para compartir entre forms  

01034      

01035         'crea matriz para la tabla de arcos  

01036         Public Matriz (- 1 , - 1 ) As String 

01037         'crea matriz para la cabecera de nodos  

01038         Public Cabecera1 () As String 

01039         'crea matriz par los valore de nodos  




01040         Public Cabecera2 () As String 

01041         'total nodos en la matriz  

01042         Public Shared NodosMatriz As Long 

01043         Public Shared NuevoNodosMatriz As Long 'para ser cambiado por usuario  

01044         'Celda en edición  

01045         Public CeldaX As Long 

01046         Public CeldaY As Long 

01047      

01048         'Crea el objeto Graphics principal  

01049         Public G As Graphics 

01050      

01051         'para la publicación de resultados del algoritmo  

01052         Public Shared txtResultadosAlgoritmo As String 

01053         Public Shared AlgoritmoMILP As Boolean 

01054         Public WithEvents CajaSolucion As New Form6 

01055      




01056         Sub DibujaGrafo () 

01057             'Me.Cursor = Cursors.WaitCursor  

01058             Try 

01059                 PictureBox1 . Width = Grafico . TapizX * Grafico . Zoom 

01060                 PictureBox1 . Height = Grafico . TapizY * Grafico . Zoom 

01061                 'PictureBox1.BackColor = Grafico.ColorTapiz  

01062                 'Pone la información de zoom en panel  

01063                 StatusBar . Panels ( 5 ) . Text = "Zoom = " & Format ( Grafico . Zoom , "#0.00"  

       »                  

01064      

01065                 'Crea un objeto Graphics  

01066                 'Dim G As Graphics  

01067      

01068                 'toma el objeto graphics  

01069                 G = TomaObjetoGraphics ( PictureBox1

01070      

01071                 'borra el objeto graphics  

01072                 G . Clear ( Grafico . ColorTapiz

01073                 If Grafico . MostrarImagenTapiz = True And Grafico . ImagenTapiz <> ""  

       »                   Then 

01074                     'carga y ajusta la imagen de fondo al tamaño del tapiz  

01075                     G . DrawImage ( Image . FromFile ( Grafico . ImagenTapiz ), 0 , 0 , Grafico .  

       »                       TapizX * Grafico . Zoom , Grafico . TapizY * Grafico . Zoom

01076                 Else 

01077                     G . Clear ( Grafico . ColorTapiz

01078                 End If 

01079      

01080                 'Opciones de prestaciones gráficas  

01081                 G . SmoothingMode = Drawing . Drawing2D . SmoothingMode . None 

01082                 'G.InterpolationMode = Drawing.Drawing2D.InterpolationMode.Low  

01083                 'G.TextRenderingHint = Drawing.Text.TextRenderingHint.SystemDefault  

01084      

01085                 'definiciones  

01086                 Dim p As Pen 'pluma  

01087                 Dim brocha As System . Drawing . SolidBrush 

01088      

01089                 Dim pf As Pen ' pluma  

01090      

01091                 Dim b As Rectangle 

01092                 Dim i As Long 'contador  

01093      

01094                 Dim x , y As Single 

01095                 Dim x2 , y2 As Single 

01096                 Dim radio As Single 

01097                 Dim t As String 'para texto  

01098                 Dim v As Single 'para valor  

01099      

01100                 Dim tamañotexto As SizeF 

01101      

01102                 Dim LV As Single 

01103                 Dim Xa As Single , Ya As Single 

01104                 Dim Xb As Single , Yb As Single 

01105      

01106                 Dim fuente As Font 

01107      

01108                 Dim f As Form2 

01109                 f = New Form2 

01110      

01111                 'prueba de linea con cabezas flecha  

01112                 '#######  

01113                 Dim Fxa , Fya , Fxb , Fyb As Single 

01114                 Dim pff As Pen ' pluma  

01115                 '#######  

01116      




01117                 'Cambia escala del tipo de letra  

01118                 fuente = New Font ( Grafico . Fuente . Name , Grafico . Fuente . Size *  

       »                   Grafico . Zoom , Grafico . Fuente . Style , GraphicsUnit . Pixel

01119      

01120                 '--------------  

01121                 'DibujaRejilla  

01122                 '--------------  

01123                 If mnuFormatoRejilla . Checked = True Then 

01124                     'define trazo y color de pluma  

01125                     p = New Pen ( Grafico . ColorRejilla , 1

01126                     p . DashStyle = Drawing . Drawing2D . DashStyle . Dash 

01127                     For x = 0 To PictureBox1 . Width Step Grafico . Rejilla * Grafico .  

       »                       Zoom 

01128                         'líneas verticales  

01129                         G . DrawLine ( p , x , 0 , x , PictureBox1 . Height

01130                         For y = 0 To PictureBox1 . Height Step Grafico . Rejilla *  

       »                           Grafico . Zoom 

01131                             'líneas horizontales  

01132                             G . DrawLine ( p , 0 , y , PictureBox1 . Width , y

01133                         Next

01134                     Next

01135                 End If 

01136                 '-------------  

01137      

01138                 '----------------------------  

01139                 'Dibuja la colección de Arcos  

01140                 '----------------------------  

01141                 Dim nArcosR As Long 

01142                 Dim xxa , yya As Single 

01143                 Dim rra As Single 

01144      

01145                 Dim ArcS As Long 

01146      

01147                 For i = 0 To TotalArcos -

01148      

01149                     'define el trazo y su color  

01150                     p = New Pen ( Arcos ( i ) . Col , Arcos ( i ) . Grosor * Grafico . Zoom

01151      

01152                     'Compone etiqueta del arco  

01153                     If Grafico . minArco Or Grafico . maxArco Or Grafico . costArco Then 

01154                         t = "(" 

01155      

01156                         If Grafico . minArco Then 

01157                             t = t & Arcos ( i ) . Min . ToString 

01158                         End If 

01159      

01160                         If Grafico . maxArco Then 

01161                             If Grafico . minArco Then t = t & "; " 

01162                             t = t & Arcos ( i ) . Max . ToString 

01163                         End If 

01164      

01165                         If Grafico . costArco Then 

01166                             If ( Grafico . maxArco Or Grafico . minArco ) Then t = t &  

       »                               "; " 

01167                             t = t & Arcos ( i ) . Coste . ToString 

01168                         End If 

01169      

01170                         t = t & ")" 

01171                     End If 

01172      

01173                     If Arcos ( i ) . Nd1 = Arcos ( i ) . Nd2 Then 

01174                         'Arco entre un mismo nodo  

01175                         '----------  

01176                         rra = Nodos ( Arcos ( i ) . Nd1 ) . Radio * Grafico . Zoom 

01177                         x = Nodos ( Arcos ( i ) . Nd1 ) . X * Grafico . Zoom 




01178                         y = Nodos ( Arcos ( i ) . Nd1 ) . Y * Grafico . Zoom 

01179                         'dibuja beizer  

01180                         G . DrawBezier ( p , x - rra , y , x - rra * 3 , y + rra * 3 , x

       »                           rra * 5 , y + rra * 4.6 , x , y

01181                     Else 

01182                         'El arco va entre nodos diferentes  

01183                         '----------  

01184                         'Comprueba si entre nodos existe doble arco  

01185                         nArcosR =

01186                         nArcosR = ExisteArcoReves ( Arcos ( i ) . Nd1 , Arcos ( i ) . Nd2

01187      

01188                         'Busca un arco simétrico  

01189                         ArcS = -

01190                         ArcS = BuscaArcoSimetrico ( i

01191      

01192                         If ArcS <> - 1 Then 

01193                             If ArcS > i Then 

01194                                 Arcos ( i ) . B = True 

01195                                 Arcos ( ArcS ) . B = False 

01196                             End If 

01197                         Else 

01198                             Arcos ( i ) . B = False 

01199                         End If 

01200      

01201                         If nArcosR = 0 Or ( ArcS <> - 1 And Grafico . BArco = True )  

       »                           Then 'un sólo arco también si es simétrico  

01202                             'un sólo arco  

01203                             'toma datos del nodo 1  

01204                             x = Nodos ( Arcos ( i ) . Nd1 ) . X * Grafico . Zoom 

01205                             y = Nodos ( Arcos ( i ) . Nd1 ) . Y * Grafico . Zoom 

01206      

01207                             'toma datos del nodo 2  

01208                             x2 = Nodos ( Arcos ( i ) . Nd2 ) . X * Grafico . Zoom 

01209                             y2 = Nodos ( Arcos ( i ) . Nd2 ) . Y * Grafico . Zoom 

01210      

01211                         Else 

01212                             'toma datos del nodo 1  

01213                             x = Nodos ( Arcos ( i ) . Nd1 ) . X * Grafico . Zoom 

01214                             y = Nodos ( Arcos ( i ) . Nd1 ) . Y * Grafico . Zoom 

01215      

01216                             'toma datos del nodo 2  

01217                             x2 = Nodos ( Arcos ( i ) . Nd2 ) . X * Grafico . Zoom 

01218                             y2 = Nodos ( Arcos ( i ) . Nd2 ) . Y * Grafico . Zoom 

01219      

01220      

01221                             'dos arcos en diferentes sentidos  

01222                             'calcula vector unitario  

01223                             LV = Math . Sqrt ((( x2 - x )) ^ 2 + (( y2 - y )) ^ 2

01224                             If LV = 0 Then LV = 0.0000001 

01225      

01226                             'vector unitario de tamaño radio más pequeño  

01227                             If Nodos ( Arcos ( i ) . Nd1 ) . Radio < Nodos ( Arcos ( i ) . Nd2 ) .  

       »                               Radio Then 

01228                                 rra = Nodos ( Arcos ( i ) . Nd1 ) . Radio * 0.5 

01229                             Else 

01230                                 rra = Nodos ( Arcos ( i ) . Nd2 ) . Radio * 0.5 

01231                             End If 

01232                             'vector perpendicular  

01233                             yya = ( x2 - x ) / LV * rra * Grafico . Zoom 

01234                             xxa = (- 1 ) * ( y2 - y ) / LV * rra * Grafico . Zoom 

01235                             'traslada el punto de origen y destino  

01236                             x = x + xxa 

01237                             y = y + yya 

01238                             x2 = x2 + xxa 

01239                             y2 = y2 + yya 




01240                         End If 

01241      

01242                         'línea principal de centro a centro  

01243                         '------------------------------------  

01244                         G . DrawLine ( p , x , y , x2 , y2

01245      

01246                         ''prueba de dibujar flecha de otra manera  

01247                         ''######  

01248                         ''---------  

01249      

01250                         ''dos arcos en diferentes sentidos  

01251                         ''calcula vector unitario  

01252                         'LV = Math.Sqrt(((x2 - x)) ^ 2 + ((y2 - y)) ^ 2)  

01253                         'If LV = 0 Then LV = 0.0000001  

01254                         'xxa = (x2 - x) / LV * Grafico.Zoom  

01255                         'yya = (y2 - y) / LV * Grafico.Zoom  

01256                         ''calcula puntos de intersección con la circunferencia de  

       »                           ambos nodos  

01257                         'rra = Nodos(Arcos(i).Nd1).Radio * 1  

01258                         'Fxa = x + xxa * rra  

01259                         'Fya = y + yya * rra  

01260                         'rra = Nodos(Arcos(i).Nd2).Radio * 1  

01261                         'Fxb = x2 - xxa * rra  

01262                         'Fyb = y2 - yya * rra  

01263                         ''--------  

01264                         ''define el trazo y su color  

01265                         'p = New Pen(Arcos(i).Col, Arcos(i).Grosor * Grafico.Zoom)  

01266                         'p.StartCap = Drawing2D.LineCap.NoAnchor  

01267                         'p.EndCap = Drawing2D.LineCap.NoAnchor  

01268                         'G.DrawLine(p, Fxb, Fyb + 30, Fxa, Fya + 30)  

01269      

01270                         ''define el trazo y su color  

01271                         'pff = New Pen(Arcos(i).Col, Arcos(i).Grosor * 5 *  

       »                           Grafico.Zoom)  

01272                         'pff.StartCap = Drawing2D.LineCap.ArrowAnchor  

01273                         'pff.EndCap = Drawing2D.LineCap.NoAnchor  

01274                         'G.DrawLine(pff, Fxb, Fyb + 30, Fxb - xxa * 5, Fyb + 30 -  

       »                           yya * 5)  

01275                         'pff.StartCap = Drawing2D.LineCap.ArrowAnchor  

01276                         'pff.EndCap = Drawing2D.LineCap.NoAnchor  

01277                         'G.DrawLine(pff, Fxa, Fya + 30, Fxa + xxa * 5, Fya + 30 +  

       »                           yya * 5)  

01278                         ''#########  

01279      

01280                     End If 

01281      

01282                     'Dibuja etiqueta del arco  

01283                     '-------------------------  

01284                     If Arcos ( i ) . Nd1 = Arcos ( i ) . Nd2 Then 

01285                         'Arco sobre un mismo nodo  

01286                         'si se quisiera a la mitad, sustituir por 0.5  

01287                         tamañotexto = G . MeasureString ( t , fuente

01288                         'rectangulo blanco debajo para que el texto se lea más  

       »                           claro  

01289                         b = New Rectangle ( x - tamañotexto . Width / 2 , y + rra * 2

       »                           tamañotexto . Height / 2 , tamañotexto . Width , tamañotexto .  

       »                           Height

01290                         brocha = New System . Drawing . SolidBrush ( Grafico . ColorTapiz

01291                         G . FillRectangle ( brocha , b

01292                         'escribe el texto  

01293                         G . DrawString ( t , fuente , Brushes . Black , x - tamañotexto .  

       »                           Width / 2 , y + rra * 2 - tamañotexto . Height / 2

01294      

01295                         'punta de flecha en arco sobre un mismo nodo  

01296                         y2 = y + rra *




01297                         x2 = x + rra *

01298                         'calcula vector unitario  

01299      

01300                         LV = Math . Sqrt ((( x2 - x )) ^ 2 + (( y2 - y )) ^ 2

01301                         If LV = 0 Then LV = 0.0000001 

01302                         'vector unitario de tamaño radio destino  

01303                         x = (- 1 ) * ( x2 - x ) / LV * Nodos ( Arcos ( i ) . Nd2 ) . Radio *  

       »                           Grafico . Zoom 

01304                         y = (- 1 ) * ( y2 - y ) / LV * Nodos ( Arcos ( i ) . Nd2 ) . Radio *  

       »                           Grafico . Zoom 

01305      

01306                         'punto de intersección de la línea principal con el  

       »                           círculo del nodo destino  

01307                         Xa = x2 - rra * 2.3 

01308                         Ya = y2 - rra * 2.3 

01309                         'cambia el tamaño de la flecha  

01310                         x = x / Nodos ( Arcos ( i ) . Nd2 ) . Radio * 10 

01311                         y = y / Nodos ( Arcos ( i ) . Nd2 ) . Radio * 10 

01312                         'segmento estribor de la punta de la flecha  

01313                         Xb = Xa - x * Arcos ( i ) . Grosor - y / 2 * Arcos ( i ) . Grosor 

01314                         Yb = Ya - y * Arcos ( i ) . Grosor + x / 2 * Arcos ( i ) . Grosor 

01315                         G . DrawLine ( p , Xb , Yb , Xa , Ya

01316                         'segmento babor de la punta de la flecha  

01317                         Xb = Xa - x * Arcos ( i ) . Grosor + y / 2 * Arcos ( i ) . Grosor 

01318                         Yb = Ya - y * Arcos ( i ) . Grosor - x / 2 * Arcos ( i ) . Grosor 

01319                         G . DrawLine ( p , Xb , Yb , Xa , Ya

01320      

01321                     Else 

01322      

01323                         If Arcos ( i ) . B = True And Grafico . BArco = True Then 

01324                             'si se quisiera a la mitad, sustituir por 0.5  

01325                             tamañotexto = G . MeasureString ( t , fuente

01326                             'rectangulo blanco debajo para que el texto se lea más  

       »                               claro  

01327                             b = New Rectangle ( x + 0.3 * ( x2 - x ) - tamañotexto .  

       »                               Width / 2 , y + 0.3 * ( y2 - y ) - tamañotexto . Height

       »                               2 , tamañotexto . Width , tamañotexto . Height

01328                             brocha = New System . Drawing . SolidBrush ( Grafico .  

       »                               ColorTapiz

01329                             G . FillRectangle ( brocha , b

01330                             'escribe el texto  

01331                             G . DrawString ( t , fuente , Brushes . Black , x + 0.3 * ( x2

       »                               x ) - tamañotexto . Width / 2 , y + 0.3 * ( y2 - y ) -  

       »                               tamañotexto . Height / 2

01332                         Else 

01333                             'el 0.7 hace que el texto del arco se encuentre cerca  

       »                               del destino  

01334                             'si se quisiera a la mitad, sustituir por 0.5  

01335                             tamañotexto = G . MeasureString ( t , fuente

01336                             'rectangulo blanco debajo para que el texto se lea más  

       »                               claro  

01337                             b = New Rectangle ( x + 0.7 * ( x2 - x ) - tamañotexto .  

       »                               Width / 2 , y + 0.7 * ( y2 - y ) - tamañotexto . Height

       »                               2 , tamañotexto . Width , tamañotexto . Height

01338                             brocha = New System . Drawing . SolidBrush ( Grafico .  

       »                               ColorTapiz

01339                             G . FillRectangle ( brocha , b

01340                             'escribe el texto  

01341                             G . DrawString ( t , fuente , Brushes . Black , x + 0.7 * ( x2

       »                               x ) - tamañotexto . Width / 2 , y + 0.7 * ( y2 - y ) -  

       »                               tamañotexto . Height / 2

01342                         End If 

01343      

01344                         'punta de flecha destino  

01345                         '-----------------------  




01346      

01347                         'calcula vector unitario  

01348                         LV = Math . Sqrt ((( x2 - x )) ^ 2 + (( y2 - y )) ^ 2

01349                         If LV = 0 Then LV = 0.0000001 

01350                         'vector unitario de tamaño radio destino  

01351                         x = ( x2 - x ) / LV * Nodos ( Arcos ( i ) . Nd2 ) . Radio * Grafico .  

       »                           Zoom 

01352                         y = ( y2 - y ) / LV * Nodos ( Arcos ( i ) . Nd2 ) . Radio * Grafico .  

       »                           Zoom 

01353      

01354                         'punto de intersección de la línea principal con el  

       »                           círculo del nodo destino  

01355                         Xa = x2 -

01356                         Ya = y2 -

01357      

01358                         'cambia el tamaño de la flecha  

01359                         x = x / Nodos ( Arcos ( i ) . Nd2 ) . Radio * 10 

01360                         y = y / Nodos ( Arcos ( i ) . Nd2 ) . Radio * 10 

01361                         'segmento estribor de la punta de la flecha  

01362                         Xb = Xa - x * Arcos ( i ) . Grosor - y / 2 * Arcos ( i ) . Grosor 

01363                         Yb = Ya - y * Arcos ( i ) . Grosor + x / 2 * Arcos ( i ) . Grosor 

01364                         G . DrawLine ( p , Xb , Yb , Xa , Ya

01365                         'segmento babor de la punta de la flecha  

01366                         Xb = Xa - x * Arcos ( i ) . Grosor + y / 2 * Arcos ( i ) . Grosor 

01367                         Yb = Ya - y * Arcos ( i ) . Grosor - x / 2 * Arcos ( i ) . Grosor 

01368                         G . DrawLine ( p , Xb , Yb , Xa , Ya

01369      

01370                         'Caso de arco bidireccional  

01371                         'con dos puntas de flecha  

01372                         If Arcos ( i ) . B = True And Grafico . BArco = True Then 

01373                             'punta de flecha origen  

01374                             '-----------------------  

01375                             'toma los nodos al revés y ya está!  

01376                             'toma datos del nodo 1  

01377                             x = Nodos ( Arcos ( i ) . Nd2 ) . X * Grafico . Zoom 

01378                             y = Nodos ( Arcos ( i ) . Nd2 ) . Y * Grafico . Zoom 

01379      

01380                             'toma datos del nodo 2  

01381                             x2 = Nodos ( Arcos ( i ) . Nd1 ) . X * Grafico . Zoom 

01382                             y2 = Nodos ( Arcos ( i ) . Nd1 ) . Y * Grafico . Zoom 

01383      

01384                             'calcula vector unitario  

01385                             LV = Math . Sqrt ((( x2 - x )) ^ 2 + (( y2 - y )) ^ 2

01386                             If LV = 0 Then LV = 0.0000001 

01387                             'vector unitario de tamaño radio destino  

01388                             x = ( x2 - x ) / LV * Nodos ( Arcos ( i ) . Nd1 ) . Radio *  

       »                               Grafico . Zoom 

01389                             y = ( y2 - y ) / LV * Nodos ( Arcos ( i ) . Nd1 ) . Radio *  

       »                               Grafico . Zoom 

01390      

01391                             'punto de intersección de la línea principal con el  

       »                               círculo del nodo destino  

01392                             Xa = x2 -

01393                             Ya = y2 -

01394      

01395                             'cambia el tamaño de la flecha  

01396                             x = x / Nodos ( Arcos ( i ) . Nd1 ) . Radio * 10 

01397                             y = y / Nodos ( Arcos ( i ) . Nd1 ) . Radio * 10 

01398                             'segmento estribor de la punta de la flecha  

01399                             Xb = Xa - x * Arcos ( i ) . Grosor - y / 2 * Arcos ( i ) .  

       »                               Grosor 

01400                             Yb = Ya - y * Arcos ( i ) . Grosor + x / 2 * Arcos ( i ) .  

       »                               Grosor 

01401                             G . DrawLine ( p , Xb , Yb , Xa , Ya

01402                             'segmento babor de la punta de la flecha  




01403                             Xb = Xa - x * Arcos ( i ) . Grosor + y / 2 * Arcos ( i ) .  

       »                               Grosor 

01404                             Yb = Ya - y * Arcos ( i ) . Grosor - x / 2 * Arcos ( i ) .  

       »                               Grosor 

01405                             G . DrawLine ( p , Xb , Yb , Xa , Ya

01406                         End If 

01407                     End If 

01408                 Next

01409      

01410                 '----------------------------  

01411                 'Dibuja la colección de Nodos  

01412                 '----------------------------  

01413                 For i = 0 To TotalNodos -

01414                     'toma datos del nodo  

01415                     x = Nodos ( i ) . X * Grafico . Zoom 

01416                     y = Nodos ( i ) . Y * Grafico . Zoom 

01417                     radio = Nodos ( i ) . Radio * Grafico . Zoom 

01418      

01419                     'define el trazo y su color  

01420                     p = New Pen ( Color . Black , Nodos ( i ) . Grosor * Grafico . Zoom

01421                     'dibuja círculo del nodo  

01422                     b = New Rectangle ( x - radio , y - radio , radio * 2 , radio * 2

01423                     'rellena el círculo del nodo  

01424                     Select Case

01425                         Case Nd1S 'primer nodo seleccionado  

01426                             brocha = New System . Drawing . SolidBrush ( Color . LightGreen  

       »                              

01427                         Case Nd2S 'segundo nodo seleccionado  

01428                             brocha = New System . Drawing . SolidBrush ( Color . Red

01429                         Case Else 'no seleccionado - color original  

01430                             brocha = New System . Drawing . SolidBrush ( Nodos ( i ) . Col

01431                     End Select 

01432      

01433                     'condicion de dibujado de ambos textos separados por ecuador  

01434                     'o uno sólo centrado en el nodo  

01435                     Dim condicion As Integer 

01436                     If Grafico . textoNodo = False Or Grafico . costNodo = False Then 

01437                         condicion =

01438                     Else 

01439                         condicion =

01440                     End If 

01441      

01442                     G . FillEllipse ( brocha , b

01443                     If Grafico . textoNodo And Grafico . costNodo Then 

01444                         'dibuja ecuador del nodo  

01445                         G . DrawLine ( p , x - radio , y , x + radio , y

01446                     End If 

01447                     If Grafico . textoNodo Then 

01448                         'pone texto etiqueta en la mitad superior  

01449                         t = Nodos ( i ) . Texto 

01450                         tamañotexto = G . MeasureString ( t , fuente

01451                         G . DrawString ( t , fuente , Brushes . Black , x - tamañotexto .  

       »                           Width / 2 , y - tamañotexto . Height / 2 - radio / 2 *  

       »                           condicion

01452                     End If 

01453                     If Grafico . costNodo Then 

01454                         'pone texto valor en la mitad inferior  

01455                         t = Nodos ( i ) . Valor . ToString 

01456                         tamañotexto = G . MeasureString ( t , fuente

01457                         G . DrawString ( t , fuente , Brushes . Black , x - tamañotexto .  

       »                           Width / 2 , y - tamañotexto . Height / 2 + radio / 2 *  

       »                           condicion

01458                     End If 

01459      

01460                     'dibuja el borde del nodo  




01461                     G . DrawEllipse ( p , b

01462                 Next

01463                 '----------------------------  

01464      

01465                 'Intercepción de posibles errores al dibujar  

01466             Catch ex As Exception 

01467                 Me . Cursor = Cursors . Default 

01468                 MsgBox ( "Ha fallado el proceso de dibujar el grafo" & vbCrLf & ex .  

       »                   Message , MsgBoxStyle . Exclamation , "Grafos - Excepción"

01469                 Exit Sub 

01470             Finally 

01471             End Try 

01472      

01473         End Sub 

01474      




01475         Public Sub DibujaGrafoSVG ( ByVal fichero As String

01476             'Esta rutina se basa en la rutina DibujaGrafo  

01477             'transforma todas los comandos gráficos en instrucciones  

01478             'xml que serán guardadas como texto en un fichero de  

01479             'extensión .svg (Scalable Vector Graphics) que puede ser  

01480             'interpretado por un navegador con el plugin svg instalado.  

01481             Try 

01482                 Dim txt , txt0 , txt1 , txt2 , txt3 , txt4 As String 

01483                 Dim cdn As String 

01484                 Dim cr , cg , cb As Integer 

01485      

01486      

01487                 Dim version As String 

01488                 version = System . Diagnostics . FileVersionInfo . GetVersionInfo ( System .  

       »                   Reflection . Assembly . GetExecutingAssembly . Location ) . FileMajorPart 

01489                 version = version & "." & System . Diagnostics . FileVersionInfo .  

       »                   GetVersionInfo ( System . Reflection . Assembly . GetExecutingAssembly .  

       »                   Location ) . FileMinorPart 

01490                 version = version & "." & System . Diagnostics . FileVersionInfo .  

       »                   GetVersionInfo ( System . Reflection . Assembly . GetExecutingAssembly .  

       »                   Location ) . FileBuildPart 

01491      

01492                 'cabecera del fichero xml  

01493                 txt = "" 

01494                 txt = "<?xml version=""1.0"" encoding=""UTF-8""?>" 

01495                 txt & = vbCrLf 

01496                 txt & = "<!-- This file was written by Grafos software. -->" &  

       »                   vbCrLf 

01497                 txt & = "<!-- http://ttt.upv.es/~arodrigu/grafos -->" &  

       »                   vbCrLf 

01498                 txt & = "<!-- (cc) 2003..2005 - Alejandro Rodriguez Villalobos -->" & 

       »                   vbCrLf 

01499                 txt & = "<!-- Fecha: " & Now . ToShortDateString & " -->" & vbCrLf 

01500                 txt & = "<!-- Version: " & version & " -->" & vbCrLf 

01501                 txt & = vbCrLf 

01502                 'tamaño del grafo  

01503                 txt & = "<!-- Tamaño del objeto -->" 

01504                 txt & = vbCrLf 

01505                 txt & = "<svg xml:space=""preserve"" width=""" & Grafico . TapizX *  

       »                   Grafico . Zoom + 2 & """ height=""" & Grafico . TapizY * Grafico . Zoom 

       »                   + 2 & """>" 

01506                 txt & = vbCrLf 

01507                 txt & = "<!-- Escala general 1:1 en pixeles -->" 

01508                 txt & = vbCrLf 

01509                 txt & = "<g transform=""scale(1)"">" 

01510                 txt & = vbCrLf 

01511                 'tapiz  

01512                 txt0 & = "<g id=""0"">" 

01513                 txt0 & = vbCrLf 

01514                 txt0 & = "<!-- Tapiz -->" 

01515                 txt0 & = vbCrLf 

01516                 cr = Grafico . ColorTapiz .

01517                 cg = Grafico . ColorTapiz .

01518                 cb = Grafico . ColorTapiz .

01519      

01520                 txt0 & = "<rect style=""fill:rgb(" & cr & "," & cg & "," & cb &  

       »                   ");stroke:rgb(127,127,127)"" width=""" & Grafico . TapizX * Grafico  

       »                   . Zoom + 1 & """ height=""" & Grafico . TapizY * Grafico . Zoom + 1 &  

       »                   """/>" 

01521                 txt0 & = vbCrLf 

01522                 txt0 & = "</g>" 

01523                 txt0 & = vbCrLf 

01524                 'definiciones  

01525                 G = TomaObjetoGraphics ( PictureBox1




01526      

01527                 Dim p As Pen 'pluma  

01528                 Dim brocha As System . Drawing . SolidBrush 

01529      

01530                 Dim b As Rectangle 

01531                 Dim i As Long 'contador  

01532      

01533                 Dim x , y As Single 

01534                 Dim x2 , y2 As Single 

01535                 Dim radio As Single 

01536                 Dim t As String 'para texto  

01537                 Dim v As Single 'para valor  

01538      

01539                 Dim tamañotexto As SizeF 

01540      

01541                 Dim LV As Single 

01542                 Dim Xa As Single , Ya As Single 

01543                 Dim Xb As Single , Yb As Single 

01544      

01545                 Dim fuente As Font 

01546      

01547                 Dim f As Form2 

01548                 f = New Form2 

01549                 'Cambia escala del tipo de letra  

01550                 fuente = New Font ( Grafico . Fuente . Name , Grafico . Fuente . Size *  

       »                   Grafico . Zoom , Grafico . Fuente . Style , GraphicsUnit . Pixel

01551      

01552                 '--------------  

01553                 'DibujaRejilla  

01554                 '--------------  

01555                 txt1 & = "<g id=""1"">" 

01556                 txt1 & = vbCrLf 

01557                 If mnuFormatoRejilla . Checked = True Then 

01558                     txt1 & = "<!-- rejilla -->" 

01559                     txt1 & = vbCrLf 

01560                     cr = Grafico . ColorRejilla .

01561                     cg = Grafico . ColorRejilla .

01562                     cb = Grafico . ColorRejilla .

01563      

01564                     For x = 0 To Grafico . TapizX * Grafico . Zoom Step Grafico . Rejilla 

       »                       * Grafico . Zoom 

01565                         'líneas verticales  

01566                         txt1 & = "<line x1=""" & x & """ y1=""" & 0 & """ x2=""" &

       »                           & """ y2=""" & Grafico . TapizY * Grafico . Zoom & """  

       »                           style=""stroke-width:" & 1 & ";stroke:rgb(" & cr & "," &  

       »                           cg & "," & cb & ")""></line>" 

01567                         txt1 & = vbCrLf 

01568                         For y = 0 To Grafico . TapizY * Grafico . Zoom Step Grafico .  

       »                           Rejilla * Grafico . Zoom 

01569                             'líneas horizontales  

01570                             txt1 & = "<line x1=""" & 0 & """ y1=""" & y & """ x2=""" 

       »                               & Grafico . TapizX * Grafico . Zoom & """ y2=""" & y &  

       »                               """ style=""stroke-width:" & 1 & ";stroke:rgb(" & cr  

       »                               & "," & cg & "," & cb & ")""></line>" 

01571                             txt1 & = vbCrLf 

01572                         Next

01573                     Next

01574                 End If 

01575                 txt1 & = "</g>" 

01576                 txt1 & = vbCrLf 

01577                 '------------  

01578      

01579                 '----------------------------  

01580                 'Dibuja la colección de Arcos  

01581                 '----------------------------  




01582                 Dim nArcosR As Long 

01583                 Dim xxa , yya As Single 

01584                 Dim rra As Single 

01585      

01586                 Dim ArcS As Long 

01587      

01588                 txt2 & = "<!-- arcos -->" 

01589                 txt2 & = "<g id=""2"">" 

01590                 txt2 & = vbCrLf 

01591                 txt2 & = vbCrLf 

01592      

01593                 txt3 & = "<!-- textos -->" 

01594                 txt3 & = "<g id=""3"">" 

01595                 txt3 & = vbCrLf 

01596                 txt3 & = vbCrLf 

01597      

01598                 For i = 0 To TotalArcos -

01599      

01600                     'define el trazo y su color  

01601                     cr = Arcos ( i ) . Col .

01602                     cg = Arcos ( i ) . Col .

01603                     cb = Arcos ( i ) . Col .

01604      

01605                     'Compone etiqueta del arco  

01606                     If Grafico . minArco Or Grafico . maxArco Or Grafico . costArco Then 

01607                         t = "(" 

01608      

01609                         If Grafico . minArco Then 

01610                             t = t & Arcos ( i ) . Min . ToString 

01611                         End If 

01612      

01613                         If Grafico . maxArco Then 

01614                             If Grafico . minArco Then t = t & "; " 

01615                             t = t & Arcos ( i ) . Max . ToString 

01616                         End If 

01617      

01618                         If Grafico . costArco Then 

01619                             If ( Grafico . maxArco Or Grafico . minArco ) Then t = t &  

       »                               "; " 

01620                             t = t & Arcos ( i ) . Coste . ToString 

01621                         End If 

01622      

01623                         t = t & ")" 

01624                     End If 

01625      

01626                     If Arcos ( i ) . Nd1 = Arcos ( i ) . Nd2 Then 

01627                         'Arco entre un mismo nodo  

01628                         '----------  

01629                         rra = Nodos ( Arcos ( i ) . Nd1 ) . Radio * Grafico . Zoom 

01630                         x = Nodos ( Arcos ( i ) . Nd1 ) . X * Grafico . Zoom 

01631                         y = Nodos ( Arcos ( i ) . Nd1 ) . Y * Grafico . Zoom 

01632                         'dibuja beizer  

01633                         'g.DrawBezier(p,, x - rra, y, x - rra * 3, y + rra * 3, x  

       »                           + rra * 5, y + rra * 4.6, x, y)  

01634                         txt2 & = "<path style=""stroke-width:" & Arcos ( i ) . Grosor *  

       »                           Grafico . Zoom & ";stroke:rgb(" & cr & "," & cg & "," & cb  

       »                           & ");fill:none""" 

01635                         txt2 & = " d=""M " & Int ( x - rra ) & "," & Int ( y ) & " " 

01636                         txt2 & = " Q " & Int ( x - rra * 3.5 ) & "," & Int ( y + rra * 2  

       »                           ) & " " & Int ( x ) & "," & Int ( y + rra * 3 ) & " " 

01637                         txt2 & = " Q " & Int ( x + rra * 3.5 ) & "," & Int ( y + rra *  

       »                           3.8 ) & " " & Int ( x ) & "," & Int ( y - 6 ) & " " 

01638      

01639                         txt2 & = "Z""/> " 

01640                         txt2 & = vbCrLf 




01641      

01642                     Else 

01643                         'El arco va entre nodos diferentes  

01644                         '----------  

01645                         'Comprueba si entre nodos existe doble arco  

01646                         nArcosR =

01647                         nArcosR = ExisteArcoReves ( Arcos ( i ) . Nd1 , Arcos ( i ) . Nd2

01648      

01649                         'Busca un arco simétrico  

01650                         ArcS = -

01651                         ArcS = BuscaArcoSimetrico ( i

01652      

01653                         If ArcS <> - 1 Then 

01654                             If ArcS > i Then 

01655                                 Arcos ( i ) . B = True 

01656                                 Arcos ( ArcS ) . B = False 

01657                             End If 

01658                         Else 

01659                             Arcos ( i ) . B = False 

01660                         End If 

01661      

01662                         If nArcosR = 0 Or ( ArcS <> - 1 And Grafico . BArco = True )  

       »                           Then 'un sólo arco también si es simétrico  

01663                             'un sólo arco  

01664                             'toma datos del nodo 1  

01665                             x = Nodos ( Arcos ( i ) . Nd1 ) . X * Grafico . Zoom 

01666                             y = Nodos ( Arcos ( i ) . Nd1 ) . Y * Grafico . Zoom 

01667      

01668                             'toma datos del nodo 2  

01669                             x2 = Nodos ( Arcos ( i ) . Nd2 ) . X * Grafico . Zoom 

01670                             y2 = Nodos ( Arcos ( i ) . Nd2 ) . Y * Grafico . Zoom 

01671      

01672                         Else 

01673                             'toma datos del nodo 1  

01674                             x = Nodos ( Arcos ( i ) . Nd1 ) . X * Grafico . Zoom 

01675                             y = Nodos ( Arcos ( i ) . Nd1 ) . Y * Grafico . Zoom 

01676      

01677                             'toma datos del nodo 2  

01678                             x2 = Nodos ( Arcos ( i ) . Nd2 ) . X * Grafico . Zoom 

01679                             y2 = Nodos ( Arcos ( i ) . Nd2 ) . Y * Grafico . Zoom 

01680      

01681      

01682                             'dos arcos en diferentes sentidos  

01683                             'calcula vector unitario  

01684                             LV = Math . Sqrt ((( x2 - x )) ^ 2 + (( y2 - y )) ^ 2

01685                             If LV = 0 Then LV = 0.0000001 

01686      

01687      

01688                             'vector unitario de tamaño radio más pequeño  

01689                             If Nodos ( Arcos ( i ) . Nd1 ) . Radio < Nodos ( Arcos ( i ) . Nd2 ) .  

       »                               Radio Then 

01690                                 rra = Nodos ( Arcos ( i ) . Nd1 ) . Radio * 0.5 

01691                             Else 

01692                                 rra = Nodos ( Arcos ( i ) . Nd2 ) . Radio * 0.5 

01693                             End If 

01694                             'vector perpendicular  

01695                             yya = ( x2 - x ) / LV * rra * Grafico . Zoom 

01696                             xxa = (- 1 ) * ( y2 - y ) / LV * rra * Grafico . Zoom 

01697                             'traslada el punto de origen y destino  

01698                             x = x + xxa 

01699                             y = y + yya 

01700                             x2 = x2 + xxa 

01701                             y2 = y2 + yya 

01702                         End If 

01703      




01704                         'línea principal de centro a centro  

01705                         '------------------------------------  

01706                         txt2 & = "<line x1=""" & x & """ y1=""" & y & """ x2=""" &  

       »                           x2 & """ y2=""" & y2 & """ style=""stroke-width:" & Arcos  

       »                           ( i ) . Grosor * Grafico . Zoom & ";stroke:rgb(" & cr & "," &  

       »                           cg & "," & cb & ")""></line>" 

01707                         txt2 & = vbCrLf 

01708      

01709                     End If 

01710      

01711                     'Dibuja etiqueta del arco  

01712                     '-------------------------  

01713                     If Arcos ( i ) . Nd1 = Arcos ( i ) . Nd2 Then 

01714                         'Arco sobre un mismo nodo  

01715                         'si se quisiera a la mitad, sustituir por 0.5  

01716                         tamañotexto = G . MeasureString ( t , fuente

01717      

01718                         'escribe el texto  

01719                         txt3 & = "<text x=""" & Int ( x ) & """ y=""" & Int ( y + rra *  

       »                           2 ) & """ style=""font-family:" & Grafico . Fuente . Name .  

       »                           ToString & ";font-size:" & Int ( tamañotexto . Height ) &  

       »                           ";fill:rgb(0,0,0);text-anchor:middle;"">" & t & "</text>" 

01720                         txt3 & = vbCrLf 

01721      

01722                         'punta de flecha en arco sobre un mismo nodo  

01723                         y2 = y + rra *

01724                         x2 = x + rra *

01725                         'calcula vector unitario  

01726      

01727                         LV = Math . Sqrt ((( x2 - x )) ^ 2 + (( y2 - y )) ^ 2

01728                         If LV = 0 Then LV = 0.0000001 

01729                         'vector unitario de tamaño radio destino  

01730                         x = (- 1 ) * ( x2 - x ) / LV * Nodos ( Arcos ( i ) . Nd2 ) . Radio *  

       »                           Grafico . Zoom 

01731                         y = (- 1 ) * ( y2 - y ) / LV * Nodos ( Arcos ( i ) . Nd2 ) . Radio *  

       »                           Grafico . Zoom 

01732      

01733                         'punto de intersección de la línea principal con el  

       »                           círculo del nodo destino  

01734                         Xa = x2 - rra * 2.3 

01735                         Ya = y2 - rra * 2.3 

01736      

01737                         'cambia el tamaño de la flecha  

01738                         x = x / Nodos ( Arcos ( i ) . Nd2 ) . Radio * 10 

01739                         y = y / Nodos ( Arcos ( i ) . Nd2 ) . Radio * 10 

01740                         'segmento estribor de la punta de la flecha  

01741                         Xb = Xa - x * Arcos ( i ) . Grosor - y / 2 * Arcos ( i ) . Grosor 

01742                         Yb = Ya - y * Arcos ( i ) . Grosor + x / 2 * Arcos ( i ) . Grosor 

01743      

01744                         txt2 & = "<line x1=""" & Xb & """ y1=""" & Yb & """ x2=""" & 

       »                           Xa & """ y2=""" & Ya & """ style=""stroke-width:" &  

       »                           Arcos ( i ) . Grosor * Grafico . Zoom & ";stroke:rgb(" & cr &  

       »                           "," & cg & "," & cb & ")""></line>" 

01745                         txt2 & = vbCrLf 

01746                         'segmento babor de la punta de la flecha  

01747                         Xb = Xa - x * Arcos ( i ) . Grosor + y / 2 * Arcos ( i ) . Grosor 

01748                         Yb = Ya - y * Arcos ( i ) . Grosor - x / 2 * Arcos ( i ) . Grosor 

01749      

01750                         txt2 & = "<line x1=""" & Xb & """ y1=""" & Yb & """ x2=""" & 

       »                           Xa & """ y2=""" & Ya & """ style=""stroke-width:" &  

       »                           Arcos ( i ) . Grosor * Grafico . Zoom & ";stroke:rgb(" & cr &  

       »                           "," & cg & "," & cb & ")""></line>" 

01751                         txt2 & = vbCrLf 

01752                     Else 

01753                         If Arcos ( i ) . B = True And Grafico . BArco = True Then 




01754                             'si se quisiera a la mitad, sustituir por 0.5  

01755                             tamañotexto = G . MeasureString ( t , fuente

01756      

01757                             'escribe el texto  

01758                             txt3 & = "<text x=""" & Int ( x + 0.3 * ( x2 - x )) & """  

       »                               y=""" & Int ( y + 0.3 * ( y2 - y )) & """ style=" 

       »                               "font-family:" & Grafico . Fuente . Name . ToString &  

       »                               ";font-size:" & Int ( tamañotexto . Height ) &  

       »                               ";fill:rgb(0,0,0);text-anchor:middle;"">" & t &  

       »                               "</text>" 

01759                             txt3 & = vbCrLf 

01760      

01761                         Else 

01762                             'el 0.7 hace que el texto del arco se encuentre cerca  

       »                               del destino  

01763                             'si se quisiera a la mitad, sustituir por 0.5  

01764                             tamañotexto = G . MeasureString ( t , fuente

01765      

01766                             'escribe el texto  

01767                             txt3 & = "<text x=""" & Int ( x + 0.7 * ( x2 - x )) & """  

       »                               y=""" & Int ( y + 0.7 * ( y2 - y )) & """ style=" 

       »                               "font-family:" & Grafico . Fuente . Name . ToString &  

       »                               ";font-size:" & Int ( tamañotexto . Height ) &  

       »                               ";fill:rgb(0,0,0);text-anchor:middle;"">" & t &  

       »                               "</text>" 

01768                             txt3 & = vbCrLf 

01769                         End If 

01770      

01771                         'punta de flecha destino  

01772                         '-----------------------  

01773      

01774                         'calcula vector unitario  

01775                         LV = Math . Sqrt ((( x2 - x )) ^ 2 + (( y2 - y )) ^ 2

01776                         If LV = 0 Then LV = 0.0000001 

01777                         'vector unitario de tamaño radio destino  

01778                         x = ( x2 - x ) / LV * Nodos ( Arcos ( i ) . Nd2 ) . Radio * Grafico .  

       »                           Zoom 

01779                         y = ( y2 - y ) / LV * Nodos ( Arcos ( i ) . Nd2 ) . Radio * Grafico .  

       »                           Zoom 

01780      

01781                         'punto de intersección de la línea principal con el  

       »                           círculo del nodo destino  

01782                         Xa = x2 -

01783                         Ya = y2 -

01784      

01785                         'cambia el tamaño de la flecha  

01786                         x = x / Nodos ( Arcos ( i ) . Nd2 ) . Radio * 10 

01787                         y = y / Nodos ( Arcos ( i ) . Nd2 ) . Radio * 10 

01788                         'segmento estribor de la punta de la flecha  

01789                         Xb = Xa - x * Arcos ( i ) . Grosor - y / 2 * Arcos ( i ) . Grosor 

01790                         Yb = Ya - y * Arcos ( i ) . Grosor + x / 2 * Arcos ( i ) . Grosor 

01791      

01792                         txt2 & = "<line x1=""" & Xb & """ y1=""" & Yb & """ x2=""" & 

       »                           Xa & """ y2=""" & Ya & """ style=""stroke-width:" &  

       »                           Arcos ( i ) . Grosor * Grafico . Zoom & ";stroke:rgb(" & cr &  

       »                           "," & cg & "," & cb & ")""></line>" 

01793                         txt2 & = vbCrLf 

01794                         'segmento babor de la punta de la flecha  

01795                         Xb = Xa - x * Arcos ( i ) . Grosor + y / 2 * Arcos ( i ) . Grosor 

01796                         Yb = Ya - y * Arcos ( i ) . Grosor - x / 2 * Arcos ( i ) . Grosor 

01797      

01798                         txt2 & = "<line x1=""" & Xb & """ y1=""" & Yb & """ x2=""" & 

       »                           Xa & """ y2=""" & Ya & """ style=""stroke-width:" &  

       »                           Arcos ( i ) . Grosor * Grafico . Zoom & ";stroke:rgb(" & cr &  

       »                           "," & cg & "," & cb & ")""></line>" 




01799                         txt2 & = vbCrLf 

01800      

01801                         'Caso de arco bidireccional  

01802                         'con dos puntas de flecha  

01803                         If Arcos ( i ) . B = True And Grafico . BArco = True Then 

01804                             'punta de flecha origen  

01805                             '-----------------------  

01806                             'toma los nodos al revés y ya está!  

01807                             'toma datos del nodo 1  

01808                             x = Nodos ( Arcos ( i ) . Nd2 ) . X * Grafico . Zoom 

01809                             y = Nodos ( Arcos ( i ) . Nd2 ) . Y * Grafico . Zoom 

01810      

01811                             'toma datos del nodo 2  

01812                             x2 = Nodos ( Arcos ( i ) . Nd1 ) . X * Grafico . Zoom 

01813                             y2 = Nodos ( Arcos ( i ) . Nd1 ) . Y * Grafico . Zoom 

01814      

01815                             'calcula vector unitario  

01816                             LV = Math . Sqrt ((( x2 - x )) ^ 2 + (( y2 - y )) ^ 2

01817                             If LV = 0 Then LV = 0.0000001 

01818                             'vector unitario de tamaño radio destino  

01819                             x = ( x2 - x ) / LV * Nodos ( Arcos ( i ) . Nd1 ) . Radio *  

       »                               Grafico . Zoom 

01820                             y = ( y2 - y ) / LV * Nodos ( Arcos ( i ) . Nd1 ) . Radio *  

       »                               Grafico . Zoom 

01821      

01822                             'punto de intersección de la línea principal con el  

       »                               círculo del nodo destino  

01823                             Xa = x2 -

01824                             Ya = y2 -

01825                             'cambia el tamaño de la flecha  

01826                             x = x / Nodos ( Arcos ( i ) . Nd1 ) . Radio * 10 

01827                             y = y / Nodos ( Arcos ( i ) . Nd1 ) . Radio * 10 

01828                             'segmento estribor de la punta de la flecha  

01829                             Xb = Xa - x * Arcos ( i ) . Grosor - y / 2 * Arcos ( i ) .  

       »                               Grosor 

01830                             Yb = Ya - y * Arcos ( i ) . Grosor + x / 2 * Arcos ( i ) .  

       »                               Grosor 

01831      

01832                             txt2 & = "<line x1=""" & Xb & """ y1=""" & Yb & """ x2=" 

       »                               "" & Xa & """ y2=""" & Ya & """ style=" 

       »                               "stroke-width:" & Arcos ( i ) . Grosor * Grafico . Zoom &  

       »                               ";stroke:rgb(" & cr & "," & cg & "," & cb & ")" 

       »                               "></line>" 

01833                             txt2 & = vbCrLf 

01834                             'segmento babor de la punta de la flecha  

01835                             Xb = Xa - x * Arcos ( i ) . Grosor + y / 2 * Arcos ( i ) .  

       »                               Grosor 

01836                             Yb = Ya - y * Arcos ( i ) . Grosor - x / 2 * Arcos ( i ) .  

       »                               Grosor 

01837      

01838                             txt2 & = "<line x1=""" & Xb & """ y1=""" & Yb & """ x2=" 

       »                               "" & Xa & """ y2=""" & Ya & """ style=" 

       »                               "stroke-width:" & Arcos ( i ) . Grosor * Grafico . Zoom &  

       »                               ";stroke:rgb(" & cr & "," & cg & "," & cb & ")" 

       »                               "></line>" 

01839                             txt2 & = vbCrLf 

01840                         End If 

01841                     End If 

01842                 Next

01843      

01844                 txt2 & = "</g>" 

01845                 txt2 & = vbCrLf 

01846      

01847                 txt4 & = "<!-- nodos -->" 

01848                 txt4 & = "<g id=""4"">" 




01849                 txt4 & = vbCrLf 

01850      

01851                 '----------------------------  

01852                 'Dibuja la colección de Nodos  

01853                 '----------------------------  

01854                 For i = 0 To TotalNodos -

01855                     'toma datos del nodo  

01856                     x = Nodos ( i ) . X * Grafico . Zoom 

01857                     y = Nodos ( i ) . Y * Grafico . Zoom 

01858                     radio = Nodos ( i ) . Radio * Grafico . Zoom 

01859      

01860                     'condicion de dibujado de ambos textos separados por ecuador  

01861                     'o uno sólo centrado en el nodo  

01862                     Dim condicion As Integer 

01863                     If Grafico . textoNodo = False Or Grafico . costNodo = False Then 

01864                         condicion =

01865                     Else 

01866                         condicion =

01867                     End If 

01868      

01869                     'dibuja nodo en svg  

01870                     txt4 & = "<!-- nodo " & i & " -->" 

01871                     txt4 & = vbCrLf 

01872                     txt4 & = "<ellipse cx=""" & x & """ cy=""" & y & """ rx=""" &  

       »                       radio & """ ry=""" & radio & """ style=""fill:rgb(" & Nodos ( i  

       »                       ) . Col . R & "," & Nodos ( i ) . Col . G & "," & Nodos ( i ) . Col . B &  

       »                       ");stroke:rgb(0,0,0);stroke-width:" & Nodos ( i ) . Grosor *  

       »                       Grafico . Zoom & ";""/>" 

01873                     txt4 & = vbCrLf 

01874      

01875                     If Grafico . textoNodo And Grafico . costNodo Then 

01876                         'dibuja ecuador del nodo  

01877                         txt4 & = "<line x1=""" & x - radio & """ y1=""" & y & """  

       »                           x2=""" & x + radio & """ y2=""" & y & """ style=" 

       »                           "stroke-width:" & Nodos ( i ) . Grosor * Grafico . Zoom &  

       »                           ";stroke:rgb(0,0,0)""></line>" 

01878                         txt4 & = vbCrLf 

01879                     End If 

01880                     If Grafico . textoNodo Then 

01881                         ' 'pone texto etiqueta en la mitad superior  

01882                         t = Nodos ( i ) . Texto 

01883                         tamañotexto = G . MeasureString ( t , fuente

01884                         txt3 & = "<text x=""" & Int ( x ) & """ y=""" & Int ( y +  

       »                           tamañotexto . Height * 0.25 - radio / 2 * condicion ) & """  

       »                           style=""font-family:" & Grafico . Fuente . Name . ToString &  

       »                           ";font-size:" & Int ( tamañotexto . Height ) &  

       »                           ";fill:rgb(0,0,0);text-anchor:middle;"">" & t & "</text>" 

01885                         txt3 & = vbCrLf 

01886                     End If 

01887                     If Grafico . costNodo Then 

01888                         ' 'pone texto valor en la mitad inferior  

01889                         t = Nodos ( i ) . Valor . ToString 

01890                         tamañotexto = G . MeasureString ( t , fuente

01891                         txt3 & = "<text x=""" & Int ( x ) & """ y=""" & Int ( y +  

       »                           tamañotexto . Height * 0.25 + radio / 2 * condicion ) & """  

       »                           style=""font-family:" & Grafico . Fuente . Name . ToString &  

       »                           ";font-size:" & Int ( tamañotexto . Height ) &  

       »                           ";fill:rgb(0,0,0);text-anchor:middle;"">" & t & "</text>" 

01892                         txt3 & = vbCrLf 

01893                     End If 

01894                 Next

01895                 '----------------------------  

01896                 txt3 & = "</g>" 

01897                 txt3 & = vbCrLf 

01898                 txt4 & = "</g>" 




01899                 txt4 & = vbCrLf 

01900      

01901                 'consolida todos los textos  

01902                 'lo último en dibujar son los textos,  

01903                 'las capas van de izq a dcha. y de abajo a arriba.  

01904                 txt & = txt0 & txt1 & txt2 & txt4 & txt3 

01905      

01906                 'pie del fichero xml  

01907                 txt & = "</g></svg>" 

01908                 'Guarda el fichero .svg  

01909                 EscribeFicheroTexto ( fichero , txt

01910      

01911                 'fichero .htm anexo que permite activar/desactivar capas  

01912                 txt = "<HTML>" 

01913                 txt & = vbCrLf & "<HEAD>" 

01914                 txt & = vbCrLf & "<TITLE>Grafo en formato SVG - (cc) 2003..2005 -  

       »                   Alejandro Rodriguez Villalobos</TITLE>" 

01915                 txt & = vbCrLf & "<SCRIPT LANGUAGE=""JavaScript1.2""><!--" 

01916                 txt & = vbCrLf & "/*" 

01917                 txt & = vbCrLf & "* Esta función activa/desactiva las capas de la  

       »                   imagen SVG." 

01918                 txt & = vbCrLf & "* Para ello hay que hacer click en los checkbox del 

       »                   lateral." 

01919                 txt & = vbCrLf & "*" 

01920                 txt & = vbCrLf & "* Input Parameters:" 

01921                 txt & = vbCrLf & "* checkbox - Form object (checkbox) that was  

       »                   clicked on." 

01922                 txt & = vbCrLf & "* element_name - SVG element name that should be  

       »                   made visible/" 

01923                 txt & = vbCrLf & "* invisible." 

01924                 txt & = vbCrLf & "*/" 

01925                 txt & = vbCrLf & "function hilite_elem (checkbox, element_name)" 

01926                 txt & = vbCrLf & "{" 

01927                 txt & = vbCrLf & " var svgobj;" 

01928                 txt & = vbCrLf & " var svgstyle;" 

01929                 txt & = vbCrLf & " var svgdoc = document.network.getSVGDocument();" 

01930                 txt & = vbCrLf & " // For selected element, get the elements style  

       »                   object, then set" 

01931                 txt & = vbCrLf & " // its visibility according to the state of the  

       »                   checkbox." 

01932                 txt & = vbCrLf & " svgobj = svgdoc.getElementById(element_name);" 

01933                 txt & = vbCrLf & " svgstyle = svgobj.getStyle();" 

01934                 txt & = vbCrLf & " if (!checkbox.checked) " 

01935                 txt & = vbCrLf & " { // Hide layer." 

01936                 txt & = vbCrLf & " svgstyle.setProperty('visibility',  

       »                   'hidden');" 

01937                 txt & = vbCrLf & " }" 

01938                 txt & = vbCrLf & " else" 

01939                 txt & = vbCrLf & " { // SHow layer." 

01940                 txt & = vbCrLf & " svgstyle.setProperty('visibility',  

       »                   'visible');" 

01941                 txt & = vbCrLf & " }" 

01942                 txt & = vbCrLf & "}" 

01943                 txt & = vbCrLf & "// -->" 

01944                 txt & = vbCrLf & "</SCRIPT>" 

01945                 txt & = vbCrLf & " </HEAD>" 

01946                 txt & = vbCrLf & "<BODY>" 

01947                 txt & = vbCrLf & "<center>" 

01948                 txt & = vbCrLf & "<table><tr><td>" 

01949                 txt & = vbCrLf & "<EMBED SRC=""" & fichero & " "" NAME=""network""" 

01950                 txt & = vbCrLf & " HEIGHT=""555.00"" WIDTH=""887.00""" 

01951                 txt & = vbCrLf & " TYPE=""image/svg-xml""" 

01952                 txt & = vbCrLf & " PLUGINSPAGE=" 

       »                   "http://www.adobe.com/svg/viewer/install/"">" 

01953                 txt & = vbCrLf & "</td><td>" 




01954                 txt & = vbCrLf & "<FORM NAME=""hilite_form"">" 

01955                 txt & = vbCrLf & " <TABLE BORDER=""0"" CELLPADDING=""0""  

       »                   CELLSPACING=""2"" WIDTH=""100%"">" 

01956                 txt & = vbCrLf & " <TR>" 

01957                 txt & = vbCrLf & " <TD><INPUT TYPE=""checkbox"" VALUE="""" ONCLICK=" 

       »                   "hilite_elem(this,0)"">Tapiz</TD></tr>" 

01958                 txt & = vbCrLf & " <TD><INPUT TYPE=""checkbox"" VALUE="""" ONCLICK=" 

       »                   "hilite_elem(this,1)"">Rejilla</TD></tr>" 

01959                 txt & = vbCrLf & " <TD><INPUT TYPE=""checkbox"" VALUE="""" ONCLICK=" 

       »                   "hilite_elem(this,2)"">Arcos</TD></tr>" 

01960                 txt & = vbCrLf & " <TD><INPUT TYPE=""checkbox"" VALUE="""" ONCLICK=" 

       »                   "hilite_elem(this,3)"">Textos</TD></tr>" 

01961                 txt & = vbCrLf & " </TABLE>" 

01962                 txt & = vbCrLf & "<SCRIPT><!--" 

01963                 txt & = vbCrLf & " // Make sure all checkboxes are checked whenever  

       »                   the page" 

01964                 txt & = vbCrLf & " // is reloaded in the browser." 

01965                 txt & = vbCrLf & " for (var i = 0; i <  

       »                   document.hilite_form.elements.length; i++)" 

01966                 txt & = vbCrLf & " if (document.hilite_form.elements[i].type ==  

       »                   'checkbox')" 

01967                 txt & = vbCrLf & " document.hilite_form.elements[i].checked =  

       »                   true;" 

01968                 txt & = vbCrLf & " // -->" 

01969                 txt & = vbCrLf & "</SCRIPT>" 

01970                 txt & = vbCrLf & "</FORM>" 

01971                 txt & = vbCrLf & "</td></tr>" 

01972                 txt & = vbCrLf & "</table>" 

01973                 txt & = vbCrLf & " </center>" 

01974                 txt & = vbCrLf & "</BODY>" 

01975                 txt & = vbCrLf & "</HTML>" 

01976                 'Guarda el fichero .htm  

01977                 EscribeFicheroTexto ( fichero & ".htm" , txt

01978      

01979                 'Intercepción de posibles errores al dibujar  

01980             Catch ex As Exception 

01981                 Me . Cursor = Cursors . Default 

01982                 MsgBox ( "Ha fallado el proceso de exportación gráfica a .svg" &  

       »                   vbCrLf & ex . Message , MsgBoxStyle . Exclamation , "Grafos -  

       »                   Excepción"

01983                 Exit Sub 

01984             Finally 

01985             End Try 

01986         End Sub 

01987         Function BuscaArcoSimetrico ( ByVal i As Long ) As Long 

01988             'Busca un arco simétrico al pasado como parámetro  

01989             'para ser fusionado en el grafo (en caso de opción bidireccional)  

01990             'y que aparezca sólo un arco con doble flecha  

01991             Dim j As Long 

01992             For j = 0 To TotalArcos -

01993                 'que no sea él mismo  

01994                 If j <> i Then 

01995      

01996                     'coincide dirección y sentido inverso  

01997                     If Arcos ( i ) . Nd1 = Arcos ( j ) . Nd2 And Arcos ( i ) . Nd2 = Arcos ( j ) . Nd1 

       »                       Then 

01998      

01999                         'coinciden valores  

02000                         If Arcos ( i ) . Min = Arcos ( j ) . Min And Arcos ( i ) . Max = Arcos ( j )  

       »                           . Max And Arcos ( i ) . Coste = Arcos ( j ) . Coste Then 

02001                             'encontrado  

02002                             Return

02003                         End If 

02004                     End If 




02005                 End If 

02006             Next

02007      

02008             Return -

02009         End Function 




02010         Private Sub PictureBox1_MouseMove ( ByVal sender As Object , ByVal e As System .  

       »           Windows . Forms . MouseEventArgs ) Handles PictureBox1 . MouseMove 

02011      

02012             'Muestra en el panel de estado las coordenadas del ratón en movimiento.  

02013             StatusBar . Panels ( 0 ) . Text = "X = " & e . X . ToString 

02014             StatusBar . Panels ( 1 ) . Text = "Y = " & e . Y . ToString 

02015             Dim nd As Long 

02016             nd = XYSobreNodo ( e . X , e . Y

02017             If nd <> - 1 Then 

02018                 StatusBar . Panels ( 2 ) . Text = "Nodo = " & Nodos ( nd ) . Texto 

02019             Else 

02020                 StatusBar . Panels ( 2 ) . Text = " " 

02021             End If 

02022      

02023             If e . Button = MouseButtons . Left And Nd1S <> - 1 Then 

02024                 'redondea el valor de las coordenadas al ancho de la rejilla  

02025                 'si la opción imán está seleccionada en el menú  

02026                 If mnuFormatoIman . Checked = True Then 

02027                     Nodos ( Nd1S ) . X = Int (( e . X - XNuevo ) / Grafico . Zoom / Grafico .  

       »                       Rejilla ) * Grafico . Rejilla 

02028                     Nodos ( Nd1S ) . Y = Int (( e . Y - YNuevo ) / Grafico . Zoom / Grafico .  

       »                       Rejilla ) * Grafico . Rejilla 

02029                 Else 

02030                     'sino, toma los valores tal cual  

02031                     'Nodos(Nd1S).X = e.X / Grafico.Zoom  

02032                     'Nodos(Nd1S).Y = e.Y / Grafico.Zoom  

02033                     ' If e.X / Grafico.Zoom <> XNuevo Or e.Y / Grafico.Zoom <>  

       »                       YNuevo Then  

02034                     Nodos ( Nd1S ) . X = ( e . X - XNuevo ) / Grafico . Zoom 

02035                     Nodos ( Nd1S ) . Y = ( e . Y - YNuevo ) / Grafico . Zoom 

02036                     'End If  

02037                 End If 

02038      

02039                 DibujaGrafo () 

02040                 PictureBox1 . Refresh () 

02041      

02042             End If 

02043      

02044             'Activa o desactiva menús de análisis  

02045             'debe existir al menos un arco para tener un grafo  

02046             If TotalArcos > 0 Then 

02047                 mnuAnalisisDijkstra . Enabled = True 

02048                 mnuAnalisisDijkstraCC . Enabled = True 

02049                 mnuAnalisisDijkstraCM . Enabled = True 

02050                 mnuAnalisisDijkstraMax . Enabled = True 

02051                 mnuAnalisisBellmanFordCmin . Enabled = True 

02052                 mnuAnalisisBellmanFordCmax . Enabled = True 

02053                 mnuAnalisisFordFulkersonMax . Enabled = True 

02054      

02055                 mnuAnalisisKruskalmin . Enabled = True 

02056                 mnuAnalisisKruskalmax . Enabled = True 

02057                 mnuAnalisisPrimMin . Enabled = True 

02058                 mnuAnalisisPrimMax . Enabled = True 

02059                 mnuAnalisisFloydWarshallmin . Enabled = True 

02060                 mnuAnalisis_Transbordo . Enabled = True 

02061                 mnuAnalisis_TSP . Enabled = True 

02062             Else 

02063                 mnuAnalisisDijkstra . Enabled = False 

02064                 mnuAnalisisDijkstraCC . Enabled = False 

02065                 mnuAnalisisDijkstraCM . Enabled = False 

02066                 mnuAnalisisDijkstraMax . Enabled = False 

02067                 mnuAnalisisBellmanFordCmin . Enabled = False 

02068                 mnuAnalisisBellmanFordCmax . Enabled = False 

02069                 mnuAnalisisFordFulkersonMax . Enabled = False 




02070      

02071                 mnuAnalisisKruskalmin . Enabled = False 

02072                 mnuAnalisisKruskalmax . Enabled = False 

02073                 mnuAnalisisPrimMin . Enabled = False 

02074                 mnuAnalisisPrimMax . Enabled = False 

02075                 mnuAnalisisFloydWarshallmin . Enabled = False 

02076                 mnuAnalisis_Transbordo . Enabled = False 

02077                 mnuAnalisis_TSP . Enabled = False 

02078             End If 

02079         End Sub 

02080         Function XYSobreNodo ( ByVal x As Single , ByVal y As Single ) As Long 

02081      

02082             Dim i As Long 

02083             Dim Dist As Single 

02084      

02085             Dim minDist As Single 

02086             Dim NdProx As Long 

02087      

02088             minDist = 1000000000000000000 

02089             NdProx = -

02090      

02091             For i = 0 To UBound ( Nodos

02092                 Dist = Math . Sqrt (( x - Nodos ( i ) . X * Grafico . Zoom ) ^ 2 + ( y - Nodos (  

       »                   i ) . Y * Grafico . Zoom ) ^ 2

02093                 If Dist <= minDist And Dist <= Nodos ( i ) . Radio * Grafico . Zoom Then 

02094                     minDist = Dist 

02095                     NdProx =

02096                 End If 

02097             Next

02098      

02099             Return NdProx 

02100         End Function 

02101         Private Sub mnuFormatoRejilla_Click ( ByVal sender As System . Object , ByVal e  

       »           As System . EventArgs ) Handles mnuFormatoRejilla . Click 

02102             'Activa o desactiva la visualización de la rejilla  

02103             If mnuFormatoRejilla . Checked = True Then 

02104                 mnuFormatoRejilla . Checked = False 

02105                 Grafico . MostrarRejilla = False 

02106                 CajaPropiedades . chkMostrarRejilla . Checked = False 

02107                 DibujaGrafo () 'redibuja el grafo  

02108             Else 

02109                 mnuFormatoRejilla . Checked = True 

02110                 Grafico . MostrarRejilla = True 

02111                 CajaPropiedades . chkMostrarRejilla . Checked = True 

02112      

02113                 DibujaGrafo () 'redibuja el grafo  

02114             End If 

02115      

02116         End Sub 

02117         Private Sub mnuArchivoImprimir_Click ( ByVal sender As System . Object , ByVal e  

       »           As System . EventArgs ) Handles mnuArchivoImprimir . Click 

02118             'Muestra el diálogo de previsualización  

02119             'que a su vez llama al evento PrintPage de PrintDocument1  

02120      

02121             Try 

02122                 PrintPreviewDialog1 . Document = PrintDocument1 

02123                 PrintPreviewDialog1 . ShowDialog () 

02124      

02125                 'si ocurriera algún error lo muestra en pantalla  

02126             Catch ex As Exception 

02127                 MsgBox ( "Ha fallado la operación de impresión." & vbCrLf & ex . Message  

       »                   , MsgBoxStyle . Exclamation , "Grafos - Excepción"




02128             End Try 

02129      

02130         End Sub 

02131         Private Sub mnuArchivoConfigurarPag_Click ( ByVal sender As System . Object ,  

       »           ByVal e As System . EventArgs ) Handles mnuArchivoConfigurarPag . Click 

02132             'Establece configuración de página  

02133             With PageSetupDialog1 

02134                 . PageSettings = PrintDocument1 . DefaultPageSettings 

02135                 If . ShowDialog () = DialogResult . OK Then 

02136                     PrintDocument1 . DefaultPageSettings = . PageSettings 

02137                 End If 

02138             End With 

02139         End Sub 

02140         Private Sub mnuArchivoConfigurarImp_Click ( ByVal sender As System . Object ,  

       »           ByVal e As System . EventArgs ) Handles mnuArchivoConfigurarImp . Click 

02141             'Configura impresora y parámetros de impresión  

02142             With PrintDialog1 

02143                 . PrinterSettings = PrintDocument1 . PrinterSettings 

02144                 If . ShowDialog () = DialogResult . OK Then 

02145                     PrintDocument1 . PrinterSettings = . PrinterSettings 

02146                 End If 

02147             End With 

02148         End Sub 

02149         Private Sub PrintDocument1_PrintPage ( ByVal sender As Object , ByVal e As  

       »           System . Drawing . Printing . PrintPageEventArgs ) Handles PrintDocument1 .  

       »           PrintPage 

02150             'Es llamado por el previsualizador  

02151             'rellena el PrintDocument con la imagen del picturebox  

02152             'ajustada al tamaño de página.  

02153             Me . Cursor = Cursors . WaitCursor 

02154             Dim r As Rectangle 

02155             Dim pw , ph , pl , pt As Integer 

02156      

02157             pw = PictureBox1 . Width 

02158             ph = PictureBox1 . Height 

02159             'si la imagen del picturebox es más pequeña que la página la centra en  

       »               ella  

02160             'si no se cortará!!!! (ver posibilidad de ajustar)  

02161             With PrintDocument1 . DefaultPageSettings . PaperSize 

02162                 If pw < . Width Then 

02163                     pl = ( . Width - pw ) /

02164                 Else 

02165                     pl =

02166                 End If 

02167                 If ph < . Height Then 

02168                     pt = ( . Height - ph ) /

02169                 Else 

02170                     pt =

02171                 End If 

02172             End With 

02173      

02174             'dibuja la imagen en la impresora  

02175             r = New Rectangle ( pl , pt , pw , ph

02176             e . Graphics . DrawImage ( PictureBox1 . Image , r

02177             Me . Cursor = Cursors . Default 

02178         End Sub 




02179         Private Sub PictureBox1_MouseDown ( ByVal sender As Object , ByVal e As System .  

       »           Windows . Forms . MouseEventArgs ) Handles PictureBox1 . MouseDown 

02180             Dim nd As Long 

02181             'Selección del nodo origen  

02182             If e . Button = MouseButtons . Left Then 

02183                 nd = XYSobreNodo ( e . X , e . Y

02184                 If nd <> - 1 Then 

02185                     Nd1S = nd 

02186                     'If Nd1S = Nd2S Then  

02187                     'Nd2S = -1 'si selecciona encima del nd2s, deselecciona el nd2s  

02188                     'End If  

02189      

02190                     'PRUEBA ALEX  

02191                     'PUNTOS PANTALLA  

02192                     XNuevo = ( e . X - Nodos ( nd ) . X * Grafico . Zoom

02193                     YNuevo = ( e . Y - Nodos ( nd ) . Y * Grafico . Zoom

02194      

02195                 Else 

02196                     Nd1S = -

02197                 End If 

02198                 DibujaGrafo () 

02199             End If 

02200      

02201             'Selección del nodo destino  

02202             If e . Button = MouseButtons . Right Then 

02203      

02204                 'Guarda coordenadas para la creación de un nuevo nodo  

02205                 XNuevo = e . X / Grafico . Zoom 

02206                 YNuevo = e . Y / Grafico . Zoom 

02207      

02208                 nd = XYSobreNodo ( e . X , e . Y

02209                 If nd <> - 1 Then 

02210                     Nd2S = nd 

02211                     'If Nd2S = Nd1S Then  

02212                     ' Nd1S = -1 'si selecciona encima del nd1s, deselecciona el  

       »                       nd1s  

02213                     'End If  

02214                 Else 

02215                     Nd2S = -

02216                 End If 

02217                 DibujaGrafo () 

02218             End If 

02219      

02220             'evita errores de selección fuera de rango  

02221             If Nd1S > TotalNodos - 1 Then Nd1S = -

02222             If Nd2S > TotalNodos - 1 Then Nd2S = -

02223      

02224             'Cambia visualizaciones según las selecciones  

02225             'según el nodo seleccionado  

02226             If Nd1S = - 1 Then 

02227                 StatusBar . Panels ( 3 ) . Text = "-" 

02228      

02229                 mnuAnalisisDijkstra . Enabled = False 

02230                 mnuAnalisisDijkstraMax . Enabled = False 

02231             Else 

02232                 StatusBar . Panels ( 3 ) . Text = "Nd1 = " & Nodos ( Nd1S ) . Texto 

02233      

02234                 mnuAnalisisDijkstra . Enabled = True 

02235                 mnuAnalisisDijkstraMax . Enabled = True 

02236             End If 

02237             If Nd2S = - 1 Then 

02238                 StatusBar . Panels ( 4 ) . Text = "-" 

02239                 mnuBorrarNodo . Enabled = False 

02240                 mnuEditarNodo . Enabled = False 




02241             Else 

02242                 StatusBar . Panels ( 4 ) . Text = "Nd2 = " & Nodos ( Nd2S ) . Texto 

02243                 mnuBorrarNodo . Enabled = True 

02244                 mnuEditarNodo . Enabled = True 

02245             End If 

02246             'dos nodos seleccionados  

02247             If Nd1S <> - 1 And Nd2S <> - 1 Then 'And Nd1S <> Nd2S Then  

02248                 Dim nArcos As Long 

02249                 nArcos = ExisteArco ( Nd1S , Nd2S

02250                 Dim nArcosR As Long 

02251                 nArcosR = ExisteArcoReves ( Nd1S , Nd2S

02252                 'comprobaciones  

02253                 'If nArcos > 0 Or nArcosR > 0 Then 'sólo un arco y en un sólo  

       »                   sentido  

02254                 If nArcos > 0 Then  'dos arcos si son en sentidos opuestos  

02255                     mnuAñadirArco . Enabled = False 

02256                 Else 

02257                     mnuAñadirArco . Enabled = True 

02258                 End If 

02259                 If nArcos = 0 Then 

02260                     'no se puede borrar y editar algo que no existe  

02261                     mnuBorrarArco . Enabled = False 

02262                     mnuEditarArco . Enabled = False 

02263                 Else 

02264                     'si existe si se puede borrar y editar  

02265                     mnuBorrarArco . Enabled = True 

02266                     mnuEditarArco . Enabled = True 

02267      

02268                 End If 

02269                 mnuAlinearNodos . Enabled = True 

02270                 mnuAnalisisDijkstraCC . Enabled = True 

02271                 mnuAnalisisDijkstraCM . Enabled = True 

02272                 mnuAnalisisBellmanFordCmax . Enabled = True 

02273                 mnuAnalisisBellmanFordCmin . Enabled = True 

02274                 mnuAnalisisFordFulkersonMax . Enabled = True 

02275             Else 

02276                 'si no se seleccionan dos no se pueden efectuar operaciones de arco  

02277                 mnuAñadirArco . Enabled = False 

02278                 mnuBorrarArco . Enabled = False 

02279                 mnuEditarArco . Enabled = False 

02280                 mnuAlinearNodos . Enabled = False 

02281                 mnuAnalisisDijkstraCC . Enabled = False 

02282                 mnuAnalisisDijkstraCM . Enabled = False 

02283                 mnuAnalisisBellmanFordCmax . Enabled = False 

02284                 mnuAnalisisBellmanFordCmin . Enabled = False 

02285                 mnuAnalisisFordFulkersonMax . Enabled = False 

02286             End If 

02287      

02288             If Nd1S = Nd2S Then mnuAlinearNodos . Enabled = False 

02289         End Sub 




02290         Private Sub mnuAñadirArco_Click ( ByVal sender As System . Object , ByVal e As  

       »           System . EventArgs ) Handles mnuAñadirArco . Click 

02291             'Añade un arco nuevo a la colección  

02292             'El arco no puede ser entre un mismo nodo  

02293             'If Nd1S = Nd2S Then Exit Sub  

02294      

02295             Dim i As Long 

02296             'i = UBound(Arcos) + 1  

02297             TotalArcos = TotalArcos +

02298      

02299             ReDim Preserve Arcos ( TotalArcos - 1

02300             i = TotalArcos -

02301             Arcos ( i ) . Nd1 = Nd1S 

02302             Arcos ( i ) . Nd2 = Nd2S 

02303      

02304             Arcos ( i ) . Min =

02305             Arcos ( i ) . Max =

02306             Arcos ( i ) . Coste =

02307      

02308             'tomar opciones gráficas de la configuración por defecto  

02309             Arcos ( i ) . B = False 'por defecto false, se trata en DibujaGrafo  

02310      

02311             Arcos ( i ) . Grosor = Grafico . TrazoArco 

02312             Arcos ( i ) . Col = Grafico . ColArco 

02313      

02314             DibujaGrafo () 

02315         End Sub 

02316         Private Sub mnuAñadirNodo_Click ( ByVal sender As Object , ByVal e As System .  

       »           EventArgs ) Handles mnuAñadirNodo . Click 

02317             'Añade un nodo nuevo a la colección  

02318      

02319             Dim i As Long 

02320             ' i = UBound(Nodos) + 1  

02321      

02322             If TotalNodos = 200 Then Exit Sub 

02323      

02324             TotalNodos = TotalNodos +

02325      

02326             ReDim Preserve Nodos ( TotalNodos - 1

02327             i = TotalNodos - 1 'ultimo nodo  

02328             Nodos ( i ) . X = XNuevo 

02329             Nodos ( i ) . Y = YNuevo 

02330             Nodos ( i ) . Z =

02331      

02332             If Grafico . Iman Then 

02333                 Nodos ( i ) . X = Int ( Nodos ( i ) . X / Grafico . Rejilla ) * Grafico . Rejilla 

02334                 Nodos ( i ) . Y = Int ( Nodos ( i ) . Y / Grafico . Rejilla ) * Grafico . Rejilla 

02335             End If 

02336      

02337             'tomará datos de un formulario  

02338             Nodos ( i ) . Texto = i . ToString 

02339             Nodos ( i ) . Valor =

02340             'tomar opciones gráficas de la configuración por defecto  

02341             'si no peta cuando el grafo está vacio y se pone el primer nodo  

02342             Nodos ( i ) . Radio = Grafico . RadioNodo  'todos los radios iguales  

02343             Nodos ( i ) . Grosor = Grafico . TrazoNodo 

02344             Nodos ( i ) . Col = Grafico . ColNodo 

02345      

02346             DibujaGrafo () 

02347         End Sub 




02348         Sub BorraArco ( ByVal n As Long

02349             'Redimensiona la matriz de arcos para borrar el arco seleccionado  

02350             Dim i As Long 

02351      

02352             If n > TotalArcos - 1 Or n < 0 Then Exit Sub 

02353      

02354             If n = TotalArcos - 1 Then 'se borra el último  

02355                 ReDim Preserve Arcos ( TotalArcos - 1 - 1

02356             Else 'se corren los valores  

02357                 For i = n To TotalArcos - 1 -

02358                     Arcos ( i ) = Arcos ( i + 1

02359                 Next

02360                 ReDim Preserve Arcos ( TotalArcos - 1 - 1

02361             End If 

02362      

02363             TotalArcos = TotalArcos -

02364         End Sub 

02365         Private Sub mnuBorrarNodo_Click ( ByVal sender As Object , ByVal e As System .  

       »           EventArgs ) Handles mnuBorrarNodo . Click 

02366             Dim i As Long 

02367             Dim total As Long 

02368      

02369             'debe recorrer los arcos  

02370             If TotalArcos > 0 Then 

02371                 i =

02372                 Do While i <= TotalArcos -

02373      

02374                     If Arcos ( i ) . Nd1 = Nd2S Or Arcos ( i ) . Nd2 = Nd2S Then 

02375                         BorraArco ( i ) 'borrar el que tenga ese nodo seleccionado  

02376                         i = - 1 'vuelve a empezar el recorrido  

02377                     End If 

02378                     i = i +

02379      

02380                     'así hasta no encontrar más arcos con ese nodo  

02381                 Loop 

02382             End If 

02383             'renumera nodos superiores al que se va a borrar  

02384             'por la traslación de indices hacia abajo que hay  

02385             'en el proceso de borrar nodo  

02386             For i = 0 To TotalArcos -

02387                 If Arcos ( i ) . Nd1 > Nd2S Then Arcos ( i ) . Nd1 = Arcos ( i ) . Nd1 -

02388                 If Arcos ( i ) . Nd2 > Nd2S Then Arcos ( i ) . Nd2 = Arcos ( i ) . Nd2 -

02389             Next 

02390      

02391             total = UBound ( Nodos ) 'ultimo nodo  

02392      

02393             If Nd2S = total Then  'se borra el último  

02394                 'If total = 0 'Then ATENCION se borra el único existente????  

02395      

02396                 ReDim Preserve Nodos ( total - 1

02397             Else 

02398                 For i = Nd2S To total -

02399                     Nodos ( i ) = Nodos ( i + 1

02400                 Next

02401      

02402                 'If total = 0 'Then ATENCION se borra el único existente????  

02403      

02404                 ReDim Preserve Nodos ( total - 1

02405             End If 

02406      

02407             TotalNodos = TotalNodos -

02408      

02409             'no selecciona segundo nodo  




02410             Nd2S = -

02411             StatusBar . Panels ( 4 ) . Text = "" 

02412      

02413             DibujaGrafo () 

02414         End Sub 

02415         Private Sub mnuBorrarArco_Click ( ByVal sender As Object , ByVal e As System .  

       »           EventArgs ) Handles mnuBorrarArco . Click 

02416             'busca en la colección de arcos el que cumple/los que cumplen las  

02417             'condiciones de origen y destino de nodos seleccionados  

02418             'una vez localizados los borra uno a uno  

02419             Dim i As Long 

02420      

02421             i =

02422             Do While i <= TotalArcos -

02423      

02424                 If Arcos ( i ) . Nd1 = Nd1S And Arcos ( i ) . Nd2 = Nd2S Then 

02425                     BorraArco ( i

02426                     i = - 1 'vuelve a empezar el recorrido  

02427                 End If 

02428                 i = i +

02429      

02430                 'así hasta no encontrar más arcos con esa condición  

02431             Loop 

02432             DibujaGrafo () 

02433         End Sub 

02434         Private Sub mnuZoomMas_Click ( ByVal sender As System . Object , ByVal e As  

       »           System . EventArgs ) Handles mnuZoomMas . Click 

02435             'Va subiendo los valores del zoom hasta 4 = 400%  

02436             If Grafico . Zoom < 4 Then Grafico . Zoom = Grafico . Zoom + 0.2 

02437      

02438             DibujaGrafo () 

02439         End Sub 

02440         Private Sub mnuZoomMenos_Click ( ByVal sender As System . Object , ByVal e As  

       »           System . EventArgs ) Handles mnuZoomMenos . Click 

02441             'Baja los valores del zoom hasta llegar a un 0.2 = 20%  

02442             If Grafico . Zoom > 0.4 Then Grafico . Zoom = Grafico . Zoom - 0.2 

02443      

02444             DibujaGrafo () 

02445         End Sub 




02446         Private Sub mnuZoomAjustar_Click ( ByVal sender As System . Object , ByVal e As  

       »           System . EventArgs ) Handles mnuZoomAjustar . Click 

02447             If TotalNodos < 2 Then Exit Sub 

02448             Dim i As Long 

02449      

02450             Dim minX As Single = 1000000000 

02451             Dim minY As Single = 1000000000 

02452             Dim maxX As Single = - 1000000000 

02453             Dim maxY As Single = - 1000000000 

02454      

02455             Dim zoomx As Single 

02456             Dim zoomy As Single 

02457      

02458             For i = 0 To TotalNodos -

02459      

02460                 minX = Math . Min ( Nodos ( i ) . X - Nodos ( i ) . Radio , minX

02461                 minY = Math . Min ( Nodos ( i ) . Y - Nodos ( i ) . Radio , minY

02462      

02463                 maxX = Math . Max ( Nodos ( i ) . X + Nodos ( i ) . Radio , maxX

02464                 maxY = Math . Max ( Nodos ( i ) . Y + Nodos ( i ) . Radio , maxY

02465             Next

02466      

02467             zoomx = ( Panel1 . Width - 20 ) / ( maxX - minX

02468             zoomy = ( Panel1 . Height - 20 ) / ( maxY - minY

02469      

02470             If zoomx > zoomy Then Grafico . Zoom = zoomy Else Grafico . Zoom = zoomx 

02471             minX = minX - 20 

02472             minY = minY - 20 

02473      

02474             DibujaGrafo () 

02475      

02476             'Panel1.AutoScroll = False  

02477             Dim p As Point 

02478             If minX * Grafico . Zoom <= 0 Then 

02479                 p . X =

02480             Else 

02481                 p . X = minX * Grafico . Zoom 

02482             End If 

02483      

02484             If minY * Grafico . Zoom <= 0 Then 

02485                 p . Y =

02486             Else 

02487                 p . Y = minY * Grafico . Zoom 

02488             End If 

02489      

02490             PictureBox1 . Left =

02491             PictureBox1 . Top =

02492      

02493             Panel1 . AutoScrollPosition =

02494      

02495             'Pone la información de zoom en panel  

02496             StatusBar . Panels ( 5 ) . Text = "Zoom = " & Format ( Grafico . Zoom , "#0.00"

02497         End Sub 




02498         Sub ActivaMenus () 

02499      

02500             Me . mnuArchivoGuardar . Enabled = True 

02501             Me . mnuArchivoGuardarComo . Enabled = True 

02502             Me . mnuArchivoNuevoAleatorio . Enabled = True 

02503             Me . mnuArchivoExportarDatos . Enabled = True 

02504             Me . mnuArchivoImportarDatos . Enabled = True 

02505             Me . mnuArchivoCopiarImg . Enabled = True 

02506             Me . mnuArchivoExportarImg . Enabled = True 

02507             Me . mnuArchivoConfigurarPag . Enabled = True 

02508             Me . mnuArchivoImprimir . Enabled = True 

02509             Me . mnuEdicion . Enabled = True 

02510             Me . mnuFormato . Enabled = True 

02511             Me . mnuFormatoOpciones . Enabled = True 

02512             Me . mnuAnalisis . Enabled = True 

02513      

02514             Me . mnuAnalisisBellmanFordCmax . Enabled = False 

02515             Me . mnuAnalisisBellmanFordCmin . Enabled = False 

02516             Me . mnuAnalisisDijkstra . Enabled = False 

02517             Me . mnuAnalisisDijkstraCC . Enabled = False 

02518             Me . mnuAnalisisDijkstraCM . Enabled = False 

02519             Me . mnuAnalisisDijkstraMax . Enabled = False 

02520             Me . mnuAnalisisKruskalmax . Enabled = False 

02521             Me . mnuAnalisisKruskalmin . Enabled = False 

02522             Me . mnuAnalisisPrimMax . Enabled = False 

02523             Me . mnuAnalisisPrimMin . Enabled = False 

02524             Me . mnuAnalisisFordFulkersonMax . Enabled = False 

02525             Me . mnuAnalisisFloydWarshallmin . Enabled = False 

02526      

02527             Me . mnuAnalisis_Transbordo . Enabled = False 

02528             Me . mnuAnalisis_TSP . Enabled = False 

02529      

02530         End Sub 




02531         Private Sub mnuArchivoNuevo_Click ( ByVal sender As System . Object , ByVal e As  

       »           System . EventArgs ) Handles mnuArchivoNuevo . Click 

02532      

02533             If TotalNodos > 0 Or NodosMatriz > 0 Then 

02534                 Dim respuesta As MsgBoxResult 

02535                 respuesta = MsgBox ( " Si no ha grabado las últimas modificaciones,  

       »                   perderá los datos actuales." & vbCrLf & " ¿Desea realmente crear  

       »                   un nuevo grafo?" , MsgBoxStyle . OKCancel , ) 

02536                 If respuesta = MsgBoxResult . Cancel Then Exit Sub 

02537             End If 

02538             'nombre del fichero en estatus bar  

02539             Me . StatusBar . Panels ( 6 ) . Text = "" 

02540      

02541             'lee las opciones por defecto  

02542             OpcionesporDefecto () 

02543      

02544             'inicia la caja de propiedades con las opciones por defecto elegidas  

02545             CajaPropiedades . LeeOpciones () 

02546      

02547             'Cambia y posiciona el picturebox  

02548             PictureBox1 . Top =

02549             PictureBox1 . Left =

02550             PictureBox1 . Width = Grafico . TapizX * Grafico . Zoom 

02551             PictureBox1 . Height = Grafico . TapizX * Grafico . Zoom 

02552      

02553             TotalNodos =

02554             TotalArcos =

02555             NodosMatriz =

02556      

02557             'no selecciona ningún nodo  

02558             Nd1S = -

02559             Nd2S = -

02560      

02561             'Llama al proceso principal de dibujar grafo  

02562             DibujaGrafo () 

02563             Grafico . Fichero = "" 

02564             Grafico . Extension = ".graphML" 'extensión por defecto .graphML  

02565      

02566             PictureBox1 . Visible = True 

02567             ActivaMenus () 

02568             Me . mnuEdicionGrafica_Click ( Me , e

02569         End Sub 




02570         Sub CreaGrafoAleatorio ( ByVal n As Long , ByVal a As Long , ByVal r As Boolean

02571             'Crea un grafo aleatorio  

02572             If n > 200 Then Exit Sub 

02573      

02574             TotalNodos =

02575             ReDim Nodos ( TotalNodos - 1

02576      

02577             Dim i , j , k As Integer 

02578             'Crea una colección de nodos  

02579             For i = 0 To TotalNodos -

02580                 Nodos ( i ) . Texto = i . ToString 

02581                 Nodos ( i ) . X = Rnd () * Grafico . TapizX 

02582                 Nodos ( i ) . Y = Rnd () * Grafico . TapizY 

02583                 Nodos ( i ) . Col = Grafico . ColNodo 

02584      

02585                 Nodos ( i ) . Radio = Grafico . RadioNodo 

02586                 Nodos ( i ) . Grosor = Grafico . TrazoNodo 

02587                 Nodos ( i ) . Valor =

02588             Next

02589             'Crea una colección de arcos  

02590      

02591             TotalArcos =

02592             ReDim Arcos ( 0

02593             Dim sigue As Boolean 

02594             For i = 0 To TotalNodos -

02595                 For j = 0 To TotalNodos -

02596                     If 100 * Rnd () < a And a > 0 Then 

02597                         sigue = True 

02598                         If r = True And i = j Then sigue = True 

02599                         If r