| 1 | package Chart::Clicker::Decoration::MarkerOverlay; | ||||||||||||||
| 2 | 8 | $Chart::Clicker::Decoration::MarkerOverlay::VERSION = '2.89'; | |||||||||||||
| 3 | 8 | ▶ | use Moose; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 4 | |||||||||||||||
| 5 | 8 | extends 'Chart::Clicker::Decoration'; | |||||||||||||
| 6 | |||||||||||||||
| 7 | # ABSTRACT: Component for drawing markers | ||||||||||||||
| 8 | |||||||||||||||
| 9 | 8 | ▶ | use Graphics::Primitive::Operation::Stroke; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 10 | 8 | ▶ | use Graphics::Primitive::Operation::Fill; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 11 | 8 | ▶ | use Graphics::Primitive::Paint::Solid; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 12 | |||||||||||||||
| 13 | |||||||||||||||
| 14 | override('finalize', sub { | ||||||||||||||
| 15 | 0 | ▶ | my ($self) = @_; | ||||||||||||
|
Subroutine
__ANON__: not called CC=9 SCAR=45.0
| |||||||||||||||
| 16 | |||||||||||||||
| 17 | 0 | my $width = $self->width; | |||||||||||||
| 18 | 0 | my $height = $self->height; | |||||||||||||
| 19 | |||||||||||||||
| 20 | 0 | my $clicker = $self->clicker; | |||||||||||||
| 21 | |||||||||||||||
| 22 | 0 | foreach my $cname ($clicker->context_names) { | |||||||||||||
| 23 | 0 | my $ctx = $clicker->get_context($cname); | |||||||||||||
| 24 | 0 | foreach my $marker (@{ $ctx->markers }) { | |||||||||||||
| 25 | |||||||||||||||
| 26 | 0 | my $key = $marker->key; | |||||||||||||
| 27 | 0 | my $value = $marker->value; | |||||||||||||
| 28 | |||||||||||||||
| 29 | 0 | ▶ | if(not defined($value)) { | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 30 | 0 | my $key2 = $marker->key2; | |||||||||||||
| 31 | |||||||||||||||
| 32 | 0 | my $domain = $ctx->domain_axis; | |||||||||||||
| 33 | |||||||||||||||
| 34 | 0 | my $x = $domain->mark($self->width, $key); | |||||||||||||
| 35 | 0 | my $x2; | |||||||||||||
| 36 | |||||||||||||||
| 37 | 0 | ▶ | if($key2) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 38 | 0 | $x2 = $domain->mark($self->width, $key2); | |||||||||||||
| 39 | 0 | $self->move_to($x, 0); | |||||||||||||
| 40 | 0 | $self->rectangle(($x2 - $x), $height); | |||||||||||||
| 41 | 0 | my $fillop = Graphics::Primitive::Operation::Fill->new( | |||||||||||||
| 42 | paint => Graphics::Primitive::Paint::Solid->new( | ||||||||||||||
| 43 | color => $marker->inside_color | ||||||||||||||
| 44 | ), | ||||||||||||||
| 45 | ); | ||||||||||||||
| 46 | 0 | $self->do($fillop); | |||||||||||||
| 47 | } | ||||||||||||||
| 48 | |||||||||||||||
| 49 | 0 | $self->move_to($x, 0); | |||||||||||||
| 50 | 0 | $self->rel_line_to(0, $height); | |||||||||||||
| 51 | |||||||||||||||
| 52 | 0 | ▶ | if($x2) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 53 | 0 | $self->move_to($x2, 0); | |||||||||||||
| 54 | 0 | $self->rel_line_to(0, $height); | |||||||||||||
| 55 | } | ||||||||||||||
| 56 | |||||||||||||||
| 57 | 0 | my $op = Graphics::Primitive::Operation::Stroke->new; | |||||||||||||
| 58 | 0 | $op->brush($marker->brush); | |||||||||||||
| 59 | 0 | $op->brush->color($marker->color); | |||||||||||||
| 60 | |||||||||||||||
| 61 | 0 | $self->do($op); | |||||||||||||
| 62 | } elsif(not defined($key)) { | ||||||||||||||
| 63 | 0 | my $value2 = $marker->value2; | |||||||||||||
| 64 | |||||||||||||||
| 65 | 0 | my $range = $ctx->range_axis; | |||||||||||||
| 66 | # | ||||||||||||||
| 67 | 0 | my $y = $height - $range->mark($height, $value); | |||||||||||||
| 68 | 0 | my $y2; | |||||||||||||
| 69 | |||||||||||||||
| 70 | 0 | ▶ | if($value2) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 71 | 0 | $y2 = $height - $range->mark($self->height, $value2); | |||||||||||||
| 72 | 0 | $self->move_to(0, $y); | |||||||||||||
| 73 | 0 | $self->rectangle($width, ($y2 - $y)); | |||||||||||||
| 74 | 0 | my $fillop = Graphics::Primitive::Operation::Fill->new( | |||||||||||||
| 75 | paint => Graphics::Primitive::Paint::Solid->new( | ||||||||||||||
| 76 | color => $marker->inside_color | ||||||||||||||
| 77 | ), | ||||||||||||||
| 78 | ); | ||||||||||||||
| 79 | 0 | $self->do($fillop); | |||||||||||||
| 80 | |||||||||||||||
| 81 | } | ||||||||||||||
| 82 | |||||||||||||||
| 83 | 0 | $self->move_to(0, $y); | |||||||||||||
| 84 | 0 | $self->rel_line_to($width, 0); | |||||||||||||
| 85 | |||||||||||||||
| 86 | 0 | ▶ | if($y2) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 87 | 0 | $self->move_to(0, $y2); | |||||||||||||
| 88 | 0 | $self->rel_line_to($width, 0); | |||||||||||||
| 89 | } | ||||||||||||||
| 90 | |||||||||||||||
| 91 | 0 | my $op = Graphics::Primitive::Operation::Stroke->new; | |||||||||||||
| 92 | 0 | $op->brush($marker->brush); | |||||||||||||
| 93 | 0 | $op->brush->color($marker->color); | |||||||||||||
| 94 | |||||||||||||||
| 95 | 0 | $self->do($op); | |||||||||||||
| 96 | } | ||||||||||||||
| 97 | } | ||||||||||||||
| 98 | } | ||||||||||||||
| 99 | 8 | }); | |||||||||||||
| 100 | |||||||||||||||
| 101 | 8 | __PACKAGE__->meta->make_immutable; | |||||||||||||
| 102 | |||||||||||||||
| 103 | 8 | ▶ | no Moose; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 104 | |||||||||||||||
| 105 | 8 | 1; | |||||||||||||
| 106 | |||||||||||||||
| 107 | __END__ | ||||||||||||||
| 108 | |||||||||||||||
| 109 | =pod | ||||||||||||||
| 110 | |||||||||||||||
| 111 | =head1 NAME | ||||||||||||||
| 112 | |||||||||||||||
| 113 | Chart::Clicker::Decoration::MarkerOverlay - Component for drawing markers | ||||||||||||||
| 114 | |||||||||||||||
| 115 | =head1 VERSION | ||||||||||||||
| 116 | |||||||||||||||
| 117 | version 2.89 | ||||||||||||||
| 118 | |||||||||||||||
| 119 | =head1 DESCRIPTION | ||||||||||||||
| 120 | |||||||||||||||
| 121 | A Component that handles the rendering of Markers. | ||||||||||||||
| 122 | |||||||||||||||
| 123 | =head1 AUTHOR | ||||||||||||||
| 124 | |||||||||||||||
| 125 | Cory G Watson <gphat@cpan.org> | ||||||||||||||
| 126 | |||||||||||||||
| 127 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||
| 128 | |||||||||||||||
| 129 | This software is copyright (c) 2016 by Cory G Watson. | ||||||||||||||
| 130 | |||||||||||||||
| 131 | This is free software; you can redistribute it and/or modify it under | ||||||||||||||
| 132 | the same terms as the Perl 5 programming language system itself. | ||||||||||||||
| 133 | |||||||||||||||
| 134 | =cut | ||||||||||||||