Construction/Role/Output.pm

filter: Statementstmt 100% 25 / 25 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 100% 1 / 1 totaltotal 97.2% 35 / 36 CC 3 SCAR 5.6
CC
3
Cov
97%
draw_label
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.8
« Construction/Draw.pm ↑ Summary Construction/FixedPoint.pm »
1 package Math::Geometry::Construction::Role::Output;
2 15 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 15 ▶use 5.008008;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 15 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 =head1 NAME
9  
10 C<Math::Geometry::Construction::Role::Output> - graphical output issues
11  
12 =head1 VERSION
13  
14 Version 0.019
15  
16 =cut
17  
18 15 our $VERSION = '0.019';
19  
20  
21 ###########################################################################
22 # #
23 # Accessors #
24 # #
25 ###########################################################################
26  
27 15 requires 'construction';
28 15 requires 'id';
29  
30 15 has 'hidden' => (isa => 'Bool',
31 is => 'rw',
32 default => 0);
33  
34 15 has 'label' => (isa => 'Str',
35 is => 'rw',
36 clearer => 'clear_label',
37 predicate => 'has_label');
38  
39 15 has 'label_offset_x' => (isa => 'Num',
40 is => 'rw',
41 default => 0);
42  
43 15 has 'label_offset_y' => (isa => 'Num',
44 is => 'rw',
45 default => 0);
46  
47 has 'style' => (isa => 'HashRef[Str|ArrayRef]',
48 is => 'rw',
49 reader => 'style_hash',
50 writer => '_style_hash',
51 traits => ['Hash'],
52 467 ▶ default => sub { {} },
Subroutine __ANON__: called CC=1 SCAR=0.0
53 15 handles => {style => 'accessor'});
54  
55 has 'label_style' => (isa => 'HashRef[Str|ArrayRef]',
56 is => 'rw',
57 reader => 'label_style_hash',
58 writer => '_label_style_hash',
59 traits => ['Hash'],
60 472 ▶ default => sub { {} },
Subroutine __ANON__: called CC=1 SCAR=0.0
61 15 handles => {label_style => 'accessor'});
62  
63 ###########################################################################
64 # #
65 # Retrieve Data #
66 # #
67 ###########################################################################
68  
69 19 ▶sub draw_label {
Subroutine draw_label: called CC=3 SCAR=11.0
Pod documented
70 19 my ($self, %args) = @_;
71  
72 19 ▶ if($self->has_label) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->has_label) 1 18 19
73 1 my $label = $self->label;
74 return $self->construction->draw_text
75 ('x' => $args{x} + $self->label_offset_x,
76 1 ▶ 'y' => $args{y} + $self->label_offset_y,
Branch: 1 branch
BranchTrueFalseTotal
defined $label ? : 1 0 1
77 style => $self->label_style_hash,
78 text => defined($label) ? $label : '',
79 id => $self->id.'_label');
80 }
81  
82 18 return;
83 }
84  
85 ###########################################################################
86 # #
87 # Change Data #
88 # #
89 ###########################################################################
90  
91 15 1;
92  
93  
94 __END__
« Construction/Draw.pm ↑ Summary Construction/FixedPoint.pm »