00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "plplotP.h"
00026
00027
00028
00029 static struct line
00030 {
00031 PLINT nels;
00032 PLINT mark[4];
00033 PLINT space[4];
00034 } line[] = {
00035 {
00036 0,
00037 {
00038 0, 0, 0, 0
00039 },
00040 {
00041 0, 0, 0, 0
00042 }
00043 },
00044 {
00045 1,
00046 {
00047 1000, 0, 0, 0
00048 },
00049 {
00050 1000, 0, 0, 0
00051 }
00052 },
00053 {
00054 1,
00055 {
00056 2000, 0, 0, 0
00057 },
00058 {
00059 2000, 0, 0, 0
00060 }
00061 },
00062 {
00063 1,
00064 {
00065 2000, 0, 0, 0
00066 },
00067 {
00068 1000, 0, 0, 0
00069 }
00070 },
00071 {
00072 2,
00073 {
00074 2500, 1000, 0, 0
00075 },
00076 {
00077 1000, 1000, 0, 0
00078 }
00079 },
00080 {
00081 2,
00082 {
00083 2000, 1000, 0, 0
00084 },
00085 {
00086 2000, 1000, 0, 0
00087 }
00088 },
00089 {
00090 3,
00091 {
00092 1000, 1500, 2000, 0
00093 },
00094 {
00095 1000, 1500, 2000, 0
00096 }
00097 },
00098 {
00099 3,
00100 {
00101 1000, 1500, 2000, 0
00102 },
00103 {
00104 1000, 1000, 1000, 0
00105 }
00106 }
00107 };
00108
00109
00110
00111 static struct pattern
00112 {
00113 PLINT nlines;
00114 PLINT inc[2];
00115 PLINT del[2];
00116 } pattern[] = {
00117 {
00118 1,
00119 {
00120 0, 0
00121 },
00122 {
00123 2000, 0
00124 }
00125 },
00126 {
00127 1,
00128 {
00129 900, 0
00130 },
00131 {
00132 2000, 0
00133 }
00134 },
00135 {
00136 1,
00137 {
00138 450, 0
00139 },
00140 {
00141 2000, 0
00142 }
00143 },
00144 {
00145 1,
00146 {
00147 -450, 0
00148 },
00149 {
00150 2000, 0
00151 }
00152 },
00153 {
00154 1,
00155 {
00156 300, 0
00157 },
00158 {
00159 2000, 0
00160 }
00161 },
00162 {
00163 1,
00164 {
00165 -300, 0
00166 },
00167 {
00168 2000, 0
00169 }
00170 },
00171 {
00172 2,
00173 {
00174 0, 900
00175 },
00176 {
00177 2000, 2000
00178 }
00179 },
00180 {
00181 2,
00182 {
00183 450, -450
00184 },
00185 {
00186 2000, 2000
00187 }
00188 }
00189 };
00190
00191
00192
00193 static void
00194 spat( PLINT inc[], PLINT del[], PLINT nlin );
00195
00196
00197
00198
00199
00200
00201
00202 void
00203 c_plschr( PLFLT def, PLFLT scale )
00204 {
00205 if ( def != 0.0 )
00206 plsc->chrdef = def;
00207
00208 plsc->chrht = scale * plsc->chrdef;
00209 }
00210
00211
00212
00213
00214
00215
00216
00217 void
00218 c_plsmin( PLFLT def, PLFLT scale )
00219 {
00220 if ( def != 0.0 )
00221 plsc->mindef = def;
00222
00223 plsc->minht = scale * plsc->mindef;
00224 }
00225
00226
00227
00228
00229
00230
00231
00232 void
00233 c_plsmaj( PLFLT def, PLFLT scale )
00234 {
00235 if ( def != 0.0 )
00236 plsc->majdef = def;
00237
00238 plsc->majht = scale * plsc->majdef;
00239 }
00240
00241
00242
00243
00244
00245
00246
00247 void
00248 c_plssym( PLFLT def, PLFLT scale )
00249 {
00250 if ( def != 0.0 )
00251 plsc->symdef = def;
00252
00253 plsc->symht = scale * plsc->symdef;
00254 }
00255
00256
00257
00258
00259
00260
00261
00262 void
00263 c_pllsty( PLINT lin )
00264 {
00265 if ( plsc->level < 1 )
00266 {
00267 plabort( "pllsty: Please call plinit first" );
00268 return;
00269 }
00270 if ( lin < 1 || lin > 8 )
00271 {
00272 plabort( "pllsty: Invalid line style" );
00273 return;
00274 }
00275
00276 plsc->line_style = lin;
00277 plstyl( line[lin - 1].nels,
00278 &line[lin - 1].mark[0], &line[lin - 1].space[0] );
00279 }
00280
00281
00282
00283
00284
00285
00286
00287 void
00288 c_plpat( PLINT nlin, const PLINT *inc, const PLINT *del )
00289 {
00290 PLINT i;
00291
00292 if ( plsc->level < 1 )
00293 {
00294 plabort( "plpat: Please call plinit first" );
00295 return;
00296 }
00297 if ( nlin < 1 || nlin > 2 )
00298 {
00299 plabort( "plpat: Only 1 or 2 line styles allowed" );
00300 return;
00301 }
00302 for ( i = 0; i < nlin; i++ )
00303 {
00304 if ( del[i] < 0 )
00305 {
00306 plabort( "plpat: Line spacing must be greater than 0" );
00307 return;
00308 }
00309 }
00310 spat( (PLINT *) inc, (PLINT *) del, nlin );
00311 }
00312
00313
00314
00315
00316
00317
00318
00319
00320 void
00321 c_plpsty( PLINT patt )
00322 {
00323 if ( plsc->level < 1 )
00324 {
00325 plabort( "plpsty: Please call plinit first" );
00326 return;
00327 }
00328 if ( patt > 8 )
00329 {
00330 plabort( "plpsty: Invalid pattern" );
00331 return;
00332 }
00333 if ( patt != plsc->patt )
00334 {
00335 plsc->patt = patt;
00336
00337 if ( plsc->level > 0 )
00338 {
00339 plP_state( PLSTATE_FILL );
00340 }
00341 }
00342 if ( patt > 0 )
00343 {
00344 spat( &pattern[patt - 1].inc[0], &pattern[patt - 1].del[0],
00345 pattern[patt - 1].nlines );
00346 }
00347 }
00348
00349
00350
00351
00352
00353
00354
00355 static void
00356 spat( PLINT inc[], PLINT del[], PLINT nlin )
00357 {
00358 PLINT i;
00359
00360 plsc->nps = nlin;
00361 for ( i = 0; i < nlin; i++ )
00362 {
00363 plsc->inclin[i] = inc[i];
00364 plsc->delta[i] = del[i];
00365 }
00366 }