/usr/share/ncarg/tests/tareas.f is in libncarg-data 6.3.0-6build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 | PROGRAM TAREAS
C
C Define the error file, the Fortran unit number, the workstation type,
C and the workstation ID to be used in calls to GKS routines.
C
C PARAMETER (IERRF=6, LUNIT=2, IWTYPE=1, IWKID=1) ! NCGM
C PARAMETER (IERRF=6, LUNIT=2, IWTYPE=8, IWKID=1) ! X Windows
C PARAMETER (IERRF=6, LUNIT=2, IWTYPE=11, IWKID=1) ! PDF
C PARAMETER (IERRF=6, LUNIT=2, IWTYPE=20, IWKID=1) ! PostScript
C
PARAMETER (IERRF=6, LUNIT=2, IWTYPE=1, IWKID=1)
C
C OPEN GKS, OPEN WORKSTATION OF TYPE 1, ACTIVATE WORKSTATION
C
CALL GOPKS (IERRF, ISZDM)
CALL GOPWK (IWKID, LUNIT, IWTYPE)
CALL GACWK (IWKID)
C
C INVOKE DEMO DRIVER
C
CALL AREAS(IERR,IWKID)
C
C DEACTIVATE AND CLOSE WORKSTATION, CLOSE GKS.
C
CALL GDAWK (IWKID)
CALL GCLWK (IWKID)
CALL GCLKS
C
STOP
END
C
SUBROUTINE AREAS (IERROR, IWKID)
C
C PURPOSE To provide a simple demonstration of the use
C of AREAS.
C
C USAGE CALL AREAS (IERROR)
C
C ARGUMENTS
C
C ON OUTPUT IERROR
C
C an error parameter
C = 0, if the test is successful,
C = 1, otherwise
C
C I/O If the test is successful, the message
C
C AREAS TEST EXECUTED--SEE PLOTS TO CERTIFY
C
C is written on unit 6.
C
C PRECISION Single.
C
C REQUIRED LIBRARY AREAS, SPPS
C FILES
C
C REQUIRED GKS LEVEL 0A
C
C LANGUAGE FORTRAN
C
C HISTORY Written in JUNE, 1987.
C
C ALGORITHM TAREAS constructs and colors a very simple
C picture illustrating the use of all of the
C routines in the package.
C
C PORTABILITY FORTRAN 77
C
C Define an array in which to construct the area map.
C
DIMENSION IAM(5000)
C
C Define the arrays needed for edge-coordinate data.
C
DIMENSION XCA(73),YCA(73)
C
C Dimension the arrays needed by ARSCAM and ARDRLN for X/Y coordinates.
C
DIMENSION XCS(150),YCS(150)
C
C Dimension the arrays needed by ARSCAM and ARDRLN for area and group
C identifiers.
C
DIMENSION IAI(2),IAG(2)
C
C Define the RGB color triples needed below.
C
DIMENSION RGB(3,15)
C
C Define a set of indices to order the colors.
C
DIMENSION IOC(15)
C
C Define an array for GKS aspect source flags.
C
DIMENSION IF(13)
C
C Declare the routine which will color the areas.
C
EXTERNAL COLRAM
C
C Declare the routine which will draw lines over the circle.
C
EXTERNAL COLRLN
C
DATA RGB / 0.70 , 0.70 , 0.70 ,
+ 0.75 , 0.50 , 1.00 ,
+ 0.50 , 0.00 , 1.00 ,
+ 0.00 , 0.00 , 1.00 ,
+ 0.00 , 0.50 , 1.00 ,
+ 0.00 , 1.00 , 1.00 ,
+ 0.00 , 1.00 , 0.60 ,
+ 0.00 , 1.00 , 0.00 ,
+ 0.70 , 1.00 , 0.00 ,
+ 1.00 , 1.00 , 0.00 ,
+ 1.00 , 0.75 , 0.00 ,
+ 1.00 , 0.38 , 0.38 ,
+ 1.00 , 0.00 , 0.38 ,
+ 1.00 , 0.00 , 0.00 ,
+ 1.00 , 1.00 , 1.00 /
DATA IOC / 6,2,5,12,10,11,1,3,4,8,9,7,13,14,15 /
C
C Declare the constant for converting from degrees to radians.
C
DATA DTR / .017453292519943 /
C
C Set the aspect source flags for FILL AREA INTERIOR STYLE and for
C FILL AREA STYLE INDEX to "individual".
C
CALL GQASF (IE,IF)
IF(11)=1
IF(12)=1
CALL GSASF (IF)
C
C Force solid fill.
C
CALL GSFAIS (1)
C
C Define 15 different color indices.
C
CALL GSCR(IWKID,0,0.,0.,0.)
DO 101 J=1,15
I=IOC(J)
CALL GSCR(IWKID,J,RGB(1,I),RGB(2,I),RGB(3,I))
101 CONTINUE
C
C Initialize the area map.
C
CALL ARINAM (IAM,5000)
C
C Add edges to the area map.
C
CALL SET (.01,.99,.01,.99,-1.,1.,-1.,1.,1)
C
C First, define a circle, using group 1 edges. After this step, the
C area inside the circle has area identifier zero and the area outside
C has area identifier -1.
C
DO 102 ING=1,73
ANG=DTR*REAL(5*(ING-1))
XCA(ING)=COS(ANG)
YCA(ING)=SIN(ANG)
102 CONTINUE
CALL AREDAM (IAM,XCA,YCA,73,1,0,-1)
C
C Add lines splitting the circle into wedges. The area identifiers
C for the wedges are added to the area map with this step.
C
XCA(1)=0.
YCA(1)=0.
DO 103 ING=1,15
ANG=DTR*REAL(24*(ING-1))
XCA(2)=COS(ANG)
YCA(2)=SIN(ANG)
CALL AREDAM (IAM,XCA,YCA,2,1,ING,MOD(ING+13,15)+1)
103 CONTINUE
C
C Now, put in another, smaller, off-center circle, using a group 2
C edge. The interior of the circle has area identifier 1 and the
C exterior of the circle has group identifier 2.
C
DO 104 ING=1,73
ANG=DTR*REAL(5*(ING-1))
XCA(ING)=.25+.5*COS(ANG)
YCA(ING)=.25+.5*SIN(ANG)
104 CONTINUE
CALL AREDAM (IAM,XCA,YCA,73,2,1,2)
C
C Pre-process the area map.
C
CALL ARPRAM (IAM,0,0,0)
C
C Compute and print the amount of space used in the area map.
C
ISU=5000-(IAM(6)-IAM(5)-1)
PRINT * , 'SPACE USED IN AREA MAP IS ',ISU
C
C Color the areas defined.
C
CALL ARSCAM (IAM,XCS,YCS,150,IAI,IAG,2,COLRAM)
C
C In contrasting colors, draw three stars on the plot.
C
DO 105 I=1,3
IF (I.EQ.1) THEN
XCN=-.5
YCN=+.5
ELSE IF (I.EQ.2) THEN
XCN=-.5
YCN=-.5
ELSE IF (I.EQ.3) THEN
XCN=+.5
YCN=-.5
END IF
XCA(1)=XCN+.25*COS( 162.*DTR)
YCA(1)=YCN+.25*SIN( 162.*DTR)
XCA(2)=XCN+.25*COS( 18.*DTR)
YCA(2)=YCN+.25*SIN( 18.*DTR)
XCA(3)=XCN+.25*COS(-126.*DTR)
YCA(3)=YCN+.25*SIN(-126.*DTR)
XCA(4)=XCN+.25*COS( 90.*DTR)
YCA(4)=YCN+.25*SIN( 90.*DTR)
XCA(5)=XCN+.25*COS( -54.*DTR)
YCA(5)=YCN+.25*SIN( -54.*DTR)
XCA(6)=XCN+.25*COS( 162.*DTR)
YCA(6)=YCN+.25*SIN( 162.*DTR)
CALL ARDRLN (IAM,XCA,YCA,6,XCS,YCS,150,IAI,IAG,2,COLRLN)
105 CONTINUE
C
C Draw a spiral of points in the blanked-out circle, using the colors
C from edge group 1.
C
ICF=1
DO 108 ING=1,1500
RAD=REAL(ING)/1000.
ANG=DTR*REAL(ING-1)
XCD=.25+.5*RAD*COS(ANG)
YCD=.25+.5*RAD*SIN(ANG)
CALL ARGTAI (IAM,XCD,YCD,IAI,IAG,2,NAI,ICF)
ITM=1
DO 106 I=1,NAI
IF (IAI(I).LT.0) ITM=0
106 CONTINUE
IF (ITM.NE.0) THEN
IT1=0
IT2=0
DO 107 I=1,NAI
IF (IAG(I).EQ.1) IT1=IAI(I)
IF (IAG(I).EQ.2) IT2=IAI(I)
107 CONTINUE
IF (IT1.GT.0.AND.IT2.EQ.1) THEN
C
C Flush PLOTIT's buffers and set polyline color index.
C
CALL PLOTIT(0,0,0)
CALL GSPLCI(IT1)
C
CALL POINT (XCD,YCD)
END IF
END IF
ICF=0
108 CONTINUE
C
C Advance the frame.
C
CALL FRAME
C
C Done.
C
IERROR=0
WRITE (6,1001)
C
RETURN
C
1001 FORMAT (' AREAS TEST EXECUTED--SEE PLOTS TO CERTIFY')
C
END
SUBROUTINE COLRAM (XCS,YCS,NCS,IAI,IAG,NAI)
DIMENSION XCS(*),YCS(*),IAI(*),IAG(*)
ITM=1
DO 101 I=1,NAI
IF (IAI(I).LT.0) ITM=0
101 CONTINUE
IF (ITM.NE.0) THEN
IT1=0
DO 102 I=1,NAI
IF (IAG(I).EQ.1) IT1=IAI(I)
IF (IAG(I).EQ.2) IT2=IAI(I)
102 CONTINUE
IF (IT1.GT.0.AND.IT2.NE.1) THEN
C
C Set fill area color index.
C
CALL GSFACI(IT1)
C
CALL GFA (NCS-1,XCS,YCS)
END IF
END IF
RETURN
END
SUBROUTINE COLRLN (XCS,YCS,NCS,IAI,IAG,NAI)
DIMENSION XCS(*),YCS(*),IAI(*),IAG(*)
ITM=1
DO 101 I=1,NAI
IF (IAI(I).LT.0) ITM=0
101 CONTINUE
IF (ITM.NE.0) THEN
IT1=0
IT2=0
DO 102 I=1,NAI
IF (IAG(I).EQ.1) IT1=IAI(I)
IF (IAG(I).EQ.2) IT2=IAI(I)
102 CONTINUE
IF (IT1.GT.0.AND.IT2.NE.1) THEN
C
C Flush PLOTIT's buffers and set polyline color index.
C
CALL PLOTIT(0,0,0)
CALL GSPLCI(MOD(IT1+3,15)+1)
C
CALL GPL (NCS,XCS,YCS)
END IF
END IF
RETURN
END
|