home *** CD-ROM | disk | FTP | other *** search
/ Super Net 1 / SUPERNET_1.iso / PC / OTROS / EXTRAS / WINWAIS / VB / MAP.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1993-08-30  |  25.7 KB  |  843 lines

  1. VERSION 2.00
  2. Begin Form map_form 
  3.    BackColor       =   &H00FFFFFF&
  4.    Caption         =   "Spatial Data Locator"
  5.    ClientHeight    =   4755
  6.    ClientLeft      =   105
  7.    ClientTop       =   1860
  8.    ClientWidth     =   9420
  9.    Height          =   5445
  10.    Left            =   45
  11.    LinkMode        =   1  'Source
  12.    LinkTopic       =   "Form1"
  13.    MousePointer    =   11  'Hourglass
  14.    ScaleHeight     =   4755
  15.    ScaleWidth      =   9420
  16.    Top             =   1230
  17.    Width           =   9540
  18.    Begin SSPanel disp_frame 
  19.       Align           =   1  'Align Top
  20.       BackColor       =   &H00808080&
  21.       Font3D          =   1  'Raised w/light shading
  22.       ForeColor       =   &H00000000&
  23.       Height          =   555
  24.       Left            =   0
  25.       Outline         =   -1  'True
  26.       TabIndex        =   0
  27.       Top             =   0
  28.       Width           =   9420
  29.       Begin SSCommand clear_out_bbox 
  30.          AutoSize        =   2  'Adjust Button Size To Picture
  31.          BevelWidth      =   1
  32.          Font3D          =   0  'None
  33.          Height          =   390
  34.          Left            =   1860
  35.          Picture         =   MAP.FRX:0000
  36.          TabIndex        =   15
  37.          Top             =   90
  38.          Width           =   420
  39.       End
  40.       Begin SSCommand clear_in_bbox 
  41.          AutoSize        =   2  'Adjust Button Size To Picture
  42.          BevelWidth      =   1
  43.          Font3D          =   0  'None
  44.          Height          =   390
  45.          Left            =   1470
  46.          Picture         =   MAP.FRX:0182
  47.          TabIndex        =   14
  48.          Top             =   90
  49.          Width           =   420
  50.       End
  51.       Begin SSCommand copy_in2out_bbox 
  52.          AutoSize        =   2  'Adjust Button Size To Picture
  53.          BevelWidth      =   1
  54.          Font3D          =   0  'None
  55.          Height          =   390
  56.          Left            =   1080
  57.          Picture         =   MAP.FRX:0304
  58.          TabIndex        =   13
  59.          Top             =   90
  60.          Width           =   420
  61.       End
  62.       Begin SSCommand recenter_bbox 
  63.          AutoSize        =   2  'Adjust Button Size To Picture
  64.          BevelWidth      =   1
  65.          Font3D          =   0  'None
  66.          Height          =   390
  67.          Left            =   600
  68.          Picture         =   MAP.FRX:0486
  69.          TabIndex        =   12
  70.          Top             =   90
  71.          Width           =   420
  72.       End
  73.       Begin SSCommand load_save_bbox 
  74.          AutoSize        =   2  'Adjust Button Size To Picture
  75.          BevelWidth      =   1
  76.          Font3D          =   0  'None
  77.          Height          =   390
  78.          Left            =   120
  79.          Picture         =   MAP.FRX:0608
  80.          TabIndex        =   11
  81.          Top             =   90
  82.          Width           =   420
  83.       End
  84.       Begin SSPanel Panel3D6 
  85.          BackColor       =   &H00C0C0C0&
  86.          BorderWidth     =   1
  87.          Font3D          =   1  'Raised w/light shading
  88.          ForeColor       =   &H00000000&
  89.          Height          =   375
  90.          Left            =   6240
  91.          Outline         =   -1  'True
  92.          TabIndex        =   10
  93.          Top             =   90
  94.          Width           =   555
  95.          Begin SpinButton spin_lon10 
  96.             BorderThickness =   0
  97.             Height          =   315
  98.             Left            =   30
  99.             Top             =   30
  100.             Width           =   255
  101.          End
  102.          Begin SpinButton spin_lon 
  103.             BorderThickness =   0
  104.             Height          =   315
  105.             Left            =   270
  106.             Top             =   30
  107.             Width           =   255
  108.          End
  109.       End
  110.       Begin SSPanel Panel3D5 
  111.          BackColor       =   &H00C0C0C0&
  112.          BorderWidth     =   1
  113.          Font3D          =   1  'Raised w/light shading
  114.          ForeColor       =   &H00000000&
  115.          Height          =   375
  116.          Left            =   4020
  117.          Outline         =   -1  'True
  118.          TabIndex        =   9
  119.          Top             =   90
  120.          Width           =   555
  121.          Begin SpinButton spin_lat10 
  122.             BorderThickness =   0
  123.             Height          =   315
  124.             Left            =   30
  125.             Top             =   30
  126.             Width           =   255
  127.          End
  128.          Begin SpinButton spin_lat 
  129.             BorderThickness =   0
  130.             Height          =   315
  131.             Left            =   270
  132.             Top             =   30
  133.             Width           =   255
  134.          End
  135.       End
  136.       Begin SSPanel Panel3D1 
  137.          BackColor       =   &H00C0C0C0&
  138.          BorderWidth     =   1
  139.          Font3D          =   1  'Raised w/light shading
  140.          ForeColor       =   &H00000000&
  141.          Height          =   375
  142.          Left            =   8070
  143.          Outline         =   -1  'True
  144.          TabIndex        =   8
  145.          Top             =   90
  146.          Width           =   285
  147.          Begin SpinButton spin_zoom 
  148.             BorderThickness =   0
  149.             ForeColor       =   &H00000000&
  150.             Height          =   300
  151.             Left            =   30
  152.             Top             =   30
  153.             Width           =   225
  154.          End
  155.       End
  156.       Begin CommandButton redraw 
  157.          Caption         =   "ReDraw"
  158.          Height          =   375
  159.          Left            =   8460
  160.          TabIndex        =   3
  161.          Top             =   90
  162.          Width           =   855
  163.       End
  164.       Begin SSPanel disp_lon 
  165.          BackColor       =   &H00FFFFFF&
  166.          BevelOuter      =   1  'Inset
  167.          Font3D          =   1  'Raised w/light shading
  168.          ForeColor       =   &H00000000&
  169.          Height          =   255
  170.          Left            =   5700
  171.          Outline         =   -1  'True
  172.          RoundedCorners  =   0   'False
  173.          TabIndex        =   7
  174.          Top             =   150
  175.          Width           =   555
  176.       End
  177.       Begin SSPanel Panel3D4 
  178.          BackColor       =   &H00C0C0C0&
  179.          BevelOuter      =   1  'Inset
  180.          Caption         =   "Center Lon:"
  181.          Font3D          =   0  'None
  182.          ForeColor       =   &H00000000&
  183.          Height          =   255
  184.          Left            =   4620
  185.          Outline         =   -1  'True
  186.          RoundedCorners  =   0   'False
  187.          TabIndex        =   5
  188.          Top             =   150
  189.          Width           =   1095
  190.       End
  191.       Begin SSPanel disp_lat 
  192.          BackColor       =   &H00FFFFFF&
  193.          BevelOuter      =   1  'Inset
  194.          Font3D          =   1  'Raised w/light shading
  195.          ForeColor       =   &H00000000&
  196.          Height          =   255
  197.          Left            =   3480
  198.          Outline         =   -1  'True
  199.          RoundedCorners  =   0   'False
  200.          TabIndex        =   6
  201.          Top             =   150
  202.          Width           =   555
  203.       End
  204.       Begin SSPanel Panel3D3 
  205.          BackColor       =   &H00C0C0C0&
  206.          BevelOuter      =   1  'Inset
  207.          Caption         =   "Center Lat:"
  208.          Font3D          =   0  'None
  209.          ForeColor       =   &H00000000&
  210.          Height          =   255
  211.          Left            =   2400
  212.          Outline         =   -1  'True
  213.          RoundedCorners  =   0   'False
  214.          TabIndex        =   4
  215.          Top             =   150
  216.          Width           =   1095
  217.       End
  218.       Begin SSPanel disp_zoom 
  219.          BackColor       =   &H00FFFFFF&
  220.          BevelOuter      =   1  'Inset
  221.          Font3D          =   1  'Raised w/light shading
  222.          ForeColor       =   &H00000000&
  223.          Height          =   255
  224.          Left            =   7680
  225.          Outline         =   -1  'True
  226.          RoundedCorners  =   0   'False
  227.          TabIndex        =   2
  228.          Top             =   150
  229.          Width           =   405
  230.       End
  231.       Begin SSPanel Panel3D2 
  232.          BackColor       =   &H00C0C0C0&
  233.          BevelOuter      =   1  'Inset
  234.          BorderWidth     =   1
  235.          Caption         =   "Zoom x:"
  236.          Font3D          =   0  'None
  237.          ForeColor       =   &H00000000&
  238.          Height          =   255
  239.          Left            =   6840
  240.          Outline         =   -1  'True
  241.          RoundedCorners  =   0   'False
  242.          TabIndex        =   1
  243.          Top             =   150
  244.          Width           =   855
  245.       End
  246.    End
  247.    Begin Menu map_menu_file 
  248.       Caption         =   "&File"
  249.       Begin Menu menu_load_save 
  250.          Caption         =   "Load/save location"
  251.       End
  252.       Begin Menu x 
  253.          Caption         =   "-"
  254.       End
  255.       Begin Menu map_menu_exit 
  256.          Caption         =   "E&xit"
  257.       End
  258.    End
  259.    Begin Menu map_menu_edit 
  260.       Caption         =   "&Edit"
  261.       Begin Menu map_menu_center 
  262.          Caption         =   "&Re-center"
  263.       End
  264.       Begin Menu map_menu_copy 
  265.          Caption         =   "&Copy in to out"
  266.       End
  267.       Begin Menu map_menu_clear_in 
  268.          Caption         =   "Clear &Input"
  269.       End
  270.       Begin Menu map_menu_clear_out 
  271.          Caption         =   "Clear &Output"
  272.       End
  273.    End
  274. Dim ref_center_x As Double
  275. Dim ref_center_y As Double
  276. Dim ref_radius As Double
  277. Dim center_lat As Double
  278. Dim center_lon As Double
  279. Dim center_lat_rad As Double
  280. Dim center_lon_rad As Double
  281. Dim sin_center_lat As Double
  282. Dim cos_center_lat As Double
  283. Dim zoom As Double
  284. Dim already_positioned As Integer
  285. Dim map_cancelled As Integer
  286. Sub clear_in_bbox_Click ()
  287.     map_menu_clear_in_click
  288. End Sub
  289. Sub clear_out_bbox_Click ()
  290.     map_menu_clear_out_click
  291. End Sub
  292. Sub copy_in2out_bbox_Click ()
  293.     map_menu_copy_click
  294. End Sub
  295. Sub Form_Load ()
  296.     scalemode = 3 ' use pixels for "C" subroutine calls
  297.     form_cancelled = False
  298.     already_positioned = False
  299.     If question_form.max_displays.Checked Then
  300.       windowstate = MAXIMIZED
  301.     End If
  302.     out_point = 0
  303.     zoom = 1
  304.     disp_zoom.Caption = Str$(zoom)
  305.     disp_zoom.Refresh
  306.     center_lat = 40
  307.     center_lat_rad = center_lat * DEG2RAD
  308.     sin_center_lat = Sin(center_lat_rad)
  309.     cos_center_lat = Cos(center_lat_rad)
  310.     disp_lat.Caption = Str$(center_lat)
  311.     disp_lat.Refresh
  312.     center_lon = -100
  313.     center_lon_rad = center_lon * DEG2RAD
  314.     disp_lon.Caption = Str$(center_lon)
  315.     disp_lon.Refresh
  316. End Sub
  317. Sub Form_MouseDown (button As Integer, Shift As Integer, x As Single, Y As Single)
  318.     If button = 1 Then
  319.       If out_point < MAX_POINTS Then
  320.         plot_line x, Y, out_location(), -1, RGB(255, 0, 0)' use out_point to plot lines
  321.         Exit Sub
  322.       Else
  323.         msg$ = "Maximum of" + Str$(MAX_POINTS) + " points has been reached"
  324.         MsgBox msg$, MB_INFO
  325.         Exit Sub
  326.       End If
  327.     End If
  328.     If out_point = 0 Then
  329.       Exit Sub
  330.     End If
  331.     unplot_line x, Y, out_point, out_location()
  332.     out_point = out_point - 1
  333. End Sub
  334. Sub form_resize ()
  335. Dim inlat As Double
  336. Dim inlon As Double
  337. Dim outx As Double
  338. Dim outy As Double
  339. Dim max_lat As Double
  340. Dim min_lat As Double
  341. Dim max_lon As Double
  342. Dim min_lon As Double
  343. Dim xx As Single
  344. Dim yy As Single
  345. Dim sign As Integer
  346. Dim x As Integer
  347.     If form_cancelled Then
  348.       Exit Sub
  349.     End If
  350.     If coprocessor <> 4 Then
  351.       If 6 <> MsgBox("Drawing the map without a coprocessor takes a VERY long time.  Proceed?", MB_WARN Or 4) Then
  352.         form_cancelled = True
  353.         map_form.Hide
  354.         Exit Sub
  355.       End If
  356.     End If
  357.     mousepointer = HOURGLASS
  358.     Cls
  359.     'disp_frame.Width = scalewidth
  360.     'disp_frame.Refresh
  361.     ref_center_x = scalewidth / 2
  362.     ref_center_y = scaleheight / 2 + 20
  363.     If ref_center_x < ref_center_y Then
  364.       ref_radius = (scalewidth - 100) / 2
  365.     Else
  366.       ref_radius = (scaleheight - 60) / 2
  367.     End If
  368.     ref_radius = ref_radius * zoom
  369.     If in_point > 0 Then
  370.       If Not already_positioned Then
  371.       
  372.         max_lat = in_location(0, 0)
  373.         min_lat = max_lat
  374.         max_lon = in_location(0, 1)
  375.         min_lon = max_lon
  376.         For x = 1 To in_point - 1
  377.           If in_location(x, 0) > max_lat Then
  378.             max_lat = in_location(x, 0)
  379.           End If
  380.           If in_location(x, 0) < min_lat Then
  381.             min_lat = in_location(x, 0)
  382.           End If
  383.           If in_location(x, 1) > max_lon Then
  384.             max_lon = in_location(x, 1)
  385.           End If
  386.           If in_location(x, 1) < min_lon Then
  387.             min_lon = in_location(x, 1)
  388.           End If
  389.         Next x
  390.       
  391.         center_lat = Int(min_lat + (max_lat - min_lat) / 2)
  392.         center_lat_rad = center_lat * DEG2RAD
  393.         sin_center_lat = Sin(center_lat_rad)
  394.         cos_center_lat = Cos(center_lat_rad)
  395.         disp_lat.Caption = Str$(center_lat)
  396.         disp_lat.Refresh
  397.         
  398.         center_lon = Int(min_lon + (max_lon - min_lon) / 2)
  399.         center_lon_rad = center_lon * DEG2RAD
  400.         disp_lon.Caption = Str$(center_lon)
  401.         disp_lon.Refresh
  402.       
  403.         already_positioned = True
  404.       End If
  405.     End If
  406.     z = draw_map(hDC, True, True, ref_center_x, ref_center_y, ref_radius, center_lon_rad, sin_center_lat, cos_center_lat)
  407.     If in_point > 0 Then
  408.       For x = 0 To in_point - 1
  409.         xxx = ortho(in_location(x, 0) * DEG2RAD, in_location(x, 1) * DEG2RAD, outx, outy)
  410.         xx = outx + ref_center_x
  411.         yy = ref_center_y - outy
  412.         plot_line xx, yy, in_location(), x, RGB(0, 0, 255)
  413.       Next x
  414.     End If
  415.     If out_point > 0 Then
  416.       For x = 0 To out_point - 1
  417.         xxx = ortho(out_location(x, 0) * DEG2RAD, out_location(x, 1) * DEG2RAD, outx, outy)
  418.         xx = outx + ref_center_x
  419.         yy = ref_center_y - outy
  420.         plot_line xx, yy, out_location(), x, RGB(255, 0, 0)
  421.       Next x
  422.     End If
  423.     mousepointer = DEFAULT
  424. End Sub
  425. Sub Form_Unload (Cancel As Integer)
  426.     If out_point > 0 Then
  427.       If 6 = MsgBox("Include coordinates in search?", MB_INFO Or 4) Then
  428.          For C = 0 To out_point - 1
  429.           lat$ = Format$(out_location(C, 0), "00.###")
  430.           lon$ = Format$(out_location(C, 1), "00.###")
  431.           ll$ = ll$ + lat$ + "," + lon$ + " "
  432.         Next C
  433.         question_form.keywords.Text = question_form.keywords.Text + " INSIDE(" + RTrim$(ll$) + ")"
  434.       End If
  435.     End If
  436.     form_cancelled = True
  437. End Sub
  438. Sub load_save_bbox_Click ()
  439.     menu_load_save_click
  440. End Sub
  441. Sub map_menu_center_click ()
  442. Dim x As Integer
  443.     If out_point = 0 Then
  444.       Exit Sub
  445.     End If
  446.     max_lat = out_location(0, 0)
  447.     min_lat = max_lat
  448.     max_lon = out_location(0, 1)
  449.     min_lon = max_lon
  450.     For x = 1 To out_point - 1
  451.       If out_location(x, 0) > max_lat Then
  452.         max_lat = out_location(x, 0)
  453.       End If
  454.       If out_location(x, 0) < min_lat Then
  455.         min_lat = out_location(x, 0)
  456.       End If
  457.       If out_location(x, 1) > max_lon Then
  458.         max_lon = out_location(x, 1)
  459.       End If
  460.       If out_location(x, 1) < min_lon Then
  461.         min_lon = out_location(x, 1)
  462.       End If
  463.     Next x
  464.       
  465.     center_lat = Int(min_lat + (max_lat - min_lat) / 2)
  466.     center_lat_rad = center_lat * DEG2RAD
  467.     sin_center_lat = Sin(center_lat_rad)
  468.     cos_center_lat = Cos(center_lat_rad)
  469.     center_lon = Int(min_lon + (max_lon - min_lon) / 2)
  470.     center_lon_rad = center_lon * DEG2RAD
  471.     disp_lat.Caption = Str$(center_lat)
  472.     disp_lat.Refresh
  473.     disp_lon.Caption = Str$(center_lon)
  474.     disp_lon.Refresh
  475.       
  476.     form_resize
  477. End Sub
  478. Sub map_menu_clear_in_click ()
  479. Dim outx As Double
  480. Dim outy As Double
  481. Dim xx As Single
  482. Dim yy As Single
  483. Dim x As Integer
  484.     If in_point > 0 Then
  485.       
  486.       For x = in_point To 1 Step -1
  487.         xxx = ortho(in_location(x, 0) * DEG2RAD, in_location(x, 1) * DEG2RAD, outx, outy)
  488.         xx = outx + ref_center_x
  489.         yy = ref_center_y - outy
  490.         unplot_line xx, yy, x, in_location()
  491.       Next x
  492.       
  493.       in_point = 0
  494.     End If
  495. End Sub
  496. Sub map_menu_clear_out_click ()
  497. Dim outx As Double
  498. Dim outy As Double
  499. Dim xx As Single
  500. Dim yy As Single
  501. Dim x As Integer
  502.     If out_point > 0 Then
  503.       
  504.       For x = out_point To 1 Step -1
  505.         xxx = ortho(out_location(x, 0) * DEG2RAD, out_location(x, 1) * DEG2RAD, outx, outy)
  506.         xx = outx + ref_center_x
  507.         yy = ref_center_y - outy
  508.         unplot_line xx, yy, x, out_location()
  509.       Next x
  510.     out_point = 0
  511.     End If
  512. End Sub
  513. Sub map_menu_copy_click ()
  514. Dim outx As Double
  515. Dim outy As Double
  516. Dim xx As Single
  517. Dim yy As Single
  518. Dim x As Integer
  519.     If in_point > 0 Then
  520.       
  521.       For x = 0 To in_point - 1
  522.         out_location(x, 0) = in_location(x, 0)
  523.         out_location(x, 1) = in_location(x, 1)
  524.       Next x
  525.       
  526.       out_point = in_point
  527.       
  528.       For x = 0 To out_point - 1
  529.         xxx = ortho(out_location(x, 0) * DEG2RAD, out_location(x, 1) * DEG2RAD, outx, outy)
  530.         xx = outx + ref_center_x
  531.         yy = ref_center_y - outy
  532.         plot_line xx, yy, out_location(), x, RGB(255, 0, 0)
  533.       Next x
  534.     End If
  535. End Sub
  536. Sub map_menu_exit_click ()
  537.     map_form.Hide
  538. End Sub
  539. Sub menu_load_save_click ()
  540.     maploc_form.Show 1
  541.     Unload maploc_form
  542.     form_resize
  543. End Sub
  544. Function ortho (inlat As Double, inlon As Double, outx As Double, outy As Double) As Integer
  545. Dim delta As Double
  546. Dim cosL As Double
  547. Dim cosC As Double
  548. Dim sin_inlat As Double
  549. Dim cos_inlat As Double
  550.     delta = inlon - center_lon_rad
  551.     If delta < -PI Then
  552.       delta = delta + TWOPI
  553.     ElseIf delta > PI Then
  554.       delta = delta - TWOPI
  555.     End If
  556.     sin_inlat = Sin(inlat)
  557.     cos_inlat = Cos(inlat)
  558.     cosL = Cos(delta) * cos_inlat
  559.     cosC = sin_center_lat * sin_inlat + cos_center_lat * cosL
  560.     If cosC >= 0 Then
  561.       outx = cos_inlat * Sin(delta) * ref_radius
  562.       outy = (cos_center_lat * sin_inlat - sin_center_lat * cosL) * ref_radius
  563.       ortho = 0
  564.     Else
  565.       ortho = -1
  566.     End If
  567. End Function
  568. Sub plot_line (x As Single, Y As Single, latlon() As Double, pnt As Integer, color As Long)
  569. Dim x_to_center As Double
  570. Dim y_to_center As Double
  571. Dim rad As Double
  572. Dim dR As Double
  573. Dim A As Double
  574. Dim B As Double
  575. Dim C As Double
  576. Dim sinC As Double
  577. Dim cosC As Double
  578. Dim sin_out_lat As Double
  579. Dim out_lat As Double
  580. Dim out_lon As Double
  581. Dim mid_lat As Double
  582. Dim mid_lon As Double
  583. Dim outx As Double
  584. Dim outy As Double
  585. Dim xx As Double
  586. Dim yy As Double
  587. Dim oldx As Double
  588. Dim oldy As Double
  589. Dim pt As Integer
  590. Dim line_break As Integer
  591.     x_to_center = x - ref_center_x
  592.     y_to_center = ref_center_y - Y
  593.     rad = Sqr(x_to_center ^ 2 + y_to_center ^ 2)
  594.     If rad > ref_radius Then
  595.       Exit Sub
  596.     End If
  597.     If rad = 0 Then
  598.       
  599.       out_lat = center_lat
  600.       out_lon = center_lon
  601.     Else
  602.       
  603.       dR = rad / ref_radius
  604.       
  605.       C = Atn(dR / Sqr(-dR * dR + 1)) ' c = arcsin(dR)
  606.       
  607.       sinC = Sin(C)
  608.       cosC = Cos(C)
  609.       sin_out_lat = cosC * sin_center_lat + (y_to_center * sinC * cos_center_lat / rad)
  610.       out_lat = Atn(sin_out_lat / Sqr(-sin_out_lat * sin_out_lat + 1)) * RAD2DEG
  611.       
  612.       Select Case center_lat
  613.         Case 90
  614.           A = x_to_center
  615.           B = -y_to_center
  616.         Case -90
  617.           A = x_to_center
  618.           B = y_to_center
  619.         Case Else
  620.           A = x_to_center * sinC
  621.           B = rad * cos_center_lat * cosC - y_to_center * sin_center_lat * sinC
  622.       End Select
  623.       Select Case Sgn(B)
  624.         Case -1
  625.           out_lon = center_lon + Atn(A / B) * RAD2DEG + 180 * Sgn(A)
  626.         Case 0
  627.           out_lon = 90 * Sgn(A)
  628.         Case 1
  629.           out_lon = center_lon + Atn(A / B) * RAD2DEG
  630.       End Select
  631.       While out_lon > 180
  632.         out_lon = out_lon - 360
  633.       Wend
  634.       
  635.       While out_lon < -180
  636.         out_lon = out_lon + 360
  637.       Wend
  638.     End If
  639.     stat = ortho(out_lat * DEG2RAD, out_lon * DEG2RAD, outx, outy)
  640.     xx = outx + ref_center_x
  641.     yy = ref_center_y - outy
  642.     If pnt < 0 Then
  643.       pt = out_point
  644.       latlon(pt, 0) = out_lat
  645.       latlon(pt, 1) = out_lon
  646.     Else
  647.       pt = pnt
  648.     End If
  649.     If stat <> -1 Then
  650.       Line (xx - 1, yy - 1)-(xx + 1, yy + 1), color, B
  651.     End If
  652.     If pt > 0 Then
  653.       
  654.       mid_lat = (latlon(pt - 1, 0) - out_lat) / LINE_DENSITY
  655.       mid_lon = (latlon(pt - 1, 1) - out_lon) / LINE_DENSITY
  656.       
  657.       oldx = xx
  658.       oldy = yy
  659.       
  660.       line_break = False
  661.       
  662.       For inc = 1 To LINE_DENSITY
  663.         
  664.         If -1 <> ortho((out_lat + mid_lat) * DEG2RAD, (out_lon + mid_lon) * DEG2RAD, outx, outy) Then
  665.           xx = oldx
  666.           yy = oldy
  667.           oldx = outx + ref_center_x
  668.           oldy = ref_center_y - outy
  669.           If line_break = False Then
  670.             Line (oldx, oldy)-(xx, yy), color
  671.           End If
  672.           line_break = False
  673.         Else
  674.           line_break = True
  675.         End If
  676.         
  677.         out_lat = out_lat + mid_lat
  678.         out_lon = out_lon + mid_lon
  679.       
  680.       Next inc
  681.     End If
  682.     If pnt < 0 Then
  683.       out_point = out_point + 1
  684.     End If
  685. End Sub
  686. Sub recenter_bbox_Click ()
  687.     map_menu_center_click
  688. End Sub
  689. Sub redraw_Click ()
  690. Static reentry As Integer
  691.     If reentry Then
  692.       map_cancelled = True
  693.       Exit Sub
  694.     End If
  695.     reentry = True
  696.     form_resize
  697.     reentry = False
  698. End Sub
  699. Sub spin_lat_SpinDown ()
  700.     If center_lat > -90 Then
  701.       center_lat = Int(center_lat) - 1
  702.       center_lat_rad = center_lat * DEG2RAD
  703.       sin_center_lat = Sin(center_lat_rad)
  704.       cos_center_lat = Cos(center_lat_rad)
  705.       disp_lat.Caption = Str$(center_lat)
  706.       disp_lat.Refresh
  707.     End If
  708. End Sub
  709. Sub spin_lat_SpinUp ()
  710.     If center_lat < 90 Then
  711.       center_lat = Int(center_lat) + 1
  712.       center_lat_rad = center_lat * DEG2RAD
  713.       sin_center_lat = Sin(center_lat_rad)
  714.       cos_center_lat = Cos(center_lat_rad)
  715.       disp_lat.Caption = Str$(center_lat)
  716.       disp_lat.Refresh
  717.     End If
  718. End Sub
  719. Sub spin_lat10_SpinDown ()
  720.     If center_lat > -86 Then
  721.       
  722.       center_lat = Int(center_lat) - 5
  723.       center_lat_rad = center_lat * DEG2RAD
  724.       sin_center_lat = Sin(center_lat_rad)
  725.       cos_center_lat = Cos(center_lat_rad)
  726.       disp_lat.Caption = Str$(center_lat)
  727.       disp_lat.Refresh
  728.     End If
  729. End Sub
  730. Sub spin_lat10_SpinUp ()
  731.     If center_lat < 86 Then
  732.       
  733.       center_lat = Int(center_lat) + 5
  734.       center_lat_rad = center_lat * DEG2RAD
  735.       sin_center_lat = Sin(center_lat_rad)
  736.       cos_center_lat = Cos(center_lat_rad)
  737.       disp_lat.Caption = Str$(center_lat)
  738.       disp_lat.Refresh
  739.     End If
  740. End Sub
  741. Sub spin_lon_SpinDown ()
  742.     If center_lon > -180 Then
  743.       center_lon = Int(center_lon) - 1
  744.       center_lon_rad = center_lon * DEG2RAD
  745.       disp_lon.Caption = Str$(center_lon)
  746.       disp_lon.Refresh
  747.     End If
  748. End Sub
  749. Sub spin_lon_SpinUp ()
  750.     If center_lon < 180 Then
  751.       
  752.       center_lon = Int(center_lon) + 1
  753.       center_lon_rad = center_lon * DEG2RAD
  754.       disp_lon.Caption = Str$(center_lon)
  755.       disp_lon.Refresh
  756.     End If
  757. End Sub
  758. Sub spin_lon10_SpinDown ()
  759.     If center_lon > -171 Then
  760.       center_lon = Int(center_lon) - 10
  761.       center_lon_rad = center_lon * DEG2RAD
  762.       disp_lon.Caption = Str$(center_lon)
  763.       disp_lon.Refresh
  764.     End If
  765. End Sub
  766. Sub spin_lon10_SpinUp ()
  767.     If center_lon < 171 Then
  768.       
  769.       center_lon = Int(center_lon) + 10
  770.       center_lon_rad = center_lon * DEG2RAD
  771.       disp_lon.Caption = Str$(center_lon)
  772.       disp_lon.Refresh
  773.     End If
  774. End Sub
  775. Sub spin_zoom_SpinDown ()
  776.     If zoom > 1 Then
  777.       zoom = zoom - 1
  778.       disp_zoom.Caption = Str$(zoom)
  779.       disp_zoom.Refresh
  780.     End If
  781. End Sub
  782. Sub spin_zoom_SpinUp ()
  783.     'If zoom < 25 Then
  784.       zoom = zoom + 1
  785.       disp_zoom.Caption = Str$(zoom)
  786.       disp_zoom.Refresh
  787.     'End If
  788. End Sub
  789. Sub unplot_line (x As Single, Y As Single, pt As Integer, latlon() As Double)
  790. Dim xx As Double
  791. Dim yy As Double
  792. Dim outx As Double
  793. Dim outy As Double
  794. Dim out_lat As Double
  795. Dim out_lon As Double
  796. Dim mid_lat As Double
  797. Dim mid_lon As Double
  798. Dim inc As Integer
  799. Dim line_break As Integer
  800.     If Sqr((x - ref_center_x) ^ 2 + (ref_center_y - Y) ^ 2) > ref_radius Then
  801.       Exit Sub
  802.     End If
  803.     stat = ortho(latlon(pt - 1, 0) * DEG2RAD, latlon(pt - 1, 1) * DEG2RAD, outx, outy)
  804.     xx = outx + ref_center_x
  805.     yy = ref_center_y - outy
  806.     If stat <> -1 Then
  807.       Line (xx - 1, yy - 1)-(xx + 1, yy + 1), RGB(255, 255, 255), B
  808.     End If
  809.     If pt > 1 Then
  810.       
  811.       out_lat = latlon(pt - 1, 0)
  812.       out_lon = latlon(pt - 1, 1)
  813.       
  814.       mid_lat = (latlon(pt - 2, 0) - out_lat) / LINE_DENSITY
  815.       mid_lon = (latlon(pt - 2, 1) - out_lon) / LINE_DENSITY
  816.       
  817.       oldx = xx
  818.       oldy = yy
  819.       
  820.       line_break = False
  821.       
  822.       For inc = 1 To LINE_DENSITY
  823.         
  824.         If -1 <> ortho((out_lat + mid_lat) * DEG2RAD, (out_lon + mid_lon) * DEG2RAD, outx, outy) Then
  825.           xx = oldx
  826.           yy = oldy
  827.           oldx = outx + ref_center_x
  828.           oldy = ref_center_y - outy
  829.           If line_break = False Then
  830.             Line (oldx, oldy)-(xx, yy), RGB(255, 255, 255)
  831.           End If
  832.           line_break = False
  833.         Else
  834.           line_break = True
  835.         End If
  836.         
  837.         out_lat = out_lat + mid_lat
  838.         out_lon = out_lon + mid_lon
  839.       
  840.       Next inc
  841.     End If
  842. End Sub
  843.