| 1 | package VRML::Base; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | ############################## Copyright ############################## | ||||||||||||||||||||||||||||||||||||||||||
| 4 | # # | ||||||||||||||||||||||||||||||||||||||||||
| 5 | # This program is Copyright 1996,1998 by Hartmut Palm. # | ||||||||||||||||||||||||||||||||||||||||||
| 6 | # This program is free software; you can redistribute it and/or # | ||||||||||||||||||||||||||||||||||||||||||
| 7 | # modify it under the terms of the GNU General Public License # | ||||||||||||||||||||||||||||||||||||||||||
| 8 | # as published by the Free Software Foundation; either version 2 # | ||||||||||||||||||||||||||||||||||||||||||
| 9 | # of the License, or (at your option) any later version. # | ||||||||||||||||||||||||||||||||||||||||||
| 10 | # # | ||||||||||||||||||||||||||||||||||||||||||
| 11 | # This program is distributed in the hope that it will be useful, # | ||||||||||||||||||||||||||||||||||||||||||
| 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # | ||||||||||||||||||||||||||||||||||||||||||
| 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # | ||||||||||||||||||||||||||||||||||||||||||
| 14 | # GNU General Public License for more details. # | ||||||||||||||||||||||||||||||||||||||||||
| 15 | # # | ||||||||||||||||||||||||||||||||||||||||||
| 16 | # If you do not have a copy of the GNU General Public License write # | ||||||||||||||||||||||||||||||||||||||||||
| 17 | # to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, # | ||||||||||||||||||||||||||||||||||||||||||
| 18 | # MA 02139, USA. # | ||||||||||||||||||||||||||||||||||||||||||
| 19 | # # | ||||||||||||||||||||||||||||||||||||||||||
| 20 | ####################################################################### | ||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | 2 | require 5.000; | |||||||||||||||||||||||||||||||||||||||||
| 23 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 24 | 2 | ▶ | use vars qw($VERSION $PI $PI_2); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | 2 | $VERSION = "1.07"; | |||||||||||||||||||||||||||||||||||||||||
| 27 | 2 | $PI = 3.1415926; | |||||||||||||||||||||||||||||||||||||||||
| 28 | 2 | $PI_2 = $PI/2; | |||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | 12 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 31 | 12 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 32 | 12 | my $tabs = shift; | |||||||||||||||||||||||||||||||||||||||||
| 33 | 12 | my $self = {}; | |||||||||||||||||||||||||||||||||||||||||
| 34 | 12 | ▶ | $self->{'TAB'} = defined $tabs ? "\t" x $tabs : ""; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 35 | 12 | $self->{'TAB_VIEW'} = ""; | |||||||||||||||||||||||||||||||||||||||||
| 36 | 12 | $self->{'DEBUG'} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 37 | 12 | $self->{'VERSION'} = 0; # VRML specification | |||||||||||||||||||||||||||||||||||||||||
| 38 | 12 | $self->{'CONVERT'} = 1; # convert degree to radiant | |||||||||||||||||||||||||||||||||||||||||
| 39 | 12 | $self->{'BROWSER'} = "";# Which VRML + HTML browser | |||||||||||||||||||||||||||||||||||||||||
| 40 | 12 | $self->{'VRML'} = []; # THE VRML array | |||||||||||||||||||||||||||||||||||||||||
| 41 | 12 | $self->{'DEF'} = {}; # remember DEFs | |||||||||||||||||||||||||||||||||||||||||
| 42 | 12 | $self->{'PROTO'} = {}; # remember PROTOs | |||||||||||||||||||||||||||||||||||||||||
| 43 | 12 | $self->{'XYZ'} = [[0,0,0]]; | |||||||||||||||||||||||||||||||||||||||||
| 44 | 12 | $self->{'Xmax'} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 45 | 12 | $self->{'Ymax'} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 46 | 12 | $self->{'Zmax'} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 47 | 12 | $self->{'Xmin'} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 48 | 12 | $self->{'Ymin'} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 49 | 12 | $self->{'Zmin'} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 50 | 12 | $self->{'DX'} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 51 | 12 | $self->{'DY'} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 52 | 12 | $self->{'DZ'} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 53 | 12 | $self->{'ID'} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 54 | 12 | return bless $self, $class; | |||||||||||||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | ▶ | sub browser { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
browser: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | ▶ | return unless $_[0]; # @_ wouldn't work on PC | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | ($self->{'BROWSER'}) = join("+",@_); | |||||||||||||||||||||||||||||||||||||||||
| 61 | $self->_put("# Set Browser to: '$self->{'browser'}'\n") | ||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | ▶ | if $self->{'DEBUG'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||
| 66 | ##################################################################### | ||||||||||||||||||||||||||||||||||||||||||
| 67 | # Methods to modify the VRML array | ||||||||||||||||||||||||||||||||||||||||||
| 68 | # | ||||||||||||||||||||||||||||||||||||||||||
| 69 | ##################################################################### | ||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | ▶ | sub _init { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_init: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | my $vrml = shift; | |||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | $self->{'VRML'} = [$vrml]; | |||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | ▶ | sub _add { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_add: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | my $vrml = shift; | |||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | ${$self->{'VRML'}}[$#{$self->{'VRML'}}] .= $vrml; | |||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | ▶ | sub _put { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_put: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | my $vrml = shift; | |||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | push @{$self->{'VRML'}}, $vrml; | |||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | ▶ | sub _row { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_row: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | my ($row) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | my $vrml = $self->{'TAB'}.$row; | |||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | push @{$self->{'VRML'}}, $vrml; | |||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | ▶ | sub _swap { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_swap: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | my $element1 = pop @{$self->{'VRML'}}; | |||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | my $element2 = pop @{$self->{'VRML'}}; | |||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | push @{$self->{'VRML'}}, $element1; | |||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | push @{$self->{'VRML'}}, $element2; | |||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | ▶ | sub _pos { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_pos: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | return $#{$self->{'VRML'}}; | |||||||||||||||||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||
| 114 | 19 | ▶ | sub _trim { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_trim: called CC=2 SCAR=7.1
| |||||||||||||||||||||||||||||||||||||||||||
| 115 | 19 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 116 | 19 | my ($index) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | ▶ | $index = $#{$self->{'VRML'}} unless defined $index; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 118 | 19 | $self->{'VRML'}[$index-1] =~ s/\s+$/ /; | |||||||||||||||||||||||||||||||||||||||||
| 119 | 19 | $self->{'VRML'}[$index] =~ s/^\s+//; | |||||||||||||||||||||||||||||||||||||||||
| 120 | 19 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | ▶ | sub debug { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
debug: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | $self->{'DEBUG'} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | $self->_put("# Set Debug Level to $self->{'DEBUG'}\n"); | |||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | ▶ | sub display_vars { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
display_vars: not called CC=9 SCAR=45.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | ▶ | my @keys = @_ ? @_ : sort keys %$self; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | my $key; | |||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | foreach $key (@keys) { | |||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | ▶ | unless (defined $self->{$key}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | print "# $key => undef\n"; | |||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | print "# $key => $self->{$key}"; | |||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | print " [".(join(', ',@{$self->{$key}}))."]" if defined | |||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | ▶ | ref($self->{$key}) && ref($self->{$key}) eq "ARRAY" && | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
defined ref $self->{$key} and ref $self->{$key} eq "ARRAY" and $key ne "VRML"
defined ref $self->{$key} and ref $self->{$key} eq "ARRAY"
MC/DC0%0/3
defined ref $self->{$key} and ref $self->{$key} eq "ARRAY" and $key ne "VRML"
defined ref $self->{$key}
ref $self->{$key} eq "ARRAY"
$key ne "VRML"
Truth table0%0/4
A and B and C
A= defined ref $self->{$key}B= ref $self->{$key} eq "ARRAY"C= $key ne "VRML"
| |||||||||||||||||||||||||||||||||||||||||||
| 142 | $key ne "VRML"; | ||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | print " [".(join(', ',sort keys %{$self->{$key}}))."]" | |||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | ▶ | if defined ref($self->{$key}) && ref($self->{$key}) eq "HASH"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined ref $self->{$key} and ref $self->{$key} eq "HASH"
MC/DC0%0/2
defined ref $self->{$key} and ref $self->{$key} eq "HASH"
defined ref $self->{$key}
ref $self->{$key} eq "HASH"
Truth table0%0/3
A and B
A= defined ref $self->{$key}B= ref $self->{$key} eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | print "\n"; | |||||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||
| 150 | 8 | ▶ | sub string_to_array { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
string_to_array: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 151 | 8 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 152 | 8 | my $pt = shift; | |||||||||||||||||||||||||||||||||||||||||
| 153 | 8 | ▶ | return @$pt if ref $pt eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 154 | # remove leading/trailing spaces! | ||||||||||||||||||||||||||||||||||||||||||
| 155 | 8 | my $tmp = $pt; $tmp =~ s/^\s+//; $tmp =~ s/\s+$//; | |||||||||||||||||||||||||||||||||||||||||
| 156 | 8 | return split(/\s+/,$tmp); | |||||||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||
| 159 | #-------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 160 | # Insert Comments | ||||||||||||||||||||||||||||||||||||||||||
| 161 | #-------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | ▶ | sub comment { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
comment: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | my ($comment) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | ▶ | $comment = defined $comment ? "# ".$comment : "#"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | push @{$self->{'VRML'}}, $comment."\n"; | |||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||
| 170 | #-------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 171 | # In-/Output VRML | ||||||||||||||||||||||||||||||||||||||||||
| 172 | #-------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | ▶ | sub insert { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
insert: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | my $string = shift; | |||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | $string =~ s/^\s+|\s+$//g; | |||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | $string = $self->{'TAB'}.$string; | |||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | $string =~ s/\n/\n$self->{'TAB'}/g; | |||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | push @{$self->{'VRML'}}, $string."\n"; | |||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | ▶ | sub insert__DATA__ { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
insert__DATA__: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | ▶ | $self->{'DATApos'} = tell(main::DATA) unless defined $self->{'DATApos'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | ▶ | print " self->{'DATApos'}=$self->{'DATApos'}\n" if $self->{'DEBUG'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | push @{$self->{'VRML'}}, <main::DATA>,"\n"; | |||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | seek(main::DATA,$self->{'DATApos'},0); | |||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | ▶ | sub include { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
include: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | my @filename = @_; | |||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | ▶ | return $self if !defined $filename[0] || $filename[0] eq ""; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $filename[0] or $filename[0] eq ""
MC/DC0%0/2
not defined $filename[0] or $filename[0] eq ""
not defined $filename[0]
$filename[0] eq ""
Truth table0%0/3
not(A) or B
A= not defined $filename[0]B= $filename[0] eq ""
| |||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | foreach (@filename) { | |||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | ▶ | open(INCLUDE, "<$_") || die "Can't include \"$_\"\n$!\n"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | push @{$self->{'VRML'}}, <INCLUDE>; | |||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | push @{$self->{'VRML'}}, "\n"; | |||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | close(INCLUDE); | |||||||||||||||||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | ▶ | sub format { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
format: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | my $format = shift; | |||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | ▶ | if (defined $format && $format eq "none") { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $format and $format eq "none"
MC/DC0%0/2
defined $format and $format eq "none"
defined $format
$format eq "none"
Truth table0%0/3
A and B
A= defined $formatB= $format eq "none"
| |||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | map { s/^[\t ]+//; s/\n[\t ]+/\n/g; s/\t+/ /g; s/ +/ /g; } @{$self->{'VRML'}}; | |||||||||||||||||||||||||||||||||||||||||
| 210 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | map { s/ / /g; s/\t/ /g; } @{$self->{'VRML'}}; | |||||||||||||||||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | ▶ | sub print { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
print: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | my $mime = shift; | |||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | my $pipe = shift; | |||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | select STDOUT; $|=1; | |||||||||||||||||||||||||||||||||||||||||
| 221 | print "Content-type: $self->{'Content-type'}\n\n" | ||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | ▶ | if $self->{'Content-type'} && $mime; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->{"Content-type"} and $mime
MC/DC0%0/2
$self->{"Content-type"} and $mime
$self->{"Content-type"}
$mime
Truth table0%0/3
A and B
A= $self->{"Content-type"}B= $mime
| |||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | ▶ | if ($pipe) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | ▶ | open(PIPE, "|$pipe") || die; select PIPE; $|=1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | for (@{$self->{'VRML'}}) { print; } | |||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | select STDOUT; | |||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | close(PIPE); | |||||||||||||||||||||||||||||||||||||||||
| 228 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | for (@{$self->{'VRML'}}) { print; } | |||||||||||||||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | ▶ | sub save { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
save: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | my $filename = shift; | |||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | my $pipe = shift; | |||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | ▶ | unless (defined $filename) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | ($filename) = $0 =~ m/(.*)\./; | |||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | $filename .= ".wrl"; | |||||||||||||||||||||||||||||||||||||||||
| 241 | } | ||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | ▶ | open(VRMLFILE, ">$filename") || | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 243 | die "Can't create file: \"$filename\" ($!)\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | ▶ | if ($pipe) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | print VRMLFILE "Can't pipe to \"$pipe\"\n"; | |||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | close(VRMLFILE); | |||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | ▶ | open(VRMLFILE, "| $pipe > $filename") || die; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | for (@{$self->{'VRML'}}) { print VRMLFILE; } | |||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | close(VRMLFILE); | |||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||
| 254 | 12 | ▶ | sub as_string { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
as_string: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 255 | 12 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 256 | 12 | my $vrml = ""; | |||||||||||||||||||||||||||||||||||||||||
| 257 | 12 | for (@{$self->{'VRML'}}) { $vrml .= $_ }; | |||||||||||||||||||||||||||||||||||||||||
| 258 | 12 | return $vrml; | |||||||||||||||||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||
| 261 | #-------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | ▶ | sub escape { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
escape: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | shift; | |||||||||||||||||||||||||||||||||||||||||
| 266 | } | ||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||
| 268 | 1 | ▶ | sub ascii { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ascii: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 269 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 270 | 1 | local $_ = undef; | |||||||||||||||||||||||||||||||||||||||||
| 271 | 1 | foreach (@_) { | |||||||||||||||||||||||||||||||||||||||||
| 272 | 1 | s/[\204\344\365]/ae/g; | |||||||||||||||||||||||||||||||||||||||||
| 273 | 1 | s/[\224\366]/oe/g; | |||||||||||||||||||||||||||||||||||||||||
| 274 | 1 | s/[\201\374]/ue/g; | |||||||||||||||||||||||||||||||||||||||||
| 275 | 1 | s/[\216\304]/Ae/g; | |||||||||||||||||||||||||||||||||||||||||
| 276 | 1 | s/[\231\305\326]/Oe/g; | |||||||||||||||||||||||||||||||||||||||||
| 277 | 1 | s/[\263\334]/Ue/g; | |||||||||||||||||||||||||||||||||||||||||
| 278 | 1 | s/[\257\337]/sz/g; | |||||||||||||||||||||||||||||||||||||||||
| 279 | 1 | s/[\000-\010\013-\037\177-\377]/_/g; | |||||||||||||||||||||||||||||||||||||||||
| 280 | } | ||||||||||||||||||||||||||||||||||||||||||
| 281 | 1 | ▶ | return (@_) if wantarray; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 282 | 1 | return $_[0]; | |||||||||||||||||||||||||||||||||||||||||
| 283 | } | ||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||
| 285 | 1 | ▶ | sub utf8 { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
utf8: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 286 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 287 | 1 | local $_ = undef; | |||||||||||||||||||||||||||||||||||||||||
| 288 | #foreach (@_) { | ||||||||||||||||||||||||||||||||||||||||||
| 289 | # s/[\201\374]/\x00\x75\x03\x08/g; | ||||||||||||||||||||||||||||||||||||||||||
| 290 | # s/(.)/\x00$1/g; | ||||||||||||||||||||||||||||||||||||||||||
| 291 | #} | ||||||||||||||||||||||||||||||||||||||||||
| 292 | 1 | ▶ | return (@_) if wantarray; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 293 | 1 | return $_[0]; | |||||||||||||||||||||||||||||||||||||||||
| 294 | } | ||||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||
| 296 | 0 | ▶ | sub xyz { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
xyz: not called CC=9 SCAR=45.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 297 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | ▶ | return $self unless @_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 299 | 0 | ($self->{'DX'}, $self->{'DY'}, $self->{'DZ'}) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | ${$self->{'XYZ'}[0]}[0] += $self->{'DX'}; | |||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | ${$self->{'XYZ'}[0]}[1] += $self->{'DY'}; | |||||||||||||||||||||||||||||||||||||||||
| 302 | 0 | ${$self->{'XYZ'}[0]}[2] += $self->{'DZ'}; | |||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | print "XYZ = ".join(', ',@{$self->{'XYZ'}[0]})."\n" | |||||||||||||||||||||||||||||||||||||||||
| 304 | 0 | ▶ | if $self->{'DEBUG'} == 2; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 305 | 0 | $self->{'Xmax'} = ${$self->{'XYZ'}[0]}[0] | |||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | ▶ | if $self->{'Xmax'} < ${$self->{'XYZ'}[0]}[0]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 307 | 0 | $self->{'Ymax'} = ${$self->{'XYZ'}[0]}[1] | |||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | ▶ | if $self->{'Ymax'} < ${$self->{'XYZ'}[0]}[1]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 309 | 0 | $self->{'Zmax'} = ${$self->{'XYZ'}[0]}[2] | |||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | ▶ | if $self->{'Zmax'} < ${$self->{'XYZ'}[0]}[2]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 311 | 0 | $self->{'Xmin'} = ${$self->{'XYZ'}[0]}[0] | |||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | ▶ | if $self->{'Xmin'} > ${$self->{'XYZ'}[0]}[0]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | $self->{'Ymin'} = ${$self->{'XYZ'}[0]}[1] | |||||||||||||||||||||||||||||||||||||||||
| 314 | 0 | ▶ | if $self->{'Ymin'} > ${$self->{'XYZ'}[0]}[1]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 315 | 0 | $self->{'Zmin'} = ${$self->{'XYZ'}[0]}[2] | |||||||||||||||||||||||||||||||||||||||||
| 316 | 0 | ▶ | if $self->{'Zmin'} > ${$self->{'XYZ'}[0]}[2]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 317 | } | ||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||
| 319 | 0 | ▶ | sub bboxCenter { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
bboxCenter: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 320 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | my ($x, $y, $z) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | ▶ | $x = ($self->{'Xmax'} + $self->{'Xmin'})/2 unless defined $x; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 323 | 0 | ▶ | $y = ($self->{'Ymax'} + $self->{'Ymin'})/2 unless defined $y; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 324 | 0 | ▶ | $z = ($self->{'Zmax'} + $self->{'Zmin'})/2 unless defined $z; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 325 | 0 | ▶ | return ($x, $y, $z) if wantarray; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | return "$x $y $z"; | |||||||||||||||||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | ▶ | sub bboxSize { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
bboxSize: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 331 | 0 | my ($dx, $dy, $dz) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | ▶ | $dx = $self->{'Xmax'} - $self->{'Xmin'} unless defined $dx; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | ▶ | $dy = $self->{'Ymax'} - $self->{'Ymin'} unless defined $dy; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | ▶ | $dz = $self->{'Zmax'} - $self->{'Zmin'} unless defined $dz; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | ▶ | return ($dx, $dy, $dz) if wantarray; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | return "$dx $dy $dz"; | |||||||||||||||||||||||||||||||||||||||||
| 337 | } | ||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||
| 339 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||
| 341 | __END__ | ||||||||||||||||||||||||||||||||||||||||||