1*-----------------------------------------------------------------------
2*     PLOT ROUTINE ON VC (ENCODING TEXT)
3*-----------------------------------------------------------------------
4*     Copyright (C) 2000-2004 GFD Dennou Club. All rights reserved.
5*-----------------------------------------------------------------------
6      SUBROUTINE SZOPLC
7
8      CHARACTER CH*(*)
9
10      PARAMETER (MAXTMP=400)
11
12      REAL      VXT(MAXTMP),VYT(MAXTMP)
13      LOGICAL   LCHAR,LCSET,LROT,LBUFF,LCURV,LCPUT
14      CHARACTER CHZ*80
15
16      COMMON    /SZBLS3/ LCHAZ
17      LOGICAL   LCHAZ
18
19      EXTERNAL  LENC,RR2D
20
21      SAVE
22
23      DATA      LCSET/.FALSE./
24
25
26*     / OPEN DASH LINE & CHARACTER SEGMENT /
27
28      LCHAR=LCHAZ.AND.LCSET
29
30      IF (LCHAR) THEN
31
32        CALL SGLGET('LROT',LROT)
33        CALL SGIGET('IROT',IROT)
34        CALL SGRGET('FWC',FWC)
35        CALL SGRGET('CWL',CWL)
36        CALL SGRGET('FFCT',FFCT)
37        CALL SGIGET('INDEXC',INDEX)
38        CALL SGLGET('LBUFF',LBUFF)
39        CALL SGIGET('NBUFF',NBUFF)
40        CALL SGRGET('RBUFF',RBUFF)
41        CALL SGLGET('LCURV',LCURV)
42        CALL SGRGET('RCURV',RCURV)
43
44        IF (.NOT.(FWC.GE.1.0)) THEN
45          CALL MSGDMP('E','SZOPLC','PARAMETER ''FWC'' IS LESS THAN 1.')
46        END IF
47        IF (.NOT.(CWL.GT.0.0)) THEN
48          CALL MSGDMP('E','SZOPLC','PARAMETER ''CWL'' IS LESS THAN 0.')
49        END IF
50        IF (.NOT.(0.0.LT.FFCT .AND. FFCT.LT.1.0)) THEN
51          CALL MSGDMP('E','SZOPLC',
52     +         'PARAMETER ''FFCT'' IS NOT IN THE RANGE OF (0,1).')
53        END IF
54        IF (.NOT.(1.LE.NBUFF .AND. NBUFF.LE.MAXTMP)) THEN
55          CALL MSGDMP('E','SZOPLC',
56     +         'PARAMETER ''NBUFF'' IS NOT IN THE RANGE OF (1,MAXTMP).')
57        END IF
58        IF (.NOT.(0.0.LT.RBUFF .AND. RBUFF.LT.1.0)) THEN
59          CALL MSGDMP('E','SZOPLC',
60     +         'PARAMETER ''RBUFF'' IS NOT IN THE RANGE OF (0,1).')
61        END IF
62        IF (.NOT.(0.0.LT.RCURV .AND. RCURV.LT.FWC)) THEN
63          CALL MSGDMP('E','SZOPLC',
64     +         'PARAMETER ''RCURV'' IS NOT IN THE RANGE OF (0,FWC).')
65        END IF
66
67        CALL SZQTXW(CHZ,NCHZ,WXCH,WYCH)
68
69        FC=WXCH*FWC
70        FL=CWL
71
72        WC=HZ*FC
73        WL=HZ*FL
74        XW=WL+WC
75        XI=WL*FFCT
76
77      END IF
78
79      IF (LBUFF) NT=0
80
81      CALL SZOPLD
82
83      RETURN
84*-----------------------------------------------------------------------
85      ENTRY SZMVLC(VX,VY)
86
87*     / PEN-UP MOVE /
88
89      IF (LBUFF .AND. NT.NE.0) THEN
90        DO 5 N=1,NT
91          CALL SZPLLD(VXT(N),VYT(N))
92    5   CONTINUE
93        NT=0
94      END IF
95
96      CALL SZMVLD(VX,VY)
97
98      VX0=VX
99      VY0=VY
100      XL0=XI
101
102      RETURN
103*-----------------------------------------------------------------------
104      ENTRY SZPLLC(VX,VY)
105
106*     / PEN-DOWN MOVE /
107
108      IF (.NOT.LCHAR) THEN
109
110*       / THERE IS NO TEXT IN THE CYCLE /
111
112        CALL SZPLLD(VX,VY)
113
114      ELSE
115
116*       / THERE EXISTS A TEXT IN THE CYCLE /
117
118   10   CONTINUE
119
120          R=SQRT((VX-VX0)**2+(VY-VY0)**2)
121          IF (R.EQ.0) RETURN
122
123          XL=XL0+R
124
125          IF (XL.LT.WL) THEN
126
127*           / CURRENET POSITION IS IN THE LINE PART /
128
129            CALL SZPLLD(VX,VY)
130
131            VX0=VX
132            VY0=VY
133            XL0=XL
134
135          ELSE IF (XL.LT.XW) THEN
136
137*           / CURRENT POSITION IS IN THE CHARCTER PART /
138
139            IF (XL0.LT.WL) THEN
140
141*             / LAST POSITION WAS IN THE LINE PART /
142
143              VX1=VX0+(VX-VX0)*(WL-XL0)/R
144              VY1=VY0+(VY-VY0)*(WL-XL0)/R
145
146              CALL SZPLLD(VX1,VY1)
147
148            END IF
149
150            VX0=VX
151            VY0=VY
152            XL0=XL
153
154            IF (LBUFF) THEN
155
156*           / BUFFERRING /
157
158              NT=NT+1
159              VXT(NT)=VX
160              VYT(NT)=VY
161
162              IF (NT.EQ.NBUFF) THEN
163
164                DO 15 N=1,NT
165                  CALL SZPLLD(VXT(N),VYT(N))
166   15           CONTINUE
167                XL0=WL*RBUFF
168                NT=0
169
170              END IF
171
172            END IF
173
174          ELSE
175
176*           / CURRENT POSITION IS IN THE NEXT CYCLE /
177
178            IF (XL0.LT.WL) THEN
179
180*             / LAST POSITION WAS IN THE LINE PART /
181
182              VX1=VX0+(VX-VX0)*(WL-XL0)/R
183              VY1=VY0+(VY-VY0)*(WL-XL0)/R
184
185              CALL SZPLLD(VX1,VY1)
186
187            END IF
188
189*           / POSITION OF TEXT /
190
191            VX0=VX0+(VX-VX0)*(XW-XL0)/R
192            VY0=VY0+(VY-VY0)*(XW-XL0)/R
193            VXC=(VX0+VX1)/2
194            VYC=(VY0+VY1)/2
195
196            LCPUT=.TRUE.
197
198            IF (LBUFF.AND.LCURV) THEN
199
200*             / CHECK CURVATURE (RUN PATH) /
201
202              XLC=SQRT((VX1-VX0)**2+(VY1-VY0)**2)
203              IF (XLC.LE.HZ*WXCH*RCURV) THEN
204                DO 20 N=1,NT
205                  CALL SZPLLD(VXT(N),VYT(N))
206   20           CONTINUE
207                XL0=WL*RBUFF
208                NT=0
209                CALL SZPLLD(VX,VY)
210                VX0=VX
211                VY0=VY
212                LCPUT=.FALSE.
213              END IF
214
215            END IF
216
217            IF (LCPUT) THEN
218
219*             / ROTATION OPTION /
220
221              IF (LROT) THEN
222                ITH=IROT
223              ELSE
224                ITH=MOD(RR2D(ATAN2(VY0-VY1,VX0-VX1))+270,180.0)-90
225              END IF
226
227*             / WRITE TEXT /
228
229              CALL SZQIDX(INDEXZ)
230              IF (INDEX.EQ.0) THEN
231                INDEXY=INDEXZ
232              ELSE
233                INDEXY=INDEX
234              END IF
235
236              CALL SZCLLD
237
238*             CALL SGTXZV(VXC,VYC,CHZ,HZ,ITH,0,INDEXY)
239              CALL SZTXOP(HZ,ITH,0,INDEXY)
240              CALL SZTXZV(VXC,VYC,CHZ)
241              CALL SZTXCL
242
243              CALL SZSIDX(INDEXZ)
244
245              CALL SZOPLD
246              CALL SZMVLD(VX0,VY0)
247
248              XL0=0
249              NT=0
250
251            END IF
252
253          END IF
254
255        IF (.NOT.(XL.LT.XW)) GO TO 10
256
257      END IF
258
259      RETURN
260*-----------------------------------------------------------------------
261      ENTRY SZCLLC
262
263*     / CLOSE DASHCHAR SEGMENT /
264
265      IF (LBUFF .AND. NT.NE.0) THEN
266        DO 25 N=1,NT
267          CALL SZPLLD(VXT(N),VYT(N))
268   25   CONTINUE
269      END IF
270
271      CALL SZCLLD
272
273      RETURN
274*-----------------------------------------------------------------------
275      ENTRY SZSCHZ(CH,H)
276
277      NC  = LENC(CH)
278      CHZ = CH(1:NC)
279      HZ  = H
280      LCSET = .TRUE.
281
282      RETURN
283*-----------------------------------------------------------------------
284      ENTRY SZQCHZ(CH,H)
285
286      IF (.NOT.LCSET) THEN
287        CALL MSGDMP('E','SZQCHZ','TEXT HAS NOT BEEN SET YET.')
288      END IF
289
290      CH = CHZ
291      H  = HZ
292
293      RETURN
294*-----------------------------------------------------------------------
295      ENTRY SZCRST
296
297      LCSET=.FALSE.
298
299      RETURN
300      END
301