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 autor00017
'y otros tratados internacionales. Grafos es un software libre y gratuito. Se00018
'distribuye bajo las condiciones:Reconocimiento-NoComercial-CompartirIgual 2.1.00019
'(Creative Commons License). La comercialización sin consentimiento del autor00020
'de este programa o cualquier parte del mismo, está penada por la ley con00021
'severas sanciones civiles y penales, y será objeto de todas las acciones00022
'judiciales que correspondan." & vbcrlf & "Grafos incluye la librería lp_solve00023
'5.x Copyright 1991, 2005 Free Software Foundation, Inc. bajo licencia LGPL.00024
00025
00026
00027
'Importa espacio de nombres de lp_solve500028
Imports Grafos . lpsolve5100029
00030
00031
'Para las funciones de apertura/escritura de ficheros00032
Imports System . IO00033
Imports System . Xml00034
'Imports System.Runtime.Serialization.Formatters.Soap00035
'Imports System.Runtime.Serialization.Formatters.Binary00036
00037
00038
'pruebas con otro solver00039
'Imports Grafos.QSopt100040
00041
00042
Public Class Form100043
Inherits System . Windows . Forms . Form00044
'declaración global para lp_solve 500045
'Private lpsolve As lpsolve5100046
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 500060
'lpsolve = New lpsolve5100061
00062
System . Diagnostics . Debug . WriteLine ( CurDir ())00063
'lpsolve.Init(".")00064
00065
00066
00067
00068
00069
00070
00071
00072
End Sub00073
00074
'Form reemplaza a Dispose para limpiar la lista de componentes.00075
Protected Overloads Overrides Sub Dispose ( ByVal disposing As Boolean )00076
If disposing Then00077
If Not ( components Is Nothing ) Then00078
components . Dispose ()00079
End If00080
End If00081
MyBase . Dispose ( disposing )00082
End Sub00083
00084
'Requerido por el Diseñador de Windows Forms00085
Private components As System . ComponentModel . IContainer00086
00087
'NOTA: el Diseñador de Windows Forms requiere el siguiente procedimiento00088
'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 . MainMenu00091
Friend WithEvents MenuItem1 As System . Windows . Forms . MenuItem00092
Friend WithEvents mnuEdicion As System . Windows . Forms . MenuItem00093
Friend WithEvents mnuFormato As System . Windows . Forms . MenuItem00094
Friend WithEvents mnuAnalisis As System . Windows . Forms . MenuItem00095
Friend WithEvents MenuItem5 As System . Windows . Forms . MenuItem00096
Friend WithEvents mnuArchivoNuevo As System . Windows . Forms . MenuItem00097
Friend WithEvents mnuArchivoAbrir As System . Windows . Forms . MenuItem00098
Friend WithEvents MenuItem8 As System . Windows . Forms . MenuItem00099
Friend WithEvents mnuArchivoGuardar As System . Windows . Forms . MenuItem00100
Friend WithEvents mnuArchivoGuardarComo As System . Windows . Forms . MenuItem00101
Friend WithEvents MenuItem11 As System . Windows . Forms . MenuItem00102
Friend WithEvents mnuArchivoSalir As System . Windows . Forms . MenuItem00103
Friend WithEvents mnuEdicionGrafica As System . Windows . Forms . MenuItem00104
Friend WithEvents mnuFormatoOpciones As System . Windows . Forms . MenuItem00105
Friend WithEvents PictureBox1 As System . Windows . Forms . PictureBox00106
Friend WithEvents PanelX As System . Windows . Forms . StatusBarPanel00107
Friend WithEvents PanelY As System . Windows . Forms . StatusBarPanel00108
Friend WithEvents StatusBar As System . Windows . Forms . StatusBar00109
Friend WithEvents Panel1 As System . Windows . Forms . Panel00110
Friend WithEvents mnuFormatoRejilla As System . Windows . Forms . MenuItem00111
Friend WithEvents mnuFormatoIman As System . Windows . Forms . MenuItem00112
Friend WithEvents MenuItem19 As System . Windows . Forms . MenuItem00113
Friend WithEvents mnuAyudaAcercade As System . Windows . Forms . MenuItem00114
Friend WithEvents mnuArchivoImprimir As System . Windows . Forms . MenuItem00115
Friend WithEvents mnuEdicion2 As System . Windows . Forms . MenuItem00116
Friend WithEvents PrintDialog1 As System . Windows . Forms . PrintDialog00117
Friend WithEvents PrintPreviewDialog1 As System . Windows . Forms .» PrintPreviewDialog
00118
Friend WithEvents mnuArchivoConfigurarPag As System . Windows . Forms . MenuItem00119
Friend WithEvents PrintDocument1 As System . Drawing . Printing . PrintDocument00120
Friend WithEvents PageSetupDialog1 As System . Windows . Forms . PageSetupDialog00121
Friend WithEvents mnuArchivoConfigurarImp As System . Windows . Forms . MenuItem00122
Friend WithEvents SobreObj As System . Windows . Forms . StatusBarPanel00123
Friend WithEvents Nd1 As System . Windows . Forms . StatusBarPanel00124
Friend WithEvents Nd2 As System . Windows . Forms . StatusBarPanel00125
Friend WithEvents mnuPopUp As System . Windows . Forms . ContextMenu00126
Friend WithEvents mnuAñadirNodo As System . Windows . Forms . MenuItem00127
Friend WithEvents mnuEditarNodo As System . Windows . Forms . MenuItem00128
Friend WithEvents mnuBorrarNodo As System . Windows . Forms . MenuItem00129
Friend WithEvents mnuEdicion4 As System . Windows . Forms . MenuItem00130
Friend WithEvents mnuAñadirArco As System . Windows . Forms . MenuItem00131
Friend WithEvents mnuEdicion8 As System . Windows . Forms . MenuItem00132
Friend WithEvents mnuZoomMas As System . Windows . Forms . MenuItem00133
Friend WithEvents mnuZoomMenos As System . Windows . Forms . MenuItem00134
Friend WithEvents mnuZoomAjustar As System . Windows . Forms . MenuItem00135
Friend WithEvents mnuEditarArco As System . Windows . Forms . MenuItem00136
Friend WithEvents mnuBorrarArco As System . Windows . Forms . MenuItem00137
Friend WithEvents z As System . Windows . Forms . StatusBarPanel00138
Friend WithEvents mnuArchivoCopiarImg As System . Windows . Forms . MenuItem00139
Friend WithEvents mnuArchivoExportarImg As System . Windows . Forms . MenuItem00140
Friend WithEvents TextBox1 As System . Windows . Forms . TextBox00141
Friend WithEvents mnuEdicionTabular As System . Windows . Forms . MenuItem00142
Friend WithEvents mnuPopTabla As System . Windows . Forms . ContextMenu00143
Friend WithEvents mnuTablaBorrarNodo As System . Windows . Forms . MenuItem00144
Friend WithEvents mnuTablaAñadirNodo As System . Windows . Forms . MenuItem00145
Friend WithEvents mnuTablaTotalNodos As System . Windows . Forms . MenuItem00146
Friend WithEvents MenuItem2 As System . Windows . Forms . MenuItem00147
Friend WithEvents hfgTabla As AxMSFlexGridLib . AxMSFlexGrid00148
Friend WithEvents MenuItem6 As System . Windows . Forms . MenuItem00149
Friend WithEvents mnuFormatoCircular As System . Windows . Forms . MenuItem00150
Friend WithEvents mnuFormatoAleatorio As System . Windows . Forms . MenuItem00151
Friend WithEvents mnuFormatoTablero As System . Windows . Forms . MenuItem00152
Friend WithEvents MenuItem3 As System . Windows . Forms . MenuItem00153
Friend WithEvents mnuTablaCopiarTabla As System . Windows . Forms . MenuItem00154
Friend WithEvents mnuAlinearNodos As System . Windows . Forms . MenuItem00155
Friend WithEvents mnuAlinearNodosH As System . Windows . Forms . MenuItem00156
Friend WithEvents mnuAlinearNodosV As System . Windows . Forms . MenuItem00157
Friend WithEvents mnuAnalisisDijkstra As System . Windows . Forms . MenuItem00158
Friend WithEvents mnuAnalisisDijkstraMax As System . Windows . Forms . MenuItem00159
Friend WithEvents mnuAnalisisDijkstraCC As System . Windows . Forms . MenuItem00160
Friend WithEvents mnuAnalisisDijkstraCM As System . Windows . Forms . MenuItem00161
Friend WithEvents MenuItem4 As System . Windows . Forms . MenuItem00162
Friend WithEvents MenuItem7 As System . Windows . Forms . MenuItem00163
Friend WithEvents mnuAnalisisBellmanFordCmin As System . Windows . Forms . MenuItem00164
Friend WithEvents mnuAnalisisBellmanFordCmax As System . Windows . Forms . MenuItem00165
Friend WithEvents MenuItem9 As System . Windows . Forms . MenuItem00166
Friend WithEvents mnuAnalisisKruskalmin As System . Windows . Forms . MenuItem00167
Friend WithEvents mnuAnalisisKruskalmax As System . Windows . Forms . MenuItem00168
Friend WithEvents mnuFormatoFlujo As System . Windows . Forms . MenuItem00169
Friend WithEvents MenuItem10 As System . Windows . Forms . MenuItem00170
Friend WithEvents mnuAnalisisPrimMin As System . Windows . Forms . MenuItem00171
Friend WithEvents mnuAnalisisPrimMax As System . Windows . Forms . MenuItem00172
Friend WithEvents MenuItem12 As System . Windows . Forms . MenuItem00173
Friend WithEvents mnuFormatoAjustar As System . Windows . Forms . MenuItem00174
Friend WithEvents mnuFormatoCentrar As System . Windows . Forms . MenuItem00175
Friend WithEvents MenuItem15 As System . Windows . Forms . MenuItem00176
Friend WithEvents mnuAnalisisFordFulkersonMax As System . Windows . Forms .» MenuItem
00177
Friend WithEvents MenuItem13 As System . Windows . Forms . MenuItem00178
Friend WithEvents mnuAnalisisFloydWarshallmin As System . Windows . Forms .» MenuItem
00179
Friend WithEvents MenuItem14 As System . Windows . Forms . MenuItem00180
Friend WithEvents mnuAnalisis_Transbordo As System . Windows . Forms . MenuItem00181
'Friend WithEvents mnuAnalisis_Transporte As System.Windows.Forms.MenuItem00182
Friend WithEvents mnuAnalisis_TSP As System . Windows . Forms . MenuItem00183
Friend WithEvents mnuFormatoOrganico As System . Windows . Forms . MenuItem00184
Friend WithEvents mnuFormatoImantar As System . Windows . Forms . MenuItem00185
Friend WithEvents mnuArchivoImportarDatos As System . Windows . Forms . MenuItem00186
Friend WithEvents mnuArchivoExportarDatos As System . Windows . Forms . MenuItem00187
Friend WithEvents MenuItem20 As System . Windows . Forms . MenuItem00188
Friend WithEvents mnuArchivoNuevoAleatorio As System . Windows . Forms . MenuItem00189
Friend WithEvents filestatusbar As System . Windows . Forms . StatusBarPanel00190
Friend WithEvents mnuFormatoAutoRadio As System . Windows . Forms . MenuItem00191
Friend WithEvents mnuFormatoAutoTrazo As System . Windows . Forms . MenuItem00192
Friend WithEvents MenuItem18 As System . Windows . Forms . MenuItem00193
< 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 . MainMenu00196
Me . MenuItem1 = New System . Windows . Forms . MenuItem00197
Me . mnuArchivoNuevo = New System . Windows . Forms . MenuItem00198
Me . mnuArchivoNuevoAleatorio = New System . Windows . Forms . MenuItem00199
Me . mnuArchivoAbrir = New System . Windows . Forms . MenuItem00200
Me . mnuArchivoImportarDatos = New System . Windows . Forms . MenuItem00201
Me . MenuItem8 = New System . Windows . Forms . MenuItem00202
Me . mnuArchivoGuardar = New System . Windows . Forms . MenuItem00203
Me . mnuArchivoGuardarComo = New System . Windows . Forms . MenuItem00204
Me . mnuArchivoExportarDatos = New System . Windows . Forms . MenuItem00205
Me . MenuItem20 = New System . Windows . Forms . MenuItem00206
Me . mnuArchivoCopiarImg = New System . Windows . Forms . MenuItem00207
Me . mnuArchivoExportarImg = New System . Windows . Forms . MenuItem00208
Me . mnuEdicion2 = New System . Windows . Forms . MenuItem00209
Me . mnuArchivoConfigurarImp = New System . Windows . Forms . MenuItem00210
Me . mnuArchivoConfigurarPag = New System . Windows . Forms . MenuItem00211
Me . mnuArchivoImprimir = New System . Windows . Forms . MenuItem00212
Me . MenuItem11 = New System . Windows . Forms . MenuItem00213
Me . mnuArchivoSalir = New System . Windows . Forms . MenuItem00214
Me . mnuEdicion = New System . Windows . Forms . MenuItem00215
Me . mnuEdicionGrafica = New System . Windows . Forms . MenuItem00216
Me . mnuEdicionTabular = New System . Windows . Forms . MenuItem00217
Me . mnuFormato = New System . Windows . Forms . MenuItem00218
Me . mnuFormatoOpciones = New System . Windows . Forms . MenuItem00219
Me . MenuItem19 = New System . Windows . Forms . MenuItem00220
Me . mnuFormatoRejilla = New System . Windows . Forms . MenuItem00221
Me . mnuFormatoIman = New System . Windows . Forms . MenuItem00222
Me . MenuItem15 = New System . Windows . Forms . MenuItem00223
Me . mnuFormatoCentrar = New System . Windows . Forms . MenuItem00224
Me . mnuFormatoAjustar = New System . Windows . Forms . MenuItem00225
Me . mnuFormatoImantar = New System . Windows . Forms . MenuItem00226
Me . MenuItem18 = New System . Windows . Forms . MenuItem00227
Me . mnuFormatoAutoRadio = New System . Windows . Forms . MenuItem00228
Me . mnuFormatoAutoTrazo = New System . Windows . Forms . MenuItem00229
Me . MenuItem6 = New System . Windows . Forms . MenuItem00230
Me . mnuFormatoAleatorio = New System . Windows . Forms . MenuItem00231
Me . mnuFormatoCircular = New System . Windows . Forms . MenuItem00232
Me . mnuFormatoTablero = New System . Windows . Forms . MenuItem00233
Me . mnuFormatoFlujo = New System . Windows . Forms . MenuItem00234
Me . mnuFormatoOrganico = New System . Windows . Forms . MenuItem00235
Me . mnuAnalisis = New System . Windows . Forms . MenuItem00236
Me . mnuAnalisisDijkstra = New System . Windows . Forms . MenuItem00237
Me . mnuAnalisisDijkstraMax = New System . Windows . Forms . MenuItem00238
Me . MenuItem4 = New System . Windows . Forms . MenuItem00239
Me . mnuAnalisisDijkstraCM = New System . Windows . Forms . MenuItem00240
Me . mnuAnalisisDijkstraCC = New System . Windows . Forms . MenuItem00241
Me . MenuItem7 = New System . Windows . Forms . MenuItem00242
Me . mnuAnalisisBellmanFordCmin = New System . Windows . Forms . MenuItem00243
Me . mnuAnalisisBellmanFordCmax = New System . Windows . Forms . MenuItem00244
Me . MenuItem13 = New System . Windows . Forms . MenuItem00245
Me . mnuAnalisisFloydWarshallmin = New System . Windows . Forms . MenuItem00246
Me . MenuItem9 = New System . Windows . Forms . MenuItem00247
Me . mnuAnalisisKruskalmin = New System . Windows . Forms . MenuItem00248
Me . mnuAnalisisKruskalmax = New System . Windows . Forms . MenuItem00249
Me . MenuItem10 = New System . Windows . Forms . MenuItem00250
Me . mnuAnalisisPrimMin = New System . Windows . Forms . MenuItem00251
Me . mnuAnalisisPrimMax = New System . Windows . Forms . MenuItem00252
Me . MenuItem12 = New System . Windows . Forms . MenuItem00253
Me . mnuAnalisisFordFulkersonMax = New System . Windows . Forms . MenuItem00254
Me . MenuItem14 = New System . Windows . Forms . MenuItem00255
Me . mnuAnalisis_Transbordo = New System . Windows . Forms . MenuItem00256
Me . mnuAnalisis_TSP = New System . Windows . Forms . MenuItem00257
Me . MenuItem5 = New System . Windows . Forms . MenuItem00258
Me . mnuAyudaAcercade = New System . Windows . Forms . MenuItem00259
Me . StatusBar = New System . Windows . Forms . StatusBar00260
Me . PanelX = New System . Windows . Forms . StatusBarPanel00261
Me . PanelY = New System . Windows . Forms . StatusBarPanel00262
Me . SobreObj = New System . Windows . Forms . StatusBarPanel00263
Me . Nd1 = New System . Windows . Forms . StatusBarPanel00264
Me . Nd2 = New System . Windows . Forms . StatusBarPanel00265
Me . z = New System . Windows . Forms . StatusBarPanel00266
Me . filestatusbar = New System . Windows . Forms . StatusBarPanel00267
Me . PictureBox1 = New System . Windows . Forms . PictureBox00268
Me . mnuPopUp = New System . Windows . Forms . ContextMenu00269
Me . mnuAñadirNodo = New System . Windows . Forms . MenuItem00270
Me . mnuEditarNodo = New System . Windows . Forms . MenuItem00271
Me . mnuBorrarNodo = New System . Windows . Forms . MenuItem00272
Me . mnuAlinearNodos = New System . Windows . Forms . MenuItem00273
Me . mnuAlinearNodosH = New System . Windows . Forms . MenuItem00274
Me . mnuAlinearNodosV = New System . Windows . Forms . MenuItem00275
Me . mnuEdicion4 = New System . Windows . Forms . MenuItem00276
Me . mnuAñadirArco = New System . Windows . Forms . MenuItem00277
Me . mnuEditarArco = New System . Windows . Forms . MenuItem00278
Me . mnuBorrarArco = New System . Windows . Forms . MenuItem00279
Me . mnuEdicion8 = New System . Windows . Forms . MenuItem00280
Me . mnuZoomMas = New System . Windows . Forms . MenuItem00281
Me . mnuZoomMenos = New System . Windows . Forms . MenuItem00282
Me . mnuZoomAjustar = New System . Windows . Forms . MenuItem00283
Me . Panel1 = New System . Windows . Forms . Panel00284
Me . TextBox1 = New System . Windows . Forms . TextBox00285
Me . mnuPopTabla = New System . Windows . Forms . ContextMenu00286
Me . mnuTablaAñadirNodo = New System . Windows . Forms . MenuItem00287
Me . mnuTablaBorrarNodo = New System . Windows . Forms . MenuItem00288
Me . MenuItem2 = New System . Windows . Forms . MenuItem00289
Me . mnuTablaTotalNodos = New System . Windows . Forms . MenuItem00290
Me . MenuItem3 = New System . Windows . Forms . MenuItem00291
Me . mnuTablaCopiarTabla = New System . Windows . Forms . MenuItem00292
Me . hfgTabla = New AxMSFlexGridLib . AxMSFlexGrid00293
Me . PrintDialog1 = New System . Windows . Forms . PrintDialog00294
Me . PrintPreviewDialog1 = New System . Windows . Forms . PrintPreviewDialog00295
Me . PrintDocument1 = New System . Drawing . Printing . PrintDocument00296
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
'MainMenu100308
'00309
Me . MainMenu1 . MenuItems . AddRange ( New System . Windows . Forms . MenuItem () { Me .» MenuItem1 , Me . mnuEdicion , Me . mnuFormato , Me . mnuAnalisis , Me . MenuItem5
» })
00310
'00311
'MenuItem100312
'00313
Me . MenuItem1 . Index = 000314
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
'mnuArchivoNuevo00318
'00319
Me . mnuArchivoNuevo . Index = 000320
Me . mnuArchivoNuevo . Shortcut = System . Windows . Forms . Shortcut . CtrlU00321
Me . mnuArchivoNuevo . Text = "&Nuevo"00322
'00323
'mnuArchivoNuevoAleatorio00324
'00325
Me . mnuArchivoNuevoAleatorio . Index = 100326
Me . mnuArchivoNuevoAleatorio . Text = "Crear alea&torio..."00327
'00328
'mnuArchivoAbrir00329
'00330
Me . mnuArchivoAbrir . Index = 200331
Me . mnuArchivoAbrir . Shortcut = System . Windows . Forms . Shortcut . CtrlA00332
Me . mnuArchivoAbrir . Text = "&Abrir"00333
'00334
'mnuArchivoImportarDatos00335
'00336
Me . mnuArchivoImportarDatos . Enabled = False00337
Me . mnuArchivoImportarDatos . Index = 300338
Me . mnuArchivoImportarDatos . Text = "I&mportar datos..."00339
'00340
'MenuItem800341
'00342
Me . MenuItem8 . Index = 400343
Me . MenuItem8 . Text = "-"00344
'00345
'mnuArchivoGuardar00346
'00347
Me . mnuArchivoGuardar . Enabled = False00348
Me . mnuArchivoGuardar . Index = 500349
Me . mnuArchivoGuardar . Shortcut = System . Windows . Forms . Shortcut . CtrlG00350
Me . mnuArchivoGuardar . Text = "&Guardar"00351
'00352
'mnuArchivoGuardarComo00353
'00354
Me . mnuArchivoGuardarComo . Enabled = False00355
Me . mnuArchivoGuardarComo . Index = 600356
Me . mnuArchivoGuardarComo . Text = "G&uardar como..."00357
'00358
'mnuArchivoExportarDatos00359
'00360
Me . mnuArchivoExportarDatos . Enabled = False00361
Me . mnuArchivoExportarDatos . Index = 700362
Me . mnuArchivoExportarDatos . Text = "Exportar &datos..."00363
'00364
'MenuItem2000365
'00366
Me . MenuItem20 . Index = 800367
Me . MenuItem20 . Text = "-"00368
'00369
'mnuArchivoCopiarImg00370
'00371
Me . mnuArchivoCopiarImg . Enabled = False00372
Me . mnuArchivoCopiarImg . Index = 900373
Me . mnuArchivoCopiarImg . Shortcut = System . Windows . Forms . Shortcut . CtrlC00374
Me . mnuArchivoCopiarImg . Text = "&Copiar imagen"00375
'00376
'mnuArchivoExportarImg00377
'00378
Me . mnuArchivoExportarImg . Enabled = False00379
Me . mnuArchivoExportarImg . Index = 1000380
Me . mnuArchivoExportarImg . Shortcut = System . Windows . Forms . Shortcut . CtrlE00381
Me . mnuArchivoExportarImg . Text = "&Exportar imagen..."00382
'00383
'mnuEdicion200384
'00385
Me . mnuEdicion2 . Index = 1100386
Me . mnuEdicion2 . Text = "-"00387
'00388
'mnuArchivoConfigurarImp00389
'00390
Me . mnuArchivoConfigurarImp . Index = 1200391
Me . mnuArchivoConfigurarImp . Text = "C&onfigurar impresora..."00392
'00393
'mnuArchivoConfigurarPag00394
'00395
Me . mnuArchivoConfigurarPag . Enabled = False00396
Me . mnuArchivoConfigurarPag . Index = 1300397
Me . mnuArchivoConfigurarPag . Text = "Con&figurar página..."00398
'00399
'mnuArchivoImprimir00400
'00401
Me . mnuArchivoImprimir . Enabled = False00402
Me . mnuArchivoImprimir . Index = 1400403
Me . mnuArchivoImprimir . Shortcut = System . Windows . Forms . Shortcut . CtrlP00404
Me . mnuArchivoImprimir . Text = "&Imprimir..."00405
'00406
'MenuItem1100407
'00408
Me . MenuItem11 . Index = 1500409
Me . MenuItem11 . Text = "-"00410
'00411
'mnuArchivoSalir00412
'00413
Me . mnuArchivoSalir . Index = 1600414
Me . mnuArchivoSalir . Text = "&Salir"00415
'00416
'mnuEdicion00417
'00418
Me . mnuEdicion . Enabled = False00419
Me . mnuEdicion . Index = 100420
Me . mnuEdicion . MenuItems . AddRange ( New System . Windows . Forms . MenuItem () { Me» . mnuEdicionGrafica , Me . mnuEdicionTabular })
00421
Me . mnuEdicion . Text = "&Edición"00422
'00423
'mnuEdicionGrafica00424
'00425
Me . mnuEdicionGrafica . Checked = True00426
Me . mnuEdicionGrafica . Index = 000427
Me . mnuEdicionGrafica . RadioCheck = True00428
Me . mnuEdicionGrafica . Text = "&Gráfica"00429
'00430
'mnuEdicionTabular00431
'00432
Me . mnuEdicionTabular . Index = 100433
Me . mnuEdicionTabular . RadioCheck = True00434
Me . mnuEdicionTabular . Text = "&Tabular"00435
'00436
'mnuFormato00437
'00438
Me . mnuFormato . Enabled = False00439
Me . mnuFormato . Index = 200440
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
'mnuFormatoOpciones00444
'00445
Me . mnuFormatoOpciones . Enabled = False00446
Me . mnuFormatoOpciones . Index = 000447
Me . mnuFormatoOpciones . Shortcut = System . Windows . Forms . Shortcut . CtrlO00448
Me . mnuFormatoOpciones . Text = "&Opciones..."00449
'00450
'MenuItem1900451
'00452
Me . MenuItem19 . Index = 100453
Me . MenuItem19 . Text = "-"00454
'00455
'mnuFormatoRejilla00456
'00457
Me . mnuFormatoRejilla . Checked = True00458
Me . mnuFormatoRejilla . Index = 200459
Me . mnuFormatoRejilla . Shortcut = System . Windows . Forms . Shortcut . CtrlR00460
Me . mnuFormatoRejilla . Text = "&Rejilla"00461
'00462
'mnuFormatoIman00463
'00464
Me . mnuFormatoIman . Checked = True00465
Me . mnuFormatoIman . Index = 300466
Me . mnuFormatoIman . Shortcut = System . Windows . Forms . Shortcut . CtrlI00467
Me . mnuFormatoIman . Text = "&Imán"00468
'00469
'MenuItem1500470
'00471
Me . MenuItem15 . Index = 400472
Me . MenuItem15 . Text = "-"00473
'00474
'mnuFormatoCentrar00475
'00476
Me . mnuFormatoCentrar . Index = 500477
Me . mnuFormatoCentrar . Text = "&Centrar grafo"00478
'00479
'mnuFormatoAjustar00480
'00481
Me . mnuFormatoAjustar . Index = 600482
Me . mnuFormatoAjustar . Text = "&Ajustar tapiz"00483
'00484
'mnuFormatoImantar00485
'00486
Me . mnuFormatoImantar . Index = 700487
Me . mnuFormatoImantar . Text = "I&mantar"00488
'00489
'MenuItem1800490
'00491
Me . MenuItem18 . Index = 800492
Me . MenuItem18 . Text = "-"00493
'00494
'mnuFormatoAutoRadio00495
'00496
Me . mnuFormatoAutoRadio . Index = 900497
Me . mnuFormatoAutoRadio . Text = "&1 Auto-radio nodos (valor)"00498
'00499
'mnuFormatoAutoTrazo00500
'00501
Me . mnuFormatoAutoTrazo . Index = 1000502
Me . mnuFormatoAutoTrazo . Text = "&2 Auto-trazo arcos (coste)"00503
'00504
'MenuItem600505
'00506
Me . MenuItem6 . Index = 1100507
Me . MenuItem6 . Text = "-"00508
'00509
'mnuFormatoAleatorio00510
'00511
Me . mnuFormatoAleatorio . Index = 1200512
Me . mnuFormatoAleatorio . RadioCheck = True00513
Me . mnuFormatoAleatorio . Text = "A&leatorio"00514
'00515
'mnuFormatoCircular00516
'00517
Me . mnuFormatoCircular . Checked = True00518
Me . mnuFormatoCircular . Index = 1300519
Me . mnuFormatoCircular . RadioCheck = True00520
Me . mnuFormatoCircular . Text = "Circ&ular"00521
'00522
'mnuFormatoTablero00523
'00524
Me . mnuFormatoTablero . Index = 1400525
Me . mnuFormatoTablero . RadioCheck = True00526
Me . mnuFormatoTablero . Text = "&Tablero"00527
'00528
'mnuFormatoFlujo00529
'00530
Me . mnuFormatoFlujo . Index = 1500531
Me . mnuFormatoFlujo . RadioCheck = True00532
Me . mnuFormatoFlujo . Text = "&Flujo"00533
'00534
'mnuFormatoOrganico00535
'00536
Me . mnuFormatoOrganico . Index = 1600537
Me . mnuFormatoOrganico . Text = "Or&gánico"00538
'00539
'mnuAnalisis00540
'00541
Me . mnuAnalisis . Enabled = False00542
Me . mnuAnalisis . Index = 300543
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
'mnuAnalisisDijkstra00547
'00548
Me . mnuAnalisisDijkstra . Enabled = False00549
Me . mnuAnalisisDijkstra . Index = 000550
Me . mnuAnalisisDijkstra . Text = "Árbol mínimo - Alg. Dijkstra (Nd1)"00551
'00552
'mnuAnalisisDijkstraMax00553
'00554
Me . mnuAnalisisDijkstraMax . Enabled = False00555
Me . mnuAnalisisDijkstraMax . Index = 100556
Me . mnuAnalisisDijkstraMax . Text = "Árbol máximo - Alg. Dijkstra (Nd1)"00557
'00558
'MenuItem400559
'00560
Me . MenuItem4 . Index = 200561
Me . MenuItem4 . Text = "-"00562
'00563
'mnuAnalisisDijkstraCM00564
'00565
Me . mnuAnalisisDijkstraCM . Enabled = False00566
Me . mnuAnalisisDijkstraCM . Index = 300567
Me . mnuAnalisisDijkstraCM . Text = "Camino mínimo - Alg. Dijkstra» (Nd1-Nd2)"
00568
'00569
'mnuAnalisisDijkstraCC00570
'00571
Me . mnuAnalisisDijkstraCC . Enabled = False00572
Me . mnuAnalisisDijkstraCC . Index = 400573
Me . mnuAnalisisDijkstraCC . Text = "Camino crítico - Alg. Dijkstra» (Nd1-Nd2)"
00574
'00575
'MenuItem700576
'00577
Me . MenuItem7 . Index = 500578
Me . MenuItem7 . Text = "-"00579
'00580
'mnuAnalisisBellmanFordCmin00581
'00582
Me . mnuAnalisisBellmanFordCmin . Enabled = False00583
Me . mnuAnalisisBellmanFordCmin . Index = 600584
Me . mnuAnalisisBellmanFordCmin . Text = "Camino mínimo - Alg. BellmanFord» (Nd1-Nd2)"
00585
'00586
'mnuAnalisisBellmanFordCmax00587
'00588
Me . mnuAnalisisBellmanFordCmax . Enabled = False00589
Me . mnuAnalisisBellmanFordCmax . Index = 700590
Me . mnuAnalisisBellmanFordCmax . Text = "Camino máximo - Alg. BellmanFord» (Nd1-Nd2)"
00591
'00592
'MenuItem1300593
'00594
Me . MenuItem13 . Index = 800595
Me . MenuItem13 . Text = "-"00596
'00597
'mnuAnalisisFloydWarshallmin00598
'00599
Me . mnuAnalisisFloydWarshallmin . Enabled = False00600
Me . mnuAnalisisFloydWarshallmin . Index = 900601
Me . mnuAnalisisFloydWarshallmin . Text = "Todos los Caminos mínimos - Alg.» FloydWarshall"
00602
'00603
'MenuItem900604
'00605
Me . MenuItem9 . Index = 1000606
Me . MenuItem9 . Text = "-"00607
'00608
'mnuAnalisisKruskalmin00609
'00610
Me . mnuAnalisisKruskalmin . Enabled = False00611
Me . mnuAnalisisKruskalmin . Index = 1100612
Me . mnuAnalisisKruskalmin . Text = "Árbol de valor total mínimo - Alg.» Kruskal"
00613
'00614
'mnuAnalisisKruskalmax00615
'00616
Me . mnuAnalisisKruskalmax . Enabled = False00617
Me . mnuAnalisisKruskalmax . Index = 1200618
Me . mnuAnalisisKruskalmax . Text = "Árbol de valor total máximo - Alg.» Kruskal"
00619
'00620
'MenuItem1000621
'00622
Me . MenuItem10 . Index = 1300623
Me . MenuItem10 . Text = "-"00624
'00625
'mnuAnalisisPrimMin00626
'00627
Me . mnuAnalisisPrimMin . Enabled = False00628
Me . mnuAnalisisPrimMin . Index = 1400629
Me . mnuAnalisisPrimMin . Text = "Árbol de valor total mínimo - Alg. Prim"00630
'00631
'mnuAnalisisPrimMax00632
'00633
Me . mnuAnalisisPrimMax . Enabled = False00634
Me . mnuAnalisisPrimMax . Index = 1500635
Me . mnuAnalisisPrimMax . Text = "Árbol de valor total máximo - Alg. Prim"00636
'00637
'MenuItem1200638
'00639
Me . MenuItem12 . Index = 1600640
Me . MenuItem12 . Text = "-"00641
'00642
'mnuAnalisisFordFulkersonMax00643
'00644
Me . mnuAnalisisFordFulkersonMax . Enabled = False00645
Me . mnuAnalisisFordFulkersonMax . Index = 1700646
Me . mnuAnalisisFordFulkersonMax . Text = "Flujo máximo - Alg. FordFulkerson» (Nd1-Nd2)"
00647
'00648
'MenuItem1400649
'00650
Me . MenuItem14 . Index = 1800651
Me . MenuItem14 . Text = "-"00652
'00653
'mnuAnalisis_Transbordo00654
'00655
Me . mnuAnalisis_Transbordo . Enabled = False00656
Me . mnuAnalisis_Transbordo . Index = 1900657
Me . mnuAnalisis_Transbordo . Text = "Transbordo a coste mínimo - LP» (equilibrado)"
00658
'00659
'mnuAnalisis_TSP00660
'00661
Me . mnuAnalisis_TSP . Enabled = False00662
Me . mnuAnalisis_TSP . Index = 2000663
Me . mnuAnalisis_TSP . Text = "Viajante de Comercio - MILP"00664
'00665
'MenuItem500666
'00667
Me . MenuItem5 . Index = 400668
Me . MenuItem5 . MenuItems . AddRange ( New System . Windows . Forms . MenuItem () { Me .» mnuAyudaAcercade })
00669
Me . MenuItem5 . Text = "Ay&uda"00670
'00671
'mnuAyudaAcercade00672
'00673
Me . mnuAyudaAcercade . Index = 000674
Me . mnuAyudaAcercade . Text = "&Acerca de..."00675
'00676
'StatusBar00677
'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 = True00682
Me . StatusBar . Size = New System . Drawing . Size ( 624 , 16 )00683
Me . StatusBar . TabIndex = 000684
Me . StatusBar . Text = "StatusBar1"00685
'00686
'PanelX00687
'00688
Me . PanelX . BorderStyle = System . Windows . Forms . StatusBarPanelBorderStyle .» None
00689
Me . PanelX . MinWidth = 6000690
Me . PanelX . Width = 6000691
'00692
'PanelY00693
'00694
Me . PanelY . BorderStyle = System . Windows . Forms . StatusBarPanelBorderStyle .» None
00695
Me . PanelY . MinWidth = 6000696
Me . PanelY . Width = 6000697
'00698
'SobreObj00699
'00700
Me . SobreObj . BorderStyle = System . Windows . Forms . StatusBarPanelBorderStyle» . None
00701
Me . SobreObj . MinWidth = 12000702
Me . SobreObj . Width = 12000703
'00704
'Nd100705
'00706
Me . Nd1 . MinWidth = 10000707
'00708
'Nd200709
'00710
Me . Nd2 . MinWidth = 10000711
'00712
'z00713
'00714
Me . z . BorderStyle = System . Windows . Forms . StatusBarPanelBorderStyle . None00715
Me . z . MinWidth = 12000716
Me . z . Width = 12000717
'00718
'filestatusbar00719
'00720
Me . filestatusbar . AutoSize = System . Windows . Forms . StatusBarPanelAutoSize .» Spring
00721
Me . filestatusbar . Width = 4800722
'00723
'PictureBox100724
'00725
Me . PictureBox1 . BackColor = System . Drawing . Color . White00726
Me . PictureBox1 . BorderStyle = System . Windows . Forms . BorderStyle .» FixedSingle
00727
Me . PictureBox1 . ContextMenu = Me . mnuPopUp00728
Me . PictureBox1 . Cursor = System . Windows . Forms . Cursors . Cross00729
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 = 100734
Me . PictureBox1 . TabStop = False00735
Me . PictureBox1 . Visible = False00736
'00737
'mnuPopUp00738
'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ñadirNodo00742
'00743
Me . mnuAñadirNodo . Index = 000744
Me . mnuAñadirNodo . Text = "Añadir Nodo"00745
'00746
'mnuEditarNodo00747
'00748
Me . mnuEditarNodo . Index = 100749
Me . mnuEditarNodo . Text = "Editar Nodo"00750
'00751
'mnuBorrarNodo00752
'00753
Me . mnuBorrarNodo . Index = 200754
Me . mnuBorrarNodo . Text = "Borrar Nodo"00755
'00756
'mnuAlinearNodos00757
'00758
Me . mnuAlinearNodos . Index = 300759
Me . mnuAlinearNodos . MenuItems . AddRange ( New System . Windows . Forms . MenuItem (» ) { Me . mnuAlinearNodosH , Me . mnuAlinearNodosV })
00760
Me . mnuAlinearNodos . Text = "Alinear Nodos"00761
'00762
'mnuAlinearNodosH00763
'00764
Me . mnuAlinearNodosH . Index = 000765
Me . mnuAlinearNodosH . Text = "Horizontalmente"00766
'00767
'mnuAlinearNodosV00768
'00769
Me . mnuAlinearNodosV . Index = 100770
Me . mnuAlinearNodosV . Text = "Verticalmente"00771
'00772
'mnuEdicion400773
'00774
Me . mnuEdicion4 . Index = 400775
Me . mnuEdicion4 . Text = "-"00776
'00777
'mnuAñadirArco00778
'00779
Me . mnuAñadirArco . Index = 500780
Me . mnuAñadirArco . Text = "Añadir Arco"00781
'00782
'mnuEditarArco00783
'00784
Me . mnuEditarArco . Index = 600785
Me . mnuEditarArco . Text = "Editar Arco"00786
'00787
'mnuBorrarArco00788
'00789
Me . mnuBorrarArco . Index = 700790
Me . mnuBorrarArco . Text = "Borrar Arco"00791
'00792
'mnuEdicion800793
'00794
Me . mnuEdicion8 . Index = 800795
Me . mnuEdicion8 . Text = "-"00796
'00797
'mnuZoomMas00798
'00799
Me . mnuZoomMas . Index = 900800
Me . mnuZoomMas . Text = "Zoom +"00801
'00802
'mnuZoomMenos00803
'00804
Me . mnuZoomMenos . Index = 1000805
Me . mnuZoomMenos . Text = "Zoom -"00806
'00807
'mnuZoomAjustar00808
'00809
Me . mnuZoomAjustar . Index = 1100810
Me . mnuZoomAjustar . Text = "Zoom ajustado"00811
'00812
'Panel100813
'00814
Me . Panel1 . AutoScroll = True00815
Me . Panel1 . AutoScrollMinSize = New System . Drawing . Size ( 20 , 20 )00816
Me . Panel1 . BorderStyle = System . Windows . Forms . BorderStyle . Fixed3D00817
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 . Fill00821
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 = 300826
'00827
'TextBox100828
'00829
Me . TextBox1 . AutoSize = False00830
Me . TextBox1 . BackColor = System . Drawing . Color . FromArgb ( CType ( 255 , Byte ),» CType ( 255 , Byte ), CType ( 192 , Byte ))
00831
Me . TextBox1 . BorderStyle = System . Windows . Forms . BorderStyle . FixedSingle00832
Me . TextBox1 . ContextMenu = Me . mnuPopTabla00833
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 = False00835
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 = 200839
Me . TextBox1 . Text = "TextBox1"00840
Me . TextBox1 . TextAlign = System . Windows . Forms . HorizontalAlignment . Right00841
Me . TextBox1 . Visible = False00842
'00843
'mnuPopTabla00844
'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ñadirNodo00848
'00849
Me . mnuTablaAñadirNodo . Index = 000850
Me . mnuTablaAñadirNodo . Text = "Añadir Nodo"00851
'00852
'mnuTablaBorrarNodo00853
'00854
Me . mnuTablaBorrarNodo . Index = 100855
Me . mnuTablaBorrarNodo . Text = "Borrar Nodo"00856
'00857
'MenuItem200858
'00859
Me . MenuItem2 . Index = 200860
Me . MenuItem2 . Text = "-"00861
'00862
'mnuTablaTotalNodos00863
'00864
Me . mnuTablaTotalNodos . Index = 300865
Me . mnuTablaTotalNodos . Text = "Total Nodos..."00866
'00867
'MenuItem300868
'00869
Me . MenuItem3 . Index = 400870
Me . MenuItem3 . Text = "-"00871
'00872
'mnuTablaCopiarTabla00873
'00874
Me . mnuTablaCopiarTabla . Index = 500875
Me . mnuTablaCopiarTabla . Text = "Copiar Tabla"00876
'00877
'hfgTabla00878
'00879
Me . hfgTabla . ContainingControl = Me00880
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 = 400885
Me . hfgTabla . Visible = False00886
'00887
'PrintPreviewDialog100888
'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 = True00893
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 . Empty00898
Me . PrintPreviewDialog1 . Visible = False00899
'00900
'PrintDocument100901
'00902
'00903
'Form100904
'00905
Me . AutoScaleBaseSize = New System . Drawing . Size ( 5 , 13 )00906
Me . AutoScroll = True00907
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 . MainMenu100912
Me . Name = "Form1"00913
Me . StartPosition = System . Windows . Forms . FormStartPosition . CenterScreen00914
Me . Text = "Grafos - (cc) 2003..2005 - Alejandro Rodríguez Villalobos "00915
Me . WindowState = System . Windows . Forms . FormWindowState . Maximized00916
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 Sub00928
00929
# End Region00930
00931
'Declaraciones de DLLs de Análisis00932
Dim WithEvents Dijkstra1 As New Dijkstra . Dijkstra00933
Dim WithEvents BellmanFord1 As New BellmanFord . BellmanFord00934
Dim WithEvents Kruskal1 As New Kruskal . Kruskal00935
Dim WithEvents Prim1 As New Prim . Prim00936
Dim WithEvents FordFulkerson1 As New FordFulkerson . FordFulkerson00937
Dim WithEvents FloydWarshall1 As New FloydWarshall . FloydWarshall00938
00939
'declaración de ventana de opciones de formato00940
Dim WithEvents CajaPropiedades As New Form200941
'declaración de ventana de importar datos00942
Dim WithEvents CajaImportar As New frmImportarDatos00943
Dim CajaExportar As New frmExportarDatos00944
Dim WithEvents CajaNuevoAleatorio As New frmNuevoAleatorio00945
'Array donde guardará la solución de las00946
'variables de decisión del modelo LP_solve00947
Dim SolucionModeloLP ()00948
Dim TiempoModelado As Long00949
'Estructura de árbol para guardar datos XML00950
Public EstructuraArbol As New ArrayList00951
Public XMLValido As Boolean00952
00953
'Declara la estructura del objeto Nodo00954
Public Structure Nodo00955
Dim Texto As String 'etiqueta00956
Dim Valor As Single 'valor del nodo00957
Dim X As Single 'coordenadas00958
Dim Y As Single00959
Dim Z As Single00960
Dim Col As Color 'color de relleno del nodo00961
Dim Radio As Single 'radio del nodo00962
Dim Grosor As Single 'trazo del nodo00963
End Structure00964
'Declara la estructura del objeto Arco o relación entre nodos00965
Public Structure Arco00966
Dim Texto As String 'etiqueta00967
Dim Min As Single 'valor de mínimo00968
Dim Max As Single 'valor de máximo00969
Dim Coste As Single 'valor de coste00970
Dim Col As Color 'color del arco00971
Dim Grosor As Single 'trazo del arco00972
Dim Nd1 As Long 'nodo origen00973
Dim Nd2 As Long 'nodo destino00974
Dim B As Boolean 'doble flecha si o no00975
End Structure00976
'Declara la estructura del objeto Grafo00977
Public Structure Graf00978
Dim Fichero As String 'nombre del fichero00979
Dim Extension As String 'extensión del formato de fichero00980
Dim Zoom As Single00981
Dim Rejilla As Single00982
Dim Iman As Boolean00983
Dim MostrarRejilla As Boolean00984
Dim TapizX As Single00985
Dim TapizY As Single00986
Dim ColorRejilla As Color00987
Dim ColorTapiz As Color00988
Dim ImagenTapiz As String00989
Dim MostrarImagenTapiz As Boolean00990
00991
'Nodos00992
Dim Fuente As Font00993
Dim RadioNodo As Single00994
Dim TrazoNodo As Single00995
Dim ColNodo As Color00996
Dim textoNodo As Boolean00997
Dim costNodo As Boolean00998
00999
'Arcos01000
Dim minArco As Boolean01001
Dim maxArco As Boolean01002
Dim costArco As Boolean01003
Dim ColArco As Color01004
Dim TrazoArco As Single01005
Dim BArco As Boolean 'bidireccional01006
01007
End Structure01008
01009
'Nodos Seleccionados01010
Public Shared Nd1S As Long = - 1 'primer nodo seleccionado01011
Public Shared Nd2S As Long = - 1 'segundo nodo seleccionado01012
'Arco Seleccionado01013
Dim ArcS As Long = - 1 'Arco seleccionado01014
01015
'Coordenadas de creación de un nuevo nodo01016
Dim XNuevo , YNuevo As Single01017
01018
'Totales de Nodos y Arcos01019
Public Shared TotalNodos As Long01020
Public Shared TotalArcos As Long01021
01022
'Crea las colecciones para ambos objetos01023
Public Shared Nodos ( 1 ) As Nodo01024
Public Shared Arcos ( 1 ) As Arco01025
'para copia previo a solución01026
Public Shared NodosPrev ( 1 ) As Nodo01027
Public Shared ArcosPrev ( 1 ) As Arco01028
'para copia de solución01029
Public Shared NodosSol ( 1 ) As Nodo01030
Public Shared ArcosSol ( 1 ) As Arco01031
01032
'crea objeto grafo01033
Public Shared Grafico As Graf 'public shared para compartir entre forms01034
01035
'crea matriz para la tabla de arcos01036
Public Matriz (- 1 , - 1 ) As String01037
'crea matriz para la cabecera de nodos01038
Public Cabecera1 () As String01039
'crea matriz par los valore de nodos01040
Public Cabecera2 () As String01041
'total nodos en la matriz01042
Public Shared NodosMatriz As Long01043
Public Shared NuevoNodosMatriz As Long 'para ser cambiado por usuario01044
'Celda en edición01045
Public CeldaX As Long01046
Public CeldaY As Long01047
01048
'Crea el objeto Graphics principal01049
Public G As Graphics01050
01051
'para la publicación de resultados del algoritmo01052
Public Shared txtResultadosAlgoritmo As String01053
Public Shared AlgoritmoMILP As Boolean01054
Public WithEvents CajaSolucion As New Form601055
01056
Sub DibujaGrafo ()01057
'Me.Cursor = Cursors.WaitCursor01058
Try01059
PictureBox1 . Width = Grafico . TapizX * Grafico . Zoom01060
PictureBox1 . Height = Grafico . TapizY * Grafico . Zoom01061
'PictureBox1.BackColor = Grafico.ColorTapiz01062
'Pone la información de zoom en panel01063
StatusBar . Panels ( 5 ) . Text = "Zoom = " & Format ( Grafico . Zoom , "#0.00"» )
01064
01065
'Crea un objeto Graphics01066
'Dim G As Graphics01067
01068
'toma el objeto graphics01069
G = TomaObjetoGraphics ( PictureBox1 )01070
01071
'borra el objeto graphics01072
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 tapiz01075
G . DrawImage ( Image . FromFile ( Grafico . ImagenTapiz ), 0 , 0 , Grafico .» TapizX * Grafico . Zoom , Grafico . TapizY * Grafico . Zoom )
01076
Else01077
G . Clear ( Grafico . ColorTapiz )01078
End If01079
01080
'Opciones de prestaciones gráficas01081
G . SmoothingMode = Drawing . Drawing2D . SmoothingMode . None01082
'G.InterpolationMode = Drawing.Drawing2D.InterpolationMode.Low01083
'G.TextRenderingHint = Drawing.Text.TextRenderingHint.SystemDefault01084
01085
'definiciones01086
Dim p As Pen 'pluma01087
Dim brocha As System . Drawing . SolidBrush01088
01089
Dim pf As Pen ' pluma01090
01091
Dim b As Rectangle01092
Dim i As Long 'contador01093
01094
Dim x , y As Single01095
Dim x2 , y2 As Single01096
Dim radio As Single01097
Dim t As String 'para texto01098
Dim v As Single 'para valor01099
01100
Dim tamañotexto As SizeF01101
01102
Dim LV As Single01103
Dim Xa As Single , Ya As Single01104
Dim Xb As Single , Yb As Single01105
01106
Dim fuente As Font01107
01108
Dim f As Form201109
f = New Form201110
01111
'prueba de linea con cabezas flecha01112
'#######01113
Dim Fxa , Fya , Fxb , Fyb As Single01114
Dim pff As Pen ' pluma01115
'#######01116
01117
'Cambia escala del tipo de letra01118
fuente = New Font ( Grafico . Fuente . Name , Grafico . Fuente . Size *» Grafico . Zoom , Grafico . Fuente . Style , GraphicsUnit . Pixel )
01119
01120
'--------------01121
'DibujaRejilla01122
'--------------01123
If mnuFormatoRejilla . Checked = True Then01124
'define trazo y color de pluma01125
p = New Pen ( Grafico . ColorRejilla , 1 )01126
p . DashStyle = Drawing . Drawing2D . DashStyle . Dash01127
For x = 0 To PictureBox1 . Width Step Grafico . Rejilla * Grafico .» Zoom
01128
'líneas verticales01129
G . DrawLine ( p , x , 0 , x , PictureBox1 . Height )01130
For y = 0 To PictureBox1 . Height Step Grafico . Rejilla *» Grafico . Zoom
01131
'líneas horizontales01132
G . DrawLine ( p , 0 , y , PictureBox1 . Width , y )01133
Next y01134
Next x01135
End If01136
'-------------01137
01138
'----------------------------01139
'Dibuja la colección de Arcos01140
'----------------------------01141
Dim nArcosR As Long01142
Dim xxa , yya As Single01143
Dim rra As Single01144
01145
Dim ArcS As Long01146
01147
For i = 0 To TotalArcos - 101148
01149
'define el trazo y su color01150
p = New Pen ( Arcos ( i ) . Col , Arcos ( i ) . Grosor * Grafico . Zoom )01151
01152
'Compone etiqueta del arco01153
If Grafico . minArco Or Grafico . maxArco Or Grafico . costArco Then01154
t = "("01155
01156
If Grafico . minArco Then01157
t = t & Arcos ( i ) . Min . ToString01158
End If01159
01160
If Grafico . maxArco Then01161
If Grafico . minArco Then t = t & "; "01162
t = t & Arcos ( i ) . Max . ToString01163
End If01164
01165
If Grafico . costArco Then01166
If ( Grafico . maxArco Or Grafico . minArco ) Then t = t &» "; "
01167
t = t & Arcos ( i ) . Coste . ToString01168
End If01169
01170
t = t & ")"01171
End If01172
01173
If Arcos ( i ) . Nd1 = Arcos ( i ) . Nd2 Then01174
'Arco entre un mismo nodo01175
'----------01176
rra = Nodos ( Arcos ( i ) . Nd1 ) . Radio * Grafico . Zoom01177
x = Nodos ( Arcos ( i ) . Nd1 ) . X * Grafico . Zoom01178
y = Nodos ( Arcos ( i ) . Nd1 ) . Y * Grafico . Zoom01179
'dibuja beizer01180
G . DrawBezier ( p , x - rra , y , x - rra * 3 , y + rra * 3 , x +» rra * 5 , y + rra * 4.6 , x , y )
01181
Else01182
'El arco va entre nodos diferentes01183
'----------01184
'Comprueba si entre nodos existe doble arco01185
nArcosR = 001186
nArcosR = ExisteArcoReves ( Arcos ( i ) . Nd1 , Arcos ( i ) . Nd2 )01187
01188
'Busca un arco simétrico01189
ArcS = - 101190
ArcS = BuscaArcoSimetrico ( i )01191
01192
If ArcS <> - 1 Then01193
If ArcS > i Then01194
Arcos ( i ) . B = True01195
Arcos ( ArcS ) . B = False01196
End If01197
Else01198
Arcos ( i ) . B = False01199
End If01200
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 arco01203
'toma datos del nodo 101204
x = Nodos ( Arcos ( i ) . Nd1 ) . X * Grafico . Zoom01205
y = Nodos ( Arcos ( i ) . Nd1 ) . Y * Grafico . Zoom01206
01207
'toma datos del nodo 201208
x2 = Nodos ( Arcos ( i ) . Nd2 ) . X * Grafico . Zoom01209
y2 = Nodos ( Arcos ( i ) . Nd2 ) . Y * Grafico . Zoom01210
01211
Else01212
'toma datos del nodo 101213
x = Nodos ( Arcos ( i ) . Nd1 ) . X * Grafico . Zoom01214
y = Nodos ( Arcos ( i ) . Nd1 ) . Y * Grafico . Zoom01215
01216
'toma datos del nodo 201217
x2 = Nodos ( Arcos ( i ) . Nd2 ) . X * Grafico . Zoom01218
y2 = Nodos ( Arcos ( i ) . Nd2 ) . Y * Grafico . Zoom01219
01220
01221
'dos arcos en diferentes sentidos01222
'calcula vector unitario01223
LV = Math . Sqrt ((( x2 - x )) ^ 2 + (( y2 - y )) ^ 2 )01224
If LV = 0 Then LV = 0.000000101225
01226
'vector unitario de tamaño radio más pequeño01227
If Nodos ( Arcos ( i ) . Nd1 ) . Radio < Nodos ( Arcos ( i ) . Nd2 ) .» Radio Then
01228
rra = Nodos ( Arcos ( i ) . Nd1 ) . Radio * 0.501229
Else01230
rra = Nodos ( Arcos ( i ) . Nd2 ) . Radio * 0.501231
End If01232
'vector perpendicular01233
yya = ( x2 - x ) / LV * rra * Grafico . Zoom01234
xxa = (- 1 ) * ( y2 - y ) / LV * rra * Grafico . Zoom01235
'traslada el punto de origen y destino01236
x = x + xxa01237
y = y + yya01238
x2 = x2 + xxa01239
y2 = y2 + yya01240
End If01241
01242
'línea principal de centro a centro01243
'------------------------------------01244
G . DrawLine ( p , x , y , x2 , y2 )01245
01246
''prueba de dibujar flecha de otra manera01247
''######01248
''---------01249
01250
''dos arcos en diferentes sentidos01251
''calcula vector unitario01252
'LV = Math.Sqrt(((x2 - x)) ^ 2 + ((y2 - y)) ^ 2)01253
'If LV = 0 Then LV = 0.000000101254
'xxa = (x2 - x) / LV * Grafico.Zoom01255
'yya = (y2 - y) / LV * Grafico.Zoom01256
''calcula puntos de intersección con la circunferencia de» ambos nodos
01257
'rra = Nodos(Arcos(i).Nd1).Radio * 101258
'Fxa = x + xxa * rra01259
'Fya = y + yya * rra01260
'rra = Nodos(Arcos(i).Nd2).Radio * 101261
'Fxb = x2 - xxa * rra01262
'Fyb = y2 - yya * rra01263
''--------01264
''define el trazo y su color01265
'p = New Pen(Arcos(i).Col, Arcos(i).Grosor * Grafico.Zoom)01266
'p.StartCap = Drawing2D.LineCap.NoAnchor01267
'p.EndCap = Drawing2D.LineCap.NoAnchor01268
'G.DrawLine(p, Fxb, Fyb + 30, Fxa, Fya + 30)01269
01270
''define el trazo y su color01271
'pff = New Pen(Arcos(i).Col, Arcos(i).Grosor * 5 *» Grafico.Zoom)
01272
'pff.StartCap = Drawing2D.LineCap.ArrowAnchor01273
'pff.EndCap = Drawing2D.LineCap.NoAnchor01274
'G.DrawLine(pff, Fxb, Fyb + 30, Fxb - xxa * 5, Fyb + 30 -» yya * 5)
01275
'pff.StartCap = Drawing2D.LineCap.ArrowAnchor01276
'pff.EndCap = Drawing2D.LineCap.NoAnchor01277
'G.DrawLine(pff, Fxa, Fya + 30, Fxa + xxa * 5, Fya + 30 +» yya * 5)
01278
''#########01279
01280
End If01281
01282
'Dibuja etiqueta del arco01283
'-------------------------01284
If Arcos ( i ) . Nd1 = Arcos ( i ) . Nd2 Then01285
'Arco sobre un mismo nodo01286
'si se quisiera a la mitad, sustituir por 0.501287
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 texto01293
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 nodo01296
y2 = y + rra * 301297
x2 = x + rra * 301298
'calcula vector unitario01299
01300
LV = Math . Sqrt ((( x2 - x )) ^ 2 + (( y2 - y )) ^ 2 )01301
If LV = 0 Then LV = 0.000000101302
'vector unitario de tamaño radio destino01303
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.301308
Ya = y2 - rra * 2.301309
'cambia el tamaño de la flecha01310
x = x / Nodos ( Arcos ( i ) . Nd2 ) . Radio * 1001311
y = y / Nodos ( Arcos ( i ) . Nd2 ) . Radio * 1001312
'segmento estribor de la punta de la flecha01313
Xb = Xa - x * Arcos ( i ) . Grosor - y / 2 * Arcos ( i ) . Grosor01314
Yb = Ya - y * Arcos ( i ) . Grosor + x / 2 * Arcos ( i ) . Grosor01315
G . DrawLine ( p , Xb , Yb , Xa , Ya )01316
'segmento babor de la punta de la flecha01317
Xb = Xa - x * Arcos ( i ) . Grosor + y / 2 * Arcos ( i ) . Grosor01318
Yb = Ya - y * Arcos ( i ) . Grosor - x / 2 * Arcos ( i ) . Grosor01319
G . DrawLine ( p , Xb , Yb , Xa , Ya )01320
01321
Else01322
01323
If Arcos ( i ) . B = True And Grafico . BArco = True Then01324
'si se quisiera a la mitad, sustituir por 0.501325
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 texto01331
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
Else01333
'el 0.7 hace que el texto del arco se encuentre cerca» del destino
01334
'si se quisiera a la mitad, sustituir por 0.501335
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 texto01341
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 If01343
01344
'punta de flecha destino01345
'-----------------------01346
01347
'calcula vector unitario01348
LV = Math . Sqrt ((( x2 - x )) ^ 2 + (( y2 - y )) ^ 2 )01349
If LV = 0 Then LV = 0.000000101350
'vector unitario de tamaño radio destino01351
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 - x01356
Ya = y2 - y01357
01358
'cambia el tamaño de la flecha01359
x = x / Nodos ( Arcos ( i ) . Nd2 ) . Radio * 1001360
y = y / Nodos ( Arcos ( i ) . Nd2 ) . Radio * 1001361
'segmento estribor de la punta de la flecha01362
Xb = Xa - x * Arcos ( i ) . Grosor - y / 2 * Arcos ( i ) . Grosor01363
Yb = Ya - y * Arcos ( i ) . Grosor + x / 2 * Arcos ( i ) . Grosor01364
G . DrawLine ( p , Xb , Yb , Xa , Ya )01365
'segmento babor de la punta de la flecha01366
Xb = Xa - x * Arcos ( i ) . Grosor + y / 2 * Arcos ( i ) . Grosor01367
Yb = Ya - y * Arcos ( i ) . Grosor - x / 2 * Arcos ( i ) . Grosor01368
G . DrawLine ( p , Xb , Yb , Xa , Ya )01369
01370
'Caso de arco bidireccional01371
'con dos puntas de flecha01372
If Arcos ( i ) . B = True And Grafico . BArco = True Then01373
'punta de flecha origen01374
'-----------------------01375
'toma los nodos al revés y ya está!01376
'toma datos del nodo 101377
x = Nodos ( Arcos ( i ) . Nd2 ) . X * Grafico . Zoom01378
y = Nodos ( Arcos ( i ) . Nd2 ) . Y * Grafico . Zoom01379
01380
'toma datos del nodo 201381
x2 = Nodos ( Arcos ( i ) . Nd1 ) . X * Grafico . Zoom01382
y2 = Nodos ( Arcos ( i ) . Nd1 ) . Y * Grafico . Zoom01383
01384
'calcula vector unitario01385
LV = Math . Sqrt ((( x2 - x )) ^ 2 + (( y2 - y )) ^ 2 )01386
If LV = 0 Then LV = 0.000000101387
'vector unitario de tamaño radio destino01388
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 - x01393
Ya = y2 - y01394
01395
'cambia el tamaño de la flecha01396
x = x / Nodos ( Arcos ( i ) . Nd1 ) . Radio * 1001397
y = y / Nodos ( Arcos ( i ) . Nd1 ) . Radio * 1001398
'segmento estribor de la punta de la flecha01399
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 flecha01403
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 If01407
End If01408
Next i01409
01410
'----------------------------01411
'Dibuja la colección de Nodos01412
'----------------------------01413
For i = 0 To TotalNodos - 101414
'toma datos del nodo01415
x = Nodos ( i ) . X * Grafico . Zoom01416
y = Nodos ( i ) . Y * Grafico . Zoom01417
radio = Nodos ( i ) . Radio * Grafico . Zoom01418
01419
'define el trazo y su color01420
p = New Pen ( Color . Black , Nodos ( i ) . Grosor * Grafico . Zoom )01421
'dibuja círculo del nodo01422
b = New Rectangle ( x - radio , y - radio , radio * 2 , radio * 2 )01423
'rellena el círculo del nodo01424
Select Case i01425
Case Nd1S 'primer nodo seleccionado01426
brocha = New System . Drawing . SolidBrush ( Color . LightGreen» )
01427
Case Nd2S 'segundo nodo seleccionado01428
brocha = New System . Drawing . SolidBrush ( Color . Red )01429
Case Else 'no seleccionado - color original01430
brocha = New System . Drawing . SolidBrush ( Nodos ( i ) . Col )01431
End Select01432
01433
'condicion de dibujado de ambos textos separados por ecuador01434
'o uno sólo centrado en el nodo01435
Dim condicion As Integer01436
If Grafico . textoNodo = False Or Grafico . costNodo = False Then01437
condicion = 001438
Else01439
condicion = 101440
End If01441
01442
G . FillEllipse ( brocha , b )01443
If Grafico . textoNodo And Grafico . costNodo Then01444
'dibuja ecuador del nodo01445
G . DrawLine ( p , x - radio , y , x + radio , y )01446
End If01447
If Grafico . textoNodo Then01448
'pone texto etiqueta en la mitad superior01449
t = Nodos ( i ) . Texto01450
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 If01453
If Grafico . costNodo Then01454
'pone texto valor en la mitad inferior01455
t = Nodos ( i ) . Valor . ToString01456
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 If01459
01460
'dibuja el borde del nodo01461
G . DrawEllipse ( p , b )01462
Next i01463
'----------------------------01464
01465
'Intercepción de posibles errores al dibujar01466
Catch ex As Exception01467
Me . Cursor = Cursors . Default01468
MsgBox ( "Ha fallado el proceso de dibujar el grafo" & vbCrLf & ex .» Message , MsgBoxStyle . Exclamation , "Grafos - Excepción" )
01469
Exit Sub01470
Finally01471
End Try01472
01473
End Sub01474
01475
Public Sub DibujaGrafoSVG ( ByVal fichero As String )01476
'Esta rutina se basa en la rutina DibujaGrafo01477
'transforma todas los comandos gráficos en instrucciones01478
'xml que serán guardadas como texto en un fichero de01479
'extensión .svg (Scalable Vector Graphics) que puede ser01480
'interpretado por un navegador con el plugin svg instalado.01481
Try01482
Dim txt , txt0 , txt1 , txt2 , txt3 , txt4 As String01483
Dim cdn As String01484
Dim cr , cg , cb As Integer01485
01486
01487
Dim version As String01488
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 xml01493
txt = ""01494
txt = "<?xml version=""1.0"" encoding=""UTF-8""?>"01495
txt & = vbCrLf01496
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 & " -->" & vbCrLf01500
txt & = "<!-- Version: " & version & " -->" & vbCrLf01501
txt & = vbCrLf01502
'tamaño del grafo01503
txt & = "<!-- Tamaño del objeto -->"01504
txt & = vbCrLf01505
txt & = "<svg xml:space=""preserve"" width=""" & Grafico . TapizX *» Grafico . Zoom + 2 & """ height=""" & Grafico . TapizY * Grafico . Zoom
» + 2 & """>"
01506
txt & = vbCrLf01507
txt & = "<!-- Escala general 1:1 en pixeles -->"01508
txt & = vbCrLf01509
txt & = "<g transform=""scale(1)"">"01510
txt & = vbCrLf01511
'tapiz01512
txt0 & = "<g id=""0"">"01513
txt0 & = vbCrLf01514
txt0 & = "<!-- Tapiz -->"01515
txt0 & = vbCrLf01516
cr = Grafico . ColorTapiz . R01517
cg = Grafico . ColorTapiz . G01518
cb = Grafico . ColorTapiz . B01519
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 & = vbCrLf01522
txt0 & = "</g>"01523
txt0 & = vbCrLf01524
'definiciones01525
G = TomaObjetoGraphics ( PictureBox1 )01526
01527
Dim p As Pen 'pluma01528
Dim brocha As System . Drawing . SolidBrush01529
01530
Dim b As Rectangle01531
Dim i As Long 'contador01532
01533
Dim x , y As Single01534
Dim x2 , y2 As Single01535
Dim radio As Single01536
Dim t As String 'para texto01537
Dim v As Single 'para valor01538
01539
Dim tamañotexto As SizeF01540
01541
Dim LV As Single01542
Dim Xa As Single , Ya As Single01543
Dim Xb As Single , Yb As Single01544
01545
Dim fuente As Font01546
01547
Dim f As Form201548
f = New Form201549
'Cambia escala del tipo de letra01550
fuente = New Font ( Grafico . Fuente . Name , Grafico . Fuente . Size *» Grafico . Zoom , Grafico . Fuente . Style , GraphicsUnit . Pixel )
01551
01552
'--------------01553
'DibujaRejilla01554
'--------------01555
txt1 & = "<g id=""1"">"01556
txt1 & = vbCrLf01557
If mnuFormatoRejilla . Checked = True Then01558
txt1 & = "<!-- rejilla -->"01559
txt1 & = vbCrLf01560
cr = Grafico . ColorRejilla . R01561
cg = Grafico . ColorRejilla . G01562
cb = Grafico . ColorRejilla . B01563
01564
For x = 0 To Grafico . TapizX * Grafico . Zoom Step Grafico . Rejilla» * Grafico . Zoom
01565
'líneas verticales01566
txt1 & = "<line x1=""" & x & """ y1=""" & 0 & """ x2=""" & x» & """ y2=""" & Grafico . TapizY * Grafico . Zoom & """
» style=""stroke-width:" & 1 & ";stroke:rgb(" & cr & "," &
» cg & "," & cb & ")""></line>"
01567
txt1 & = vbCrLf01568
For y = 0 To Grafico . TapizY * Grafico . Zoom Step Grafico .» Rejilla * Grafico . Zoom
01569
'líneas horizontales01570
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 & = vbCrLf01572
Next y01573
Next x01574
End If01575
txt1 & = "</g>"01576
txt1 & = vbCrLf01577
'------------01578
01579
'----------------------------01580
'Dibuja la colección de Arcos01581
'----------------------------01582
Dim nArcosR As Long01583
Dim xxa , yya As Single01584
Dim rra As Single01585
01586
Dim ArcS As Long01587
01588
txt2 & = "<!-- arcos -->"01589
txt2 & = "<g id=""2"">"01590
txt2 & = vbCrLf01591
txt2 & = vbCrLf01592
01593
txt3 & = "<!-- textos -->"01594
txt3 & = "<g id=""3"">"01595
txt3 & = vbCrLf01596
txt3 & = vbCrLf01597
01598
For i = 0 To TotalArcos - 101599
01600
'define el trazo y su color01601
cr = Arcos ( i ) . Col . R01602
cg = Arcos ( i ) . Col . G01603
cb = Arcos ( i ) . Col . B01604
01605
'Compone etiqueta del arco01606
If Grafico . minArco Or Grafico . maxArco Or Grafico . costArco Then01607
t = "("01608
01609
If Grafico . minArco Then01610
t = t & Arcos ( i ) . Min . ToString01611
End If01612
01613
If Grafico . maxArco Then01614
If Grafico . minArco Then t = t & "; "01615
t = t & Arcos ( i ) . Max . ToString01616
End If01617
01618
If Grafico . costArco Then01619
If ( Grafico . maxArco Or Grafico . minArco ) Then t = t &» "; "
01620
t = t & Arcos ( i ) . Coste . ToString01621
End If01622
01623
t = t & ")"01624
End If01625
01626
If Arcos ( i ) . Nd1 = Arcos ( i ) . Nd2 Then01627
'Arco entre un mismo nodo01628
'----------01629
rra = Nodos ( Arcos ( i ) . Nd1 ) . Radio * Grafico . Zoom01630
x = Nodos ( Arcos ( i ) . Nd1 ) . X * Grafico . Zoom01631
y = Nodos ( Arcos ( i ) . Nd1 ) . Y * Grafico . Zoom01632
'dibuja beizer01633
'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 & = vbCrLf01641
01642
Else01643
'El arco va entre nodos diferentes01644
'----------01645
'Comprueba si entre nodos existe doble arco01646
nArcosR = 001647
nArcosR = ExisteArcoReves ( Arcos ( i ) . Nd1 , Arcos ( i ) . Nd2 )01648
01649
'Busca un arco simétrico01650
ArcS = - 101651
ArcS = BuscaArcoSimetrico ( i )01652
01653
If ArcS <> - 1 Then01654
If ArcS > i Then01655
Arcos ( i ) . B = True01656
Arcos ( ArcS ) . B = False01657
End If01658
Else01659
Arcos ( i ) . B = False01660
End If01661
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 arco01664
'toma datos del nodo 101665
x = Nodos ( Arcos ( i ) . Nd1 ) . X * Grafico . Zoom01666
y = Nodos ( Arcos ( i ) . Nd1 ) . Y * Grafico . Zoom01667
01668
'toma datos del nodo 201669
x2 = Nodos ( Arcos ( i ) . Nd2 ) . X * Grafico . Zoom01670
y2 = Nodos ( Arcos ( i ) . Nd2 ) . Y * Grafico . Zoom01671
01672
Else01673
'toma datos del nodo 101674
x = Nodos ( Arcos ( i ) . Nd1 ) . X * Grafico . Zoom01675
y = Nodos ( Arcos ( i ) . Nd1 ) . Y * Grafico . Zoom01676
01677
'toma datos del nodo 201678
x2 = Nodos ( Arcos ( i ) . Nd2 ) . X * Grafico . Zoom01679
y2 = Nodos ( Arcos ( i ) . Nd2 ) . Y * Grafico . Zoom01680
01681
01682
'dos arcos en diferentes sentidos01683
'calcula vector unitario01684
LV = Math . Sqrt ((( x2 - x )) ^ 2 + (( y2 - y )) ^ 2 )01685
If LV = 0 Then LV = 0.000000101686
01687
01688
'vector unitario de tamaño radio más pequeño01689
If Nodos ( Arcos ( i ) . Nd1 ) . Radio < Nodos ( Arcos ( i ) . Nd2 ) .» Radio Then
01690
rra = Nodos ( Arcos ( i ) . Nd1 ) . Radio * 0.501691
Else01692
rra = Nodos ( Arcos ( i ) . Nd2 ) . Radio * 0.501693
End If01694
'vector perpendicular01695
yya = ( x2 - x ) / LV * rra * Grafico . Zoom01696
xxa = (- 1 ) * ( y2 - y ) / LV * rra * Grafico . Zoom01697
'traslada el punto de origen y destino01698
x = x + xxa01699
y = y + yya01700
x2 = x2 + xxa01701
y2 = y2 + yya01702
End If01703
01704
'línea principal de centro a centro01705
'------------------------------------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 & = vbCrLf01708
01709
End If01710
01711
'Dibuja etiqueta del arco01712
'-------------------------01713
If Arcos ( i ) . Nd1 = Arcos ( i ) . Nd2 Then01714
'Arco sobre un mismo nodo01715
'si se quisiera a la mitad, sustituir por 0.501716
tamañotexto = G . MeasureString ( t , fuente )01717
01718
'escribe el texto01719
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 & = vbCrLf01721
01722
'punta de flecha en arco sobre un mismo nodo01723
y2 = y + rra * 301724
x2 = x + rra * 301725
'calcula vector unitario01726
01727
LV = Math . Sqrt ((( x2 - x )) ^ 2 + (( y2 - y )) ^ 2 )01728
If LV = 0 Then LV = 0.000000101729
'vector unitario de tamaño radio destino01730
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.301735
Ya = y2 - rra * 2.301736
01737
'cambia el tamaño de la flecha01738
x = x / Nodos ( Arcos ( i ) . Nd2 ) . Radio * 1001739
y = y / Nodos ( Arcos ( i ) . Nd2 ) . Radio * 1001740
'segmento estribor de la punta de la flecha01741
Xb = Xa - x * Arcos ( i ) . Grosor - y / 2 * Arcos ( i ) . Grosor01742
Yb = Ya - y * Arcos ( i ) . Grosor + x / 2 * Arcos ( i ) . Grosor01743
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 & = vbCrLf01746
'segmento babor de la punta de la flecha01747
Xb = Xa - x * Arcos ( i ) . Grosor + y / 2 * Arcos ( i ) . Grosor01748
Yb = Ya - y * Arcos ( i ) . Grosor - x / 2 * Arcos ( i ) . Grosor01749
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 & = vbCrLf01752
Else01753
If Arcos ( i ) . B = True And Grafico . BArco = True Then01754
'si se quisiera a la mitad, sustituir por 0.501755
tamañotexto = G . MeasureString ( t , fuente )01756
01757
'escribe el texto01758
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 & = vbCrLf01760
01761
Else01762
'el 0.7 hace que el texto del arco se encuentre cerca» del destino
01763
'si se quisiera a la mitad, sustituir por 0.501764
tamañotexto = G . MeasureString ( t , fuente )01765
01766
'escribe el texto01767
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 & = vbCrLf01769
End If01770
01771
'punta de flecha destino01772
'-----------------------01773
01774
'calcula vector unitario01775
LV = Math . Sqrt ((( x2 - x )) ^ 2 + (( y2 - y )) ^ 2 )01776
If LV = 0 Then LV = 0.000000101777
'vector unitario de tamaño radio destino01778
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 - x01783
Ya = y2 - y01784
01785
'cambia el tamaño de la flecha01786
x = x / Nodos ( Arcos ( i ) . Nd2 ) . Radio * 1001787
y = y / Nodos ( Arcos ( i ) . Nd2 ) . Radio * 1001788
'segmento estribor de la punta de la flecha01789
Xb = Xa - x * Arcos ( i ) . Grosor - y / 2 * Arcos ( i ) . Grosor01790
Yb = Ya - y * Arcos ( i ) . Grosor + x / 2 * Arcos ( i ) . Grosor01791
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 & = vbCrLf01794
'segmento babor de la punta de la flecha01795
Xb = Xa - x * Arcos ( i ) . Grosor + y / 2 * Arcos ( i ) . Grosor01796
Yb = Ya - y * Arcos ( i ) . Grosor - x / 2 * Arcos ( i ) . Grosor01797
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 & = vbCrLf01800
01801
'Caso de arco bidireccional01802
'con dos puntas de flecha01803
If Arcos ( i ) . B = True And Grafico . BArco = True Then01804
'punta de flecha origen01805
'-----------------------01806
'toma los nodos al revés y ya está!01807
'toma datos del nodo 101808
x = Nodos ( Arcos ( i ) . Nd2 ) . X * Grafico . Zoom01809
y = Nodos ( Arcos ( i ) . Nd2 ) . Y * Grafico . Zoom01810
01811
'toma datos del nodo 201812
x2 = Nodos ( Arcos ( i ) . Nd1 ) . X * Grafico . Zoom01813
y2 = Nodos ( Arcos ( i ) . Nd1 ) . Y * Grafico . Zoom01814
01815
'calcula vector unitario01816
LV = Math . Sqrt ((( x2 - x )) ^ 2 + (( y2 - y )) ^ 2 )01817
If LV = 0 Then LV = 0.000000101818
'vector unitario de tamaño radio destino01819
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 - x01824
Ya = y2 - y01825
'cambia el tamaño de la flecha01826
x = x / Nodos ( Arcos ( i ) . Nd1 ) . Radio * 1001827
y = y / Nodos ( Arcos ( i ) . Nd1 ) . Radio * 1001828
'segmento estribor de la punta de la flecha01829
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 & = vbCrLf01834
'segmento babor de la punta de la flecha01835
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 & = vbCrLf01840
End If01841
End If01842
Next i01843
01844
txt2 & = "</g>"01845
txt2 & = vbCrLf01846
01847
txt4 & = "<!-- nodos -->"01848
txt4 & = "<g id=""4"">"01849
txt4 & = vbCrLf01850
01851
'----------------------------01852
'Dibuja la colección de Nodos01853
'----------------------------01854
For i = 0 To TotalNodos - 101855
'toma datos del nodo01856
x = Nodos ( i ) . X * Grafico . Zoom01857
y = Nodos ( i ) . Y * Grafico . Zoom01858
radio = Nodos ( i ) . Radio * Grafico . Zoom01859
01860
'condicion de dibujado de ambos textos separados por ecuador01861
'o uno sólo centrado en el nodo01862
Dim condicion As Integer01863
If Grafico . textoNodo = False Or Grafico . costNodo = False Then01864
condicion = 001865
Else01866
condicion = 101867
End If01868
01869
'dibuja nodo en svg01870
txt4 & = "<!-- nodo " & i & " -->"01871
txt4 & = vbCrLf01872
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 & = vbCrLf01874
01875
If Grafico . textoNodo And Grafico . costNodo Then01876
'dibuja ecuador del nodo01877
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 & = vbCrLf01879
End If01880
If Grafico . textoNodo Then01881
' 'pone texto etiqueta en la mitad superior01882
t = Nodos ( i ) . Texto01883
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 & = vbCrLf01886
End If01887
If Grafico . costNodo Then01888
' 'pone texto valor en la mitad inferior01889
t = Nodos ( i ) . Valor . ToString01890
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 & = vbCrLf01893
End If01894
Next i01895
'----------------------------01896
txt3 & = "</g>"01897
txt3 & = vbCrLf01898
txt4 & = "</g>"01899
txt4 & = vbCrLf01900
01901
'consolida todos los textos01902
'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 & txt301905
01906
'pie del fichero xml01907
txt & = "</g></svg>"01908
'Guarda el fichero .svg01909
EscribeFicheroTexto ( fichero , txt )01910
01911
'fichero .htm anexo que permite activar/desactivar capas01912
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 .htm01977
EscribeFicheroTexto ( fichero & ".htm" , txt )01978
01979
'Intercepción de posibles errores al dibujar01980
Catch ex As Exception01981
Me . Cursor = Cursors . Default01982
MsgBox ( "Ha fallado el proceso de exportación gráfica a .svg" &» vbCrLf & ex . Message , MsgBoxStyle . Exclamation , "Grafos -
» Excepción" )
01983
Exit Sub01984
Finally01985
End Try01986
End Sub01987
Function BuscaArcoSimetrico ( ByVal i As Long ) As Long01988
'Busca un arco simétrico al pasado como parámetro01989
'para ser fusionado en el grafo (en caso de opción bidireccional)01990
'y que aparezca sólo un arco con doble flecha01991
Dim j As Long01992
For j = 0 To TotalArcos - 101993
'que no sea él mismo01994
If j <> i Then01995
01996
'coincide dirección y sentido inverso01997
If Arcos ( i ) . Nd1 = Arcos ( j ) . Nd2 And Arcos ( i ) . Nd2 = Arcos ( j ) . Nd1» Then
01998
01999
'coinciden valores02000
If Arcos ( i ) . Min = Arcos ( j ) . Min And Arcos ( i ) . Max = Arcos ( j )» . Max And Arcos ( i ) . Coste = Arcos ( j ) . Coste Then
02001
'encontrado02002
Return j02003
End If02004
End If02005
End If02006
Next j02007
02008
Return - 102009
End Function02010
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 . ToString02014
StatusBar . Panels ( 1 ) . Text = "Y = " & e . Y . ToString02015
Dim nd As Long02016
nd = XYSobreNodo ( e . X , e . Y )02017
If nd <> - 1 Then02018
StatusBar . Panels ( 2 ) . Text = "Nodo = " & Nodos ( nd ) . Texto02019
Else02020
StatusBar . Panels ( 2 ) . Text = " "02021
End If02022
02023
If e . Button = MouseButtons . Left And Nd1S <> - 1 Then02024
'redondea el valor de las coordenadas al ancho de la rejilla02025
'si la opción imán está seleccionada en el menú02026
If mnuFormatoIman . Checked = True Then02027
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
Else02030
'sino, toma los valores tal cual02031
'Nodos(Nd1S).X = e.X / Grafico.Zoom02032
'Nodos(Nd1S).Y = e.Y / Grafico.Zoom02033
' If e.X / Grafico.Zoom <> XNuevo Or e.Y / Grafico.Zoom <>» YNuevo Then
02034
Nodos ( Nd1S ) . X = ( e . X - XNuevo ) / Grafico . Zoom02035
Nodos ( Nd1S ) . Y = ( e . Y - YNuevo ) / Grafico . Zoom02036
'End If02037
End If02038
02039
DibujaGrafo ()02040
PictureBox1 . Refresh ()02041
02042
End If02043
02044
'Activa o desactiva menús de análisis02045
'debe existir al menos un arco para tener un grafo02046
If TotalArcos > 0 Then02047
mnuAnalisisDijkstra . Enabled = True02048
mnuAnalisisDijkstraCC . Enabled = True02049
mnuAnalisisDijkstraCM . Enabled = True02050
mnuAnalisisDijkstraMax . Enabled = True02051
mnuAnalisisBellmanFordCmin . Enabled = True02052
mnuAnalisisBellmanFordCmax . Enabled = True02053
mnuAnalisisFordFulkersonMax . Enabled = True02054
02055
mnuAnalisisKruskalmin . Enabled = True02056
mnuAnalisisKruskalmax . Enabled = True02057
mnuAnalisisPrimMin . Enabled = True02058
mnuAnalisisPrimMax . Enabled = True02059
mnuAnalisisFloydWarshallmin . Enabled = True02060
mnuAnalisis_Transbordo . Enabled = True02061
mnuAnalisis_TSP . Enabled = True02062
Else02063
mnuAnalisisDijkstra . Enabled = False02064
mnuAnalisisDijkstraCC . Enabled = False02065
mnuAnalisisDijkstraCM . Enabled = False02066
mnuAnalisisDijkstraMax . Enabled = False02067
mnuAnalisisBellmanFordCmin . Enabled = False02068
mnuAnalisisBellmanFordCmax . Enabled = False02069
mnuAnalisisFordFulkersonMax . Enabled = False02070
02071
mnuAnalisisKruskalmin . Enabled = False02072
mnuAnalisisKruskalmax . Enabled = False02073
mnuAnalisisPrimMin . Enabled = False02074
mnuAnalisisPrimMax . Enabled = False02075
mnuAnalisisFloydWarshallmin . Enabled = False02076
mnuAnalisis_Transbordo . Enabled = False02077
mnuAnalisis_TSP . Enabled = False02078
End If02079
End Sub02080
Function XYSobreNodo ( ByVal x As Single , ByVal y As Single ) As Long02081
02082
Dim i As Long02083
Dim Dist As Single02084
02085
Dim minDist As Single02086
Dim NdProx As Long02087
02088
minDist = 100000000000000000002089
NdProx = - 102090
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 Then02094
minDist = Dist02095
NdProx = i02096
End If02097
Next i02098
02099
Return NdProx02100
End Function02101
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 rejilla02103
If mnuFormatoRejilla . Checked = True Then02104
mnuFormatoRejilla . Checked = False02105
Grafico . MostrarRejilla = False02106
CajaPropiedades . chkMostrarRejilla . Checked = False02107
DibujaGrafo () 'redibuja el grafo02108
Else02109
mnuFormatoRejilla . Checked = True02110
Grafico . MostrarRejilla = True02111
CajaPropiedades . chkMostrarRejilla . Checked = True02112
02113
DibujaGrafo () 'redibuja el grafo02114
End If02115
02116
End Sub02117
Private Sub mnuArchivoImprimir_Click ( ByVal sender As System . Object , ByVal e» As System . EventArgs ) Handles mnuArchivoImprimir . Click
02118
'Muestra el diálogo de previsualización02119
'que a su vez llama al evento PrintPage de PrintDocument102120
02121
Try02122
PrintPreviewDialog1 . Document = PrintDocument102123
PrintPreviewDialog1 . ShowDialog ()02124
02125
'si ocurriera algún error lo muestra en pantalla02126
Catch ex As Exception02127
MsgBox ( "Ha fallado la operación de impresión." & vbCrLf & ex . Message» , MsgBoxStyle . Exclamation , "Grafos - Excepción" )
02128
End Try02129
02130
End Sub02131
Private Sub mnuArchivoConfigurarPag_Click ( ByVal sender As System . Object ,» ByVal e As System . EventArgs ) Handles mnuArchivoConfigurarPag . Click
02132
'Establece configuración de página02133
With PageSetupDialog102134
. PageSettings = PrintDocument1 . DefaultPageSettings02135
If . ShowDialog () = DialogResult . OK Then02136
PrintDocument1 . DefaultPageSettings = . PageSettings02137
End If02138
End With02139
End Sub02140
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ón02142
With PrintDialog102143
. PrinterSettings = PrintDocument1 . PrinterSettings02144
If . ShowDialog () = DialogResult . OK Then02145
PrintDocument1 . PrinterSettings = . PrinterSettings02146
End If02147
End With02148
End Sub02149
Private Sub PrintDocument1_PrintPage ( ByVal sender As Object , ByVal e As» System . Drawing . Printing . PrintPageEventArgs ) Handles PrintDocument1 .
» PrintPage
02150
'Es llamado por el previsualizador02151
'rellena el PrintDocument con la imagen del picturebox02152
'ajustada al tamaño de página.02153
Me . Cursor = Cursors . WaitCursor02154
Dim r As Rectangle02155
Dim pw , ph , pl , pt As Integer02156
02157
pw = PictureBox1 . Width02158
ph = PictureBox1 . Height02159
'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 . PaperSize02162
If pw < . Width Then02163
pl = ( . Width - pw ) / 202164
Else02165
pl = 002166
End If02167
If ph < . Height Then02168
pt = ( . Height - ph ) / 202169
Else02170
pt = 002171
End If02172
End With02173
02174
'dibuja la imagen en la impresora02175
r = New Rectangle ( pl , pt , pw , ph )02176
e . Graphics . DrawImage ( PictureBox1 . Image , r )02177
Me . Cursor = Cursors . Default02178
End Sub02179
Private Sub PictureBox1_MouseDown ( ByVal sender As Object , ByVal e As System .» Windows . Forms . MouseEventArgs ) Handles PictureBox1 . MouseDown
02180
Dim nd As Long02181
'Selección del nodo origen02182
If e . Button = MouseButtons . Left Then02183
nd = XYSobreNodo ( e . X , e . Y )02184
If nd <> - 1 Then02185
Nd1S = nd02186
'If Nd1S = Nd2S Then02187
'Nd2S = -1 'si selecciona encima del nd2s, deselecciona el nd2s02188
'End If02189
02190
'PRUEBA ALEX02191
'PUNTOS PANTALLA02192
XNuevo = ( e . X - Nodos ( nd ) . X * Grafico . Zoom )02193
YNuevo = ( e . Y - Nodos ( nd ) . Y * Grafico . Zoom )02194
02195
Else02196
Nd1S = - 102197
End If02198
DibujaGrafo ()02199
End If02200
02201
'Selección del nodo destino02202
If e . Button = MouseButtons . Right Then02203
02204
'Guarda coordenadas para la creación de un nuevo nodo02205
XNuevo = e . X / Grafico . Zoom02206
YNuevo = e . Y / Grafico . Zoom02207
02208
nd = XYSobreNodo ( e . X , e . Y )02209
If nd <> - 1 Then02210
Nd2S = nd02211
'If Nd2S = Nd1S Then02212
' Nd1S = -1 'si selecciona encima del nd1s, deselecciona el» nd1s
02213
'End If02214
Else02215
Nd2S = - 102216
End If02217
DibujaGrafo ()02218
End If02219
02220
'evita errores de selección fuera de rango02221
If Nd1S > TotalNodos - 1 Then Nd1S = - 102222
If Nd2S > TotalNodos - 1 Then Nd2S = - 102223
02224
'Cambia visualizaciones según las selecciones02225
'según el nodo seleccionado02226
If Nd1S = - 1 Then02227
StatusBar . Panels ( 3 ) . Text = "-"02228
02229
mnuAnalisisDijkstra . Enabled = False02230
mnuAnalisisDijkstraMax . Enabled = False02231
Else02232
StatusBar . Panels ( 3 ) . Text = "Nd1 = " & Nodos ( Nd1S ) . Texto02233
02234
mnuAnalisisDijkstra . Enabled = True02235
mnuAnalisisDijkstraMax . Enabled = True02236
End If02237
If Nd2S = - 1 Then02238
StatusBar . Panels ( 4 ) . Text = "-"02239
mnuBorrarNodo . Enabled = False02240
mnuEditarNodo . Enabled = False02241
Else02242
StatusBar . Panels ( 4 ) . Text = "Nd2 = " & Nodos ( Nd2S ) . Texto02243
mnuBorrarNodo . Enabled = True02244
mnuEditarNodo . Enabled = True02245
End If02246
'dos nodos seleccionados02247
If Nd1S <> - 1 And Nd2S <> - 1 Then 'And Nd1S <> Nd2S Then02248
Dim nArcos As Long02249
nArcos = ExisteArco ( Nd1S , Nd2S )02250
Dim nArcosR As Long02251
nArcosR = ExisteArcoReves ( Nd1S , Nd2S )02252
'comprobaciones02253
'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 opuestos02255
mnuAñadirArco . Enabled = False02256
Else02257
mnuAñadirArco . Enabled = True02258
End If02259
If nArcos = 0 Then02260
'no se puede borrar y editar algo que no existe02261
mnuBorrarArco . Enabled = False02262
mnuEditarArco . Enabled = False02263
Else02264
'si existe si se puede borrar y editar02265
mnuBorrarArco . Enabled = True02266
mnuEditarArco . Enabled = True02267
02268
End If02269
mnuAlinearNodos . Enabled = True02270
mnuAnalisisDijkstraCC . Enabled = True02271
mnuAnalisisDijkstraCM . Enabled = True02272
mnuAnalisisBellmanFordCmax . Enabled = True02273
mnuAnalisisBellmanFordCmin . Enabled = True02274
mnuAnalisisFordFulkersonMax . Enabled = True02275
Else02276
'si no se seleccionan dos no se pueden efectuar operaciones de arco02277
mnuAñadirArco . Enabled = False02278
mnuBorrarArco . Enabled = False02279
mnuEditarArco . Enabled = False02280
mnuAlinearNodos . Enabled = False02281
mnuAnalisisDijkstraCC . Enabled = False02282
mnuAnalisisDijkstraCM . Enabled = False02283
mnuAnalisisBellmanFordCmax . Enabled = False02284
mnuAnalisisBellmanFordCmin . Enabled = False02285
mnuAnalisisFordFulkersonMax . Enabled = False02286
End If02287
02288
If Nd1S = Nd2S Then mnuAlinearNodos . Enabled = False02289
End Sub02290
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ón02292
'El arco no puede ser entre un mismo nodo02293
'If Nd1S = Nd2S Then Exit Sub02294
02295
Dim i As Long02296
'i = UBound(Arcos) + 102297
TotalArcos = TotalArcos + 102298
02299
ReDim Preserve Arcos ( TotalArcos - 1 )02300
i = TotalArcos - 102301
Arcos ( i ) . Nd1 = Nd1S02302
Arcos ( i ) . Nd2 = Nd2S02303
02304
Arcos ( i ) . Min = 002305
Arcos ( i ) . Max = 002306
Arcos ( i ) . Coste = 002307
02308
'tomar opciones gráficas de la configuración por defecto02309
Arcos ( i ) . B = False 'por defecto false, se trata en DibujaGrafo02310
02311
Arcos ( i ) . Grosor = Grafico . TrazoArco02312
Arcos ( i ) . Col = Grafico . ColArco02313
02314
DibujaGrafo ()02315
End Sub02316
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ón02318
02319
Dim i As Long02320
' i = UBound(Nodos) + 102321
02322
If TotalNodos = 200 Then Exit Sub02323
02324
TotalNodos = TotalNodos + 102325
02326
ReDim Preserve Nodos ( TotalNodos - 1 )02327
i = TotalNodos - 1 'ultimo nodo02328
Nodos ( i ) . X = XNuevo02329
Nodos ( i ) . Y = YNuevo02330
Nodos ( i ) . Z = 002331
02332
If Grafico . Iman Then02333
Nodos ( i ) . X = Int ( Nodos ( i ) . X / Grafico . Rejilla ) * Grafico . Rejilla02334
Nodos ( i ) . Y = Int ( Nodos ( i ) . Y / Grafico . Rejilla ) * Grafico . Rejilla02335
End If02336
02337
'tomará datos de un formulario02338
Nodos ( i ) . Texto = i . ToString02339
Nodos ( i ) . Valor = 002340
'tomar opciones gráficas de la configuración por defecto02341
'si no peta cuando el grafo está vacio y se pone el primer nodo02342
Nodos ( i ) . Radio = Grafico . RadioNodo 'todos los radios iguales02343
Nodos ( i ) . Grosor = Grafico . TrazoNodo02344
Nodos ( i ) . Col = Grafico . ColNodo02345
02346
DibujaGrafo ()02347
End Sub02348
Sub BorraArco ( ByVal n As Long )02349
'Redimensiona la matriz de arcos para borrar el arco seleccionado02350
Dim i As Long02351
02352
If n > TotalArcos - 1 Or n < 0 Then Exit Sub02353
02354
If n = TotalArcos - 1 Then 'se borra el último02355
ReDim Preserve Arcos ( TotalArcos - 1 - 1 )02356
Else 'se corren los valores02357
For i = n To TotalArcos - 1 - 102358
Arcos ( i ) = Arcos ( i + 1 )02359
Next i02360
ReDim Preserve Arcos ( TotalArcos - 1 - 1 )02361
End If02362
02363
TotalArcos = TotalArcos - 102364
End Sub02365
Private Sub mnuBorrarNodo_Click ( ByVal sender As Object , ByVal e As System .» EventArgs ) Handles mnuBorrarNodo . Click
02366
Dim i As Long02367
Dim total As Long02368
02369
'debe recorrer los arcos02370
If TotalArcos > 0 Then02371
i = 002372
Do While i <= TotalArcos - 102373
02374
If Arcos ( i ) . Nd1 = Nd2S Or Arcos ( i ) . Nd2 = Nd2S Then02375
BorraArco ( i ) 'borrar el que tenga ese nodo seleccionado02376
i = - 1 'vuelve a empezar el recorrido02377
End If02378
i = i + 102379
02380
'así hasta no encontrar más arcos con ese nodo02381
Loop02382
End If02383
'renumera nodos superiores al que se va a borrar02384
'por la traslación de indices hacia abajo que hay02385
'en el proceso de borrar nodo02386
For i = 0 To TotalArcos - 102387
If Arcos ( i ) . Nd1 > Nd2S Then Arcos ( i ) . Nd1 = Arcos ( i ) . Nd1 - 102388
If Arcos ( i ) . Nd2 > Nd2S Then Arcos ( i ) . Nd2 = Arcos ( i ) . Nd2 - 102389
Next02390
02391
total = UBound ( Nodos ) 'ultimo nodo02392
02393
If Nd2S = total Then 'se borra el último02394
'If total = 0 'Then ATENCION se borra el único existente????02395
02396
ReDim Preserve Nodos ( total - 1 )02397
Else02398
For i = Nd2S To total - 102399
Nodos ( i ) = Nodos ( i + 1 )02400
Next i02401
02402
'If total = 0 'Then ATENCION se borra el único existente????02403
02404
ReDim Preserve Nodos ( total - 1 )02405
End If02406
02407
TotalNodos = TotalNodos - 102408
02409
'no selecciona segundo nodo02410
Nd2S = - 102411
StatusBar . Panels ( 4 ) . Text = ""02412
02413
DibujaGrafo ()02414
End Sub02415
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 las02417
'condiciones de origen y destino de nodos seleccionados02418
'una vez localizados los borra uno a uno02419
Dim i As Long02420
02421
i = 002422
Do While i <= TotalArcos - 102423
02424
If Arcos ( i ) . Nd1 = Nd1S And Arcos ( i ) . Nd2 = Nd2S Then02425
BorraArco ( i )02426
i = - 1 'vuelve a empezar el recorrido02427
End If02428
i = i + 102429
02430
'así hasta no encontrar más arcos con esa condición02431
Loop02432
DibujaGrafo ()02433
End Sub02434
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.202437
02438
DibujaGrafo ()02439
End Sub02440
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.202443
02444
DibujaGrafo ()02445
End Sub02446
Private Sub mnuZoomAjustar_Click ( ByVal sender As System . Object , ByVal e As» System . EventArgs ) Handles mnuZoomAjustar . Click
02447
If TotalNodos < 2 Then Exit Sub02448
Dim i As Long02449
02450
Dim minX As Single = 100000000002451
Dim minY As Single = 100000000002452
Dim maxX As Single = - 100000000002453
Dim maxY As Single = - 100000000002454
02455
Dim zoomx As Single02456
Dim zoomy As Single02457
02458
For i = 0 To TotalNodos - 102459
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 i02466
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 = zoomx02471
minX = minX - 2002472
minY = minY - 2002473
02474
DibujaGrafo ()02475
02476
'Panel1.AutoScroll = False02477
Dim p As Point02478
If minX * Grafico . Zoom <= 0 Then02479
p . X = 002480
Else02481
p . X = minX * Grafico . Zoom02482
End If02483
02484
If minY * Grafico . Zoom <= 0 Then02485
p . Y = 002486
Else02487
p . Y = minY * Grafico . Zoom02488
End If02489
02490
PictureBox1 . Left = 002491
PictureBox1 . Top = 002492
02493
Panel1 . AutoScrollPosition = p02494
02495
'Pone la información de zoom en panel02496
StatusBar . Panels ( 5 ) . Text = "Zoom = " & Format ( Grafico . Zoom , "#0.00" )02497
End Sub02498
Sub ActivaMenus ()02499
02500
Me . mnuArchivoGuardar . Enabled = True02501
Me . mnuArchivoGuardarComo . Enabled = True02502
Me . mnuArchivoNuevoAleatorio . Enabled = True02503
Me . mnuArchivoExportarDatos . Enabled = True02504
Me . mnuArchivoImportarDatos . Enabled = True02505
Me . mnuArchivoCopiarImg . Enabled = True02506
Me . mnuArchivoExportarImg . Enabled = True02507
Me . mnuArchivoConfigurarPag . Enabled = True02508
Me . mnuArchivoImprimir . Enabled = True02509
Me . mnuEdicion . Enabled = True02510
Me . mnuFormato . Enabled = True02511
Me . mnuFormatoOpciones . Enabled = True02512
Me . mnuAnalisis . Enabled = True02513
02514
Me . mnuAnalisisBellmanFordCmax . Enabled = False02515
Me . mnuAnalisisBellmanFordCmin . Enabled = False02516
Me . mnuAnalisisDijkstra . Enabled = False02517
Me . mnuAnalisisDijkstraCC . Enabled = False02518
Me . mnuAnalisisDijkstraCM . Enabled = False02519
Me . mnuAnalisisDijkstraMax . Enabled = False02520
Me . mnuAnalisisKruskalmax . Enabled = False02521
Me . mnuAnalisisKruskalmin . Enabled = False02522
Me . mnuAnalisisPrimMax . Enabled = False02523
Me . mnuAnalisisPrimMin . Enabled = False02524
Me . mnuAnalisisFordFulkersonMax . Enabled = False02525
Me . mnuAnalisisFloydWarshallmin . Enabled = False02526
02527
Me . mnuAnalisis_Transbordo . Enabled = False02528
Me . mnuAnalisis_TSP . Enabled = False02529
02530
End Sub02531
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 Then02534
Dim respuesta As MsgBoxResult02535
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 Sub02537
End If02538
'nombre del fichero en estatus bar02539
Me . StatusBar . Panels ( 6 ) . Text = ""02540
02541
'lee las opciones por defecto02542
OpcionesporDefecto ()02543
02544
'inicia la caja de propiedades con las opciones por defecto elegidas02545
CajaPropiedades . LeeOpciones ()02546
02547
'Cambia y posiciona el picturebox02548
PictureBox1 . Top = 002549
PictureBox1 . Left = 002550
PictureBox1 . Width = Grafico . TapizX * Grafico . Zoom02551
PictureBox1 . Height = Grafico . TapizX * Grafico . Zoom02552
02553
TotalNodos = 002554
TotalArcos = 002555
NodosMatriz = 002556
02557
'no selecciona ningún nodo02558
Nd1S = - 102559
Nd2S = - 102560
02561
'Llama al proceso principal de dibujar grafo02562
DibujaGrafo ()02563
Grafico . Fichero = ""02564
Grafico . Extension = ".graphML" 'extensión por defecto .graphML02565
02566
PictureBox1 . Visible = True02567
ActivaMenus ()02568
Me . mnuEdicionGrafica_Click ( Me , e )02569
End Sub02570
Sub CreaGrafoAleatorio ( ByVal n As Long , ByVal a As Long , ByVal r As Boolean )02571
'Crea un grafo aleatorio02572
If n > 200 Then Exit Sub02573
02574
TotalNodos = n02575
ReDim Nodos ( TotalNodos - 1 )02576
02577
Dim i , j , k As Integer02578
'Crea una colección de nodos02579
For i = 0 To TotalNodos - 102580
Nodos ( i ) . Texto = i . ToString02581
Nodos ( i ) . X = Rnd () * Grafico . TapizX02582
Nodos ( i ) . Y = Rnd () * Grafico . TapizY02583
Nodos ( i ) . Col = Grafico . ColNodo02584
02585
Nodos ( i ) . Radio = Grafico . RadioNodo02586
Nodos ( i ) . Grosor = Grafico . TrazoNodo02587
Nodos ( i ) . Valor = 002588
Next i02589
'Crea una colección de arcos02590
02591
TotalArcos = 002592
ReDim Arcos ( 0 )02593
Dim sigue As Boolean02594
For i = 0 To TotalNodos - 102595
For j = 0 To TotalNodos - 102596
If 100 * Rnd () < a And a > 0 Then02597
sigue = True02598
If r = True And i = j Then sigue = True02599
If r