| 1 |
=pod |
| 2 |
|
| 3 |
=head1 NAME |
| 4 |
|
| 5 |
Pedigree::AbortionNode - an abortion in a pedigree |
| 6 |
|
| 7 |
=head1 SYNOPSIS |
| 8 |
|
| 9 |
use Pedigree::AbortionNode; |
| 10 |
|
| 11 |
$node = new Pedigree::AbortionNode(I<%params>); |
| 12 |
|
| 13 |
$node->DrawNode(I<$xidst>, I<$ydist>, I<$belowtextfont>, I<$abovetextfont>, |
| 14 |
I<@fieldsfornode>); |
| 15 |
|
| 16 |
$node->PrintLegend(I<$land>, I<@fields>); |
| 17 |
|
| 18 |
=head1 DESCRIPTION |
| 19 |
|
| 20 |
This package contains data about an abortion. Abortion is like a person, |
| 21 |
but it cannot have kids, and it is drawn differently |
| 22 |
|
| 23 |
|
| 24 |
=cut |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
#################################################################### |
| 29 |
# Define the package # |
| 30 |
#################################################################### |
| 31 |
|
| 32 |
package Pedigree::AbortionNode; |
| 33 |
use Pedigree; |
| 34 |
use strict; |
| 35 |
our @ISA=('Pedigree::PersonNode'); |
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
#################################################################### |
| 40 |
# DrawNode # |
| 41 |
#################################################################### |
| 42 |
|
| 43 |
=pod |
| 44 |
|
| 45 |
=over 4 |
| 46 |
|
| 47 |
=item B<DrawNode>(I<$xdist>, I<$ydist>, I<$belowtextfont>, I<$abovetextfont>, |
| 48 |
I<@fieldsfornode>); |
| 49 |
|
| 50 |
Output the command to draw this node. The parameters are |
| 51 |
distances between the nodes (in cm) and fields for abovetext. |
| 52 |
|
| 53 |
=cut |
| 54 |
|
| 55 |
sub DrawNode { |
| 56 |
my $self=shift; |
| 57 |
my ($xdist, $ydist, $belowtextfont, $abovetextfont, @fieldsfornode) = @_; |
| 58 |
my $result = '\rput('.($xdist*$self->GetAbsX()).", ". |
| 59 |
($ydist*$self->GetAbsY()).'){\pstAbortion['; |
| 60 |
my @opts=($self->Condition(), |
| 61 |
'belowtext={'."$belowtextfont ".$self->GetGenName().'}'); |
| 62 |
if ($self->Type() eq 'sab') { |
| 63 |
push @opts, 'sab'; |
| 64 |
} |
| 65 |
my @abovetext; |
| 66 |
if ($self->Sex() ne 'unknown') { |
| 67 |
push @abovetext, $self->Sex(); |
| 68 |
} |
| 69 |
foreach my $field (@fieldsfornode) { |
| 70 |
if (($field ne 'Sex') && ($field ne 'Name')) { |
| 71 |
push @abovetext, $self->{$field}; |
| 72 |
} |
| 73 |
} |
| 74 |
if (scalar @abovetext) { |
| 75 |
push @opts,'abovetext={'."$abovetextfont ".join('; ',@abovetext).'}'; |
| 76 |
} |
| 77 |
$result .= join(', ',@opts); |
| 78 |
$result .= ']{'.$self->Id()."}}\n"; |
| 79 |
return $result; |
| 80 |
} |
| 81 |
|
| 82 |
#################################################################### |
| 83 |
# PrintLegend # |
| 84 |
#################################################################### |
| 85 |
|
| 86 |
=pod |
| 87 |
|
| 88 |
=item B<PrintLegend>(I<$lang>, I<@fields>); |
| 89 |
|
| 90 |
Print the legend for the given node, including I<@fields> in the given |
| 91 |
language I<$lang>, and excluding the fields, that have no meaning for |
| 92 |
this node. |
| 93 |
|
| 94 |
|
| 95 |
=cut |
| 96 |
|
| 97 |
sub PrintLegend { |
| 98 |
my ($self, $lang, @fields) = @_; |
| 99 |
my $result = '\item['.$self->GetGenName().'] '; |
| 100 |
my @desc; |
| 101 |
foreach my $field (@fields) { |
| 102 |
if (exists $self->{$field} && ($field ne 'DoD') && |
| 103 |
($field ne 'AgeAtDeath')) { |
| 104 |
my $res = $lang->PrintField($field, $self->{$field}); |
| 105 |
if (length($res)>0) { |
| 106 |
push @desc, $res; |
| 107 |
} |
| 108 |
} |
| 109 |
} |
| 110 |
$result .= join ("; ",@desc); |
| 111 |
$result .= ".\n"; |
| 112 |
# |
| 113 |
# We print only the nodes, for which there is an information |
| 114 |
# |
| 115 |
if (scalar @desc) { |
| 116 |
return $result; |
| 117 |
} |
| 118 |
return; |
| 119 |
} |
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
#################################################################### |
| 124 |
# THE END # |
| 125 |
#################################################################### |
| 126 |
|
| 127 |
=pod |
| 128 |
|
| 129 |
=back |
| 130 |
|
| 131 |
=head1 ENVIRONMENT |
| 132 |
|
| 133 |
The calling program should define B<$main::DEBUG> and set it to 0 |
| 134 |
or 1. |
| 135 |
|
| 136 |
=head1 SEE ALSO |
| 137 |
|
| 138 |
pedigree(1), Pedigree(3) |
| 139 |
|
| 140 |
|
| 141 |
=head1 AUTHOR |
| 142 |
|
| 143 |
Boris Veytsman, Leila Akhmadeeva, 2007 |
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
=cut |
| 148 |
|
| 149 |
1; |