1
C @(#)plotree.for 19.1 (ES0-DMD) 02/25/03 13:27:33
2
C===========================================================================
3
C Copyright (C) 1995 European Southern Observatory (ESO)
5
C This program is free software; you can redistribute it and/or
6
C modify it under the terms of the GNU General Public License as
7
C published by the Free Software Foundation; either version 2 of
8
C the License, or (at your option) any later version.
10
C This program is distributed in the hope that it will be useful,
11
C but WITHOUT ANY WARRANTY; without even the implied warranty of
12
C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
C GNU General Public License for more details.
15
C You should have received a copy of the GNU General Public
16
C License along with this program; if not, write to the Free
17
C Software Foundation, Inc., 675 Massachusetss Ave, Cambridge,
20
C Corresponding concerning ESO-MIDAS should be addressed as follows:
21
C Internet e-mail: midas@eso.org
22
C Postal address: European Southern Observatory
23
C Data Management Division
24
C Karl-Schwarzschild-Strasse 2
25
C D 85748 Garching bei Muenchen
27
C===========================================================================
29
C++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
30
C.COPYRIGHT: Copyright (c) 1987 European Southern Observatory,TKLAB
32
C.IDENTIFICATION: PLOTREE
33
C.VERSION: 1.0 ESO-FORTRAN Conversion, AA 12:54 - 16 NOV 1987
34
C.LANGUAGE: F77+ESOext
35
C.PURPOSE: Plots table tree
36
C.AUTHOR: J.D. Ponz, ESO Garching
37
C.NOTE: PLOTTBL uses the plotting routines available in the plot library
38
C which again uses the low level AGL routines.
39
C.VERSION: 860625 J.D. Ponz creation
40
C.VERSION: 870515 R.H. Warmels general update of code; new plot library
41
C.VERSION: 880420 R.H. Warmels addapted to portable version of MIDAS
42
C ---------------------------------------------------------------------
44
PROGRAM PLTTRE ! program PLTTRE *** main body ***
47
INTEGER ILOG,PMODE,FMODE
48
INTEGER NCOLUM,NROW,INADD(5),COL(4),TID
49
REAL FRAME(8),SCALES(2)
50
CHARACTER XFRAME*4,YFRAME*4
51
CHARACTER TABLE*60,SEL*64
52
CHARACTER LABEL1*80,LABEL2*80,LABEL3*80,TEXT*80
53
CHARACTER*16 LABEL(4),UNIT(4),OLAB
54
CHARACTER*40 COLUMN(4)
57
INCLUDE 'MID_INCLUDE:PLTDEC.INC/NOLIST'
58
INCLUDE 'MID_INCLUDE:TABLES.INC/NOLIST'
60
INCLUDE 'MID_INCLUDE:PLTDAT.INC/NOLIST'
61
INCLUDE 'MID_INCLUDE:TABLED.INC/NOLIST'
70
C *** start executable code
71
CALL STSPRO('PLOTTRE') !start comm. with MIDAS
72
CALL STKRDI('PLISTAT',1,1,IAC,FMODE,KUN,KNUL,IST) !get the plot mode
73
CALL STKRDC('PLCSTAT',1,5,4,IAC,XFRAME,KUN,KNUL,IST) !frame in x
74
CALL STKRDC('PLCSTAT',1,9,4,IAC,YFRAME,KUN,KNUL,IST) !frame in y
77
CALL STKRDC('P1',1,1,60,ITBL,TABLE,KUN,KNUL,ISTAT) !get table name
78
IF (ISTAT.NE.0) THEN ! take action in case of trouble
79
TEXT = '*** FATAL: Problems with table parameter '//TABLE
80
CALL STTPUT(TEXT,ISTAT)
81
CALL STSEPI ! stop communication with MIDAS
86
CALL STKRDC('P3',1,1,40,NCOL1,COLUMN(1),KUN,KNUL,ISTAT) ! first column
87
CALL STKRDC('P2',1,1,40,NCOL2,COLUMN(2),KUN,KNUL,ISTAT) ! second column
88
CALL STKRDC('P5',1,1,40,NCOL3,COLUMN(3),KUN,KNUL,ISTAT) ! third column
89
CALL STKRDC('P4',1,1,40,NCOL4,COLUMN(4),KUN,KNUL,ISTAT) ! forth column
91
C *** this procedure read the table
92
CALL TBTOPN(TABLE,F_I_MODE,TID,ISTAT)
93
IF (ISTAT.NE.0) THEN ! problems during execution
94
TEXT = '*** FATAL: Problems with opening table '//TABLE
95
CALL STTPUT(TEXT,ISTAT)
100
CALL TBIGET(TID,NCOL,NROW,NSC,NAC,NAR,ISTAT) ! read table information
101
IF (ISTAT.NE.0) THEN ! problems during execution
102
TEXT = '*** FATAL: Problems with getting table info'
103
CALL STTPUT(TEXT,ISTAT)
109
CALL STTPUT(' No points in the table ... ',ISTAT)
114
CALL TDRSEL(TID,SEL,ISTAT) ! table selection
116
C *** get column adresses
118
CALL TBCSER(TID,COLUMN(I),COL(I),ISTAT) ! find column no.
119
IF (ISTAT.NE.0) THEN ! problems during execution
120
TEXT = '*** FATAL: Problems with finding column'
121
CALL STTPUT(TEXT,ISTAT)
126
IF (COL(I).EQ.-1) THEN ! problems during execution
127
TEXT = '*** FATAL: Problems with finding column'
128
CALL STTPUT(TEXT,ISTAT)
133
CALL TBCMAP(TID,COL(I),INADD(I),ISTAT) ! get column adress
134
IF (ISTAT.NE.0) THEN ! problems during execution
135
TEXT = '*** FATAL: Problems with mapping column'
136
CALL STTPUT(TEXT,ISTAT)
141
IF (COL(I).NE.0) THEN ! read label
142
CALL TBLGET(TID,COL(I),LABEL(I),ISTAT)
143
IF (ISTAT.NE.0) THEN ! problems during execution
144
TEXT = '*** FATAL: Problems with reading column'
145
CALL STTPUT(TEXT,ISTAT)
150
CALL TBUGET(TID,COL(I),UNIT(I),ISTAT) ! read units
151
IF (ISTAT.NE.0) THEN ! problems during execution
152
TEXT = '*** FATAL: Problems with reading units'
153
CALL STTPUT(TEXT,ISTAT)
160
CALL TBCMAP(TID,0,INADD(5),ISTAT) ! select mask of the table
161
IF (ISTAT.NE.0) THEN ! problems during execution
162
TEXT = '*** FATAL: Problems with the table selection'
163
CALL STTPUT(TEXT,ISTAT)
170
IF (LABEL(1) (1:2).EQ.' ') THEN
171
WRITE (OLAB(7:10),9000) COL(1)
176
LABEL1(31:50) = ' ('//UNIT(1)//')'
180
IF (LABEL(2) (1:2).EQ.' ') THEN
181
WRITE (OLAB(7:10),9000) COL(2)
186
LABEL2(31:50) = ' ('//UNIT(2)//')'
189
CALL STKRDR('INPUTR',1,2,NVAL,SCALES,KUN,KNUL,ISTAT)
190
SCALES(1) = ABS(SCALES(1))
191
SCALES(2) = ABS(SCALES(2))
192
CALL STKWRR('PLRSTAT',SCALES,19,2,KUN,ISTAT)
194
C *** calculate frame
195
IF (XFRAME(1:4).EQ.'MANU') THEN ! man. scaling
196
CALL STKRDR('PLRSTAT',11,4,NVAL,FRAME,KUN,KNUL,ISTAT) ! get frame par.
199
CALL TDMXRS(NROW,MADRID(INADD(2)),MADRID(INADD(5)), ! min and max
201
CALL TDMXRS(NROW,MADRID(INADD(4)),MADRID(INADD(5)), ! min and max
203
FRAME(1) = MIN(XMIN1,XMIN2)
204
FRAME(2) = MAX(XMAX1,XMAX2)
205
IF (FRAME(1).EQ.FRAME(2)) THEN
206
FRAME(2) = FRAME(1) + 1.
210
IF (YFRAME(1:4).EQ.'MANU') THEN ! man. scaling
211
CALL STKRDR('PLRSTAT',15,4,NVAL,FRAME(5),KUN,KNUL,ISTAT) ! get frame
214
CALL TDMXRS(NROW,MADRID(INADD(1)),MADRID(INADD(5)), ! min and max
216
CALL TDMXRS(NROW,MADRID(INADD(3)),MADRID(INADD(5)), ! min and max
218
FRAME(5) = MIN(YMIN1,YMIN2)
219
FRAME(6) = MAX(YMAX1,YMAX2)
220
IF (FRAME(5).EQ.FRAME(6)) THEN
221
FRAME(6) = FRAME(5) + 1
226
CALL GETFRM(FRAME(1),FRAME(2),FRAME(3),FRAME(4),XFRAME)
227
CALL GETFRM(FRAME(5),FRAME(6),FRAME(7),FRAME(8),YFRAME)
228
CALL STKWRR('PLRSTAT',FRAME,11,8,KUN,ISTAT)
230
C *** do the plot setup
231
CALL PLOPN(TABLE,PMODE,FMODE)
234
CALL PLTRE(NCOLUM,MADRID(INADD(1)),MADRID(INADD(2)),
235
2 MADRID(INADD(3)),MADRID(INADD(4)),MADRID(INADD(5)),
239
CALL PLFRAM(FRAME(1),FRAME(2),FRAME(3),FRAME(4),
240
2 FRAME(5),FRAME(6),FRAME(7),FRAME(8))
241
IF (PMODE.EQ.1 .OR. PMODE.EQ.3) THEN
242
LABEL3 = 'Table: '//TABLE
243
CALL PLLABL(LABEL2,LABEL1,LABEL3,SEL)
246
CALL PLLABL(LABEL1,LABEL2,' ',' ')
247
CALL PLTREI(TABLE,COLUMN(2),COLUMN(1),COLUMN(4),
252
C *** good bye and finish
253
CALL TBTCLO(TID,ISTAT)
255
CALL STSEPI ! stop communication with MIDAS
259
SUBROUTINE PLTRE(NCOLUM,V1,V2,V3,V4,V5,NROW)
261
C.PURPOSE: Low level routine to plot a table treee
262
C.AUTHOR: Rein H. Warmels
263
C.VERSION: 86???? JDP Creation
264
C.VERSION: 860625 RHW new routine based on Daniel's work
265
C.VERSION: 861216 RHW inclusion of neg. increments
266
C.VERSION: 87???? RHW restructure of code
267
C.VERSION: 890118 RHW ST interfaces implemented
270
INTEGER NCOLUM ! # of columns to be plotted
271
REAL V1(NROW) ! adress of first column to be plotted
272
REAL V2(NROW) ! adress of second column to be plotted
273
REAL V3(NROW) ! adress of third column to be plotted
274
REAL V4(NROW) ! adress of fourth column to be plotted
275
REAL V5(NROW) ! adress
276
INTEGER NROW ! number of row
281
DOUBLE PRECISION TDNULL, TDTRUE, TDFALS
284
INCLUDE 'MID_INCLUDE:TABLES.INC/NOLIST'
285
INCLUDE 'MID_INCLUDE:PLTDEC.INC/NOLIST'
286
COMMON /VMR/MADRID(1)
287
INCLUDE 'MID_INCLUDE:TABLED.INC/NOLIST'
289
C *** get machine constants
290
CALL TBMNUL(TINULL, TRNULL, TDNULL)
291
CALL TBMCON(TBLSEL, TDTRUE, TDFALS)
296
IF (V5(I).EQ.TBLSEL) THEN
298
IF (YY(1).EQ.TRNULL) IPLOT = .FALSE.
300
IF (XX(1).EQ.TRNULL) IPLOT = .FALSE.
302
IF (YY(2).EQ.TRNULL) IPLOT = .FALSE.
304
IF (XX(2).EQ.TRNULL) IPLOT = .FALSE.
314
SUBROUTINE PLTREI(FILE,COL1,COL2,COL3,COL4,SEL)
316
C.PURPOSE: Produce plot information for a table tree plot
317
C.AUTHOR: Rein H. Warmels
319
C.VERSION: 880420 RHW Update for portable MIDAS
320
C.VERSION: 890118 RHW ST interfaces implemented
323
CHARACTER*(*) FILE !name of the table
324
CHARACTER*(*) COL1 !name of x column
325
CHARACTER*(*) COL2 !name of x column
326
CHARACTER*(*) COL3 !name of x column
327
CHARACTER*(*) COL4 !name of y column
328
CHARACTER*(*) SEL !selection string
331
CHARACTER NUMB5*10,NUMB6*10
334
INCLUDE 'MID_INCLUDE:PLTDEC.INC/NOLIST'
345
CALL AGCDEF(X1,X2,Y1,Y2)
346
CALL AGWDEF(0.0,1.0,0.0,1.0)
348
CALL PLLOGI(XT,YT) ! plot the MIDAS LOGO
350
C *** get character size
351
CALL AGTGET('M',XL,YL)
357
CALL AGGTXT(XT,YT,BUF(1:L),1)
361
CALL AGGTXT(XT,YT,BUF(1:L),1)
367
CALL AGGTXT(XT,YT,BUF(1:L),1)
371
CALL AGGTXT(XT,YT,BUF(1:L),1)
375
CALL AGGTXT(XT,YT,BUF(1:L),1)
379
CALL AGGTXT(XT,YT,BUF(1:L),1)
383
CALL AGGTXT(XT,YT,BUF(1:L),1)
389
CALL AGGTXT(XT,YT,BUF(1:L),1)
393
CALL STKRDR('PLRSTAT',19,2,IAC,SCALES,KUN,KNUL,IST)
394
WRITE (NUMB5(1:10),9010) SCALES(1)
395
WRITE (NUMB6(1:10),9010) SCALES(2)
398
CALL AGGTXT(XT,YT,BUF(1:L),1)
402
CALL AGGTXT(XT,YT,BUF(1:L),1)
408
CALL AGGTXT(XT,YT,BUF(1:L),1)
410
IF ((SEL(1:1).EQ.'-') .OR. (SEL(1:1).EQ.' ')) THEN ! no selection
414
CALL AGGTXT(XT,YT,BUF(1:L),1)
418
10 CONTINUE ! check for logicals
419
IDXOR = INDEX(SEL(ISTART:),'.OR.')
421
IDXOR = ISTART + IDXOR + 2
426
IDXAND = INDEX(SEL(ISTART:),'.AND.')
427
IF (IDXAND.NE.0) THEN
428
IDXAND = ISTART + IDXAND + 3
433
IEND = MIN(IDXOR,IDXAND)
434
IF (IEND.EQ.999) THEN ! no logicals in selection
435
CALL LENBUF(SEL(ISTART:),LSEL) ! length of the whole string
436
NLINE = LSEL/20 ! number of lines needed
437
NREST = LSEL - NLINE*20 ! number of remaining characters
438
DO 20 I = 1,NLINE ! loop through lines
439
IS = ISTART + (I-1)*20 ! start index
440
IE = IS + 19 ! end index
441
BUF = SEL(IS:IE) ! store in buffer
442
CALL LENBUF(BUF,L) ! length of string in buffer
444
CALL AGGTXT(XT,YT,BUF(1:L),1) ! put text
445
20 CONTINUE ! end loop
447
BUF = SEL(ISTART+NLINE*20:)
448
CALL LENBUF(BUF,L) ! length of buffer
450
CALL AGGTXT(XT,YT,BUF(1:L),1) ! put the text
453
ELSE ! selection includes logicals
454
CALL LENBUF(SEL(ISTART:IEND),L) ! length of the buffer
455
NLINE = L/20 ! number of full lines
456
NREST = L - NLINE*20 ! number of remaining characters
457
DO 30 I = 1,NLINE ! loop through lines
458
IS = ISTART + (I-1)*20 ! start index
459
IE = IS + 19 ! end index
460
BUF = SEL(IS:IE) ! fill buffer
461
CALL LENBUF(BUF,L) ! length of buffer
463
CALL AGGTXT(XT,YT,BUF(1:L),1) ! put the text
464
30 CONTINUE ! end of loop
466
BUF = SEL(ISTART+NLINE*20:IEND)
467
CALL LENBUF(BUF,L) ! length of buffer
469
CALL AGGTXT(XT,YT,BUF(1:L),1) ! put the text
470
ISTART = IEND + 1 ! determine next string