| 1 | package Ftree::FamilyTreeGraphics; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use version; our $VERSION = qv('2.3.41'); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 2 | ▶ | use Ftree::FamilyTreeBase; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use Params::Validate qw(:all); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 2 | ▶ | use List::Util qw(first max); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 2 | ▶ | use List::MoreUtils qw(first_index); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 2 | ▶ | use CGI::Carp qw(warningsToBrowser);# warningsToBrowser set_message); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 2 | ▶ | use Sub::Exporter -setup => { exports => [ qw(new main) ] }; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 2 | ▶ | use utf8; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 2 | ▶ | use Encode qw(decode_utf8); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 2 | ▶ | use Ftree::Picture; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | ####################################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | # The HTML output table is generated in three parts: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | # - the Ancestor tree (ATree) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | # - the peer level (peers) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | # - the Descendant tree (DTree) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | ####################################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 2 | ▶ | use base 'Ftree::FamilyTreeBase'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 1 | ▶ | sub new{ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 1 | my $type = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 1 | my $self = $type->SUPER::new(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 1 | $self->{target_person} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 1 | $self->{DLevels} = 0; # nr of levels in DTree | |||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 1 | $self->{cellwidth} = undef; # width of a cell | |||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 1 | $self->{gridWidth} = undef; # width of the tree | |||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 1 | $self->{fontsize} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 1 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 1 | ▶ | sub main{ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
main: called CC=2 SCAR=7.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 1 | my ($self) = validate_pos(@_, HASHREF); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | # my $title='/nophoto_m.jpg'; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | # warningsToBrowser(1); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 1 | $self->_process_parameters(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | #set_message("This is a better message for the end."); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | #die ("This is a test die"); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | # print $self->{cgi}->center( $self->{cgi}->h1($title) ), "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | $Ftree::Person::unknown_male->set_default_picture(Ftree::Picture->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 1 | {file_name => $self->{graphicsUrl} . '/nophoto_m.jpg', | |||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | comment => ""})); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | $Ftree::Person::unknown_female->set_default_picture(Ftree::Picture->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 1 | {file_name => $self->{graphicsUrl} . '/nophoto_f.jpg', | |||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | comment => ""})); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 1 | $self->_target_check(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 1 | $self->set_size(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 1 | $self->_password_check(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 1 | ▶ | if ( $self->{reqLevels} > 0 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 1 | $self->_draw_familytree_page(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | my $address = $self->{cgi}->url(-relative=>0); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | $address =~ s/$self->{treeScript}/$self->{personScript}/xm; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | $address .= "?target=".$self->{target_person}->get_id() | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | .";lang=".$self->{lang}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | print $self->{cgi}->redirect($address); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | ####################################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | # processing the parameters (type and passwd) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 1 | ▶ | sub _process_parameters { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_process_parameters: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 1 | my ($self) = validate_pos(@_, HASHREF); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 1 | $self->SUPER::_process_parameters(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 1 | my $id = decode_utf8(CGI::param('target')); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | my $family_tree_data = | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 1 | Ftree::FamilyTreeDataFactory::getFamilyTree( $self->{settings}{data_source} ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 1 | $self->{target_person} = $family_tree_data->get_person($id); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 1 | $self->{reqLevels} = CGI::param('levels'); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 1 | ▶ | $self->{reqLevels} = 2 unless ( defined $self->{reqLevels} ); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | ####################################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | # check if target person exists in database | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 1 | ▶ | sub _target_check { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_target_check: called CC=2 SCAR=10.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 1 | my ($self) = validate_pos(@_, HASHREF); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 1 | ▶ | if ( !defined $self->{target_person} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | my $title = $self->{textGenerator}->noDataAbout( CGI::param('target') ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | $self->_toppage($title); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | print $self->{cgi}->br, $title, $self->{cgi}->br, "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | $self->_endpage(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | exit 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | ####################################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | # Size the output according to the no. levels being displayed | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 1 | ▶ | sub set_size { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_size: called CC=6 SCAR=27.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 1 | my ($self) = validate_pos(@_, HASHREF); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 1 | ▶ | if ( $self->{reqLevels} > 3 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 5 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | $self->{imgwidth} = 45; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | $self->{fontsize} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | elsif ( $self->{reqLevels} == 3 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | $self->{imgwidth} = 60; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | $self->{fontsize} = 2; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | elsif ( $self->{reqLevels} == 2 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 1 | $self->{imgwidth} = 90; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 1 | $self->{fontsize} = 3; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | elsif ( $self->{reqLevels} == 1 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | $self->{imgwidth} = 110; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | $self->{fontsize} = 2; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | elsif ( $self->{reqLevels} == 0 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | $self->{imgwidth} = 240; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | $self->{fontsize} = 2; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | $self->{cellwidth} = 70; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | $self->{imgwidth} = 60; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | $self->{fontsize} = 2; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 1 | $self->{cellwidth} = "100%"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 1 | $self->{imgheight} = $self->{imgwidth} * 1.5; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 10 | ▶ | sub html_img { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
html_img: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 10 | my ( $self, $person ) = validate_pos(@_, HASHREF, SCALARREF); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 10 | my $img = $self->SUPER::html_img($person); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | return ($person == $self->{target_person} || | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 10 | ▶ | $person == $Ftree::Person::unknown_male || | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$person == $self->{"target_person"} or $person == $Ftree::Person::unknown_male or $person == $Ftree::Person::unknown_female
$person == $self->{"target_person"} or $person == $Ftree::Person::unknown_male
MC/DC100%3/3
$person == $self->{"target_person"} or $person == $Ftree::Person::unknown_male or $person == $Ftree::Person::unknown_female
$person == $self->{"target_person"}
$person == $Ftree::Person::unknown_male
$person == $Ftree::Person::unknown_female
Truth table100%4/4
A or B or C
A= $person == $self->{"target_person"}B= $person == $Ftree::Person::unknown_maleC= $person == $Ftree::Person::unknown_female
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | $person == $Ftree::Person::unknown_female ) ? $img : $self->aref_tree($img, $person); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 20 | ▶ | sub img_graph { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
img_graph: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 20 | my ( $self, $graphics ) = validate_pos(@_, HASHREF, SCALAR, 0); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | return $self->{cgi}->img( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | -width => $self->{cellwidth}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 20 | -height=> "26", | |||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | -src => "$self->{graphicsUrl}/".$graphics.".gif", | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | -alt => "", | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | ▶ | sub hone_img_graph { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
hone_img_graph: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | my ( $self ) = validate_pos(@_, HASHREF, 0); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | return $self->img_graph('hone'); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 12 | ▶ | sub getATreeWidth { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getATreeWidth: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 12 | my ( $self, $levels ) = validate_pos(@_, HASHREF, SCALAR, 0); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 12 | return 2**( $levels ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | ####################################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | # returns the width of tree below this person | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | # root_person: this person | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | # levels: no. of levels to descend in tree | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 16 | ▶ | sub getDTreeWidth { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getDTreeWidth: called CC=6 SCAR=18.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 16 | my ( $self, $levels, $root_person ) = validate_pos(@_, | |||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | HASHREF, SCALAR, SCALARREF ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | # carp "called: getDTreeWidth with \$root_person = " . $root_person->get_name()->get_long_name() . ", \$levels = $levels"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 16 | ▶ | return 1 if ( 0 == $levels); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 16 | ▶ | return 1 if ($root_person == $Ftree::Person::unknown_male || | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$root_person == $Ftree::Person::unknown_male or $root_person == $Ftree::Person::unknown_female
MC/DC0%0/2
$root_person == $Ftree::Person::unknown_male or $root_person == $Ftree::Person::unknown_female
$root_person == $Ftree::Person::unknown_male
$root_person == $Ftree::Person::unknown_female
Truth table33%1/3
A or B
A= $root_person == $Ftree::Person::unknown_maleB= $root_person == $Ftree::Person::unknown_female
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | $root_person == $Ftree::Person::unknown_female); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 16 | ▶ | return 1 unless defined $root_person->get_children(); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 1 | my $width = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | $width += $self->getDTreeWidth( $levels - 1, $_ ) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 1 | for ( @{ $root_person->get_children() } ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 1 | return $width; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | ####################################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | # returns the no. levels available in Ancestor tree | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | # above this person | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | # root_person: this person | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | # anc_level: current level of ancestor tree (0=root_node) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | # req_levels: no. levels requested | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 5 | ▶ | sub getATreeLevels { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getATreeLevels: called CC=6 SCAR=18.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 5 | my ( $self, $root_person, $anc_level, $req_levels ) = validate_pos(@_, | |||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | HASHREF, {type => SCALARREF|UNDEF}, SCALAR, SCALAR ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | # print "called: getATreeLevels (root_node=$root_person->get_name()->get_full_name(), anc_level=$anc_level, req_levels=$req_levels)\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 5 | ▶ | return 0 if ( $req_levels == 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 5 | ▶ | return $anc_level unless defined $root_person; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 5 | ▶ | return $anc_level unless ( defined $root_person->get_father() || | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $root_person->get_father or defined $root_person->get_mother
MC/DC50%1/2
defined $root_person->get_father or defined $root_person->get_mother
defined $root_person->get_father
defined $root_person->get_mother
Truth table66%2/3
A or B
A= defined $root_person->get_fatherB= defined $root_person->get_mother
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | defined $root_person->get_mother()); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 2 | ▶ | return $anc_level if($anc_level == $req_levels ); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 2 | my $p1_levels = $self->getATreeLevels( $root_person->get_father(), | |||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | $anc_level + 1, $req_levels ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 2 | my $p2_levels = $self->getATreeLevels( $root_person->get_mother(), | |||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | $anc_level + 1, $req_levels ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 2 | return List::Util::max($p1_levels, $p2_levels); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | ####################################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | # populate the Descendant Tree structure for all | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | # people below the person specified | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | # $root_person: this person | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | # dec_level: current level of descendant tree (0=root_node) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | # req_levels: no. levels requested | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 4 | ▶ | sub fillDTree { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fillDTree: called CC=8 SCAR=21.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 4 | my ( $self, $root_person, $dec_level, $req_levels, $DTree_ref ) = validate_pos(@_, | |||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | HASHREF, SCALARREF, SCALAR, SCALAR, ARRAYREF ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | # print "called: fillDTree (root_node=$root_node_id, dec_level=$dec_level, req_levels=$req_levels)\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 4 | $dec_level++; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 4 | ▶ | if ( $root_person != $Ftree::Person::unknown_male | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
$root_person != $Ftree::Person::unknown_male and $root_person != $Ftree::Person::unknown_female and defined $root_person->get_children
$root_person != $Ftree::Person::unknown_male and $root_person != $Ftree::Person::unknown_female
MC/DC33%1/3
$root_person != $Ftree::Person::unknown_male and $root_person != $Ftree::Person::unknown_female and defined $root_person->get_children
$root_person != $Ftree::Person::unknown_male
$root_person != $Ftree::Person::unknown_female
defined $root_person->get_children
Truth table50%2/4
A and B and C
A= $root_person != $Ftree::Person::unknown_maleB= $root_person != $Ftree::Person::unknown_femaleC= defined $root_person->get_children
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | && $root_person != $Ftree::Person::unknown_female | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | && defined $root_person->get_children() ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 1 | push @{ $DTree_ref->[$dec_level] }, @{$root_person->get_children()}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 1 | ▶ | $self->{DLevels} = $dec_level if ( $dec_level > $self->{DLevels} ); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 3 | push @{ $DTree_ref->[$dec_level] }, $Ftree::Person::unknown_female; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 4 | ▶ | if ( $dec_level < $req_levels ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 1 | ▶ | if(defined $root_person->get_children()) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | $self->fillDTree( $_, $dec_level, $req_levels, $DTree_ref ) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 1 | for ( @{ $root_person->get_children() } ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | $self->fillDTree( $Ftree::Person::unknown_female, $dec_level, $req_levels, $DTree_ref ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 4 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 99 | ▶ | sub putNTD { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
putNTD: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 99 | my ( $self, $n, $data ) = validate_pos(@_, | |||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | HASHREF, SCALAR, {type => SCALAR, default => ""} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 99 | print $self->{cgi}->td($data), "\n" for (1 .. $n); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 99 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 9 | ▶ | sub drawRow { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
drawRow: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 9 | my ( $self, $used_width, $people, $diff_levels, $this_level, | |||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | $left_fill, $emptyTDCond, $group_width_func, $display_func ) = validate_pos(@_, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | HASHREF, SCALAR, ARRAYREF, {type => SCALAR|UNDEF}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | {type => SCALAR|UNDEF}, SCALAR, CODEREF, CODEREF, CODEREF ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 9 | my $right_fill = $self->{gridWidth} - $used_width - $left_fill; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 9 | my $is_blank_line = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 9 | print $self->{cgi}->start_Tr, "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 9 | $self->putNTD($left_fill); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 9 | foreach my $person (@{$people}) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 23 | my $group_width = $group_width_func->($self, $diff_levels, $person); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 23 | my $left = int( ( $group_width - 1 ) / 2 ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 23 | my $right = $group_width - 1 - $left; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 23 | $self->putNTD($left); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 23 | ▶ | if ( $emptyTDCond->($self, $person, $this_level) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 3 | print $self->{cgi}->td(), "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 20 | print $self->{cgi}->td( {-align => "center" }, | |||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | $display_func->($self, $person) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 20 | $is_blank_line = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 23 | $self->putNTD($right); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 9 | $self->putNTD($right_fill); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 9 | print $self->{cgi}->end_Tr, "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 9 | return $is_blank_line; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 6 | ▶ | sub unknownEquiCond { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
unknownEquiCond: called CC=2 SCAR=8.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 6 | my ( $self, $person ) = validate_pos(@_, HASHREF, SCALARREF, 0 ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 6 | ▶ | return $person == $Ftree::Person::unknown_male || $person == $Ftree::Person::unknown_female; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$person == $Ftree::Person::unknown_male || $person == $Ftree::Person::unknown_female
MC/DC0%0/2
$person == $Ftree::Person::unknown_male || $person == $Ftree::Person::unknown_female
$person == $Ftree::Person::unknown_male
$person == $Ftree::Person::unknown_female
Truth table33%1/3
A || B
A= $person == $Ftree::Person::unknown_maleB= $person == $Ftree::Person::unknown_female
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 3 | ▶ | sub unknownEquiNoChildrenCond { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
unknownEquiNoChildrenCond: called CC=4 SCAR=18.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 3 | my ( $self, $person, $this_level ) = validate_pos(@_, | |||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | HASHREF, SCALARREF, SCALAR ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | return $person == $Ftree::Person::unknown_female || | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | $person == $Ftree::Person::unknown_male || | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | ! defined $person->get_children() || | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 3 | ▶ | ( $this_level == $self->{reqLevels} ); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%3/9
$person == $Ftree::Person::unknown_female || $person == $Ftree::Person::unknown_male || !defined($person->get_children) || $this_level == $self->{'reqLevels'}
$person == $Ftree::Person::unknown_female or $person == $Ftree::Person::unknown_male or not defined $person->get_children
$person == $Ftree::Person::unknown_female or $person == $Ftree::Person::unknown_male
MC/DC0%0/4
$person == $Ftree::Person::unknown_female || $person == $Ftree::Person::unknown_male || !defined($person->get_children) || $this_level == $self->{'reqLevels'}
$person == $Ftree::Person::unknown_female
$person == $Ftree::Person::unknown_male
not defined $person->get_children
$this_level == $self->{'reqLevels'}
Truth table20%1/5
A or B or not(C) || D
A= $person == $Ftree::Person::unknown_femaleB= $person == $Ftree::Person::unknown_maleC= not defined $person->get_childrenD= $this_level == $self->{'reqLevels'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 14 | ▶ | sub falseCond { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
falseCond: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 14 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | ####################################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | # generate a line of the D-tree graphics OVER the | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | # level specified | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | # this_level: level of grid to generate | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | # max_levels: max depth that will be shown | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 1 | ▶ | sub getDGridLineG { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getDGridLineG: called CC=10 SCAR=25.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 1 | my ( $self, $this_level, $max_levels, $DWidth, $DTree_ref ) = validate_pos(@_, | |||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | HASHREF, SCALAR, SCALAR, SCALAR, ARRAYREF ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | # print "called: getDGridLineG (this_level = $this_level, max_levels = $max_levels)\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 1 | my ( $left_fill, $branch, $right_fill ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 1 | my $lefto_fill = int( ( $self->{gridWidth} - $DWidth ) / 2 ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 1 | my $righto_fill = $self->{gridWidth} - $DWidth - $lefto_fill; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | # Spacers on LHS - fills gap between overall grid width and width of Dgrid | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 1 | print $self->{cgi}->start_Tr, "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 1 | $self->putNTD($lefto_fill); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 1 | ▶ | if ( @{ $DTree_ref->[$this_level] } == 0 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | printf '|;'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 1 | foreach my $person (@{ $DTree_ref->[$this_level] }) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | # Find which parent is in the level above... | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 3 | my $this_parent; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 3 | ▶ | if ( 1 == $this_level ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 3 | $this_parent = $self->{target_person}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | ▶ | $this_parent = List::Util::first {$_ == $person->get_father()} | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 0 | ▶ | @{ $DTree_ref->[$this_level - 1] } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | if(defined $person->get_father()); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | ▶ | $this_parent = List::Util::first {$_ == $person->get_mother()} | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 0 | ▶ | @{ $DTree_ref->[$this_level - 1] } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | unless( defined $this_parent); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 3 | ▶ | if ( $person == $Ftree::Person::unknown_female ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | # This blank person | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 0 | $left_fill = $branch = $right_fill = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 3 | elsif ( 1 == @{$this_parent->get_children() } ) | |||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | # This person is an only child | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | $left_fill = $right_fill = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | $branch = $self->img_graph('hone'); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | elsif ( $person == $this_parent->get_children()->[0] ) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | # Is this person the first child of this parent? | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 1 | $left_fill = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 1 | $branch = $self->img_graph('hleft'); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 1 | $right_fill = $self->img_graph('hblank'); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | elsif ( $person == $this_parent->get_children()->[-1] ) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | # Is this person the last child of this parent? | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 1 | $left_fill = $self->img_graph('hblank'); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 1 | $branch = $self->img_graph('hright'); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 1 | $right_fill = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 1 | $left_fill = $right_fill = $self->img_graph('hblank'); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 1 | $branch = $self->img_graph('hbranch'); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 3 | my $group_width = $self->getDTreeWidth( $max_levels - $this_level, $person ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 3 | my $left = int( ( $group_width - 1 ) / 2 ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 3 | my $right = $group_width - 1 - $left; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 3 | $self->putNTD( $left, $left_fill ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 3 | print $self->{cgi}->td($branch); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 3 | $self->putNTD( $right, $right_fill ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | # Spacers on RHS - fills gap between overall grid width and width of Dgrid | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 1 | $self->putNTD($righto_fill); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 1 | print $self->{cgi}->end_Tr, "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | ####################################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | # build A-tree for this person | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | # root_node: this person | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | # anc_level: current level of ancestor tree (0=root node) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | # req_levels: no. levels requested | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 7 | ▶ | sub fillATree { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fillATree: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 7 | my ( $self, $root_person, $anc_level, $req_levels, $ATree_ref ) = | |||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | validate_pos(@_, HASHREF, {type => SCALARREF|UNDEF}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | SCALAR, SCALAR, ARRAYREF ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 7 | ▶ | return unless $anc_level < $req_levels; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | # print "called: fillATree (root_node = $root_person, anc_level = $anc_level, req_levels = $req_levels)\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 3 | ▶ | my $father = defined $root_person->get_father() ? | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | $root_person->get_father() : $Ftree::Person::unknown_male; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 3 | ▶ | my $mother = defined $root_person->get_mother() ? | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | $root_person->get_mother() : $Ftree::Person::unknown_female; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 3 | push @{ $ATree_ref->[$anc_level] }, ($father, $mother); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 3 | $anc_level++; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 3 | $self->fillATree( $father, $anc_level, $req_levels, $ATree_ref ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 3 | $self->fillATree( $mother, $anc_level, $req_levels, $ATree_ref ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 3 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | ####################################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | # draw the graphics UNDER the level specified | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | # this_level: level of grid to generate | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | # max_levels: max depth that will be shown | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 2 | ▶ | sub getAGridLineG { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getAGridLineG: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 2 | my ( $self, $diff_levels, $AWidth, $aRow ) = validate_pos(@_, | |||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | HASHREF, SCALAR, SCALAR, ARRAYREF); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 2 | ▶ | return if ( 0 > $diff_levels ); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 2 | my $left_fill = int( ( $self->{gridWidth} - $AWidth + 1 ) / 2 ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 2 | my $right_fill = $self->{gridWidth} - $AWidth - $left_fill; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 2 | print $self->{cgi}->start_Tr, "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 2 | $self->putNTD($left_fill); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 2 | my $node_width = 2**$diff_levels ; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 2 | my $nodel_fill = int( ( $node_width - 1 ) / 2 ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 2 | my $noder_fill = $node_width - 1 - $nodel_fill; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 2 | ▶ | for ( my $index = 0; $index < @$aRow; $index += 2 ) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 3 | $self->putNTD($nodel_fill); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | 3 | print $self->{cgi}->td( $self->img_graph("hleftup")),"\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 3 | $self->putNTD( $node_width - 1, $self->img_graph("hblankup") ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 3 | print $self->{cgi}->td( $self->img_graph("hrightup") ), "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 3 | $self->putNTD($noder_fill); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 2 | $self->putNTD($right_fill); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 2 | print $self->{cgi}->end_Tr, "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 2 | print $self->{cgi}->start_Tr, "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 2 | $self->putNTD($left_fill); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | 2 | ▶ | for ( my $index = 0 ; $index < @$aRow; $index += 2 ) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 3 | $self->putNTD( $node_width - 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | 3 | print $self->{cgi}->td( $self->img_graph("hone") ), "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 3 | $self->putNTD($node_width); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 2 | $self->putNTD($right_fill); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 2 | print $self->{cgi}->end_Tr, "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 2 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | ####################################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 1 | ▶ | sub buildDGrid { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
buildDGrid: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 1 | my ($self, $DWidth, $DTree_ref) = validate_pos(@_, HASHREF, SCALAR, ARRAYREF); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 1 | my $left_fill = int( ( $self->{gridWidth} - $DWidth ) / 2 ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 1 | for my $this_level (1 .. $self->{DLevels}) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 1 | $self->getDGridLineG( $this_level, $self->{reqLevels}, $DWidth, $DTree_ref ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | 1 | my $is_blank_line = $self->drawRow($DWidth, \@{ $DTree_ref->[$this_level] }, | |||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 1 | $self->{reqLevels} - $this_level, $this_level, $left_fill, | |||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | \&unknownEquiCond, \&getDTreeWidth, \&Ftree::FamilyTreeGraphics::html_img); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 1 | $self->drawRow($DWidth, \@{ $DTree_ref->[$this_level] }, | |||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 1 | $self->{reqLevels} - $this_level, $this_level, $left_fill, | |||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | \&unknownEquiCond, \&getDTreeWidth, \&html_name); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 1 | $self->drawRow($DWidth, \@{ $DTree_ref->[$this_level] }, | |||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 1 | $self->{reqLevels} - $this_level, $this_level, $left_fill, | |||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | \&unknownEquiNoChildrenCond, \&getDTreeWidth, \&hone_img_graph); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 1 | ▶ | $self->{DLevels} = $this_level - 1 if ( $is_blank_line ); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | ####################################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 1 | ▶ | sub buildDestroyAGrid { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
buildDestroyAGrid: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 1 | my ( $self, $ATree_ref ) = validate_pos(@_, {type => HASHREF}, ARRAYREF); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | #printf "calling: getAGridLine \n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 1 | my $aLevel = @$ATree_ref; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 1 | my $AWidth = 2 ** $aLevel; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 1 | --$aLevel; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | 1 | my $left_fill = int( ( $self->{gridWidth} - $AWidth + 1 ) / 2 ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 1 | ▶ | for ( my $this_level = $aLevel; $this_level >= 0 ; --$this_level ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 2 | my $aRow = pop @$ATree_ref; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 2 | $self->drawRow($AWidth, $aRow, $aLevel - $this_level, $this_level, $left_fill, | |||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | \&falseCond, \&getATreeWidth , \&Ftree::FamilyTreeGraphics::html_img); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 2 | $self->drawRow($AWidth, $aRow, $aLevel - $this_level, $this_level, $left_fill, | |||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | \&falseCond, \&getATreeWidth, \&html_name); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | 2 | $self->getAGridLineG( $aLevel - $this_level, $AWidth, $aRow ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | #printf "buildAGrid returns"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | ####################################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 1 | ▶ | sub buildPGrid { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
buildPGrid: called CC=3 SCAR=11.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 1 | my ($self, $PWidth) = validate_pos(@_, {type => HASHREF}, SCALAR); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 1 | my @peers = $self->{target_person}->get_peers( ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 1 | ▶ | my $left_side = List::MoreUtils::first_index {$_ == $self->{target_person}} @peers; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 1 | my $left_fill = int(( $self->{gridWidth} - 1 ) / 2 ) - $left_side; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | 1 | my $right_fill = $self->{gridWidth} - $PWidth - $left_fill; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 1 | print $self->{cgi}->start_Tr, "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 1 | $self->putNTD($left_fill); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | 1 | ▶ | if ( @peers > 1 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | 0 | print $self->{cgi}->td( $self->img_graph("hleft") ), "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | 0 | $self->putNTD($#peers - 1, $self->img_graph("hbranch")); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 0 | print $self->{cgi}->td( $self->img_graph("hright") ), "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | 1 | print $self->{cgi}->td( $self->img_graph("hone") ), "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | 1 | $self->putNTD($right_fill); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 1 | print $self->{cgi}->end_Tr, "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | $self->drawRow($PWidth, \@peers, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | undef, undef, $left_fill, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | 1 | ▶ | \&falseCond, sub {return 1} , \&Ftree::FamilyTreeGraphics::html_img); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | $self->drawRow($PWidth, \@peers, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | undef, undef, $left_fill, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | 1 | ▶ | \&falseCond, sub {return 1} , \&Ftree::FamilyTreeGraphics::html_name); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | 1 | ▶ | if ( defined $self->{target_person}->get_children() ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 1 | print $self->{cgi}->start_Tr, "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | 1 | my $gridLeft = int( ( $self->{gridWidth} - 1 ) / 2 ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 1 | my $gridRight = $self->{gridWidth} - 1 - $gridLeft; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 1 | $self->putNTD($gridLeft); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 1 | print $self->{cgi}->td( $self->img_graph("hone") ), "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | 1 | $self->putNTD($gridRight); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | 1 | print $self->{cgi}->end_Tr, "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | ####################################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | # find the width of the peer line | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | # (allowing for the fact that it may be off-centre) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | 1 | ▶ | sub getPTreeWidth { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getPTreeWidth: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | 1 | my ($self) = validate_pos(@_, {type => HASHREF}); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | 1 | my @peers = $self->{target_person}->get_peers( ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | 1 | ▶ | my $node_pos = List::MoreUtils::first_index {$_ == $self->{target_person}} @peers; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | 1 | my $right_side = $#peers - $node_pos; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | 1 | my $big_side = List::Util::max ($node_pos, $right_side ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 1 | return $big_side * 2 + 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | ####################################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | # generates the html for the name of this person | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | 10 | ▶ | sub html_name { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
html_name: called CC=7 SCAR=19.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | 10 | my ( $self, $person ) = validate_pos(@_, {type => HASHREF}, {type => SCALARREF}); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | return $self->{cgi}->font({-size => $self->{fontsize}}, $self->{textGenerator}{Unknown}) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | 10 | ▶ | if ( !defined $person || $person == $Ftree::Person::unknown_male || $person == $Ftree::Person::unknown_female ); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
not defined $person or $person == $Ftree::Person::unknown_male or $person == $Ftree::Person::unknown_female
not defined $person or $person == $Ftree::Person::unknown_male
MC/DC66%2/3
not defined $person or $person == $Ftree::Person::unknown_male or $person == $Ftree::Person::unknown_female
not defined $person
$person == $Ftree::Person::unknown_male
$person == $Ftree::Person::unknown_female
Truth table75%3/4
not(A) or B or C
A= not defined $personB= $person == $Ftree::Person::unknown_maleC= $person == $Ftree::Person::unknown_female
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | 8 | my $show_name; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | 8 | ▶ | if(defined $person->get_name()) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | 8 | ▶ | $show_name = ( $self->{reqLevels} > 1 ) ? | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | $person->get_name()->get_first_name() : $person->get_name()->get_short_name(); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | 0 | $show_name = $self->{textGenerator}{Unknown}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | 8 | ▶ | if ( $person == $self->{target_person} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | 1 | return $self->{cgi}->strong($self->{cgi}->font({-size => $self->{fontsize}}, $show_name)); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | 7 | return $self->{cgi}->font({-size => $self->{fontsize}}, $self->aref_tree($show_name, $person)); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 1 | ▶ | sub print_zoom_buttons { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
print_zoom_buttons: called CC=3 SCAR=11.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | 1 | my ( $self, $aLevels ) = validate_pos(@_, {type => HASHREF}, SCALAR); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | 1 | my $lev_minus1 = $self->{reqLevels} - 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | print $self->{cgi}->start_table( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | { -border => "0", -cellpadding => "0", -cellspacing => "2" } ), "\n", | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | 1 | $self->{cgi}->start_Tr; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | 1 | ▶ | if ( $lev_minus1 >= 0 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | print $self->{cgi}->start_td({-align => "center"}), "\n", | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | $self->aref_tree($self->{cgi}->img( { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | -src => "$self->{graphicsUrl}/zoomin.gif", | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | -alt => $self->{textGenerator}->ZoomIn($lev_minus1) }), $self->{target_person}, $lev_minus1), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | 1 | $self->{cgi}->end_td, "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | 1 | ▶ | if( $self->{reqLevels} <= $aLevels ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | 1 | my $lev_plus1 = $self->{reqLevels} + 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | print $self->{cgi}->start_td({-align => "center"}), "\n", | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | $self->aref_tree($self->{cgi}->img( { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | -src => "$self->{graphicsUrl}/zoomout.gif", | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | -alt => $self->{textGenerator}->ZoomOut($lev_plus1) }), $self->{target_person}, $lev_plus1), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | 1 | $self->{cgi}->end_td; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | print $self->{cgi}->end_Tr, "\n", | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | 1 | $self->{cgi}->end_table, $self->{cgi}->br, $self->{cgi}->br, "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | ######################################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | # OUTPUT SECTION # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | ######################################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | 1 | ▶ | sub _draw_start_page { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_draw_start_page: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | 1 | my ( $self, $aLevels ) = validate_pos(@_, {type => HASHREF}, SCALAR); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | # header html for page | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | my $title = $self->{textGenerator}->familyTreeFor( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | defined $self->{target_person}->get_name() ? # He may have id but not any name | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | $self->{target_person}->get_name()->get_full_name(): | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | 1 | ▶ | $self->{textGenerator}->{Unknown}); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | 1 | $self->_toppage($title); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | # Zoom buttons | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | 1 | print $self->{cgi}->start_center, "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | 1 | $self->print_zoom_buttons($aLevels); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | 1 | ▶ | sub _draw_familytree_page { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_draw_familytree_page: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | 1 | my $aLevels = $self->getATreeLevels( $self->{target_person}, 0, $self->{reqLevels} ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | 1 | my $AWidth = 2 ** $aLevels; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | 1 | my $PWidth = $self->getPTreeWidth(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | 1 | my $DWidth = $self->getDTreeWidth( $self->{reqLevels}, $self->{target_person} ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | 1 | $self->{gridWidth} = List::Util::max( $AWidth, $PWidth, $DWidth ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | # fill the grid | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | 1 | my @ATree; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | 1 | $self->fillATree( $self->{target_person}, 0, $aLevels, \@ATree ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | 1 | my @DTree; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | 1 | $self->fillDTree( $self->{target_person}, 0, $self->{reqLevels}, \@DTree ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | 1 | $self->_draw_start_page(List::Util::max($aLevels, $self->{DLevels})); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | # Draw the grid | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | print $self->{cgi}->start_table( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | 1 | { -border => "0", -cellpadding => "0", -cellspacing => "0" } ), "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | 1 | $self->buildDestroyAGrid(\@ATree); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | 1 | $self->buildPGrid($PWidth); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | 1 | $self->buildDGrid($DWidth, \@DTree); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | 1 | print $self->{cgi}->end_table, "\n", $self->{cgi}->end_center, "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | 1 | $self->_endpage(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||