home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1993 #2 / Image.iso / ham / aprs114.zip / MAPCNVRT.BAS < prev    next >
BASIC Source File  |  1993-07-09  |  3KB  |  72 lines

  1. REM this program takes a map file and then can output another map file
  2. REM to a different ppdV and ppdH and different origin.
  3. REM then the beginning stuff and all labels at the end must be cut
  4. REM and pasted back into the new file
  5.  
  6. OPTION BASE 0
  7. CLS : PRINT "This program will convert any APRS map from one ORIGIN and SCALE"
  8.       PRINT "to another.  The output of this program will be in MAPTEMP.map"
  9.       PRINT
  10. Prompt: INPUT "Enter File name of source map"; F$
  11.         OPEN F$ FOR INPUT AS #3
  12.         INPUT "Enter desired SCALE in pixels-per-deg"; PPDD
  13.         INPUT "Enter New Latitude of origin"; NLat
  14.         INPUT "Enter New Longitude of origin"; NLon
  15. LoadAux: 'Load into another dim of array until full (AyPtr starts at 0)
  16.      OPEN "maptemp.map" FOR OUTPUT AS #4
  17.      INPUT #3, LATa: LINE INPUT #3, a$: IF NLat = 0 THEN NLat = LATa
  18.      PRINT #4, NLat; ","; a$
  19.      INPUT #3, LONa: LINE INPUT #3, a$: IF NLon = 0 THEN NLon = LONa
  20.      PRINT #4, NLon; ","; a$
  21.      INPUT #3, ppdV: LINE INPUT #3, a$'Pix-per-deg-Vert
  22.      PRINT #4, PPDD; ","; a$
  23.      INPUT #3, LatCen: LINE INPUT #3, a$
  24.      PRINT #4, LatCen; ","; a$
  25.      INPUT #3, LonCen: LINE INPUT #3, a$
  26.      PRINT #4, LonCen; ","; a$
  27.      INPUT #3, MapRng: LINE INPUT #3, a$
  28.      PRINT #4, MapRng; ","; a$
  29.      INPUT #3, MinRnga: LINE INPUT #3, a$
  30.      PRINT #4, MinRnga; ","; a$
  31.      LINE INPUT #3, a$: REM ignore line of instructions
  32.      PRINT #4, a$
  33.      i = 0
  34.      REM now make offset and scale calculations
  35.      Sfac = PPDD / ppdV
  36.      LOfset = LONa - NLon
  37.      LAfset = LATa - NLat
  38. ON ERROR GOTO Errorfix
  39.  
  40.      PRINT : PRINT "Now processing map points.  Should an end of file error occur"
  41.      PRINT "use F6, then CLOSE, to close the file.  Then use your editor to see"
  42.      PRINT "what you have so far and fix any errors..."
  43.  
  44.      DO WHILE NOT EOF(3)
  45.         i = i + 1: INPUT #3, x%, y%
  46.         IF x% <> 0 THEN
  47.            x% = Sfac * (x% - ppdV * LOfset)
  48.            y% = Sfac * (y% - ppdV * LAfset)
  49.            IF x% = 0 THEN x% = 1: PRINT "ZERO value of X!  Converted to 1,"; y%
  50.            END IF
  51.         REM print #4, MID$(STR$(x%), 2); ","; MID$(STR$(y%), 2)
  52.         WRITE #4, x%, y%
  53.         IF x% = 0 AND NOT EOF(3) THEN ' Get line color & store with x=0
  54.            INPUT #3, z%: LINE INPUT #3, a$ ' Echo line name
  55.            PRINT #4, z%; ","; a$
  56.            IF y% = -1 THEN EXIT DO' All labels listed at end of file
  57.            END IF
  58.         LOOP: PRINT
  59.         PRINT "All map points converted.  Now doing labels..."
  60.         DO WHILE NOT EOF(3)
  61.         LINE INPUT #3, a$: PRINT #4, a$
  62.         LOOP: CLOSE #3: CLOSE #4
  63.        
  64.         PRINT : PRINT "CONVERSION SUCCESSFUL. USE EDITOR TO ADD ANY NEW FEATURES"
  65.         PRINT "TO YOUR NEW MAP IN FILE NAMED MAPTEMP.map."
  66.         STOP
  67.  
  68. Errorfix: IF ERR = 62 THEN CLOSE : RESUME NEXT
  69.  
  70. END
  71.  
  72.