Tải bản đầy đủ
APPENDIX F.1: SCREEN GRAPHICS MENU COMPUTER PROGRAM “PC-MENU”

APPENDIX F.1: SCREEN GRAPHICS MENU COMPUTER PROGRAM “PC-MENU”

Tải bản đầy đủ

APPENDICES

(f) 3D Charts/profiles menu

181

Line numbers 4000–4380

This menu allows the user to select any of the presentation graphics formats described in Chapter 5 and listed in
Appendix E.
This program also requires the following routines.
(g) Appendix A.2
(h) Appendix A.15

Line numbers 8000–8180
Line numbers 9000–9050

“PG-MENU”—BASIC program
10 REM Presentation Graphics MENU
14 REM (C) Copyright P.H.Milne 1991
16 REM ALL RIGHTS RESERVED
20 REM VERSION PC-1.00, 28–04–91 : Appendix Nos.
30 CLEAR
50 PCF$ = "PGSCRDSK.PGD"
60 GOSUB 8000: REM Check Screen & Disc
90 WINDOW (0, 0) - (639, 199)
100 CLS
110 IF SR% = 2 AND SCR% = 2 THEN RGB% = 12 ELSE RGB% = 3
120 LINE (10, 20) − (620, 185), RGB%, B
130 LINE (6, 18) − (624, 187), RGB%, B
140 LINE (10, 150) − (620, 150), RGB%
150 LINE (14, 152) − (616, 183), 3, BF
160 GOSUB 9000
170 FOR I = 1 TO 5
180 LINE (65, 141 − I * 16) - (100, 154 − I * 16), 12, BF
190 LINE (305, 141 − I * 16) - (340, 154 − I * 16), 12, BF
200 NEXT I
210 LOCATE 9, 10: PRINT "F1":
215 LOCATE 9, 15: PRINT "Enter DATA (Keyboard)"
220 LOCATE 9, 40: PRINT "F2":
225 LOCATE 9, 45: PRINT "Load DATA (from Disc)"
230 LOCATE 11, 10: PRINT "F3":
235 LOCATE 11, 15: PRINT "View Line/Area Graph"
240 LOCATE 11, 40: PRINT "F4":
245 LOCATE 11, 45: PRINT "View Bar Chart"
250 LOCATE 13, 10: PRINT "F5":
255 LOCATE 13, 15: PRINT "View Pie/Contours"
260 LOCATE 13, 40: PRINT "F6":
265 LOCATE 13, 45: PRINT "View 3D Charts"
270 LOCATE 15, 10: PRINT "F7":
275 LOCATE 15, 15: PRINT "View 3D Profiles"
280 LOCATE 15, 40: PRINT "F8":
285 LOCATE 15, 45: PRINT "Plot Graph/Chart"
290 LOCATE 17, 10: PRINT "F9":
295 LOCATE 17, 15: PRINT "Change PG Setup"

182

MENU PROGRAMS

300 LOCATE 18, 15: PRINT "Drive - "; DDSK$
310 LOCATE 17, 40: PRINT "F10":
315 LOCATE 17, 45: PRINT "Return to MS-DOS"
320 LOCATE 20, 25: PRINT "Select Key Code - F10 to Quit";
330 LOCATE 22, 25: PRINT "(C) Copyright P.H.Milne 1991"
340 A$ = INKEY$
350 IF LEN(A$) = 2 THEN 360 ELSE 340
360 F = ASC(LEFT$(A$, 1)): S = ASC(RIGHT$(A$, 1))
370 IF S < 59 THEN 340
380 IF S > 68 THEN 340
400 ON S − 58 GOTO 410, 420, 430, 440, 450, 460, 470, 480, 490, 500
410 GOTO 1000
420 GOTO 1000
430 GOTO 2000
440 RUN MDSK$ + "GRAPH-C1"
450 GOTO 3000
460 GOTO 4000
470 GOTO 4000
480 RUN MDSK$ + "PLT-MENU"
490 RUN MDSK$ + "PGINSTAL"
500 LOCATE 24, 26: PRINT "End Graphics Session (Y/N) ?";
510 A$ = INKEY$
520 IF A$ = "" THEN 510
530 IF INSTR("YNyn", A$) = 0 THEN 510
540 IF A$ = "Y" OR A$ = "y" THEN 570
550 LOCATE 24, 25: PRINT " ";
560 GOTO 330
570 SYSTEM
1000 CLS
1010 IF SR% = 2 AND SCR% = 2 THEN RGB% = 12 ELSE RGB% = 3
1020 LINE (10, 20) – (620, 185), RGB%, B
1030 LINE (6, 18) – (624, 187), RGB%, B
1040 LINE (10, 150) – (620, 150), RGB%
1050 LINE (14, 152) – (616, 183), 3, BF
1060 GOSUB 9000
1070 FOR I = 1 TO 3
1080 LINE (65, 141 − I * 16) – (100, 154 − I * 16), 14, BF
1090 LINE (305, 141 − I * 16) – (340, 154 − I * 16), 14, BF
1100 NEXT I
1110 LOCATE 9, 10: PRINT "F1":
1115 LOCATE 9, 15: PRINT "Enter DATA (Keyboard)"
1120 LOCATE 9, 40: PRINT "F2":
1125 LOCATE 9, 45: PRINT "Load DATA (from Disc)"
1130 LOCATE 11, 10: PRINT "F3":
1135 LOCATE 11, 15: PRINT "Generate Surface DATA"
1140 LOCATE 11, 40: PRINT "F4":
1145 LOCATE 11, 45: PRINT " "
1190 LOCATE 13, 10: PRINT "F5":
1195 LOCATE 13, 15: PRINT "Change PG Setup"

APPENDICES

1200
1210
1215
1220
1230
1240
1250
1260
1270
1280
1300
1310
1320
1330
1340
1350
2000
2010
2020
2030
2040
2050
2060
2070
2080
2090
2100
2110
2115
2120
2125
2130
2135
2140
2145
2150
2155
2160
2165
2170
2175
2180
2185
2190
2195
2200
2210
2215
2220

LOCATE 14, 15: PRINT "Drive - "; DDSK$
LOCATE 13, 40: PRINT "F6":
LOCATE 13, 45: PRINT "Return to MENU"
LOCATE 20, 25: PRINT "Select Key Code - F6 to Return";
LOCATE 22, 25: PRINT "(C) Copyright P.H.Milne 1991"
A$ = INKEY$
IF LEN(A$) = 2 THEN 1260 ELSE 1240
F = ASC(LEFT$(A$, 1)): S
IF S < 59 THEN 1240
IF S > 64 THEN 1240
ON S − 58 GOTO 1310, 1320, 1330
RUN MDSK$ + "KEYBDATA"
RUN MDSK$ + "DISCDATA"
RUN MDSK$ + "KEYBEQUD"
RUN MDSK$ + "PGINSTAL"
GOTO 100
CLS
IF SR% = 2 AND SCR% = 2 THEN RGB% = 12 ELSE RGB% = 3
LINE (10, 20) – (620, 185), RGB%, B
LINE (6, 18) – (624, 187), RGB%, B
LINE (10, 150) – (620, 150), RGB%
LINE (14, 152) – (616, 183), 3, BF
GOSUB 9000
FOR I = 1 TO 5
LINE (65, 141 − I * 16) - (100, 154 − I * 16), 14, BF
LINE (305, 141 − I * 16) - (340, 154 − I * 16), 14, BF
NEXT I
LOCATE 9, 10: PRINT "F1":
LOCATE 9, 15: PRINT "Line Graph"
LOCATE 9, 40: PRINT "F2":
LOCATE 9, 45: PRINT "Linear Regression"
LOCATE 11, 10: PRINT "F3":
LOCATE 11, 15: PRINT "Exponential Fit"
LOCATE 11, 40: PRINT "F4":
LOCATE 11, 45: PRINT "Power Curve Fit"
LOCATE 13, 10: PRINT "F5":
LOCATE 13, 15: PRINT "Cubic Spline"
LOCATE 13, 40: PRINT "F6":
LOCATE 13, 45: PRINT "Area Chart"
LOCATE 15, 10: PRINT "F7":
LOCATE 15, 15: PRINT "Stacked Area Chart"
LOCATE 15, 40: PRINT "F8":
LOCATE 15, 45: PRINT "100% Stacked Area"
LOCATE 17, 10: PRINT "F9":
LOCATE 17, 15: PRINT "Change PG Setup"
LOCATE 18, 15: PRINT "Drive - "; DDSK$
LOCATE 17, 40: PRINT "F10":
LOCATE 17, 45: PRINT "Return to MENU"
LOCATE 20, 25: PRINT "Select Key Code - F10 to Return"

183

184

MENU PROGRAMS

2230 LOCATE 22, 25: PRINT "(C) Copyright P.H.Milne 1991"
2240 A$ = INKEY$
2250 IF LEN(A$) = 2 THEN 2260 ELSE 2240
2260 F = ASC(LEFT$(A$, 1)): S = ASC(RIGHT$(A$, 1))
2270 IF S < 59 THEN 2240
2280 IF S > 68 THEN 2240
2300 ON S − 58 GOTO 2310, 2320, 2330, 2340, 2350, 2360, 2370, 2380,
2390, 2400
2310 RUN MDSK$ + "GRAPH-B1"
2320 RUN MDSK$ + "GRAPH-B2"
2330 RUN MDSK$ + "GRAPH-B3"
2340 RUN MDSK$ + "GRAPH-B3"
2350 RUN MDSK$ + "GRAPH-B4"
2360 RUN MDSK$ + "GRAPH-B5"
2370 RUN MDSK$ + "GRAPH-B5"
2380 RUN MDSK$ + "GRAPH-B5"
2390 RUN MDSK$ + "PGINSTAL"
2400 GOTO 100
3000 CLS
3010 IF SR% = 2 AND SCR% = 2 THEN RGB% = 12 ELSE RGB% = 3
3020 LINE (10, 20) – (620, 185), RGB%, B
3030 LINE (6, 18) – (624, 187), RGB%, B
3040 LINE (10, 150) – (620, 150), RGB%
3050 LINE (14, 152) – (616, 183), 3, BF
3060 GOSUB 9000
3070 FOR 1 = 1 TO 3
3080 LINE (65, 141 − I * 16) – (100, 154 − I * 16), 14, BF
3090 LINE (305, 141 − I * 16) – (340, 154 − I * 16), 14, BF
3100 NEXT I
3110 LOCATE 9, 10: PRINT "F1":
3115 LOCATE 9, 15: PRINT "Pie Chart"
3120 LOCATE 9, 40: PRINT "F2":
3125 LOCATE 9, 45: PRINT "Dual Pie Chart"
3130 LOCATE 11, 10: PRINT "F3":
3135 LOCATE 11, 15: PRINT "Line Contours"
3140 LOCATE 11, 40: PRINT "F4":
3145 LOCATE 11, 45: PRINT "Shaded Contours"
3170 LOCATE 13, 10: PRINT "F5":
3175 LOCATE 13, 15: PRINT "Change PG Setup"
3180 LOCATE 14, 15: PRINT "Drive - "; DDSK$
3190 LOCATE 13, 40: PRINT "F6":
3195 LOCATE 13, 45: PRINT "Return to MENU"
3220 LOCATE 20, 25: PRINT "Select Key Code - F6 to Return";
3230 LOCATE 22, 25: PRINT "(C) Copyright P.H.Milne 1991"
3240 A$ = INKEY$
3250 IF LEN(A$) = 2 THEN 3260 ELSE 3240
3260 F = ASC(LEFT$(A$, 1)): S = ASC(RIGHT$(A$, 1))
3270 IF S < 59 THEN 3240
3280 IF S > 66 THEN 3240

APPENDICES

3300
3310
3320
3330
3340
3370
3380
4000
4010
4020
4030
4040
4050
4060
4070
4080
4090
4100
4110
4115
4120
4125
4130
4135
4140
4145
4150
4155
4160
4165
4170
4175
4180
4190
4195
4220
4230
4240
4250
4260
4270
4280
4300
4310
4320
4330
4340
4350
4360

ON S − 58 GOTO 3310, 3320, 3330, 3340, 3370, 3380
RUN MDSK$ + "GRAPH-D1"
RUN MDSK$ + "GRAPH-D1"
RUN MDSK$ + "GRAPH-D2"
RUN MDSK$ + "GRAPH-D3"
RUN MDSK$ + "PGINSTAL"
GOTO 100
CLS
IF SR% = 2 AND SCR% = 2 THEN RGB% = 12 ELSE RGB% = 3
LINE (10, 20) – (620, 185), RGB%, B
LINE (6, 18) – (624, 187), RGB%, B
LINE (10, 150) – (620, 150), RGB%
LINE (14, 152) – (616, 183), 3, BF
GOSUB 9000
FOR I = 1 TO 4
LINE (65, 141 − I * 16) – (100, 154 − I * 16), 14, BF
LINE (305, 141 − I * 16) – (340, 154 − I * 16), 14, BF
NEXT I
LOCATE 9, 10: PRINT "F1":
LOCATE 9, 15: PRINT "3D Graph"
LOCATE 9, 40: PRINT "F2":
LOCATE 9, 45: PRINT "3D Area Chart"
LOCATE 11, 10: PRINT "F3":
LOCATE 11, 15: PRINT "Line Profile"
LOCATE 11, 40: PRINT "F4":
LOCATE 11, 45: PRINT "3D Open Mesh"
LOCATE 13, 10: PRINT "F5":
LOCATE 13, 15: PRINT "3D Line Profile"
LOCATE 13, 40: PRINT "F6":
LOCATE 13, 45: PRINT "3D Shaded Mesh"
LOCATE 15, 10: PRINT "F7":
LOCATE 15, 15 PRINT "Change PG Setup"
LOCATE 16, 15: PRINT "Drive -"; DDSK$
LOCATE 15, 40: PRINT "F8":
LOCATE 15, 45: PRINT "Return to MENU"
LOCATE 20, 25: PRINT "Select Key Code - F8 to Return";
LOCATE 22, 25: PRINT "(C) Copyright P.H.Milne 1991"
A$ = INKEY$
IF LEN(A$) = 2 THEN 4260 ELSE 4240
F = ASC(LEFT$(A$, 1)): S = ASC(RIGHT$(A$, 1))
IF S < 59 THEN 4240
IF S > 66 THEN 4240
ON S − 58 GOTO 4310, 4320, 4330, 4340, 4350, 4360, 4370, 4380
RUN MDSK$ + "GRAPH-E1"
RUN MDSK$ + "GRAPH-E1"
RUN MDSK$ + "GRAPH-E2"
RUN MDSK$ + "GRAPH-E4"
RUN MDSK$ + "GRAPH-E3"
RUN MDSK$ + "GRAPH-E5"

185

186

MENU PROGRAMS

4370 RUN MDSK$ + "PGINSTAL"
4380 GOTO 100
APPENDIX F.2:
PLOTTER MENU COMPUTER PROGRAM “PLT-MENU”
This program is discussed in Section 6.1 and is called from the screen graphics menu described in Appendix F.1. The
layout of the program is identical to “PG-MENU”, where the plotter programs to be called require a “GPLOT” prefix
rather than a “GRAPH” prefix. Note that not all the screen graphics programs can be transferred to a plotter, as listed in
Table 6.1.
The following changes are required to Appendix F.1 to create the program “PLT-MENU”:
replace “PG-MENU” with “PLT-MENU” in Line 10
replace “Plot Graph/Chart” with “Return to VIEW Menu” in Line 280
replace “GRAPH-C1” with “GPLOT-C1” in Line 440
replace “PLT-MENU” with “PG-MENU” in Line 480
replace “GRAPH-B1” with “GPLOT-B1” in Line 2310
replace “GRAPH-B2” with “GPLOT-B2” in Line 2320
replace “GRAPH-B3” with “GPLOT-B2” in Line 2330
replace “GRAPH-B3” with “GPLOT-B2” in Line 2340
replace “GRAPH-B4” with “GPLOT-B4” in Line 2350
replace “GRAPH-B5” with “GPLOT-B5” in Line 2360
replace “GRAPH-B5” with “GPLOT-B5” in Line 2370
replace “GRAPH-B5” with “GPLOT-B5” in Line 2380
replace “GRAPH-D1” with “GPLOT-D1” in Line 3310
replace “GRAPH-D1” with “GPLOT-D1” in Line 3320
replace “GRAPH-D2” with “GPLOT-D2” in Line 3330
replace “GRAPH-E4” with “GPLOT-E4” in Line 4340
replace “GRAPH-E3” with “GPLOT-E3” in Line 4350
replace “PG-MENU” with “PLOT-MENU” in Line 9000.

References

Batty, M. (1987) Microcomputer Graphics, Chapman and Hall, London.
Boyle, C. (1986) Mastering Statistics with your microcomputer, Macmillan, Basingstoke.
British Standards Institution (1977) Recommendation for the presentation of tables, graphs and charts, (DD 52:1977), London.
Ford, N. (1984) Business Graphics for the IBM PC, SYBEX Inc., Berkeley.
Hannagan, T.J. (1986) Work Out Statistics ‘O’ Level and GCSE, Macmillan Master Series, London.
Harris, D. (1984) Computer Graphics and Applications, Chapman and Hall, London.
Institute of Hydrology (1985) Hydrological Data UK, 1982 Yearbook, Wallingford.
Laflin, S. (1987) Two-dimensional Computer Graphics, Chartwell-Bratt, Bromley.
McKenzie, J. (ed) (1978) Interactive Computer Graphics in Science Teaching, Ellis Horwood Limited, Chichester.
Milne, P.H. (1987) Computer Graphics for Surveying, E. & F.N. Spon Ltd, London.
National Audit Office (1989) Quality control of road and bridge construction, H.M.S.O., London.
Orvis, W.J. (1987) 1-2-3 for Scientists & Engineers, SYBEX Inc., Alameda.
Reynolds, L. and Simmonds, D. (1984) Presentation of Data in Science, Martinus Nijhoff Publishers, Dordrecht.
Rowell, J. (1988) Picture Perfect: Colour Output in Computer Graphics, Tektronix, Beaverton.
Sandler, C. (1986) Business Graphics on the IBM PC, Addison Wesley Publishing Company, Wokingham.
Savic, D. (1985) BASIC Interactive Graphics, Butterworths, London.
Simmonds, D. (ed.) (1980), Charts & Graphs, MTP Press Limited, Lancaster, Baltimore.
Spear, M.E. (1978) Practical Charting Techniques, McGraw-Hill Book Company, New York.
Turner, B.T. (1990) Effective Technical Writing and Speaking, The Manual, ADMARK (Publishing) Ltd., Vol 3(3), pp. 4–8.
Waite, M. and Morgan, C.L. (1983) Graphics primer for the IBM PC, Osborne/McGraw-Hill, Berkeley.
Which? (1989) Car Safety—the facts you need to know, Consumers’ Association Ltd., October, pp 489–93.
Wolfram, S. (1988) Mathematica, Addison-Wesley Publishing Company, Redwood City.