Edge/GenericEdge.pm

filter: Statementstmt 33.3% 11 / 33 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 33.3% 3 / 9 Podpod 100% 3 / 3 totaltotal 32.6% 17 / 52 SCAR 18.3
CC
3
Cov
29%
_addAdditionalNodes
12.0
new
2.0
_init
2.0
CRAP 6.2
« Node/GenericNode.pm ↑ Summary Edge/ArcEdge.pm »
1 package yEd::Edge::GenericEdge;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use yEd::PropertyBasedObject;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use base qw(yEd::Edge);
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 =head1 NAME
8  
9 yEd::Edge::GenericEdge - generic Edge type
10  
11 =head1 DESCRIPTION
12  
13 A generic Edge type which mostly behaves like a PolyLineEdge without smoothening.
14  
15 It has two lines and can have a filling in between.
16  
17 Like generic Nodes it has Java based properties that define it.
18 But this is hidden away at the moment since there actually is only one characteristic type.
19 This means that this class could change significantly with future versions of yEd.
20  
21 Make sure to have a look at L<yEd::Edge>, the properties and functions described there will not be repeated here.
22  
23 =head1 SUPPORTED FEATURES
24  
25 The type specific features are fully supported.
26  
27 For basic Edge type feature support and which Edge types are supported see L<yEd::Edge>.
28  
29 =head1 PROPERTIES
30  
31 =head2 all properties from base class
32  
33 L<yEd::Edge>
34  
35 =head2 configuration
36  
37 Type: descrete values ( framed )
38  
39 Default: framed
40  
41 There is only one type at the moment, so this can be ignored.
42  
43 =head2 fillColor
44  
45 Type: '#0000fa' (rgb) or '#000000cc' (rgb + transparency) java.awt.Color hex form or 'none'
46  
47 Default: 'none'
48  
49 The filling between the 2 Edge lines.
50  
51 =head1 SUBROUTINES/METHODS
52  
53 =head2 all functions from base class
54  
55 L<yEd::Edge>
56  
57 =cut
58  
59 1 my %conf = (
60 'framed' => 'com.yworks.edge.framed',
61 );
62  
63 sub new {
64 0 ▶ my ($class, @args) = @_;
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
65 0 my $self = bless {}, $class;
66 0 return $self->_init(@args);
67 }
68  
69 sub _init {
70 0 ▶ my ($self, @args) = @_;
Subroutine _init: not called CC=1 SCAR=6.9
71 0 $self->configuration('framed');
72 0 $self->fillColor('none');
73 0 $self->SUPER::_init(@args);
74 0 return $self;
75 }
76  
77 sub configuration {
78 0 ▶ my $mask = join '|', keys %conf;
Subroutine configuration: not called CC=1 SCAR=6.9
Pod documented
79 0 return _PROPERTY('^(?:' . $mask . ')$', @_);
80 }
81 sub fillColor {
82 0 ▶ return _PROPERTY($match{'color'}, @_);
Subroutine fillColor: not called CC=1 SCAR=6.9
Pod documented
83 }
84  
85 sub _addTypeNode {
86 0 ▶ my ($self, $node) = @_;
Subroutine _addTypeNode: not called CC=1 SCAR=6.9
87 0 my $type = $node->addNewChild('', 'y:GenericEdge');
88 0 $type->setAttribute('configuration', $conf{$self->configuration()});
89 0 return $type;
90 }
91 sub _addAdditionalNodes {
92 0 ▶ my ($self, $node) = @_;
Subroutine _addAdditionalNodes: not called CC=3 SCAR=24.8
93 0 ▶ if ($self->configuration() eq 'framed' and $self->fillColor() ne 'none') {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->configuration eq "framed" and $self->fillColor ne "none") 0 0 0
Condition0%0/3
$self->configuration eq "framed" and $self->fillColor ne "none"
!ll&&!rl&&r
000
MC/DC0%0/2
$self->configuration eq "framed" and $self->fillColor ne "none"
$self->configuration eq "framed" $self->fillColor ne "none"
Truth table0%0/3
A and B
A= $self->configuration eq "framed"B= $self->fillColor ne "none"
ABresult
0X0
100
111
94 0 my $sp = $node->addNewChild('', 'y:StyleProperties');
95 0 my $p = $sp->addNewChild('', 'y:Property');
96 0 $p->setAttribute('class', 'java.awt.Color');
97 0 $p->setAttribute('name', 'FramedEdgePainter.fillColor');
98 0 $p->setAttribute('value', $self->fillColor());
99 }
100 }
101  
102 =head1 SEE ALSO
103  
104 L<yEd::Document> for further informations about the whole package
105  
106 L<yEd::PropertyBasedObject> for further basic information about properties and their additional functions
107  
108 L<yEd::Edge> for information about the Edge base class and which other Edge types are currently supported
109  
110 =cut
111  
112 1 1;
« Node/GenericNode.pm ↑ Summary Edge/ArcEdge.pm »