| 1 | package LaTeX::PGF::Diagram2D; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use 5.000000; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use POSIX; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 1 | our @ISA = qw(); | |||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 1 | require LaTeX::PGF::Diagram2D::Axis; | |||||||||||||||||||||||||||
| 12 | 1 | require LaTeX::PGF::Diagram2D::Plot; | |||||||||||||||||||||||||||
| 13 | 1 | require LaTeX::PGF::Diagram2D::NumberPrinter; | |||||||||||||||||||||||||||
| 14 | 1 | require LaTeX::PGF::Diagram2D::Label; | |||||||||||||||||||||||||||
| 15 | 1 | require LaTeX::PGF::Diagram2D::Polyline; | |||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 1 | our $VERSION = '1.02'; | |||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | # Preloaded methods go here. | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | sub new | ||||||||||||||||||||||||||||
| 25 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 26 | 0 | my $self = undef; | |||||||||||||||||||||||||||
| 27 | 0 | ▶ | if($#_ < 2) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 28 | 0 | croak "Usage: LaTeX::PGF::Diagram2D->new(width,height)"; | |||||||||||||||||||||||||||
| 29 | } else { | ||||||||||||||||||||||||||||
| 30 | 0 | my $class = shift; | |||||||||||||||||||||||||||
| 31 | 0 | my $width = shift; | |||||||||||||||||||||||||||
| 32 | 0 | my $height = shift; | |||||||||||||||||||||||||||
| 33 | 0 | my @pl; | |||||||||||||||||||||||||||
| 34 | my @co; | ||||||||||||||||||||||||||||
| 35 | 0 | my $ab = LaTeX::PGF::Diagram2D::Axis->new(); $ab->{'n'} = 'b'; | |||||||||||||||||||||||||||
| 36 | 0 | my $al = LaTeX::PGF::Diagram2D::Axis->new(); $al->{'n'} = 'l'; | |||||||||||||||||||||||||||
| 37 | 0 | my $ar = LaTeX::PGF::Diagram2D::Axis->new(); $ar->{'n'} = 'r'; | |||||||||||||||||||||||||||
| 38 | 0 | my $at = LaTeX::PGF::Diagram2D::Axis->new(); $at->{'n'} = 't'; | |||||||||||||||||||||||||||
| 39 | 0 | $ab->{'used'} = 1; | |||||||||||||||||||||||||||
| 40 | 0 | $al->{'used'} = 1; | |||||||||||||||||||||||||||
| 41 | 0 | $self = { | |||||||||||||||||||||||||||
| 42 | 'type' => 0, # Type: 0=grid, 1=quantitative, 2=qualitative | ||||||||||||||||||||||||||||
| 43 | 'units' => 0, # Units: 0=cm, 1=inches, 2=bp | ||||||||||||||||||||||||||||
| 44 | 'w' => $width, # Graph width | ||||||||||||||||||||||||||||
| 45 | 'h' => $height, # Graph height | ||||||||||||||||||||||||||||
| 46 | 'p' => \@pl, # Plots in the diagram | ||||||||||||||||||||||||||||
| 47 | 'np' => 0, # Number of plots in array above | ||||||||||||||||||||||||||||
| 48 | 'b' => $ab, # Bottom x axis | ||||||||||||||||||||||||||||
| 49 | 'l' => $al, # Left y axis | ||||||||||||||||||||||||||||
| 50 | 'r' => $ar, # Right y axis | ||||||||||||||||||||||||||||
| 51 | 't' => $at, # Top x axis | ||||||||||||||||||||||||||||
| 52 | 'texpre' => undef, # Additional LaTeX preamble lines | ||||||||||||||||||||||||||||
| 53 | 'fs' => 10.0, # Font size | ||||||||||||||||||||||||||||
| 54 | 'decsgn' => ',', # Decimal sign | ||||||||||||||||||||||||||||
| 55 | 'contents' => \@co, # Additional contents | ||||||||||||||||||||||||||||
| 56 | 'nco' => 0, # Number of elements in array above | ||||||||||||||||||||||||||||
| 57 | 'x0' => 0.0, | ||||||||||||||||||||||||||||
| 58 | 'x1' => 0.0, | ||||||||||||||||||||||||||||
| 59 | 'x2' => 0.0, | ||||||||||||||||||||||||||||
| 60 | 'x3' => 0.0, | ||||||||||||||||||||||||||||
| 61 | 'x4' => 0.0, | ||||||||||||||||||||||||||||
| 62 | 'x5' => 0.0, | ||||||||||||||||||||||||||||
| 63 | 'x6' => 0.0, | ||||||||||||||||||||||||||||
| 64 | 'x7' => 0.0, | ||||||||||||||||||||||||||||
| 65 | 'y0' => 0.0, | ||||||||||||||||||||||||||||
| 66 | 'y1' => 0.0, | ||||||||||||||||||||||||||||
| 67 | 'y2' => 0.0, | ||||||||||||||||||||||||||||
| 68 | 'y3' => 0.0, | ||||||||||||||||||||||||||||
| 69 | 'y4' => 0.0, | ||||||||||||||||||||||||||||
| 70 | 'y5' => 0.0, | ||||||||||||||||||||||||||||
| 71 | 'y6' => 0.0, | ||||||||||||||||||||||||||||
| 72 | 'y7' => 0.0, | ||||||||||||||||||||||||||||
| 73 | 'x0bp' => 0.0, | ||||||||||||||||||||||||||||
| 74 | 'x1bp' => 0.0, | ||||||||||||||||||||||||||||
| 75 | 'x2bp' => 0.0, | ||||||||||||||||||||||||||||
| 76 | 'x3bp' => 0.0, | ||||||||||||||||||||||||||||
| 77 | 'x4bp' => 0.0, | ||||||||||||||||||||||||||||
| 78 | 'x5bp' => 0.0, | ||||||||||||||||||||||||||||
| 79 | 'x6bp' => 0.0, | ||||||||||||||||||||||||||||
| 80 | 'x7bp' => 0.0, | ||||||||||||||||||||||||||||
| 81 | 'y0bp' => 0.0, | ||||||||||||||||||||||||||||
| 82 | 'y1bp' => 0.0, | ||||||||||||||||||||||||||||
| 83 | 'y2bp' => 0.0, | ||||||||||||||||||||||||||||
| 84 | 'y3bp' => 0.0, | ||||||||||||||||||||||||||||
| 85 | 'y4bp' => 0.0, | ||||||||||||||||||||||||||||
| 86 | 'y5bp' => 0.0, | ||||||||||||||||||||||||||||
| 87 | 'y6bp' => 0.0, | ||||||||||||||||||||||||||||
| 88 | 'y7bp' => 0.0, | ||||||||||||||||||||||||||||
| 89 | 'f1' => undef, # Output file handle | ||||||||||||||||||||||||||||
| 90 | 'fn1' => undef, # LaTeX output file name | ||||||||||||||||||||||||||||
| 91 | 'ftf' => 0, # Flag: Full LaTeX file | ||||||||||||||||||||||||||||
| 92 | 'debug' => 0, # Debugging | ||||||||||||||||||||||||||||
| 93 | 'pgf_c' => undef, # Current color | ||||||||||||||||||||||||||||
| 94 | 'pgf_w' => undef, # Current linewidth | ||||||||||||||||||||||||||||
| 95 | }; | ||||||||||||||||||||||||||||
| 96 | 0 | bless($self, $class); | |||||||||||||||||||||||||||
| 97 | 0 | $ab->set_linear(0.0, $width)->set_grid_step(1.0)->set_tic_step(1.0); | |||||||||||||||||||||||||||
| 98 | 0 | $al->set_linear(0.0, $height)->set_grid_step(1.0)->set_tic_step(1.0); | |||||||||||||||||||||||||||
| 99 | 0 | $ar->set_linear(0.0, $height); | |||||||||||||||||||||||||||
| 100 | 0 | $at->set_linear(0.0, $width); | |||||||||||||||||||||||||||
| 101 | 0 | $ab->{'dg'} = $self; $al->{'dg'} = $self; | |||||||||||||||||||||||||||
| 102 | 0 | $ar->{'dg'} = $self; $at->{'dg'} = $self; | |||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||
| 104 | 0 | return $self; | |||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||
| 109 | sub rd | ||||||||||||||||||||||||||||
| 110 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
rd: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 111 | 0 | my $back = undef; | |||||||||||||||||||||||||||
| 112 | 0 | ▶ | if($#_ < 2) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 113 | 0 | croak "Usage: \$diagram->rd(value,digits)"; | |||||||||||||||||||||||||||
| 114 | } else { | ||||||||||||||||||||||||||||
| 115 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 116 | 0 | $back = shift; | |||||||||||||||||||||||||||
| 117 | 0 | my $digits = shift; | |||||||||||||||||||||||||||
| 118 | 0 | my $i = 0; | |||||||||||||||||||||||||||
| 119 | 0 | ▶ | for($i = 0; $i < $digits; $i++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 120 | 0 | $back = 10.0 * $back; | |||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||
| 122 | 0 | $back = floor($back + 0.5); | |||||||||||||||||||||||||||
| 123 | 0 | ▶ | for($i = 0; $i < $digits; $i++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 124 | 0 | $back = $back / 10.0; | |||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||
| 127 | 0 | return $back; | |||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||
| 132 | sub write_tex_coord | ||||||||||||||||||||||||||||
| 133 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
write_tex_coord: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 134 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 135 | 0 | my $value = shift; | |||||||||||||||||||||||||||
| 136 | 0 | my $fh = $self->{'f1'}; | |||||||||||||||||||||||||||
| 137 | 0 | $value = $self->rd($value, 5); | |||||||||||||||||||||||||||
| 138 | 0 | my $t = sprintf("%g", $value); | |||||||||||||||||||||||||||
| 139 | # ##### Exponentialschreibweise deaktivieren | ||||||||||||||||||||||||||||
| 140 | 0 | print $fh $t; | |||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||
| 145 | sub write_point | ||||||||||||||||||||||||||||
| 146 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
write_point: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 147 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 148 | 0 | my $x = shift; | |||||||||||||||||||||||||||
| 149 | 0 | my $y = shift; | |||||||||||||||||||||||||||
| 150 | 0 | my $fh = $self->{'f1'}; | |||||||||||||||||||||||||||
| 151 | 0 | print $fh "\\pgfpoint{"; | |||||||||||||||||||||||||||
| 152 | 0 | $self->write_tex_coord($x); | |||||||||||||||||||||||||||
| 153 | 0 | print $fh "bp}{"; | |||||||||||||||||||||||||||
| 154 | 0 | $self->write_tex_coord($y); | |||||||||||||||||||||||||||
| 155 | 0 | print $fh "bp}"; | |||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||
| 160 | sub prepare_for_output | ||||||||||||||||||||||||||||
| 161 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
prepare_for_output: not called CC=15 SCAR=54.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 162 | 0 | my $back = undef; | |||||||||||||||||||||||||||
| 163 | 0 | ▶ | if($#_ < 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 164 | 0 | croak "Usage: \$diagram->prepare_for_output()"; | |||||||||||||||||||||||||||
| 165 | } else { | ||||||||||||||||||||||||||||
| 166 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 167 | 0 | $back = 1; | |||||||||||||||||||||||||||
| 168 | 0 | $self->{'b'}->correct_if_necessary($self, 0, $self->{'debug'}); | |||||||||||||||||||||||||||
| 169 | 0 | $self->{'l'}->correct_if_necessary($self, 1, $self->{'debug'}); | |||||||||||||||||||||||||||
| 170 | 0 | $self->{'r'}->correct_if_necessary($self, 1, $self->{'debug'}); | |||||||||||||||||||||||||||
| 171 | 0 | $self->{'t'}->correct_if_necessary($self, 0, $self->{'debug'}); | |||||||||||||||||||||||||||
| 172 | 0 | $self->{'x0'} = 0.0; | |||||||||||||||||||||||||||
| 173 | 0 | $self->{'x3'} = $self->{'l'}->{'bo'}; | |||||||||||||||||||||||||||
| 174 | 0 | $self->{'x2'} = $self->{'x3'}; $self->{'x1'} = $self->{'x3'}; | |||||||||||||||||||||||||||
| 175 | 0 | ▶ | if($self->{'l'}->{'to'} > 0.0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 176 | 0 | $self->{'x2'} = $self->{'x3'} - $self->{'l'}->{'to'}; | |||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||
| 178 | 0 | ▶ | if($self->{'l'}->{'lo'} > 0.0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 179 | 0 | $self->{'x1'} = $self->{'x3'} - $self->{'l'}->{'lo'}; | |||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||
| 181 | 0 | $self->{'x4'} = $self->{'x3'} + $self->{'w'}; | |||||||||||||||||||||||||||
| 182 | 0 | $self->{'x5'} = $self->{'x4'}; $self->{'x6'} = $self->{'x4'}; | |||||||||||||||||||||||||||
| 183 | 0 | ▶ | if($self->{'r'}->{'to'} > 0.0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 184 | 0 | $self->{'x5'} = $self->{'x4'} + $self->{'r'}->{'to'}; | |||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||
| 186 | 0 | ▶ | if($self->{'r'}->{'lo'} > 0.0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 187 | 0 | $self->{'x6'} = $self->{'x4'} + $self->{'r'}->{'lo'}; | |||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||
| 189 | 0 | $self->{'x7'} = $self->{'x4'} + $self->{'r'}->{'bo'}; | |||||||||||||||||||||||||||
| 190 | 0 | $self->{'y0'} = 0.0; | |||||||||||||||||||||||||||
| 191 | 0 | $self->{'y3'} = $self->{'b'}->{'bo'}; | |||||||||||||||||||||||||||
| 192 | 0 | $self->{'y1'} = $self->{'y3'}; $self->{'y2'} = $self->{'y3'}; | |||||||||||||||||||||||||||
| 193 | 0 | ▶ | if($self->{'b'}->{'to'} > 0.0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 194 | 0 | $self->{'y2'} = $self->{'y3'} - $self->{'b'}->{'to'}; | |||||||||||||||||||||||||||
| 195 | 0 | ▶ | if($self->{'units'} == 1) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 196 | 0 | $self->{'y2'} = $self->{'y2'} - ($self->{'fs'} / 72.27); | |||||||||||||||||||||||||||
| 197 | } else { | ||||||||||||||||||||||||||||
| 198 | 0 | ▶ | if($self->{'units'} == 2) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 199 | 0 | $self->{'y2'} = $self->{'y2'} - ((72.0 * $self->{'fs'}) / 72.27); | |||||||||||||||||||||||||||
| 200 | } else { | ||||||||||||||||||||||||||||
| 201 | 0 | $self->{'y2'} = $self->{'y2'} - ((2.54 * $self->{'fs'}) / 72.27); | |||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||
| 205 | 0 | ▶ | if($self->{'b'}->{'lo'} > 0.0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 206 | 0 | $self->{'y1'} = $self->{'y3'} - $self->{'b'}->{'lo'}; | |||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||
| 208 | 0 | $self->{'y4'} = $self->{'y3'} + $self->{'h'}; | |||||||||||||||||||||||||||
| 209 | 0 | $self->{'y5'} = $self->{'y4'}; $self->{'y6'} = $self->{'y4'}; | |||||||||||||||||||||||||||
| 210 | 0 | $self->{'y7'} = $self->{'y4'} + $self->{'t'}->{'bo'}; | |||||||||||||||||||||||||||
| 211 | 0 | ▶ | if($self->{'t'}->{'to'} > 0.0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 212 | 0 | $self->{'y5'} = $self->{'y4'} + $self->{'t'}->{'to'}; | |||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||
| 214 | 0 | ▶ | if($self->{'t'}->{'lo'} > 0.0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 215 | 0 | $self->{'y6'} = $self->{'y4'} + $self->{'t'}->{'lo'}; | |||||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||||
| 217 | 0 | my $scf; | |||||||||||||||||||||||||||
| 218 | 0 | ▶ | if($self->{'units'} == 1) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 219 | 0 | $scf = 72.0; | |||||||||||||||||||||||||||
| 220 | } else { | ||||||||||||||||||||||||||||
| 221 | 0 | ▶ | if($self->{'units'} == 2) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 222 | 0 | $scf = 1.0; | |||||||||||||||||||||||||||
| 223 | } else { | ||||||||||||||||||||||||||||
| 224 | 0 | $scf = 72.0 / 2.54; | |||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||
| 227 | 0 | $self->{'x0bp'} = $self->rd($scf * $self->{'x0'}, 5); | |||||||||||||||||||||||||||
| 228 | 0 | $self->{'x1bp'} = $self->rd($scf * $self->{'x1'}, 5); | |||||||||||||||||||||||||||
| 229 | 0 | $self->{'x2bp'} = $self->rd($scf * $self->{'x2'}, 5); | |||||||||||||||||||||||||||
| 230 | 0 | $self->{'x3bp'} = $self->rd($scf * $self->{'x3'}, 5); | |||||||||||||||||||||||||||
| 231 | 0 | $self->{'x4bp'} = $self->rd($scf * $self->{'x4'}, 5); | |||||||||||||||||||||||||||
| 232 | 0 | $self->{'x5bp'} = $self->rd($scf * $self->{'x5'}, 5); | |||||||||||||||||||||||||||
| 233 | 0 | $self->{'x6bp'} = $self->rd($scf * $self->{'x6'}, 5); | |||||||||||||||||||||||||||
| 234 | 0 | $self->{'x7bp'} = $self->rd($scf * $self->{'x7'}, 5); | |||||||||||||||||||||||||||
| 235 | 0 | $self->{'y0bp'} = $self->rd($scf * $self->{'y0'}, 5); | |||||||||||||||||||||||||||
| 236 | 0 | $self->{'y1bp'} = $self->rd($scf * $self->{'y1'}, 5); | |||||||||||||||||||||||||||
| 237 | 0 | $self->{'y2bp'} = $self->rd($scf * $self->{'y2'}, 5); | |||||||||||||||||||||||||||
| 238 | 0 | $self->{'y3bp'} = $self->rd($scf * $self->{'y3'}, 5); | |||||||||||||||||||||||||||
| 239 | 0 | $self->{'y4bp'} = $self->rd($scf * $self->{'y4'}, 5); | |||||||||||||||||||||||||||
| 240 | 0 | $self->{'y5bp'} = $self->rd($scf * $self->{'y5'}, 5); | |||||||||||||||||||||||||||
| 241 | 0 | $self->{'y6bp'} = $self->rd($scf * $self->{'y6'}, 5); | |||||||||||||||||||||||||||
| 242 | 0 | $self->{'y7bp'} = $self->rd($scf * $self->{'y7'}, 5); | |||||||||||||||||||||||||||
| 243 | # ##### Check and prepare | ||||||||||||||||||||||||||||
| 244 | 0 | ▶ | if($self->{'debug'}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 245 | 0 | print "DEBUG x0 = " . $self->{'x0'} . "\n"; | |||||||||||||||||||||||||||
| 246 | 0 | print "DEBUG x1 = " . $self->{'x1'} . "\n"; | |||||||||||||||||||||||||||
| 247 | 0 | print "DEBUG x2 = " . $self->{'x2'} . "\n"; | |||||||||||||||||||||||||||
| 248 | 0 | print "DEBUG x3 = " . $self->{'x3'} . "\n"; | |||||||||||||||||||||||||||
| 249 | 0 | print "DEBUG x4 = " . $self->{'x4'} . "\n"; | |||||||||||||||||||||||||||
| 250 | 0 | print "DEBUG x5 = " . $self->{'x5'} . "\n"; | |||||||||||||||||||||||||||
| 251 | 0 | print "DEBUG x6 = " . $self->{'x6'} . "\n"; | |||||||||||||||||||||||||||
| 252 | 0 | print "DEBUG x7 = " . $self->{'x7'} . "\n"; | |||||||||||||||||||||||||||
| 253 | 0 | print "DEBUG y0 = " . $self->{'y0'} . "\n"; | |||||||||||||||||||||||||||
| 254 | 0 | print "DEBUG y1 = " . $self->{'y1'} . "\n"; | |||||||||||||||||||||||||||
| 255 | 0 | print "DEBUG y2 = " . $self->{'y2'} . "\n"; | |||||||||||||||||||||||||||
| 256 | 0 | print "DEBUG y3 = " . $self->{'y3'} . "\n"; | |||||||||||||||||||||||||||
| 257 | 0 | print "DEBUG y4 = " . $self->{'y4'} . "\n"; | |||||||||||||||||||||||||||
| 258 | 0 | print "DEBUG y5 = " . $self->{'y5'} . "\n"; | |||||||||||||||||||||||||||
| 259 | 0 | print "DEBUG y6 = " . $self->{'y6'} . "\n"; | |||||||||||||||||||||||||||
| 260 | 0 | print "DEBUG y7 = " . $self->{'y7'} . "\n"; | |||||||||||||||||||||||||||
| 261 | 0 | print "DEBUG x0bp = " . $self->{'x0bp'} . "\n"; | |||||||||||||||||||||||||||
| 262 | 0 | print "DEBUG x1bp = " . $self->{'x1bp'} . "\n"; | |||||||||||||||||||||||||||
| 263 | 0 | print "DEBUG x2bp = " . $self->{'x2bp'} . "\n"; | |||||||||||||||||||||||||||
| 264 | 0 | print "DEBUG x3bp = " . $self->{'x3bp'} . "\n"; | |||||||||||||||||||||||||||
| 265 | 0 | print "DEBUG x4bp = " . $self->{'x4bp'} . "\n"; | |||||||||||||||||||||||||||
| 266 | 0 | print "DEBUG x5bp = " . $self->{'x5bp'} . "\n"; | |||||||||||||||||||||||||||
| 267 | 0 | print "DEBUG x6bp = " . $self->{'x6bp'} . "\n"; | |||||||||||||||||||||||||||
| 268 | 0 | print "DEBUG x7bp = " . $self->{'x7bp'} . "\n"; | |||||||||||||||||||||||||||
| 269 | 0 | print "DEBUG y0bp = " . $self->{'y0bp'} . "\n"; | |||||||||||||||||||||||||||
| 270 | 0 | print "DEBUG y1bp = " . $self->{'y1bp'} . "\n"; | |||||||||||||||||||||||||||
| 271 | 0 | print "DEBUG y2bp = " . $self->{'y2bp'} . "\n"; | |||||||||||||||||||||||||||
| 272 | 0 | print "DEBUG y3bp = " . $self->{'y3bp'} . "\n"; | |||||||||||||||||||||||||||
| 273 | 0 | print "DEBUG y4bp = " . $self->{'y4bp'} . "\n"; | |||||||||||||||||||||||||||
| 274 | 0 | print "DEBUG y5bp = " . $self->{'y5bp'} . "\n"; | |||||||||||||||||||||||||||
| 275 | 0 | print "DEBUG y6bp = " . $self->{'y6bp'} . "\n"; | |||||||||||||||||||||||||||
| 276 | 0 | print "DEBUG y7bp = " . $self->{'y7bp'} . "\n"; | |||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||
| 279 | 0 | return $back; | |||||||||||||||||||||||||||
| 280 | } | ||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||
| 284 | sub write_rect | ||||||||||||||||||||||||||||
| 285 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
write_rect: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 286 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 287 | 0 | my $x0 = shift; my $y0 = shift; my $x1 = shift; my $y1 = shift; | |||||||||||||||||||||||||||
| 288 | 0 | my $fh = $self->{'f1'}; | |||||||||||||||||||||||||||
| 289 | 0 | print $fh "\\pgfpathmoveto{"; | |||||||||||||||||||||||||||
| 290 | 0 | $self->write_point($x0, $y0); | |||||||||||||||||||||||||||
| 291 | 0 | print $fh "}\n\\pgfpathlineto{"; | |||||||||||||||||||||||||||
| 292 | 0 | $self->write_point($x1, $y0); | |||||||||||||||||||||||||||
| 293 | 0 | print $fh "}\n\\pgfpathlineto{"; | |||||||||||||||||||||||||||
| 294 | 0 | $self->write_point($x1, $y1); | |||||||||||||||||||||||||||
| 295 | 0 | print $fh "}\n\\pgfpathlineto{"; | |||||||||||||||||||||||||||
| 296 | 0 | $self->write_point($x0, $y1); | |||||||||||||||||||||||||||
| 297 | 0 | print $fh "}\n\\pgfpathclose\n"; | |||||||||||||||||||||||||||
| 298 | } | ||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||
| 303 | sub write_clip | ||||||||||||||||||||||||||||
| 304 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
write_clip: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 305 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 306 | 0 | my $x0 = shift; my $y0 = shift; my $x1 = shift; my $y1 = shift; | |||||||||||||||||||||||||||
| 307 | 0 | my $fh = $self->{'f1'}; | |||||||||||||||||||||||||||
| 308 | 0 | $self->write_rect($x0, $y0, $x1, $y1); | |||||||||||||||||||||||||||
| 309 | 0 | print $fh "\\pgfusepath{clip}\n"; | |||||||||||||||||||||||||||
| 310 | } | ||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||
| 313 | sub setlinewidth_mm | ||||||||||||||||||||||||||||
| 314 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
setlinewidth_mm: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 315 | 0 | my $self = undef; | |||||||||||||||||||||||||||
| 316 | 0 | ▶ | if($#_ < 1) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 317 | 0 | croak "Usage: \$diagram->setlinewidth_mm(value)"; | |||||||||||||||||||||||||||
| 318 | } else { | ||||||||||||||||||||||||||||
| 319 | 0 | $self = shift; my $value = shift; | |||||||||||||||||||||||||||
| 320 | 0 | my $fh = $self->{'f1'}; | |||||||||||||||||||||||||||
| 321 | 0 | $value = $value / 10.0; $value = $self->rd($value, 5); | |||||||||||||||||||||||||||
| 322 | 0 | my $mustprint = 1; | |||||||||||||||||||||||||||
| 323 | 0 | ▶ | if(defined($self->{'pgf_w'})) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 324 | 0 | ▶ | if($self->{'pgf_w'} eq "$value") { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 325 | 0 | $mustprint = 0; | |||||||||||||||||||||||||||
| 326 | } | ||||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||
| 328 | 0 | ▶ | if($mustprint) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 329 | 0 | print $fh "\\pgfsetlinewidth{" . $value . "cm}\n"; | |||||||||||||||||||||||||||
| 330 | 0 | $self->{'pgf_w'} = $value; | |||||||||||||||||||||||||||
| 331 | } | ||||||||||||||||||||||||||||
| 332 | } | ||||||||||||||||||||||||||||
| 333 | 0 | return $self; | |||||||||||||||||||||||||||
| 334 | } | ||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||
| 338 | sub set_color | ||||||||||||||||||||||||||||
| 339 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
set_color: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 340 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 341 | 0 | my $color = shift; | |||||||||||||||||||||||||||
| 342 | 0 | my $fh = $self->{'f1'}; | |||||||||||||||||||||||||||
| 343 | 0 | my $mustprint = 1; | |||||||||||||||||||||||||||
| 344 | 0 | ▶ | if(defined($self->{'pgf_c'})) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 345 | 0 | ▶ | if($self->{'pgf_c'} eq "$color") { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 346 | 0 | $mustprint = 0; | |||||||||||||||||||||||||||
| 347 | } | ||||||||||||||||||||||||||||
| 348 | } | ||||||||||||||||||||||||||||
| 349 | 0 | ▶ | if($mustprint) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 350 | 0 | print $fh "\\pgfsetcolor{$color}\n"; | |||||||||||||||||||||||||||
| 351 | 0 | $self->{'pgf_c'} = $color; | |||||||||||||||||||||||||||
| 352 | } | ||||||||||||||||||||||||||||
| 353 | 0 | return $self; | |||||||||||||||||||||||||||
| 354 | } | ||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||
| 358 | sub begin_pgfscope | ||||||||||||||||||||||||||||
| 359 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
begin_pgfscope: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 360 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 361 | 0 | my $fh = $self->{'f1'}; | |||||||||||||||||||||||||||
| 362 | 0 | print $fh "\\begin{pgfscope}\n"; | |||||||||||||||||||||||||||
| 363 | 0 | return $self; | |||||||||||||||||||||||||||
| 364 | } | ||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||
| 368 | sub end_pgfscope | ||||||||||||||||||||||||||||
| 369 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
end_pgfscope: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 370 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 371 | 0 | my $fh = $self->{'f1'}; | |||||||||||||||||||||||||||
| 372 | 0 | print $fh "\\end{pgfscope}\n"; | |||||||||||||||||||||||||||
| 373 | 0 | $self->{'pgf_c'} = undef; | |||||||||||||||||||||||||||
| 374 | 0 | $self->{'pgf_w'} = undef; | |||||||||||||||||||||||||||
| 375 | 0 | return $self; | |||||||||||||||||||||||||||
| 376 | } | ||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||
| 380 | sub draw_axis_grid | ||||||||||||||||||||||||||||
| 381 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
draw_axis_grid: not called CC=20 SCAR=60.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 382 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 383 | 0 | my $ax = shift; | |||||||||||||||||||||||||||
| 384 | 0 | my $xyflag = shift; | |||||||||||||||||||||||||||
| 385 | 0 | my $fh = $self->{'f1'}; | |||||||||||||||||||||||||||
| 386 | 0 | my $xs = $ax->{'min'}; my $xe = $ax->{'max'}; | |||||||||||||||||||||||||||
| 387 | 0 | my $st = $ax->{'gs'}; | |||||||||||||||||||||||||||
| 388 | 0 | ▶ | if($st > 0.0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 389 | 0 | ▶ | if($ax->{'min'} > $ax->{'max'}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 390 | 0 | $xs = $ax->{'max'}; $xe = $ax->{'min'}; | |||||||||||||||||||||||||||
| 391 | } | ||||||||||||||||||||||||||||
| 392 | 0 | my $x = $xs; my $num = 0; | |||||||||||||||||||||||||||
| 393 | 0 | my $mustprint = 1; my $co = 0.0; | |||||||||||||||||||||||||||
| 394 | 0 | ▶ | if($self->{'debug'}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 395 | 0 | print "DEBUG (1) xs=$xs xe=$xe st=$st x=$x\n"; | |||||||||||||||||||||||||||
| 396 | } | ||||||||||||||||||||||||||||
| 397 | 0 | ▶ | while(($x < $xe) && ($num < 1000)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$x < $xe and $num < 1000
MC/DC0%0/2
$x < $xe and $num < 1000
$x < $xe
$num < 1000
Truth table0%0/3
A and B
A= $x < $xeB= $num < 1000
| |||||||||||||||||||||||||||||
| 398 | 0 | ▶ | if($ax->{'t'}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 399 | 0 | ▶ | if($st > 1.0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 400 | 0 | $x = $x * $st; | |||||||||||||||||||||||||||
| 401 | } else { | ||||||||||||||||||||||||||||
| 402 | 0 | $x = $x / $st; | |||||||||||||||||||||||||||
| 403 | } | ||||||||||||||||||||||||||||
| 404 | } else { | ||||||||||||||||||||||||||||
| 405 | 0 | $x = $x + $st; | |||||||||||||||||||||||||||
| 406 | } | ||||||||||||||||||||||||||||
| 407 | 0 | ▶ | if($self->{'debug'}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 408 | 0 | print "DEBUG (2) xs=$xs xe=$xe st=$st x=$x\n"; | |||||||||||||||||||||||||||
| 409 | } | ||||||||||||||||||||||||||||
| 410 | 0 | $mustprint = 1; | |||||||||||||||||||||||||||
| 411 | 0 | ▶ | if($ax->{'t'}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 412 | 0 | ▶ | if($st > 1.0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 413 | 0 | ▶ | if($x < ($xs * sqrt($st))) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 414 | 0 | $mustprint = 0; | |||||||||||||||||||||||||||
| 415 | } else { | ||||||||||||||||||||||||||||
| 416 | 0 | ▶ | if($x > ($xe / sqrt($st))) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 417 | 0 | $mustprint = 0; | |||||||||||||||||||||||||||
| 418 | } | ||||||||||||||||||||||||||||
| 419 | } | ||||||||||||||||||||||||||||
| 420 | } else { | ||||||||||||||||||||||||||||
| 421 | 0 | ▶ | if($x < ($xs / sqrt($st))) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 422 | 0 | $mustprint = 0; | |||||||||||||||||||||||||||
| 423 | } else { | ||||||||||||||||||||||||||||
| 424 | 0 | ▶ | if($x < ($xs * sqrt($st))) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 425 | 0 | $mustprint = 0; | |||||||||||||||||||||||||||
| 426 | } | ||||||||||||||||||||||||||||
| 427 | } | ||||||||||||||||||||||||||||
| 428 | } | ||||||||||||||||||||||||||||
| 429 | } else { | ||||||||||||||||||||||||||||
| 430 | 0 | ▶ | if($x < ($xs + 0.5 * $st)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 431 | 0 | $mustprint = 0; | |||||||||||||||||||||||||||
| 432 | } else { | ||||||||||||||||||||||||||||
| 433 | 0 | ▶ | if($x > ($xe - 0.5 * $st)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 434 | 0 | $mustprint = 0; | |||||||||||||||||||||||||||
| 435 | } | ||||||||||||||||||||||||||||
| 436 | } | ||||||||||||||||||||||||||||
| 437 | } | ||||||||||||||||||||||||||||
| 438 | 0 | ▶ | if($mustprint) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 439 | 0 | my $co = $ax->value_to_coord($x); | |||||||||||||||||||||||||||
| 440 | 0 | print $fh "\\pgfpathmoveto{"; | |||||||||||||||||||||||||||
| 441 | 0 | ▶ | if($xyflag) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 442 | 0 | $self->write_point($self->{'x3bp'}, $co); | |||||||||||||||||||||||||||
| 443 | } else { | ||||||||||||||||||||||||||||
| 444 | 0 | $self->write_point($co, $self->{'y3bp'}); | |||||||||||||||||||||||||||
| 445 | } | ||||||||||||||||||||||||||||
| 446 | 0 | print $fh "}\n\\pgfpathlineto{"; | |||||||||||||||||||||||||||
| 447 | 0 | ▶ | if($xyflag) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 448 | 0 | $self->write_point($self->{'x4bp'}, $co); | |||||||||||||||||||||||||||
| 449 | } else { | ||||||||||||||||||||||||||||
| 450 | 0 | $self->write_point($co, $self->{'y4bp'}); | |||||||||||||||||||||||||||
| 451 | } | ||||||||||||||||||||||||||||
| 452 | 0 | print $fh "}\n\\pgfusepath{stroke}\n"; | |||||||||||||||||||||||||||
| 453 | } | ||||||||||||||||||||||||||||
| 454 | } | ||||||||||||||||||||||||||||
| 455 | } | ||||||||||||||||||||||||||||
| 456 | 0 | return $self; | |||||||||||||||||||||||||||
| 457 | } | ||||||||||||||||||||||||||||
| 458 | |||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||
| 460 | sub draw_grid | ||||||||||||||||||||||||||||
| 461 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
draw_grid: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 462 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 463 | 0 | $self->draw_axis_grid($self->{'b'}, 0); | |||||||||||||||||||||||||||
| 464 | 0 | $self->draw_axis_grid($self->{'l'}, 1); | |||||||||||||||||||||||||||
| 465 | 0 | return $self; | |||||||||||||||||||||||||||
| 466 | } | ||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||
| 470 | sub text_label_number | ||||||||||||||||||||||||||||
| 471 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
text_label_number: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 472 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 473 | 0 | my $x = shift; # X coordinate | |||||||||||||||||||||||||||
| 474 | 0 | my $y = shift; # Y coordinate | |||||||||||||||||||||||||||
| 475 | 0 | my $p = shift; # Position string | |||||||||||||||||||||||||||
| 476 | 0 | my $n = shift; # NumberPrinter | |||||||||||||||||||||||||||
| 477 | 0 | my $v = shift; # Value | |||||||||||||||||||||||||||
| 478 | 0 | my $vt; | |||||||||||||||||||||||||||
| 479 | my $pa; | ||||||||||||||||||||||||||||
| 480 | 0 | my $pb; | |||||||||||||||||||||||||||
| 481 | 0 | my $fh = $self->{'f1'}; | |||||||||||||||||||||||||||
| 482 | 0 | print $fh "\\pgftext[$p,at={"; | |||||||||||||||||||||||||||
| 483 | 0 | $self->write_point($x, $y); | |||||||||||||||||||||||||||
| 484 | 0 | print $fh "}]{"; | |||||||||||||||||||||||||||
| 485 | 0 | ▶ | if(defined($n)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 486 | 0 | $n->write_number($fh, $v); | |||||||||||||||||||||||||||
| 487 | } else { | ||||||||||||||||||||||||||||
| 488 | 0 | $vt = sprintf("%g", $v); | |||||||||||||||||||||||||||
| 489 | 0 | ▶ | if("$vt" =~ /(.*)\.(.*)/o) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 490 | 0 | $pa = $1; $pb = $2; | |||||||||||||||||||||||||||
| 491 | 0 | print $fh "$pa" . $self->{'decsgn'} . "$pb"; | |||||||||||||||||||||||||||
| 492 | } else { | ||||||||||||||||||||||||||||
| 493 | 0 | print $fh "$vt"; | |||||||||||||||||||||||||||
| 494 | } | ||||||||||||||||||||||||||||
| 495 | } | ||||||||||||||||||||||||||||
| 496 | 0 | print $fh "}\n"; | |||||||||||||||||||||||||||
| 497 | 0 | return $self; | |||||||||||||||||||||||||||
| 498 | } | ||||||||||||||||||||||||||||
| 499 | |||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||
| 501 | |||||||||||||||||||||||||||||
| 502 | sub text_label | ||||||||||||||||||||||||||||
| 503 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
text_label: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 504 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 505 | 0 | my $x = shift; # X coordinate | |||||||||||||||||||||||||||
| 506 | 0 | my $y = shift; # Y coordinate | |||||||||||||||||||||||||||
| 507 | 0 | my $p = shift; # Position string | |||||||||||||||||||||||||||
| 508 | 0 | my $t = shift; # NumberPrinter | |||||||||||||||||||||||||||
| 509 | 0 | my $fh = $self->{'f1'}; | |||||||||||||||||||||||||||
| 510 | 0 | print $fh "\\pgftext[$p,at={"; | |||||||||||||||||||||||||||
| 511 | 0 | $self->write_point($x, $y); | |||||||||||||||||||||||||||
| 512 | 0 | print $fh "}]{$t}\n"; | |||||||||||||||||||||||||||
| 513 | 0 | return $self; | |||||||||||||||||||||||||||
| 514 | } | ||||||||||||||||||||||||||||
| 515 | |||||||||||||||||||||||||||||
| 516 | |||||||||||||||||||||||||||||
| 517 | sub tics_for_axis | ||||||||||||||||||||||||||||
| 518 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
tics_for_axis: not called CC=44 SCAR=75.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 519 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 520 | 0 | my $ax = shift; | |||||||||||||||||||||||||||
| 521 | 0 | ▶ | if(($ax->{'used'}) && ($ax->{'ts'} > 0.0)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$ax->{"used"} and $ax->{"ts"} > 0
MC/DC0%0/2
$ax->{"used"} and $ax->{"ts"} > 0
$ax->{"used"}
$ax->{"ts"} > 0
Truth table0%0/3
A and B
A= $ax->{"used"}B= $ax->{"ts"} > 0
| |||||||||||||||||||||||||||||
| 522 | 0 | my $fh = $self->{'f1'}; | |||||||||||||||||||||||||||
| 523 | 0 | my $co = $self->{'y2bp'}; | |||||||||||||||||||||||||||
| 524 | 0 | my $c2 = 0.0; | |||||||||||||||||||||||||||
| 525 | 0 | my $xyflag = 0; | |||||||||||||||||||||||||||
| 526 | 0 | my $position = "base"; | |||||||||||||||||||||||||||
| 527 | 0 | my $xs = $ax->{'min'}; | |||||||||||||||||||||||||||
| 528 | 0 | my $xe = $ax->{'max'}; | |||||||||||||||||||||||||||
| 529 | 0 | my $st = $ax->{'ts'}; | |||||||||||||||||||||||||||
| 530 | 0 | my $num = 0; # Number of attempts | |||||||||||||||||||||||||||
| 531 | 0 | my $in = 0; # Inner values | |||||||||||||||||||||||||||
| 532 | 0 | my $ci = 0; # Current inner value | |||||||||||||||||||||||||||
| 533 | 0 | my $x = 0.0; # Current x to handle | |||||||||||||||||||||||||||
| 534 | 0 | my $cc = 1; # Flag: Can continue | |||||||||||||||||||||||||||
| 535 | 0 | my $ca = 0; # Flag: Candidate | |||||||||||||||||||||||||||
| 536 | 0 | my $mut = 0; # Flag: Must use this | |||||||||||||||||||||||||||
| 537 | 0 | my $np = LaTeX::PGF::Diagram2D::NumberPrinter->new(); | |||||||||||||||||||||||||||
| 538 | 0 | my $pnp = $np; | |||||||||||||||||||||||||||
| 539 | 0 | ▶ | if($ax->{'t'}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 540 | 0 | $pnp = undef; | |||||||||||||||||||||||||||
| 541 | } | ||||||||||||||||||||||||||||
| 542 | 0 | $np->init(); | |||||||||||||||||||||||||||
| 543 | 0 | ▶ | if($ax->{'n'} eq 'l') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 544 | 0 | $xyflag = 1; $co = $self->{'x2bp'}; $position = "right"; | |||||||||||||||||||||||||||
| 545 | } | ||||||||||||||||||||||||||||
| 546 | 0 | ▶ | if($ax->{'n'} eq 'r') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 547 | 0 | $xyflag = 1; $co = $self->{'x5bp'}; $position = "right"; | |||||||||||||||||||||||||||
| 548 | } | ||||||||||||||||||||||||||||
| 549 | 0 | ▶ | if($ax->{'n'} eq 't') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 550 | 0 | $co = $self->{'y5bp'}; | |||||||||||||||||||||||||||
| 551 | } | ||||||||||||||||||||||||||||
| 552 | 0 | ▶ | for(my $passno = 0; $passno < 3; $passno++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 553 | # first value | ||||||||||||||||||||||||||||
| 554 | 0 | ▶ | if($passno == 1) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 555 | 0 | $np->add_number($xs); | |||||||||||||||||||||||||||
| 556 | } | ||||||||||||||||||||||||||||
| 557 | 0 | ▶ | if($passno == 2) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 558 | 0 | $c2 = $ax->value_to_coord($xs); | |||||||||||||||||||||||||||
| 559 | 0 | ▶ | if($xyflag) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 560 | 0 | $self->text_label_number($co, $c2, $position, $pnp, $xs); | |||||||||||||||||||||||||||
| 561 | } else { | ||||||||||||||||||||||||||||
| 562 | 0 | $self->text_label_number($c2, $co, $position, $pnp, $xs); | |||||||||||||||||||||||||||
| 563 | } | ||||||||||||||||||||||||||||
| 564 | } | ||||||||||||||||||||||||||||
| 565 | # last value | ||||||||||||||||||||||||||||
| 566 | 0 | ▶ | if($passno == 1) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 567 | 0 | $np->add_number($xe); | |||||||||||||||||||||||||||
| 568 | } | ||||||||||||||||||||||||||||
| 569 | 0 | ▶ | if($passno == 2) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 570 | 0 | $c2 = $ax->value_to_coord($xe); | |||||||||||||||||||||||||||
| 571 | 0 | ▶ | if($xyflag) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 572 | 0 | $self->text_label_number($co, $c2, $position, $pnp, $xe); | |||||||||||||||||||||||||||
| 573 | } else { | ||||||||||||||||||||||||||||
| 574 | 0 | $self->text_label_number($c2, $co, $position, $pnp, $xe); | |||||||||||||||||||||||||||
| 575 | } | ||||||||||||||||||||||||||||
| 576 | } | ||||||||||||||||||||||||||||
| 577 | # values in the middle | ||||||||||||||||||||||||||||
| 578 | 0 | $x = $xs; $cc = 1; $num = 0; $ci = 0; | |||||||||||||||||||||||||||
| 579 | 0 | ▶ | while($cc) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 580 | 0 | ▶ | if($num++ > 1000) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 581 | 0 | $cc = 0; | |||||||||||||||||||||||||||
| 582 | } | ||||||||||||||||||||||||||||
| 583 | 0 | $ca = 0; | |||||||||||||||||||||||||||
| 584 | 0 | ▶ | if($xe > $xs) { # Normal scale | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 585 | 0 | ▶ | if($ax->{'t'}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 586 | 0 | ▶ | if($st > 1.0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 587 | 0 | $x = $x * $st; | |||||||||||||||||||||||||||
| 588 | 0 | ▶ | if($x > ($xs * sqrt($st))) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 589 | 0 | ▶ | if($x < ($xe / sqrt($st))) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 590 | 0 | $ca = 1; | |||||||||||||||||||||||||||
| 591 | } else { | ||||||||||||||||||||||||||||
| 592 | 0 | $cc = 0; | |||||||||||||||||||||||||||
| 593 | } | ||||||||||||||||||||||||||||
| 594 | } | ||||||||||||||||||||||||||||
| 595 | } else { | ||||||||||||||||||||||||||||
| 596 | 0 | $x = $x / $st; | |||||||||||||||||||||||||||
| 597 | 0 | ▶ | if($x > ($xs / sqrt($st))) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 598 | 0 | ▶ | if($x < ($xe * sqrt($st))) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 599 | 0 | $ca = 1; | |||||||||||||||||||||||||||
| 600 | } else { | ||||||||||||||||||||||||||||
| 601 | 0 | $cc = 0; | |||||||||||||||||||||||||||
| 602 | } | ||||||||||||||||||||||||||||
| 603 | } | ||||||||||||||||||||||||||||
| 604 | } | ||||||||||||||||||||||||||||
| 605 | } else { | ||||||||||||||||||||||||||||
| 606 | 0 | $x = $x + $st; | |||||||||||||||||||||||||||
| 607 | 0 | ▶ | if($x > ($xs + 0.5 * $st)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 608 | 0 | ▶ | if($x < ($xe - 0.5 * $st)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 609 | 0 | $ca = 1; | |||||||||||||||||||||||||||
| 610 | } else { | ||||||||||||||||||||||||||||
| 611 | 0 | $cc = 0; | |||||||||||||||||||||||||||
| 612 | } | ||||||||||||||||||||||||||||
| 613 | } | ||||||||||||||||||||||||||||
| 614 | } | ||||||||||||||||||||||||||||
| 615 | } else { # Inverted scale | ||||||||||||||||||||||||||||
| 616 | 0 | ▶ | if($ax->{'t'}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 617 | 0 | ▶ | if($st > 1.0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 618 | 0 | $x = $x / $st; | |||||||||||||||||||||||||||
| 619 | 0 | ▶ | if($x < ($xs / sqrt($st))) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 620 | 0 | ▶ | if($x > ($xe * sqrt($st))) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 621 | 0 | $ca = 1; | |||||||||||||||||||||||||||
| 622 | } else { | ||||||||||||||||||||||||||||
| 623 | 0 | $cc = 0; | |||||||||||||||||||||||||||
| 624 | } | ||||||||||||||||||||||||||||
| 625 | } | ||||||||||||||||||||||||||||
| 626 | } else { | ||||||||||||||||||||||||||||
| 627 | 0 | $x = $x * $st; | |||||||||||||||||||||||||||
| 628 | 0 | ▶ | if($x < ($xs * sqrt($st))) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 629 | 0 | ▶ | if($x > ($xe / sqrt($st))) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 630 | 0 | $ca = 1; | |||||||||||||||||||||||||||
| 631 | } else { | ||||||||||||||||||||||||||||
| 632 | 0 | $cc = 0; | |||||||||||||||||||||||||||
| 633 | } | ||||||||||||||||||||||||||||
| 634 | } | ||||||||||||||||||||||||||||
| 635 | } | ||||||||||||||||||||||||||||
| 636 | } else { | ||||||||||||||||||||||||||||
| 637 | 0 | $x = $x - $st; | |||||||||||||||||||||||||||
| 638 | 0 | ▶ | if($x < ($xs - 0.5 * $st)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 639 | 0 | ▶ | if($x > ($xe + 0.5 * $st)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 640 | 0 | $ca = 1; | |||||||||||||||||||||||||||
| 641 | } else { | ||||||||||||||||||||||||||||
| 642 | 0 | $cc = 0; | |||||||||||||||||||||||||||
| 643 | } | ||||||||||||||||||||||||||||
| 644 | } | ||||||||||||||||||||||||||||
| 645 | } | ||||||||||||||||||||||||||||
| 646 | } | ||||||||||||||||||||||||||||
| 647 | 0 | ▶ | if($ca) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 648 | 0 | ▶ | if($passno == 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 649 | 0 | $in++; | |||||||||||||||||||||||||||
| 650 | } else { | ||||||||||||||||||||||||||||
| 651 | 0 | $mut = 1; | |||||||||||||||||||||||||||
| 652 | 0 | ▶ | if(defined($ax->{'u'})) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 653 | 0 | ▶ | if($ax->{'omit'}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 654 | 0 | ▶ | if($ci >= ($in - $ax->{'omit'})) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 655 | 0 | $mut = 0; | |||||||||||||||||||||||||||
| 656 | } | ||||||||||||||||||||||||||||
| 657 | } | ||||||||||||||||||||||||||||
| 658 | } | ||||||||||||||||||||||||||||
| 659 | 0 | ▶ | if($mut) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 660 | 0 | ▶ | if($passno == 1) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 661 | 0 | $np->add_number($x); | |||||||||||||||||||||||||||
| 662 | } | ||||||||||||||||||||||||||||
| 663 | 0 | ▶ | if($passno == 2) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 664 | 0 | $c2 = $ax->value_to_coord($x); | |||||||||||||||||||||||||||
| 665 | 0 | ▶ | if($xyflag) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 666 | 0 | $self->text_label_number($co, $c2, $position, $pnp, $x); | |||||||||||||||||||||||||||
| 667 | } else { | ||||||||||||||||||||||||||||
| 668 | 0 | $self->text_label_number($c2, $co, $position, $pnp, $x); | |||||||||||||||||||||||||||
| 669 | } | ||||||||||||||||||||||||||||
| 670 | } | ||||||||||||||||||||||||||||
| 671 | } | ||||||||||||||||||||||||||||
| 672 | } | ||||||||||||||||||||||||||||
| 673 | 0 | $ci++; | |||||||||||||||||||||||||||
| 674 | } | ||||||||||||||||||||||||||||
| 675 | } | ||||||||||||||||||||||||||||
| 676 | } | ||||||||||||||||||||||||||||
| 677 | 0 | ▶ | if(defined($ax->{'u'})) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 678 | 0 | $x = (1.0 * $in + 0.5 - 0.5 * $ax->{'omit'})/(1.0 + $in); | |||||||||||||||||||||||||||
| 679 | 0 | ▶ | if($xyflag) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 680 | 0 | $x = $self->{'y3bp'} + $x * ($self->{'y4bp'} - $self->{'y3bp'}); | |||||||||||||||||||||||||||
| 681 | 0 | $self->text_label($co, $x, $position, $ax->{'u'}); | |||||||||||||||||||||||||||
| 682 | } else { | ||||||||||||||||||||||||||||
| 683 | 0 | $x = $self->{'x3bp'} + $x * ($self->{'x4bp'} - $self->{'x3bp'}); | |||||||||||||||||||||||||||
| 684 | 0 | $self->text_label($x, $co, $position, $ax->{'u'}); | |||||||||||||||||||||||||||
| 685 | } | ||||||||||||||||||||||||||||
| 686 | } | ||||||||||||||||||||||||||||
| 687 | } | ||||||||||||||||||||||||||||
| 688 | 0 | return $self; | |||||||||||||||||||||||||||
| 689 | } | ||||||||||||||||||||||||||||
| 690 | |||||||||||||||||||||||||||||
| 691 | |||||||||||||||||||||||||||||
| 692 | |||||||||||||||||||||||||||||
| 693 | sub draw_tics | ||||||||||||||||||||||||||||
| 694 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
draw_tics: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 695 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 696 | 0 | $self->tics_for_axis($self->{'b'}); | |||||||||||||||||||||||||||
| 697 | 0 | $self->tics_for_axis($self->{'l'}); | |||||||||||||||||||||||||||
| 698 | 0 | $self->tics_for_axis($self->{'r'}); | |||||||||||||||||||||||||||
| 699 | 0 | $self->tics_for_axis($self->{'t'}); | |||||||||||||||||||||||||||
| 700 | 0 | return $self; | |||||||||||||||||||||||||||
| 701 | } | ||||||||||||||||||||||||||||
| 702 | |||||||||||||||||||||||||||||
| 703 | |||||||||||||||||||||||||||||
| 704 | |||||||||||||||||||||||||||||
| 705 | sub arrow | ||||||||||||||||||||||||||||
| 706 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
arrow: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 707 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 708 | 0 | my $x0 = shift; | |||||||||||||||||||||||||||
| 709 | 0 | my $y0 = shift; | |||||||||||||||||||||||||||
| 710 | 0 | my $d = shift; | |||||||||||||||||||||||||||
| 711 | 0 | my $fh = $self->{'f1'}; | |||||||||||||||||||||||||||
| 712 | 0 | my $x1 = $x0 + 23.811; | |||||||||||||||||||||||||||
| 713 | 0 | my $y1 = $y0; | |||||||||||||||||||||||||||
| 714 | 0 | my $x2 = $x0 + 28.346; | |||||||||||||||||||||||||||
| 715 | 0 | my $y2 = $y0; | |||||||||||||||||||||||||||
| 716 | 0 | my $x3 = $x0 + 19.843; | |||||||||||||||||||||||||||
| 717 | 0 | my $y3 = $y0 + 2.1; | |||||||||||||||||||||||||||
| 718 | 0 | my $x4 = $x3; | |||||||||||||||||||||||||||
| 719 | 0 | my $y4 = $y0 - 2.1; | |||||||||||||||||||||||||||
| 720 | 0 | ▶ | if($d == 1) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 721 | 0 | $x1 = $x0; $y1 = $y0 + 23.811; | |||||||||||||||||||||||||||
| 722 | 0 | $x2 = $x0; $y2 = $y0 + 28.346; | |||||||||||||||||||||||||||
| 723 | 0 | $x3 = $x0 - 2.1; $y3 = $y0 + 19.843; | |||||||||||||||||||||||||||
| 724 | 0 | $x4 = $x0 + 2.1; $y4 = $y3; | |||||||||||||||||||||||||||
| 725 | } else { | ||||||||||||||||||||||||||||
| 726 | 0 | ▶ | if($d == 2) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 727 | 0 | $x1 = $x0 - 23.811; $y1 = $y0; | |||||||||||||||||||||||||||
| 728 | 0 | $x2 = $x0 - 28.346; $y2 = $y0; | |||||||||||||||||||||||||||
| 729 | 0 | $x3 = $x0 - 19.843; $y3 = $y0 + 2.1; | |||||||||||||||||||||||||||
| 730 | 0 | $x4 = $x3; $y4 = $y0 - 2.1; | |||||||||||||||||||||||||||
| 731 | } else { | ||||||||||||||||||||||||||||
| 732 | 0 | ▶ | if($d == 3) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 733 | 0 | $x1 = $x0; $y1 = $y0 - 23.811; | |||||||||||||||||||||||||||
| 734 | 0 | $x2 = $x0; $y2 = $y0 - 28.346; | |||||||||||||||||||||||||||
| 735 | 0 | $x3 = $x0 - 2.1; $y3 = $y0 - 19.843; | |||||||||||||||||||||||||||
| 736 | 0 | $x4 = $x0 + 2.1; $y4 = $y3; | |||||||||||||||||||||||||||
| 737 | } | ||||||||||||||||||||||||||||
| 738 | } | ||||||||||||||||||||||||||||
| 739 | } | ||||||||||||||||||||||||||||
| 740 | 0 | print $fh "\\pgfpathmoveto{"; | |||||||||||||||||||||||||||
| 741 | 0 | $self->write_point($x0, $y0); | |||||||||||||||||||||||||||
| 742 | 0 | print $fh "}\n\\pgfpathlineto{"; | |||||||||||||||||||||||||||
| 743 | 0 | $self->write_point($x1, $y1); | |||||||||||||||||||||||||||
| 744 | 0 | print $fh "}\n\\pgfusepath{stroke}\n"; | |||||||||||||||||||||||||||
| 745 | 0 | print $fh "\\pgfpathmoveto{"; | |||||||||||||||||||||||||||
| 746 | 0 | $self->write_point($x2, $y2); | |||||||||||||||||||||||||||
| 747 | 0 | print $fh "}\n\\pgfpathlineto{"; | |||||||||||||||||||||||||||
| 748 | 0 | $self->write_point($x3, $y3); | |||||||||||||||||||||||||||
| 749 | 0 | print $fh "}\n\\pgfpathlineto{"; | |||||||||||||||||||||||||||
| 750 | 0 | $self->write_point($x4, $y4); | |||||||||||||||||||||||||||
| 751 | 0 | print $fh "}\n\\pgfpathclose\n\\pgfusepath{fill}\n"; | |||||||||||||||||||||||||||
| 752 | 0 | return $self; | |||||||||||||||||||||||||||
| 753 | } | ||||||||||||||||||||||||||||
| 754 | |||||||||||||||||||||||||||||
| 755 | |||||||||||||||||||||||||||||
| 756 | |||||||||||||||||||||||||||||
| 757 | sub axis_arrows_and_units | ||||||||||||||||||||||||||||
| 758 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
axis_arrows_and_units: not called CC=10 SCAR=47.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 759 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 760 | 0 | my $ax = shift; | |||||||||||||||||||||||||||
| 761 | 0 | my $fh = $self->{'f1'}; | |||||||||||||||||||||||||||
| 762 | 0 | ▶ | if($ax->{'used'}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 763 | 0 | ▶ | if(defined($ax->{'l'})) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 764 | 0 | my $xyflag = 0; | |||||||||||||||||||||||||||
| 765 | 0 | my $co = $self->{'y1bp'}; | |||||||||||||||||||||||||||
| 766 | 0 | my $m = $self->{'x3bp'} + 0.5 * ($self->{'x4bp'} - $self->{'x3bp'}); | |||||||||||||||||||||||||||
| 767 | 0 | ▶ | if($ax->{'n'} eq 'l') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 768 | 0 | $xyflag = 1; | |||||||||||||||||||||||||||
| 769 | 0 | $co = $self->{'x1bp'}; | |||||||||||||||||||||||||||
| 770 | 0 | $m = $self->{'y3bp'} + 0.5 * ($self->{'y4bp'} - $self->{'y3bp'}); | |||||||||||||||||||||||||||
| 771 | } | ||||||||||||||||||||||||||||
| 772 | 0 | ▶ | if($ax->{'n'} eq 'r') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 773 | 0 | $xyflag = 1; | |||||||||||||||||||||||||||
| 774 | 0 | $co = $self->{'x6bp'}; | |||||||||||||||||||||||||||
| 775 | 0 | $m = $self->{'y3bp'} + 0.5 * ($self->{'y4bp'} - $self->{'y3bp'}); | |||||||||||||||||||||||||||
| 776 | } | ||||||||||||||||||||||||||||
| 777 | 0 | ▶ | if($ax->{'n'} eq 't') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 778 | 0 | $co = $self->{'y6bp'}; | |||||||||||||||||||||||||||
| 779 | } | ||||||||||||||||||||||||||||
| 780 | 0 | ▶ | if(defined($ax->{'color'})) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 781 | 0 | $self->set_color($ax->{'color'}); | |||||||||||||||||||||||||||
| 782 | } | ||||||||||||||||||||||||||||
| 783 | 0 | ▶ | if($xyflag) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 784 | 0 | ▶ | if($ax->{'max'} > $ax->{'min'}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 785 | 0 | $self->text_label($co, ($m - 2.8346), "top", $ax->{'l'}); | |||||||||||||||||||||||||||
| 786 | 0 | $self->arrow($co, ($m + 2.8346), 1); | |||||||||||||||||||||||||||
| 787 | } else { | ||||||||||||||||||||||||||||
| 788 | 0 | $self->text_label($co, ($m + 2.8346), "bottom", $ax->{'l'}); | |||||||||||||||||||||||||||
| 789 | 0 | $self->arrow($co, ($m - 2.8346), 3); | |||||||||||||||||||||||||||
| 790 | } | ||||||||||||||||||||||||||||
| 791 | } else { | ||||||||||||||||||||||||||||
| 792 | 0 | ▶ | if($ax->{'max'} > $ax->{'min'}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 793 | 0 | $self->text_label(($m - 2.8346), $co, "right", $ax->{'l'}); | |||||||||||||||||||||||||||
| 794 | 0 | $self->arrow(($m + 2.8346), $co, 0); | |||||||||||||||||||||||||||
| 795 | } else { | ||||||||||||||||||||||||||||
| 796 | 0 | $self->text_label(($m + 2.8346), $co, "left", $ax->{'l'}); | |||||||||||||||||||||||||||
| 797 | 0 | $self->arrow(($m - 2.8346), $co, 2); | |||||||||||||||||||||||||||
| 798 | } | ||||||||||||||||||||||||||||
| 799 | } | ||||||||||||||||||||||||||||
| 800 | } | ||||||||||||||||||||||||||||
| 801 | } | ||||||||||||||||||||||||||||
| 802 | 0 | return $self; | |||||||||||||||||||||||||||
| 803 | } | ||||||||||||||||||||||||||||
| 804 | |||||||||||||||||||||||||||||
| 805 | |||||||||||||||||||||||||||||
| 806 | |||||||||||||||||||||||||||||
| 807 | sub arrows_and_units | ||||||||||||||||||||||||||||
| 808 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
arrows_and_units: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 809 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 810 | 0 | $self->axis_arrows_and_units($self->{'b'}); | |||||||||||||||||||||||||||
| 811 | 0 | $self->axis_arrows_and_units($self->{'l'}); | |||||||||||||||||||||||||||
| 812 | 0 | $self->axis_arrows_and_units($self->{'r'}); | |||||||||||||||||||||||||||
| 813 | 0 | $self->axis_arrows_and_units($self->{'t'}); | |||||||||||||||||||||||||||
| 814 | 0 | return $self; | |||||||||||||||||||||||||||
| 815 | } | ||||||||||||||||||||||||||||
| 816 | |||||||||||||||||||||||||||||
| 817 | |||||||||||||||||||||||||||||
| 818 | |||||||||||||||||||||||||||||
| 819 | sub draw_polylines_and_labels | ||||||||||||||||||||||||||||
| 820 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
draw_polylines_and_labels: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 821 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 822 | 0 | my $ar = $self->{'contents'}; | |||||||||||||||||||||||||||
| 823 | 0 | my $ai = $self->{'nco'}; | |||||||||||||||||||||||||||
| 824 | 0 | my $or; | |||||||||||||||||||||||||||
| 825 | 0 | ▶ | for(my $i = 0; $i < $ai; $i++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 826 | 0 | $or = $ar->[$i]; | |||||||||||||||||||||||||||
| 827 | 0 | $or->plot(); | |||||||||||||||||||||||||||
| 828 | } | ||||||||||||||||||||||||||||
| 829 | 0 | return $self; | |||||||||||||||||||||||||||
| 830 | } | ||||||||||||||||||||||||||||
| 831 | |||||||||||||||||||||||||||||
| 832 | |||||||||||||||||||||||||||||
| 833 | |||||||||||||||||||||||||||||
| 834 | sub draw_plots | ||||||||||||||||||||||||||||
| 835 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
draw_plots: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 836 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 837 | 0 | my $ap = $self->{'p'}; | |||||||||||||||||||||||||||
| 838 | 0 | my $np = $self->{'np'}; | |||||||||||||||||||||||||||
| 839 | 0 | my $pref; | |||||||||||||||||||||||||||
| 840 | 0 | ▶ | for(my $i = 0; $i < $np; $i++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 841 | 0 | $pref = $ap->[$i]; | |||||||||||||||||||||||||||
| 842 | 0 | $pref->plot_to($self); | |||||||||||||||||||||||||||
| 843 | } | ||||||||||||||||||||||||||||
| 844 | 0 | return $self; | |||||||||||||||||||||||||||
| 845 | } | ||||||||||||||||||||||||||||
| 846 | |||||||||||||||||||||||||||||
| 847 | |||||||||||||||||||||||||||||
| 848 | sub write_image_contents | ||||||||||||||||||||||||||||
| 849 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
write_image_contents: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 850 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 851 | 0 | my $fh = $self->{'f1'}; | |||||||||||||||||||||||||||
| 852 | # Bounding box | ||||||||||||||||||||||||||||
| 853 | $self->write_clip( | ||||||||||||||||||||||||||||
| 854 | floor($self->{'x0bp'}), floor($self->{'y0bp'}), | ||||||||||||||||||||||||||||
| 855 | 0 | ceil($self->{'x7bp'}), ceil($self->{'y7bp'}) | |||||||||||||||||||||||||||
| 856 | ); | ||||||||||||||||||||||||||||
| 857 | # Grid | ||||||||||||||||||||||||||||
| 858 | 0 | print $fh "\% Grid\n"; | |||||||||||||||||||||||||||
| 859 | 0 | $self->setlinewidth_mm(0.05); | |||||||||||||||||||||||||||
| 860 | 0 | $self->set_color('black'); | |||||||||||||||||||||||||||
| 861 | 0 | $self->draw_grid(); | |||||||||||||||||||||||||||
| 862 | # Tics | ||||||||||||||||||||||||||||
| 863 | 0 | print $fh "\% Scale values\n"; | |||||||||||||||||||||||||||
| 864 | 0 | $self->draw_tics(); | |||||||||||||||||||||||||||
| 865 | 0 | $self->begin_pgfscope(); | |||||||||||||||||||||||||||
| 866 | $self->write_clip( | ||||||||||||||||||||||||||||
| 867 | $self->{'x3bp'}, $self->{'y3bp'}, | ||||||||||||||||||||||||||||
| 868 | 0 | $self->{'x4bp'}, $self->{'y4bp'} | |||||||||||||||||||||||||||
| 869 | ); | ||||||||||||||||||||||||||||
| 870 | # Curves | ||||||||||||||||||||||||||||
| 871 | 0 | print $fh "\% Curves\n"; | |||||||||||||||||||||||||||
| 872 | 0 | $self->setlinewidth_mm(0.2); | |||||||||||||||||||||||||||
| 873 | 0 | $self->draw_plots(); | |||||||||||||||||||||||||||
| 874 | 0 | $self->end_pgfscope(); | |||||||||||||||||||||||||||
| 875 | # Polylines and arrow | ||||||||||||||||||||||||||||
| 876 | 0 | print $fh "\% Text labels and polylines\n"; | |||||||||||||||||||||||||||
| 877 | 0 | $self->draw_polylines_and_labels(); | |||||||||||||||||||||||||||
| 878 | # Frame | ||||||||||||||||||||||||||||
| 879 | 0 | print $fh "\% Frame\n"; | |||||||||||||||||||||||||||
| 880 | 0 | $self->set_color('black'); | |||||||||||||||||||||||||||
| 881 | 0 | $self->setlinewidth_mm(0.1); | |||||||||||||||||||||||||||
| 882 | $self->write_rect( | ||||||||||||||||||||||||||||
| 883 | $self->{'x3bp'}, $self->{'y3bp'}, | ||||||||||||||||||||||||||||
| 884 | 0 | $self->{'x4bp'}, $self->{'y4bp'} | |||||||||||||||||||||||||||
| 885 | ); | ||||||||||||||||||||||||||||
| 886 | 0 | print $fh "\\pgfusepath{stroke}\n"; | |||||||||||||||||||||||||||
| 887 | # Arrows and Labels | ||||||||||||||||||||||||||||
| 888 | 0 | print $fh "\% Axis labels and arrows\n"; | |||||||||||||||||||||||||||
| 889 | 0 | $self->setlinewidth_mm(0.2); | |||||||||||||||||||||||||||
| 890 | 0 | $self->arrows_and_units(); | |||||||||||||||||||||||||||
| 891 | } | ||||||||||||||||||||||||||||
| 892 | |||||||||||||||||||||||||||||
| 893 | |||||||||||||||||||||||||||||
| 894 | sub write | ||||||||||||||||||||||||||||
| 895 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
write: not called CC=9 SCAR=45.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 896 | 0 | my $self = undef; | |||||||||||||||||||||||||||
| 897 | 0 | my $fh = undef; | |||||||||||||||||||||||||||
| 898 | 0 | ▶ | if($#_ < 1) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 899 | } else { | ||||||||||||||||||||||||||||
| 900 | 0 | $self = shift; $self->{'fn1'} = shift; | |||||||||||||||||||||||||||
| 901 | 0 | $self->{'ftf'} = 0; | |||||||||||||||||||||||||||
| 902 | 0 | ▶ | if($self->{'fn1'} =~ /.*\.[Tt][Ee][Xx]/o) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 903 | 0 | $self->{'ftf'} = 1; | |||||||||||||||||||||||||||
| 904 | } | ||||||||||||||||||||||||||||
| 905 | 0 | ▶ | if(open($fh, '>', $self->{'fn1'})) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 906 | 0 | $self->{'f1'} = $fh; | |||||||||||||||||||||||||||
| 907 | 0 | $self->prepare_for_output(); | |||||||||||||||||||||||||||
| 908 | 0 | ▶ | if($self->{'ftf'}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 909 | 0 | my $utfflag = 0; | |||||||||||||||||||||||||||
| 910 | 0 | ▶ | if(exists($ENV{"LANG"})) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 911 | 0 | ▶ | if($ENV{"LANG"} =~ /\.[Uu][Tt][Ff]\-8/o) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 912 | 0 | $utfflag = 1; | |||||||||||||||||||||||||||
| 913 | } | ||||||||||||||||||||||||||||
| 914 | } | ||||||||||||||||||||||||||||
| 915 | 0 | print $fh "\\documentclass[" . $self->{'fs'} . "pt]{article}\n"; | |||||||||||||||||||||||||||
| 916 | 0 | ▶ | if($utfflag) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 917 | 0 | print $fh "\\usepackage[utf8]{inputenc}\n"; | |||||||||||||||||||||||||||
| 918 | } else { | ||||||||||||||||||||||||||||
| 919 | 0 | print $fh "\\usepackage[latin1]{inputenc}\n"; | |||||||||||||||||||||||||||
| 920 | } | ||||||||||||||||||||||||||||
| 921 | 0 | print $fh "\\usepackage[T1]{fontenc}\n"; | |||||||||||||||||||||||||||
| 922 | 0 | print $fh "\\usepackage{textcomp}\n"; | |||||||||||||||||||||||||||
| 923 | 0 | print $fh "\\usepackage{mathptmx}\n"; | |||||||||||||||||||||||||||
| 924 | 0 | print $fh "\\usepackage[scaled=.92]{helvet}\n"; | |||||||||||||||||||||||||||
| 925 | 0 | print $fh "\\usepackage{courier}\n"; | |||||||||||||||||||||||||||
| 926 | 0 | print $fh "\\usepackage[intlimits]{amsmath}\n"; | |||||||||||||||||||||||||||
| 927 | 0 | print $fh "\\usepackage{graphicx}\n"; | |||||||||||||||||||||||||||
| 928 | 0 | print $fh "\\usepackage{color}\n"; | |||||||||||||||||||||||||||
| 929 | 0 | print $fh "\\usepackage{ifpdf}\n"; | |||||||||||||||||||||||||||
| 930 | 0 | print $fh "\\usepackage{fancybox}\n"; | |||||||||||||||||||||||||||
| 931 | 0 | print $fh "\\usepackage{pgfcore}\n"; | |||||||||||||||||||||||||||
| 932 | print $fh "\\setlength{\\paperwidth}{" | ||||||||||||||||||||||||||||
| 933 | 0 | . ceil($self->{'x7bp'}) . "bp}\n"; | |||||||||||||||||||||||||||
| 934 | print $fh "\\setlength{\\paperheight}{" | ||||||||||||||||||||||||||||
| 935 | 0 | . ceil($self->{'y7bp'}) . "bp}\n"; | |||||||||||||||||||||||||||
| 936 | 0 | print $fh "\\pagestyle{empty}\n"; | |||||||||||||||||||||||||||
| 937 | 0 | print $fh "\\setlength{\\voffset}{-1in}\n"; | |||||||||||||||||||||||||||
| 938 | 0 | print $fh "\\setlength{\\topmargin}{0mm}\n"; | |||||||||||||||||||||||||||
| 939 | 0 | print $fh "\\setlength{\\headheight}{0mm}\n"; | |||||||||||||||||||||||||||
| 940 | 0 | print $fh "\\setlength{\\headsep}{0mm}\n"; | |||||||||||||||||||||||||||
| 941 | 0 | print $fh "\\setlength{\\topskip}{0mm}\n"; | |||||||||||||||||||||||||||
| 942 | 0 | print $fh "\\setlength{\\hoffset}{-1in}\n"; | |||||||||||||||||||||||||||
| 943 | 0 | print $fh "\\setlength{\\oddsidemargin}{0mm}\n"; | |||||||||||||||||||||||||||
| 944 | 0 | print $fh "\\setlength{\\evensidemargin}{0mm}\n"; | |||||||||||||||||||||||||||
| 945 | 0 | print $fh "\\setlength{\\marginparwidth}{0mm}\n"; | |||||||||||||||||||||||||||
| 946 | 0 | print $fh "\\setlength{\\marginparsep}{0mm}\n"; | |||||||||||||||||||||||||||
| 947 | 0 | print $fh "\\setlength{\\textwidth}{\\paperwidth}\n"; | |||||||||||||||||||||||||||
| 948 | 0 | print $fh "\\setlength{\\textheight}{\\paperheight}\n"; | |||||||||||||||||||||||||||
| 949 | 0 | print $fh "\\setlength{\\parskip}{0mm}\n"; | |||||||||||||||||||||||||||
| 950 | 0 | print $fh "\\setlength{\\parindent}{0mm}\n"; | |||||||||||||||||||||||||||
| 951 | 0 | print $fh "\\ifpdf\n"; | |||||||||||||||||||||||||||
| 952 | 0 | print $fh "\\setlength{\\pdfpagewidth}{\\paperwidth}\n"; | |||||||||||||||||||||||||||
| 953 | 0 | print $fh "\\setlength{\\pdfpageheight}{\\paperheight}\n"; | |||||||||||||||||||||||||||
| 954 | 0 | print $fh "\\fi\n"; | |||||||||||||||||||||||||||
| 955 | 0 | print $fh "\\begin{document}%\n"; | |||||||||||||||||||||||||||
| 956 | } | ||||||||||||||||||||||||||||
| 957 | |||||||||||||||||||||||||||||
| 958 | 0 | print $fh "\\begin{pgfpicture}\n"; | |||||||||||||||||||||||||||
| 959 | 0 | $self->write_image_contents(); | |||||||||||||||||||||||||||
| 960 | 0 | print $fh "\\end{pgfpicture}\%\n"; | |||||||||||||||||||||||||||
| 961 | |||||||||||||||||||||||||||||
| 962 | 0 | ▶ | if($self->{'ftf'}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 963 | 0 | print $fh "\\end{document}\n"; | |||||||||||||||||||||||||||
| 964 | } | ||||||||||||||||||||||||||||
| 965 | |||||||||||||||||||||||||||||
| 966 | 0 | close($fh); | |||||||||||||||||||||||||||
| 967 | } | ||||||||||||||||||||||||||||
| 968 | 0 | $self->{'ftf'} = 0; | |||||||||||||||||||||||||||
| 969 | } | ||||||||||||||||||||||||||||
| 970 | 0 | return $self; | |||||||||||||||||||||||||||
| 971 | } | ||||||||||||||||||||||||||||
| 972 | |||||||||||||||||||||||||||||
| 973 | |||||||||||||||||||||||||||||
| 974 | |||||||||||||||||||||||||||||
| 975 | sub set_font_size | ||||||||||||||||||||||||||||
| 976 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
set_font_size: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 977 | 0 | my $self = undef; | |||||||||||||||||||||||||||
| 978 | 0 | ▶ | if($#_ < 1) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 979 | 0 | croak "Usage: \$diagram->set_font_size(fontsize)"; | |||||||||||||||||||||||||||
| 980 | } else { | ||||||||||||||||||||||||||||
| 981 | 0 | $self = shift; $self->{'fs'} = shift; | |||||||||||||||||||||||||||
| 982 | } | ||||||||||||||||||||||||||||
| 983 | 0 | return $self; | |||||||||||||||||||||||||||
| 984 | } | ||||||||||||||||||||||||||||
| 985 | |||||||||||||||||||||||||||||
| 986 | |||||||||||||||||||||||||||||
| 987 | |||||||||||||||||||||||||||||
| 988 | sub axis | ||||||||||||||||||||||||||||
| 989 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
axis: not called CC=11 SCAR=48.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 990 | 0 | my $back = undef; | |||||||||||||||||||||||||||
| 991 | 0 | ▶ | if($#_ < 1) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 992 | 0 | croak "Usage: \$diagram->axis(name)"; | |||||||||||||||||||||||||||
| 993 | } else { | ||||||||||||||||||||||||||||
| 994 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 995 | 0 | my $name = shift; | |||||||||||||||||||||||||||
| 996 | 0 | ▶ | if(("$name" eq "b") || ("$name" eq "bottom")) { $back = $self->{'b'}; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
"$name" eq "b" or "$name" eq "bottom"
MC/DC0%0/2
"$name" eq "b" or "$name" eq "bottom"
"$name" eq "b"
"$name" eq "bottom"
Truth table0%0/3
A or B
A= "$name" eq "b"B= "$name" eq "bottom"
| |||||||||||||||||||||||||||||
| 997 | 0 | ▶ | if(("$name" eq "l") || ("$name" eq "left")) { $back = $self->{'l'}; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
"$name" eq "l" or "$name" eq "left"
MC/DC0%0/2
"$name" eq "l" or "$name" eq "left"
"$name" eq "l"
"$name" eq "left"
Truth table0%0/3
A or B
A= "$name" eq "l"B= "$name" eq "left"
| |||||||||||||||||||||||||||||
| 998 | 0 | ▶ | if(("$name" eq "r") || ("$name" eq "right")) { $back = $self->{'r'}; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
"$name" eq "r" or "$name" eq "right"
MC/DC0%0/2
"$name" eq "r" or "$name" eq "right"
"$name" eq "r"
"$name" eq "right"
Truth table0%0/3
A or B
A= "$name" eq "r"B= "$name" eq "right"
| |||||||||||||||||||||||||||||
| 999 | 0 | ▶ | if(("$name" eq "t") || ("$name" eq "top")) { $back = $self->{'t'}; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
"$name" eq "t" or "$name" eq "top"
MC/DC0%0/2
"$name" eq "t" or "$name" eq "top"
"$name" eq "t"
"$name" eq "top"
Truth table0%0/3
A or B
A= "$name" eq "t"B= "$name" eq "top"
| |||||||||||||||||||||||||||||
| 1000 | 0 | ▶ | if(!defined($back)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1001 | 0 | croak "ERROR: Wrong axis name \"$name\"! Allowed names:\n" | |||||||||||||||||||||||||||
| 1002 | . " 'b' (bottom), 'l', (left), 'r' (right) or 't' (top)."; | ||||||||||||||||||||||||||||
| 1003 | } | ||||||||||||||||||||||||||||
| 1004 | } | ||||||||||||||||||||||||||||
| 1005 | 0 | return $back; | |||||||||||||||||||||||||||
| 1006 | } | ||||||||||||||||||||||||||||
| 1007 | |||||||||||||||||||||||||||||
| 1008 | |||||||||||||||||||||||||||||
| 1009 | |||||||||||||||||||||||||||||
| 1010 | sub plot | ||||||||||||||||||||||||||||
| 1011 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
plot: not called CC=14 SCAR=53.5
Pod
documented
| |||||||||||||||||||||||||||||
| 1012 | 0 | my $back = undef; | |||||||||||||||||||||||||||
| 1013 | 0 | ▶ | if($#_ < 2) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1014 | 0 | croak "Usage: \$diagram->plot(axisname,axisname)"; | |||||||||||||||||||||||||||
| 1015 | } else { | ||||||||||||||||||||||||||||
| 1016 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 1017 | 0 | my $an1 = shift; | |||||||||||||||||||||||||||
| 1018 | 0 | my $an2 = shift; | |||||||||||||||||||||||||||
| 1019 | 0 | my $ax = undef; my $ay = undef; | |||||||||||||||||||||||||||
| 1020 | 0 | foreach my $i ($an1, $an2) { | |||||||||||||||||||||||||||
| 1021 | 0 | my $nok = 0; | |||||||||||||||||||||||||||
| 1022 | 0 | ▶ | if(("$i" eq "b") || ("$i" eq "bottom")) { $ax = $self->{'b'}; $nok = 1; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
"$i" eq "b" or "$i" eq "bottom"
MC/DC0%0/2
"$i" eq "b" or "$i" eq "bottom"
"$i" eq "b"
"$i" eq "bottom"
Truth table0%0/3
A or B
A= "$i" eq "b"B= "$i" eq "bottom"
| |||||||||||||||||||||||||||||
| 1023 | 0 | ▶ | if(("$i" eq "l") || ("$i" eq "left")) { $ay = $self->{'l'}; $nok = 1; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
"$i" eq "l" or "$i" eq "left"
MC/DC0%0/2
"$i" eq "l" or "$i" eq "left"
"$i" eq "l"
"$i" eq "left"
Truth table0%0/3
A or B
A= "$i" eq "l"B= "$i" eq "left"
| |||||||||||||||||||||||||||||
| 1024 | 0 | ▶ | if(("$i" eq "r") || ("$i" eq "right")) { $ay = $self->{'r'}; $nok = 1; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
"$i" eq "r" or "$i" eq "right"
MC/DC0%0/2
"$i" eq "r" or "$i" eq "right"
"$i" eq "r"
"$i" eq "right"
Truth table0%0/3
A or B
A= "$i" eq "r"B= "$i" eq "right"
| |||||||||||||||||||||||||||||
| 1025 | 0 | ▶ | if(("$i" eq "t") || ("$i" eq "top")) { $ax = $self->{'t'}; $nok = 1; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
"$i" eq "t" or "$i" eq "top"
MC/DC0%0/2
"$i" eq "t" or "$i" eq "top"
"$i" eq "t"
"$i" eq "top"
Truth table0%0/3
A or B
A= "$i" eq "t"B= "$i" eq "top"
| |||||||||||||||||||||||||||||
| 1026 | 0 | ▶ | if(!$nok) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1027 | 0 | croak "ERROR: Wrong axis name \"$i\"! Allowed names:\n" | |||||||||||||||||||||||||||
| 1028 | . " 'b' (bottom), 'l', (left), 'r' (right) or 't' (top)."; | ||||||||||||||||||||||||||||
| 1029 | } | ||||||||||||||||||||||||||||
| 1030 | } | ||||||||||||||||||||||||||||
| 1031 | 0 | ▶ | if(defined($ax) && defined($ay)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $ax and defined $ay
MC/DC0%0/2
defined $ax and defined $ay
defined $ax
defined $ay
Truth table0%0/3
A and B
A= defined $axB= defined $ay
| |||||||||||||||||||||||||||||
| 1032 | 0 | my $ar = $self->{'p'}; | |||||||||||||||||||||||||||
| 1033 | 0 | my $an = $self->{'np'}; | |||||||||||||||||||||||||||
| 1034 | 0 | $back = LaTeX::PGF::Diagram2D::Plot->new(); | |||||||||||||||||||||||||||
| 1035 | 0 | $ar->[$an++] = $back; | |||||||||||||||||||||||||||
| 1036 | 0 | $self->{'np'} = $an; | |||||||||||||||||||||||||||
| 1037 | 0 | $back->{'ax'} = $ax; $back->{'ay'} = $ay; | |||||||||||||||||||||||||||
| 1038 | 0 | $ax->{'used'} = 1; $ay->{'used'} = 1; | |||||||||||||||||||||||||||
| 1039 | 0 | $back->{'debug'} = $self->{'debug'}; | |||||||||||||||||||||||||||
| 1040 | } else { | ||||||||||||||||||||||||||||
| 1041 | 0 | croak "ERROR: One x-axis and one y-axis needed!"; | |||||||||||||||||||||||||||
| 1042 | } | ||||||||||||||||||||||||||||
| 1043 | } | ||||||||||||||||||||||||||||
| 1044 | 0 | return $back; | |||||||||||||||||||||||||||
| 1045 | } | ||||||||||||||||||||||||||||
| 1046 | |||||||||||||||||||||||||||||
| 1047 | |||||||||||||||||||||||||||||
| 1048 | |||||||||||||||||||||||||||||
| 1049 | sub copy_plot | ||||||||||||||||||||||||||||
| 1050 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
copy_plot: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 1051 | 0 | my $back = undef; | |||||||||||||||||||||||||||
| 1052 | 0 | ▶ | if($#_ < 1) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1053 | 0 | croak "Usage: \$diagram->copy_plot(plot)"; | |||||||||||||||||||||||||||
| 1054 | } else { | ||||||||||||||||||||||||||||
| 1055 | 0 | my $self = shift; my $src = shift; | |||||||||||||||||||||||||||
| 1056 | 0 | my $ar = $self->{'p'}; | |||||||||||||||||||||||||||
| 1057 | 0 | my $an = $self->{'np'}; | |||||||||||||||||||||||||||
| 1058 | 0 | $back = LaTeX::PGF::Diagram2D::Plot->new(); | |||||||||||||||||||||||||||
| 1059 | 0 | foreach my $k(keys %$src) { | |||||||||||||||||||||||||||
| 1060 | 0 | $back->{"$k"} = $src->{"$k"}; | |||||||||||||||||||||||||||
| 1061 | } | ||||||||||||||||||||||||||||
| 1062 | 0 | $ar->[$an++] = $back; | |||||||||||||||||||||||||||
| 1063 | 0 | $self->{'np'} = $an; | |||||||||||||||||||||||||||
| 1064 | } | ||||||||||||||||||||||||||||
| 1065 | 0 | return $back; | |||||||||||||||||||||||||||
| 1066 | } | ||||||||||||||||||||||||||||
| 1067 | |||||||||||||||||||||||||||||
| 1068 | |||||||||||||||||||||||||||||
| 1069 | |||||||||||||||||||||||||||||
| 1070 | sub label | ||||||||||||||||||||||||||||
| 1071 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
label: not called CC=22 SCAR=62.3
Pod
undocumented
| |||||||||||||||||||||||||||||
| 1072 | 0 | my $back = undef; | |||||||||||||||||||||||||||
| 1073 | 0 | ▶ | if($#_ < 3) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1074 | 0 | croak "Usage: \$diagram->label(xaxis, yaxis, x, y, text[, position])"; | |||||||||||||||||||||||||||
| 1075 | } else { | ||||||||||||||||||||||||||||
| 1076 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 1077 | 0 | my $xan = shift; | |||||||||||||||||||||||||||
| 1078 | 0 | my $yan = shift; | |||||||||||||||||||||||||||
| 1079 | 0 | my $x = shift; | |||||||||||||||||||||||||||
| 1080 | 0 | my $y = shift; | |||||||||||||||||||||||||||
| 1081 | 0 | my $t = shift; | |||||||||||||||||||||||||||
| 1082 | 0 | my $p = undef; | |||||||||||||||||||||||||||
| 1083 | 0 | ▶ | if($#_ >= 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1084 | 0 | $p = shift; | |||||||||||||||||||||||||||
| 1085 | } | ||||||||||||||||||||||||||||
| 1086 | 0 | my $ax = undef; my $ay = undef; | |||||||||||||||||||||||||||
| 1087 | 0 | ▶ | if(("$xan" eq "b") || ("$xan" eq "bottom")) { $ax = $self->{'b'}; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
"$xan" eq "b" or "$xan" eq "bottom"
MC/DC0%0/2
"$xan" eq "b" or "$xan" eq "bottom"
"$xan" eq "b"
"$xan" eq "bottom"
Truth table0%0/3
A or B
A= "$xan" eq "b"B= "$xan" eq "bottom"
| |||||||||||||||||||||||||||||
| 1088 | 0 | ▶ | if(("$xan" eq "l") || ("$xan" eq "left")) { $ay = $self->{'l'}; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
"$xan" eq "l" or "$xan" eq "left"
MC/DC0%0/2
"$xan" eq "l" or "$xan" eq "left"
"$xan" eq "l"
"$xan" eq "left"
Truth table0%0/3
A or B
A= "$xan" eq "l"B= "$xan" eq "left"
| |||||||||||||||||||||||||||||
| 1089 | 0 | ▶ | if(("$xan" eq "r") || ("$xan" eq "right")) { $ay = $self->{'r'}; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
"$xan" eq "r" or "$xan" eq "right"
MC/DC0%0/2
"$xan" eq "r" or "$xan" eq "right"
"$xan" eq "r"
"$xan" eq "right"
Truth table0%0/3
A or B
A= "$xan" eq "r"B= "$xan" eq "right"
| |||||||||||||||||||||||||||||
| 1090 | 0 | ▶ | if(("$xan" eq "t") || ("$xan" eq "top")) { $ax = $self->{'t'}; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
"$xan" eq "t" or "$xan" eq "top"
MC/DC0%0/2
"$xan" eq "t" or "$xan" eq "top"
"$xan" eq "t"
"$xan" eq "top"
Truth table0%0/3
A or B
A= "$xan" eq "t"B= "$xan" eq "top"
| |||||||||||||||||||||||||||||
| 1091 | 0 | ▶ | if(("$yan" eq "b") || ("$yan" eq "bottom")) { $ax = $self->{'b'}; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
"$yan" eq "b" or "$yan" eq "bottom"
MC/DC0%0/2
"$yan" eq "b" or "$yan" eq "bottom"
"$yan" eq "b"
"$yan" eq "bottom"
Truth table0%0/3
A or B
A= "$yan" eq "b"B= "$yan" eq "bottom"
| |||||||||||||||||||||||||||||
| 1092 | 0 | ▶ | if(("$yan" eq "l") || ("$yan" eq "left")) { $ay = $self->{'l'}; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
"$yan" eq "l" or "$yan" eq "left"
MC/DC0%0/2
"$yan" eq "l" or "$yan" eq "left"
"$yan" eq "l"
"$yan" eq "left"
Truth table0%0/3
A or B
A= "$yan" eq "l"B= "$yan" eq "left"
| |||||||||||||||||||||||||||||
| 1093 | 0 | ▶ | if(("$yan" eq "r") || ("$yan" eq "right")) { $ay = $self->{'r'}; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
"$yan" eq "r" or "$yan" eq "right"
MC/DC0%0/2
"$yan" eq "r" or "$yan" eq "right"
"$yan" eq "r"
"$yan" eq "right"
Truth table0%0/3
A or B
A= "$yan" eq "r"B= "$yan" eq "right"
| |||||||||||||||||||||||||||||
| 1094 | 0 | ▶ | if(("$yan" eq "t") || ("$yan" eq "top")) { $ax = $self->{'t'}; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
"$yan" eq "t" or "$yan" eq "top"
MC/DC0%0/2
"$yan" eq "t" or "$yan" eq "top"
"$yan" eq "t"
"$yan" eq "top"
Truth table0%0/3
A or B
A= "$yan" eq "t"B= "$yan" eq "top"
| |||||||||||||||||||||||||||||
| 1095 | 0 | ▶ | if((defined($ax) && defined($ay))) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $ax and defined $ay
MC/DC0%0/2
defined $ax and defined $ay
defined $ax
defined $ay
Truth table0%0/3
A and B
A= defined $axB= defined $ay
| |||||||||||||||||||||||||||||
| 1096 | 0 | ▶ | if(defined($p)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1097 | 0 | $back = LaTeX::PGF::Diagram2D::Label->new($self, $ax, $ay, $x, $y, $t, $p); | |||||||||||||||||||||||||||
| 1098 | } else { | ||||||||||||||||||||||||||||
| 1099 | 0 | $back = LaTeX::PGF::Diagram2D::Label->new($self, $ax, $ay, $x, $y, $t); | |||||||||||||||||||||||||||
| 1100 | } | ||||||||||||||||||||||||||||
| 1101 | 0 | my $ar = $self->{'contents'}; | |||||||||||||||||||||||||||
| 1102 | 0 | my $ai = $self->{'nco'}; | |||||||||||||||||||||||||||
| 1103 | 0 | $ar->[$ai++] = $back; | |||||||||||||||||||||||||||
| 1104 | 0 | $self->{'nco'} = $ai; | |||||||||||||||||||||||||||
| 1105 | } else { | ||||||||||||||||||||||||||||
| 1106 | 0 | croak "ERROR: One x- and one y-axis is needed!"; | |||||||||||||||||||||||||||
| 1107 | } | ||||||||||||||||||||||||||||
| 1108 | } | ||||||||||||||||||||||||||||
| 1109 | 0 | return $back; | |||||||||||||||||||||||||||
| 1110 | } | ||||||||||||||||||||||||||||
| 1111 | |||||||||||||||||||||||||||||
| 1112 | |||||||||||||||||||||||||||||
| 1113 | |||||||||||||||||||||||||||||
| 1114 | sub polyline | ||||||||||||||||||||||||||||
| 1115 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
polyline: not called CC=21 SCAR=61.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 1116 | 0 | my $back = undef; | |||||||||||||||||||||||||||
| 1117 | 0 | ▶ | if($#_ < 3) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1118 | 0 | croak "Usage: \$diagram->polyline(xaxis,yaxis,pointsarrayref)"; | |||||||||||||||||||||||||||
| 1119 | } else { | ||||||||||||||||||||||||||||
| 1120 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 1121 | 0 | my $xan = shift; | |||||||||||||||||||||||||||
| 1122 | 0 | my $yan = shift; | |||||||||||||||||||||||||||
| 1123 | 0 | my $pref = shift; | |||||||||||||||||||||||||||
| 1124 | 0 | my $ax = undef; my $ay = undef; | |||||||||||||||||||||||||||
| 1125 | 0 | ▶ | if(("$xan" eq "b") || ("$xan" eq "bottom")) { $ax = $self->{'b'}; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
"$xan" eq "b" or "$xan" eq "bottom"
MC/DC0%0/2
"$xan" eq "b" or "$xan" eq "bottom"
"$xan" eq "b"
"$xan" eq "bottom"
Truth table0%0/3
A or B
A= "$xan" eq "b"B= "$xan" eq "bottom"
| |||||||||||||||||||||||||||||
| 1126 | 0 | ▶ | if(("$xan" eq "l") || ("$xan" eq "left")) { $ay = $self->{'l'}; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
"$xan" eq "l" or "$xan" eq "left"
MC/DC0%0/2
"$xan" eq "l" or "$xan" eq "left"
"$xan" eq "l"
"$xan" eq "left"
Truth table0%0/3
A or B
A= "$xan" eq "l"B= "$xan" eq "left"
| |||||||||||||||||||||||||||||
| 1127 | 0 | ▶ | if(("$xan" eq "r") || ("$xan" eq "right")) { $ay = $self->{'r'}; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
"$xan" eq "r" or "$xan" eq "right"
MC/DC0%0/2
"$xan" eq "r" or "$xan" eq "right"
"$xan" eq "r"
"$xan" eq "right"
Truth table0%0/3
A or B
A= "$xan" eq "r"B= "$xan" eq "right"
| |||||||||||||||||||||||||||||
| 1128 | 0 | ▶ | if(("$xan" eq "t") || ("$xan" eq "top")) { $ax = $self->{'t'}; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
"$xan" eq "t" or "$xan" eq "top"
MC/DC0%0/2
"$xan" eq "t" or "$xan" eq "top"
"$xan" eq "t"
"$xan" eq "top"
Truth table0%0/3
A or B
A= "$xan" eq "t"B= "$xan" eq "top"
| |||||||||||||||||||||||||||||
| 1129 | 0 | ▶ | if(("$yan" eq "b") || ("$yan" eq "bottom")) { $ax = $self->{'b'}; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
"$yan" eq "b" or "$yan" eq "bottom"
MC/DC0%0/2
"$yan" eq "b" or "$yan" eq "bottom"
"$yan" eq "b"
"$yan" eq "bottom"
Truth table0%0/3
A or B
A= "$yan" eq "b"B= "$yan" eq "bottom"
| |||||||||||||||||||||||||||||
| 1130 | 0 | ▶ | if(("$yan" eq "l") || ("$yan" eq "left")) { $ay = $self->{'l'}; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
"$yan" eq "l" or "$yan" eq "left"
MC/DC0%0/2
"$yan" eq "l" or "$yan" eq "left"
"$yan" eq "l"
"$yan" eq "left"
Truth table0%0/3
A or B
A= "$yan" eq "l"B= "$yan" eq "left"
| |||||||||||||||||||||||||||||
| 1131 | 0 | ▶ | if(("$yan" eq "r") || ("$yan" eq "right")) { $ay = $self->{'r'}; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
"$yan" eq "r" or "$yan" eq "right"
MC/DC0%0/2
"$yan" eq "r" or "$yan" eq "right"
"$yan" eq "r"
"$yan" eq "right"
Truth table0%0/3
A or B
A= "$yan" eq "r"B= "$yan" eq "right"
| |||||||||||||||||||||||||||||
| 1132 | 0 | ▶ | if(("$yan" eq "t") || ("$yan" eq "top")) { $ax = $self->{'t'}; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
"$yan" eq "t" or "$yan" eq "top"
MC/DC0%0/2
"$yan" eq "t" or "$yan" eq "top"
"$yan" eq "t"
"$yan" eq "top"
Truth table0%0/3
A or B
A= "$yan" eq "t"B= "$yan" eq "top"
| |||||||||||||||||||||||||||||
| 1133 | 0 | ▶ | if(defined($ax) && defined($ay)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $ax and defined $ay
MC/DC0%0/2
defined $ax and defined $ay
defined $ax
defined $ay
Truth table0%0/3
A and B
A= defined $axB= defined $ay
| |||||||||||||||||||||||||||||
| 1134 | 0 | ▶ | if($#$pref >= 3) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1135 | 0 | $back = LaTeX::PGF::Diagram2D::Polyline->new($self, $ax, $ay, $pref); | |||||||||||||||||||||||||||
| 1136 | 0 | my $ar = $self->{'contents'}; | |||||||||||||||||||||||||||
| 1137 | 0 | my $ai = $self->{'nco'}; | |||||||||||||||||||||||||||
| 1138 | 0 | $ar->[$ai++] = $back; | |||||||||||||||||||||||||||
| 1139 | 0 | $self->{'nco'} = $ai; | |||||||||||||||||||||||||||
| 1140 | } else { | ||||||||||||||||||||||||||||
| 1141 | 0 | croak "ERROR: At least 2 points are needed!"; | |||||||||||||||||||||||||||
| 1142 | } | ||||||||||||||||||||||||||||
| 1143 | } else { | ||||||||||||||||||||||||||||
| 1144 | 0 | croak "ERROR: One x- and one y-axis is needed!"; | |||||||||||||||||||||||||||
| 1145 | } | ||||||||||||||||||||||||||||
| 1146 | } | ||||||||||||||||||||||||||||
| 1147 | 0 | return $back; | |||||||||||||||||||||||||||
| 1148 | } | ||||||||||||||||||||||||||||
| 1149 | |||||||||||||||||||||||||||||
| 1150 | |||||||||||||||||||||||||||||
| 1151 | |||||||||||||||||||||||||||||
| 1152 | sub value_to_coord | ||||||||||||||||||||||||||||
| 1153 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
value_to_coord: not called CC=10 SCAR=47.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 1154 | 0 | my $back = 0.0; | |||||||||||||||||||||||||||
| 1155 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 1156 | 0 | my $ax = shift; | |||||||||||||||||||||||||||
| 1157 | 0 | my $ay = shift; | |||||||||||||||||||||||||||
| 1158 | 0 | my $v = shift; | |||||||||||||||||||||||||||
| 1159 | 0 | my $i = shift; | |||||||||||||||||||||||||||
| 1160 | 0 | ▶ | if($i % 2) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1161 | 0 | ▶ | if(("$v" eq "t") || ("$v" eq "top")) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
"$v" eq "t" or "$v" eq "top"
MC/DC0%0/2
"$v" eq "t" or "$v" eq "top"
"$v" eq "t"
"$v" eq "top"
Truth table0%0/3
A or B
A= "$v" eq "t"B= "$v" eq "top"
| |||||||||||||||||||||||||||||
| 1162 | 0 | $back = $self->{'y5bp'}; | |||||||||||||||||||||||||||
| 1163 | } else { | ||||||||||||||||||||||||||||
| 1164 | 0 | ▶ | if(("$v" eq "b") || ("$v" eq "bottom")) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
"$v" eq "b" or "$v" eq "bottom"
MC/DC0%0/2
"$v" eq "b" or "$v" eq "bottom"
"$v" eq "b"
"$v" eq "bottom"
Truth table0%0/3
A or B
A= "$v" eq "b"B= "$v" eq "bottom"
| |||||||||||||||||||||||||||||
| 1165 | 0 | $back = $self->{'y2bp'}; | |||||||||||||||||||||||||||
| 1166 | } else { | ||||||||||||||||||||||||||||
| 1167 | 0 | $back = $ay->value_to_coord($v); | |||||||||||||||||||||||||||
| 1168 | } | ||||||||||||||||||||||||||||
| 1169 | } | ||||||||||||||||||||||||||||
| 1170 | } else { | ||||||||||||||||||||||||||||
| 1171 | 0 | ▶ | if(("$v" eq "l") || ("$v" eq "left")) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
"$v" eq "l" or "$v" eq "left"
MC/DC0%0/2
"$v" eq "l" or "$v" eq "left"
"$v" eq "l"
"$v" eq "left"
Truth table0%0/3
A or B
A= "$v" eq "l"B= "$v" eq "left"
| |||||||||||||||||||||||||||||
| 1172 | 0 | $back = $self->{'x2bp'}; | |||||||||||||||||||||||||||
| 1173 | } else { | ||||||||||||||||||||||||||||
| 1174 | 0 | ▶ | if(("$v" eq "r") || ("$v" eq "right")) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
"$v" eq "r" or "$v" eq "right"
MC/DC0%0/2
"$v" eq "r" or "$v" eq "right"
"$v" eq "r"
"$v" eq "right"
Truth table0%0/3
A or B
A= "$v" eq "r"B= "$v" eq "right"
| |||||||||||||||||||||||||||||
| 1175 | 0 | $back = $self->{'x5bp'}; | |||||||||||||||||||||||||||
| 1176 | } else { | ||||||||||||||||||||||||||||
| 1177 | 0 | $back = $ax->value_to_coord($v); | |||||||||||||||||||||||||||
| 1178 | } | ||||||||||||||||||||||||||||
| 1179 | } | ||||||||||||||||||||||||||||
| 1180 | } | ||||||||||||||||||||||||||||
| 1181 | 0 | return $back; | |||||||||||||||||||||||||||
| 1182 | } | ||||||||||||||||||||||||||||
| 1183 | |||||||||||||||||||||||||||||
| 1184 | |||||||||||||||||||||||||||||
| 1185 | |||||||||||||||||||||||||||||
| 1186 | sub set_debug | ||||||||||||||||||||||||||||
| 1187 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
set_debug: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 1188 | 0 | my $self = undef; | |||||||||||||||||||||||||||
| 1189 | 0 | ▶ | if($#_ < 1) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1190 | 0 | croak "Usage: \$diagram->set_debug(flag)"; | |||||||||||||||||||||||||||
| 1191 | } else { | ||||||||||||||||||||||||||||
| 1192 | 0 | $self = shift; $self->{'debug'} = shift; | |||||||||||||||||||||||||||
| 1193 | 0 | my $ar = $self->{'p'}; | |||||||||||||||||||||||||||
| 1194 | 0 | my $ai = $self->{'np'}; | |||||||||||||||||||||||||||
| 1195 | 0 | my $pref; | |||||||||||||||||||||||||||
| 1196 | 0 | ▶ | for(my $i = 0; $i < $ai; $i++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1197 | 0 | $pref = $ar->[$i]; | |||||||||||||||||||||||||||
| 1198 | 0 | $pref->{'debug'} = $self->{'debug'}; | |||||||||||||||||||||||||||
| 1199 | } | ||||||||||||||||||||||||||||
| 1200 | } | ||||||||||||||||||||||||||||
| 1201 | 0 | return $self; | |||||||||||||||||||||||||||
| 1202 | } | ||||||||||||||||||||||||||||
| 1203 | |||||||||||||||||||||||||||||
| 1204 | |||||||||||||||||||||||||||||
| 1205 | 1 | 1; | |||||||||||||||||||||||||||
| 1206 | __END__ | ||||||||||||||||||||||||||||