 |
If this subroutine is added to the TOWN program before the ASREAD call, it
uses graphics text to attach names to the streets drawn by the main
program.
/* ANNOTATE THE STREET MAP */
LABELS: PROC;
DCL(X1, X2, Y1) FLOAT DEC(6);
DCL XC(5) FLOAT DEC(6);
DCL YC(5) FLOAT DEC(6);
DCL NEWLINE CHAR(1);
NEWLINE ='15'X;
CALL GSSEG(7); A
CALL GSLW(2);
CALL GSMIX(2); /* Overpaint mode */
CALL GSCOL(2);
CALL GSCM(3); /* Mode-3 graphics text */ B
CALL GSCHAR(2.0, 91.0, 9, 'Mill St.'); C
CALL GSCHAR(23.0, 91.0, 16, 'Old Mill Bridge');
CALL GSCA(2.0, -5.6); /* Characters tilted at */
/* slope -5.6/2 */
CALL GSCHAR(16.0, 88.0, 10., 'New Bridge');
CALL GSCA(0.0, 0.0); /* Reset character angle */
CALL GSCB(1.8, 6.0); /* Use larger characters */
CALL GSCHAR(3.0, 58.0, 13, 'Cyprus Avenue');
CALL GSCHAR(75.0, 58.0, 11, 'Fountain St.');
CALL GSCA(2.0, -3.3); /* Change character angle*/ D
CALL GSCHAR(15.0, 32.0, 3, 'Lin');
CALL GSCA(2.0, -3.0); /* Change character angle*/
/* to fit curved street */
CALL GSCHAP(5, 'den'); /* Complete street name */ E
CALL GSCA(2.0, -1.2); /* Less steep angle */
CALL GSQCP(x1, y1); /* Query current position*/ F
x1 = x1 + 1;
y1 = y1 + 0.5;
CALL GSCHAR(x1, y1, 4, 'Road');
CALL GSCA(0.0, 0.0); /* Reset character angle */
CALL GSCD(2); /* Characters downward */ G
CALL GSCB(1.8, 4.3);
CALL GSCHAR(60.0, 40.0, 8, 'Broad St');
CALL GSCHAR(60.0, 99.0, 7, 'Lee Way');
CALL GSCD(0);
CALL GSCA(0.0, 0.0);
CALL GSCB(2.8, 8.0); H
CALL GSCBS(0.2, 0.18); I
CALL GSCOL(6);
/* Now write a string of characters and outline their text box */
CALL GSCHAR(80.8, 91.0, 11,'TOWN'||NEWLINE||'CENTER'); J
CALL GSQTB (11,'TOWN'||NEWLINE||'CENTER',5,XC,YC); K
X=80.8;
Y=91.0;
CALL GSLW(1);
CALL GSCOL(4);
CALL GSMOVE(X+XC(1),Y+YC(1)); /* Bottom left of text box */ L
CALL GSLINE(X+XC(3),Y+YC(3)); /* Draw around ... */ L
CALL GSLINE(X+XC(4),Y+YC(4)); /* the ... */ L
CALL GSLINE(X+XC(2),Y+YC(2)); /* text box */ L
CALL GSLINE(X+XC(1),Y+YC(1)); /* */ L
CALL GSCB(1.8, 6.0); /* reduce character box */
CALL GSCBS(0.0, 0.0); /* Default char. spacing */
CALL GSCOL(7);
CALL GSCH(1.0, 3.0,); /* Italic characters */ M
CALL GSCHAR(4.0, 78.0, 4, 'River');
CALL GSCA(1 1);
CALL GSCHAR(27.0, 81.0, 3, 'Usk');
CALL GSSCLS;
END LABELS;
Figure 15. Subroutine to name streets on the town plan
Figure 16. Output from the subroutine to annotate the town plan
|