« lib/App/SeismicUnixGui/sunix/model/surandspike.pm
↑ Summary
lib/App/SeismicUnixGui/sunix/plot/psmerge.pm »
| 1 | package App::SeismicUnixGui::sunix::plot::pslabel; | ||
| 2 | |||
| 3 | =head2 SYNOPSIS | ||
| 4 | |||
| 5 | PERL PROGRAM NAME: | ||
| 6 | |||
| 7 | AUTHOR: Juan Lorenzo (Perl module only) | ||
| 8 | |||
| 9 | DATE: | ||
| 10 | |||
| 11 | DESCRIPTION: | ||
| 12 | |||
| 13 | Version: | ||
| 14 | |||
| 15 | =head2 USE | ||
| 16 | |||
| 17 | =head3 NOTES | ||
| 18 | |||
| 19 | =head4 Examples | ||
| 20 | |||
| 21 | =head2 SYNOPSIS | ||
| 22 | |||
| 23 | =head3 SEISMIC UNIX NOTES | ||
| 24 | PSLABEL - output PostScript file consisting of a single TEXT string | ||
| 25 | |||
| 26 | on a specified background. (Use with psmerge to label plots.) | ||
| 27 | |||
| 28 | |||
| 29 | |||
| 30 | pslabel t= [t=] [optional parameters] > epsfile | ||
| 31 | |||
| 32 | |||
| 33 | |||
| 34 | Required Parameters (can have multiple specifications to mix fonts): | ||
| 35 | |||
| 36 | t= text string to write to output | ||
| 37 | |||
| 38 | |||
| 39 | |||
| 40 | Optional Parameters: | ||
| 41 | |||
| 42 | f=Times-Bold font for text string | ||
| 43 | |||
| 44 | (multiple specifications for each t) | ||
| 45 | |||
| 46 | size=30 size of characters in points (72 points/inch) | ||
| 47 | |||
| 48 | tcolor=black color of text string | ||
| 49 | |||
| 50 | bcolor=white color of background box | ||
| 51 | |||
| 52 | nsub=0 number of characters to subtract when | ||
| 53 | |||
| 54 | computing size of background box (not all | ||
| 55 | |||
| 56 | characters are the same size so the | ||
| 57 | |||
| 58 | background box may be too big at times.) | ||
| 59 | |||
| 60 | |||
| 61 | |||
| 62 | Example: | ||
| 63 | |||
| 64 | pslabel t="(a) " f=Times-Bold t="h" f=Symbol t="=0.04" nsub=3 > epsfile | ||
| 65 | |||
| 66 | |||
| 67 | |||
| 68 | This example yields the PostScript equivalent of the string | ||
| 69 | |||
| 70 | (written here in LaTeX notation) $ (a)\\; \\eta=0.04 $ | ||
| 71 | |||
| 72 | |||
| 73 | |||
| 74 | Notes: | ||
| 75 | |||
| 76 | This program produces a (color if desired) PostScript text string that | ||
| 77 | |||
| 78 | can be positioned and pasted on a PostScript plot using psmerge | ||
| 79 | |||
| 80 | see selfdoc of psmerge for further information. | ||
| 81 | |||
| 82 | |||
| 83 | |||
| 84 | Possible fonts: Helvetica, Helvetica-Oblique, Helvetica-Bold, | ||
| 85 | |||
| 86 | Helvetica-BoldOblique,Times-Roman,Times-Italic,Times-Bold, | ||
| 87 | |||
| 88 | Times-BoldItalic,Courier,Courier-Bold,Courier-Oblique, | ||
| 89 | |||
| 90 | Courier-BoldOblique,Symbol | ||
| 91 | |||
| 92 | |||
| 93 | |||
| 94 | Possible colors: greenyellow,yellow,goldenrod,dandelion,apricot, | ||
| 95 | |||
| 96 | peach,melon,yelloworange,orange,burntorange,bittersweet,redorange, | ||
| 97 | |||
| 98 | mahogany,maroon,brickred,red,orangered,rubinered,wildstrawberry, | ||
| 99 | |||
| 100 | salmon,carnationpink,magenta,violetred,rhodamine,mulberry,redviolet, | ||
| 101 | |||
| 102 | fuchsia,lavender,thistle,orchid,darkorchid,purple,plum,violet,royalpurple, | ||
| 103 | |||
| 104 | blueviolet,periwinkle,cadetblue,cornflowerblue,midnightblue,naveblue, | ||
| 105 | |||
| 106 | royalblue,blue,cerulean,cyan,processblue,skyblue,turquoise,tealblue, | ||
| 107 | |||
| 108 | aquamarine,bluegreen,emerald,junglegreen,seagreen,green,forestgreen, | ||
| 109 | |||
| 110 | pinegreen,limegreen,yellowgreen,springgreen,olivegreen,rawsienna,sepia, | ||
| 111 | |||
| 112 | brown,tan,white,black,gray | ||
| 113 | |||
| 114 | |||
| 115 | |||
| 116 | All color specifications may also be made in X Window style Hex format | ||
| 117 | |||
| 118 | example: tcolor=#255 | ||
| 119 | |||
| 120 | |||
| 121 | |||
| 122 | Legal font names are: | ||
| 123 | |||
| 124 | AvantGarde-Book AvantGarde-BookOblique AvantGarde-Demi AvantGarde-DemiOblique" | ||
| 125 | |||
| 126 | Bookman-Demi Bookman-DemiItalic Bookman-Light Bookman-LightItalic | ||
| 127 | |||
| 128 | Courier Courier-Bold Courier-BoldOblique Courier-Oblique | ||
| 129 | |||
| 130 | Helvetica Helvetica-Bold Helvetica-BoldOblique Helvetica-Oblique | ||
| 131 | |||
| 132 | Helvetica-Narrow Helvetica-Narrow-Bold Helvetica-Narrow-BoldOblique | ||
| 133 | |||
| 134 | Helvetica-Narrow-Oblique NewCentrySchlbk-Bold" | ||
| 135 | |||
| 136 | NewCenturySchlbk-BoldItalic NewCenturySchlbk-Roman Palatino-Bold | ||
| 137 | |||
| 138 | Palatino-BoldItalic Palatino-Italics Palatino-Roman | ||
| 139 | |||
| 140 | SanSerif-Bold SanSerif-BoldItalic SanSerif-Roman | ||
| 141 | |||
| 142 | Symbol Times-Bold Times-BoldItalic | ||
| 143 | |||
| 144 | Times-Roman Times-Italic ZapfChancery-MediumItalic | ||
| 145 | |||
| 146 | |||
| 147 | |||
| 148 | |||
| 149 | |||
| 150 | |||
| 151 | |||
| 152 | |||
| 153 | |||
| 154 | Author: John E. Anderson, Visiting Scientist from Mobil, 1994 | ||
| 155 | |||
| 156 | |||
| 157 | |||
| 158 | =head2 User's notes (Juan Lorenzo) | ||
| 159 | untested | ||
| 160 | |||
| 161 | =cut | ||
| 162 | |||
| 163 | |||
| 164 | =head2 CHANGES and their DATES | ||
| 165 | |||
| 166 | =cut | ||
| 167 | |||
| 168 | use Moose; | ||
| 169 | our $VERSION = '0.0.1'; | ||
| 170 | |||
| 171 | |||
| 172 | =head2 Import packages | ||
| 173 | |||
| 174 | =cut | ||
| 175 | |||
| 176 | use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants'; | ||
| 177 | |||
| 178 | use App::SeismicUnixGui::misc::SeismicUnix qw($in $out $on $go $to $suffix_ascii $off $suffix_su $suffix_bin); | ||
| 179 | use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config'; | ||
| 180 | |||
| 181 | |||
| 182 | =head2 instantiation of packages | ||
| 183 | |||
| 184 | =cut | ||
| 185 | |||
| 186 | my $get = L_SU_global_constants->new(); | ||
| 187 | my $Project = Project_config->new(); | ||
| 188 | my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU(); | ||
| 189 | my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN(); | ||
| 190 | my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT(); | ||
| 191 | |||
| 192 | my $var = $get->var(); | ||
| 193 | my $on = $var->{_on}; | ||
| 194 | my $off = $var->{_off}; | ||
| 195 | my $true = $var->{_true}; | ||
| 196 | my $false = $var->{_false}; | ||
| 197 | my $empty_string = $var->{_empty_string}; | ||
| 198 | |||
| 199 | =head2 Encapsulated | ||
| 200 | hash of private variables | ||
| 201 | |||
| 202 | =cut | ||
| 203 | |||
| 204 | my $pslabel = { | ||
| 205 | _bcolor => '', | ||
| 206 | _eta => '', | ||
| 207 | _f => '', | ||
| 208 | _nsub => '', | ||
| 209 | _size => '', | ||
| 210 | _t => '', | ||
| 211 | _tcolor => '', | ||
| 212 | _Step => '', | ||
| 213 | _note => '', | ||
| 214 | |||
| 215 | }; | ||
| 216 | |||
| 217 | =head2 sub Step | ||
| 218 | |||
| 219 | collects switches and assembles bash instructions | ||
| 220 | by adding the program name | ||
| 221 | |||
| 222 | =cut | ||
| 223 | |||
| 224 | sub Step { | ||
| 225 | |||
| 226 | $pslabel->{_Step} = 'pslabel'.$pslabel->{_Step}; | ||
| 227 | return ( $pslabel->{_Step} ); | ||
| 228 | |||
| 229 | } | ||
| 230 | |||
| 231 | |||
| 232 | =head2 sub note | ||
| 233 | |||
| 234 | collects switches and assembles bash instructions | ||
| 235 | by adding the program name | ||
| 236 | |||
| 237 | =cut | ||
| 238 | |||
| 239 | sub note { | ||
| 240 | |||
| 241 | $pslabel->{_note} = 'pslabel'.$pslabel->{_note}; | ||
| 242 | return ( $pslabel->{_note} ); | ||
| 243 | |||
| 244 | } | ||
| 245 | |||
| 246 | |||
| 247 | |||
| 248 | =head2 sub clear | ||
| 249 | |||
| 250 | =cut | ||
| 251 | |||
| 252 | sub clear { | ||
| 253 | |||
| 254 | $pslabel->{_bcolor} = ''; | ||
| 255 | $pslabel->{_eta} = ''; | ||
| 256 | $pslabel->{_f} = ''; | ||
| 257 | $pslabel->{_nsub} = ''; | ||
| 258 | $pslabel->{_size} = ''; | ||
| 259 | $pslabel->{_t} = ''; | ||
| 260 | $pslabel->{_tcolor} = ''; | ||
| 261 | $pslabel->{_Step} = ''; | ||
| 262 | $pslabel->{_note} = ''; | ||
| 263 | } | ||
| 264 | |||
| 265 | |||
| 266 | =head2 sub bcolor | ||
| 267 | |||
| 268 | |||
| 269 | =cut | ||
| 270 | |||
| 271 | sub bcolor { | ||
| 272 | |||
| 273 | my ( $self,$bcolor ) = @_; | ||
| 274 | if ( $bcolor ne $empty_string ) { | ||
| 275 | |||
| 276 | $pslabel->{_bcolor} = $bcolor; | ||
| 277 | $pslabel->{_note} = $pslabel->{_note}.' bcolor='.$pslabel->{_bcolor}; | ||
| 278 | $pslabel->{_Step} = $pslabel->{_Step}.' bcolor='.$pslabel->{_bcolor}; | ||
| 279 | |||
| 280 | } else { | ||
| 281 | print("pslabel, bcolor, missing bcolor,\n"); | ||
| 282 | } | ||
| 283 | } | ||
| 284 | |||
| 285 | |||
| 286 | =head2 sub eta | ||
| 287 | |||
| 288 | |||
| 289 | =cut | ||
| 290 | |||
| 291 | sub eta { | ||
| 292 | |||
| 293 | my ( $self,$eta ) = @_; | ||
| 294 | if ( $eta ne $empty_string ) { | ||
| 295 | |||
| 296 | $pslabel->{_eta} = $eta; | ||
| 297 | $pslabel->{_note} = $pslabel->{_note}.' eta='.$pslabel->{_eta}; | ||
| 298 | $pslabel->{_Step} = $pslabel->{_Step}.' eta='.$pslabel->{_eta}; | ||
| 299 | |||
| 300 | } else { | ||
| 301 | print("pslabel, eta, missing eta,\n"); | ||
| 302 | } | ||
| 303 | } | ||
| 304 | |||
| 305 | |||
| 306 | =head2 sub f | ||
| 307 | |||
| 308 | |||
| 309 | =cut | ||
| 310 | |||
| 311 | sub f { | ||
| 312 | |||
| 313 | my ( $self,$f ) = @_; | ||
| 314 | if ( $f ne $empty_string ) { | ||
| 315 | |||
| 316 | $pslabel->{_f} = $f; | ||
| 317 | $pslabel->{_note} = $pslabel->{_note}.' f='.$pslabel->{_f}; | ||
| 318 | $pslabel->{_Step} = $pslabel->{_Step}.' f='.$pslabel->{_f}; | ||
| 319 | |||
| 320 | } else { | ||
| 321 | print("pslabel, f, missing f,\n"); | ||
| 322 | } | ||
| 323 | } | ||
| 324 | |||
| 325 | |||
| 326 | =head2 sub nsub | ||
| 327 | |||
| 328 | |||
| 329 | =cut | ||
| 330 | |||
| 331 | sub nsub { | ||
| 332 | |||
| 333 | my ( $self,$nsub ) = @_; | ||
| 334 | if ( $nsub ne $empty_string ) { | ||
| 335 | |||
| 336 | $pslabel->{_nsub} = $nsub; | ||
| 337 | $pslabel->{_note} = $pslabel->{_note}.' nsub='.$pslabel->{_nsub}; | ||
| 338 | $pslabel->{_Step} = $pslabel->{_Step}.' nsub='.$pslabel->{_nsub}; | ||
| 339 | |||
| 340 | } else { | ||
| 341 | print("pslabel, nsub, missing nsub,\n"); | ||
| 342 | } | ||
| 343 | } | ||
| 344 | |||
| 345 | |||
| 346 | =head2 sub size | ||
| 347 | |||
| 348 | |||
| 349 | =cut | ||
| 350 | |||
| 351 | sub size { | ||
| 352 | |||
| 353 | my ( $self,$size ) = @_; | ||
| 354 | if ( $size ne $empty_string ) { | ||
| 355 | |||
| 356 | $pslabel->{_size} = $size; | ||
| 357 | $pslabel->{_note} = $pslabel->{_note}.' size='.$pslabel->{_size}; | ||
| 358 | $pslabel->{_Step} = $pslabel->{_Step}.' size='.$pslabel->{_size}; | ||
| 359 | |||
| 360 | } else { | ||
| 361 | print("pslabel, size, missing size,\n"); | ||
| 362 | } | ||
| 363 | } | ||
| 364 | |||
| 365 | |||
| 366 | =head2 sub t | ||
| 367 | |||
| 368 | |||
| 369 | =cut | ||
| 370 | |||
| 371 | sub t { | ||
| 372 | |||
| 373 | my ( $self,$t ) = @_; | ||
| 374 | if ( $t ne $empty_string ) { | ||
| 375 | |||
| 376 | $pslabel->{_t} = $t; | ||
| 377 | $pslabel->{_note} = $pslabel->{_note}.' t='.$pslabel->{_t}; | ||
| 378 | $pslabel->{_Step} = $pslabel->{_Step}.' t='.$pslabel->{_t}; | ||
| 379 | |||
| 380 | } else { | ||
| 381 | print("pslabel, t, missing t,\n"); | ||
| 382 | } | ||
| 383 | } | ||
| 384 | |||
| 385 | |||
| 386 | =head2 sub tcolor | ||
| 387 | |||
| 388 | |||
| 389 | =cut | ||
| 390 | |||
| 391 | sub tcolor { | ||
| 392 | |||
| 393 | my ( $self,$tcolor ) = @_; | ||
| 394 | if ( $tcolor ne $empty_string ) { | ||
| 395 | |||
| 396 | $pslabel->{_tcolor} = $tcolor; | ||
| 397 | $pslabel->{_note} = $pslabel->{_note}.' tcolor='.$pslabel->{_tcolor}; | ||
| 398 | $pslabel->{_Step} = $pslabel->{_Step}.' tcolor='.$pslabel->{_tcolor}; | ||
| 399 | |||
| 400 | } else { | ||
| 401 | print("pslabel, tcolor, missing tcolor,\n"); | ||
| 402 | } | ||
| 403 | } | ||
| 404 | |||
| 405 | |||
| 406 | =head2 sub get_max_index | ||
| 407 | |||
| 408 | max index = number of input variables -1 | ||
| 409 | |||
| 410 | =cut | ||
| 411 | |||
| 412 | sub get_max_index { | ||
| 413 | my ($self) = @_; | ||
| 414 | my $max_index = 6; | ||
| 415 | |||
| 416 | return($max_index); | ||
| 417 | } | ||
| 418 | |||
| 419 | |||
| 420 | 1; |