Edge.pm

filter: Statementstmt 8.6% 16 / 186 Branchbran 0.0% 0 / 40 Conditioncond 0.0% 0 / 12 MC/DCmcdc 0.0% 0 / 8 Subroutinesub 12.5% 5 / 40 Podpod 100% 24 / 24 totaltotal 14.5% 45 / 310 SCAR 68.2
CC
33
Cov
7%
waypoints
56.0
_init
20.0
source
20.0
CRAP 916.8
↑ Summary PropertyBasedObject.pm »
1 package yEd::Edge;
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 yEd::Label::EdgeLabel;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use XML::LibXML;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 =head1 NAME
10  
11 yEd::Edge - Base class for Edges
12  
13 =head1 DESCRIPTION
14  
15 This is the base class for Edges.
16 It may not be instanciated, instead use one of the specialized types as described in the SUPPORTED FEATURES section.
17  
18 =head1 SUPPORTED FEATURES
19  
20 All Edge types are supported, these are:
21  
22 =over 4
23
24 =item *
25
26 L<yEd::Edge::ArcEdge>
27  
28 =item *
29
30 L<yEd::Edge::BezierEdge>
31  
32 =item *
33
34 L<yEd::Edge::GenericEdge>
35  
36 =item *
37
38 L<yEd::Edge::PolyLineEdge>
39  
40 =item *
41
42 L<yEd::Edge::QuadCurveEdge>
43  
44 =item *
45
46 L<yEd::Edge::SplineEdge>
47  
48 =back
49  
50 The following features are currently not supported:
51  
52 =over 4
53  
54 =item *
55  
56 Adding meta data to Edges or edit the present ones (e.g. URL, description)
57  
58 =back
59  
60 All other basic features of Edges (yEd Version 3.13) are supported.
61  
62 Support beyond yEd:
63  
64 =over 4
65
66 =item *
67
68 You may specify waypoints to be relative to previous waypoints / source Node (see relativeWaypoints property)
69  
70 =item *
71  
72 You may add multiple Labels to a single Edge (yEd will handle it properly)
73  
74 =back
75  
76 =head1 PROPERTIES
77  
78 =head2 id
79  
80 This property is read only and returns the Edge's ID.
81  
82 =head2 source
83  
84 Type: yEd::Node
85  
86 Default: ... must be provided at constructor
87  
88 The source Node reference.
89  
90 =head2 target
91  
92 Type: yEd::Node
93  
94 Default: ... must be provided at constructor
95  
96 The target Node reference.
97  
98 =head2 sx
99  
100 Type: float
101  
102 Default: 0
103  
104 The x value for Edge connection to source Node (x=0 y=0 is center).
105  
106 =head2 sy
107  
108 Type: float
109  
110 Default: 0
111  
112 The y value for Edge connection to source Node (x=0 y=0 is center).
113  
114 =head2 tx
115  
116 Type: float
117  
118 Default: 0
119  
120 The x value for Edge connection to target Node (x=0 y=0 is center).
121  
122 =head2 ty
123  
124 Type: float
125  
126 Default: 0
127  
128 The y value for Edge connection to target Node (x=0 y=0 is center).
129  
130 =head2 lineColor
131  
132 Type: '#0000fa' (rgb) or '#000000cc' (rgb + transparency) java.awt.Color hex form or 'none'
133  
134 Default: '#000000'
135  
136 The line color.
137  
138 =head2 lineType
139  
140 Type: descrete values ( line | dotted | dashed | dashed_dotted )
141  
142 Default: 'line'
143  
144 The line type.
145  
146 =head2 lineWidth
147  
148 Type: ufloat
149  
150 Default: 1
151  
152 The line width.
153  
154 =head2 sArrow
155  
156 Type: descrete values ( standard | delta | white_delta | diamond | white_diamond | short | plain | concave | convex | circle | transparent_circle | dash | skewed_dash | t_shape | crows_foot_one_mandatory | crows_foot_many_mandatory | crows_foot_one_optional | crows_foot_many_optional | crows_foot_one | crows_foot_many | crows_foot_optional | none )
157  
158 Default: 'none'
159  
160 The arrow on source side of the Edge.
161  
162 =head2 tArrow
163  
164 Type: descrete values ( standard | delta | white_delta | diamond | white_diamond | short | plain | concave | convex | circle | transparent_circle | dash | skewed_dash | t_shape | crows_foot_one_mandatory | crows_foot_many_mandatory | crows_foot_one_optional | crows_foot_many_optional | crows_foot_one | crows_foot_many | crows_foot_optional | none )
165  
166 Default: 'none'
167  
168 The arrow on target side of the Edge.
169  
170 =head2 relativeWaypoints
171  
172 Type: bool
173  
174 Default: false
175  
176 If set to true the x and y coords of added waypoints are not considered to be absolute coords, but they will be relative to the previous waypoint.
177 First waypoint will be relative to the source Node's coords.
178 Note that the coords of a Node indicate its upper left corner, not the center, while the default anchor point of Edges is the center of a Node and is described as being (0,0) in the Node's local coordinate system.
179 However the first (relative) waypoint WILL be calculated from the source's center modified by the anchor point by this package, so you don't have to care for such inconsistency here.
180  
181 =head1 SUBROUTINES/METHODS
182  
183 =head2 new
184  
185 Creates a new instance of the corresponding Edge type.
186  
187 An ID must be provided as first parameter.
188 This value may be any string or number but must be unique among the whole L<yEd::Document>.
189 If you don't want to bother with IDs use the addNewEdge function of L<yEd::Document> instead, it will take care of the IDs.
190  
191 Second and third parameter must be references to yEd::Node type instances, which are the Edge's source and target Nodes (in this order).
192  
193 Further parameters to set properties are optional (property => value, ...).
194  
195 =cut
196  
197 sub new {
198 0 ▶ confess 'you may not instantiate a yEd::Edge base class object';
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
199 }
200  
201 =head2 copy
202  
203 Creates a copy of this Edge and returns it.
204  
205 Also copies all attached Labels and waypoints, so unless 'relativeWaypoints' was set you will most likely want to call clearWaypoints() on the copy.
206  
207 An ID must be given as first parameter as described in the Edge class constructor, it will be applied to the copy.
208  
209 Second and third parameter must be references to yEd::Node type instances, which are the copy's source and target Nodes (in this order).
210  
211 You may optionally specify properties in the form 'property => value, ...' to change these properties for the returned copy.
212  
213 =cut
214  
215 sub copy {
216 0 ▶ my ($self, $id, $s, $t, @p) = @_;
Subroutine copy: not called CC=3 SCAR=24.8
Pod documented
217 0 my $ref = ref $self;
218 0 my $o = $ref->new($id, $s, $t);
219 0 $o->setProperties($self->getProperties());
220 0 $o->setProperties(@p, 'source' => $s, 'target' => $t);
221 0 foreach my $l ($self->labels()) {
222 0 $o->addLabel($l->copy());
223 }
224 0 foreach my $wp ($self->waypoints()) {
225 0 $o->addWaypoint(@{$wp});
226 }
227 0 return $o;
228 }
229  
230 sub _init {
231 0 ▶ my ($self, $id, $source, $target, @properties) = @_;
Subroutine _init: not called CC=4 SCAR=30.0
232 0 ▶ confess 'edge id missing for edge creation' unless (defined $id);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $id 0 0 0
233 0 ▶ confess 'provide a source and target node for edge creation' unless (defined $source and defined $target);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $source and defined $target 0 0 0
Condition0%0/3
defined $source and defined $target
!ll&&!rl&&r
000
MC/DC0%0/2
defined $source and defined $target
defined $source defined $target
Truth table0%0/3
A and B
A= defined $sourceB= defined $target
ABresult
0X0
100
111
234 0 $self->{'properties'}{'id'} = $id;
235 0 $self->{'datakeys'} = [ 'd8', 'd9' ];
236 0 $self->{'rootkey'} = 'd10';
237 0 $self->source($source);
238 0 $self->target($target);
239 # defaults
240 0 $self->sx(0);
241 0 $self->sy(0);
242 0 $self->tx(0);
243 0 $self->ty(0);
244 0 $self->lineColor('#000000');
245 0 $self->lineType('line');
246 0 $self->lineWidth(1);
247 0 $self->sArrow('none');
248 0 $self->tArrow('none');
249 0 $self->relativeWaypoints(0);
250 0 $self->clearWaypoints();
251 0 $self->clearLabels();
252 # user values
253 0 $self->setProperties(@properties);
254 0 return $self;
255 }
256  
257 # edge
258 sub id {
259 0 ▶ return _PROPERTY('ro', @_);
Subroutine id: not called CC=1 SCAR=6.9
Pod documented
260 }
261 sub source {
262 0 ▶ my ($self, $value) = @_;
Subroutine source: not called CC=4 SCAR=30.0
Pod documented
263 0 my $key = 'source';
264 0 ▶ if (defined $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) { } 0 0 0
265 0 ▶ confess "value must be a yEd::Node (or one of its subtypes) (given value: $value)" unless ($value->isa('yEd::Node'));
Branch: 1 branch
BranchTrueFalseTotal
unless $value->isa("yEd::Node") 0 0 0
266 0 ▶ $self->{'properties'}{$key}->_deregisterEdge($self) if (defined $self->{'properties'}{$key});
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"properties"}{$key} 0 0 0
267 0 $self->{'properties'}{$key} = $value;
268 0 $self->{'properties'}{$key}->_registerEdge($self);
269 0 return;
270 } else {
271 0 return $self->{'properties'}{$key};
272 }
273 }
274 sub target {
275 0 ▶ my ($self, $value) = @_;
Subroutine target: not called CC=4 SCAR=30.0
Pod documented
276 0 my $key = 'target';
277 0 ▶ if (defined $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) { } 0 0 0
278 0 ▶ confess "value must be a yEd::Node (or one of its subtypes) (given value: $value)" unless ($value->isa('yEd::Node'));
Branch: 1 branch
BranchTrueFalseTotal
unless $value->isa("yEd::Node") 0 0 0
279 0 ▶ $self->{'properties'}{$key}->_deregisterEdge($self) if (defined $self->{'properties'}{$key});
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"properties"}{$key} 0 0 0
280 0 $self->{'properties'}{$key} = $value;
281 0 $self->{'properties'}{$key}->_registerEdge($self);
282 0 return;
283 } else {
284 0 return $self->{'properties'}{$key};
285 }
286 }
287 sub _deregisterAll {
288 0 ▶ my $self = shift;
Subroutine _deregisterAll: not called CC=1 SCAR=6.9
289 0 $self->source()->_deregisterEdge($self);
290 0 $self->target()->_deregisterEdge($self);
291 }
292  
293 =head2 getNodes
294  
295 Returns an array of all Nodes (as references) connected to this Edge (This will always be 1 or 2 elements).
296  
297 =cut
298  
299 sub getNodes {
300 0 ▶ my $self = shift;
Subroutine getNodes: not called CC=2 SCAR=17.9
Pod documented
301 0 my @nodes;
302 0 push @nodes, $self->source();
303 0 ▶ push @nodes, $self->target() unless $self->source() == $self->target();
Branch: 1 branch
BranchTrueFalseTotal
unless $self->source == $self->target 0 0 0
304 0 return @nodes;
305 }
306  
307 # Path
308 sub sx {
309 0 ▶ return _PROPERTY($match{'float'}, @_);
Subroutine sx: not called CC=1 SCAR=6.9
Pod documented
310 }
311 sub sy {
312 0 ▶ return _PROPERTY($match{'float'}, @_);
Subroutine sy: not called CC=1 SCAR=6.9
Pod documented
313 }
314 sub tx {
315 0 ▶ return _PROPERTY($match{'float'}, @_);
Subroutine tx: not called CC=1 SCAR=6.9
Pod documented
316 }
317 sub ty {
318 0 ▶ return _PROPERTY($match{'float'}, @_);
Subroutine ty: not called CC=1 SCAR=6.9
Pod documented
319 }
320  
321 sub relativeWaypoints {
322 0 ▶ return _PROPERTY('bool', @_);
Subroutine relativeWaypoints: not called CC=1 SCAR=6.9
Pod documented
323 }
324  
325 =head2 addWaypoint
326  
327 Takes 2 parameters, a x and y coordinate for the waypoint.
328 The waypoint is added at the end of the list.
329 Waypoint order is interpreted as: first to last = source to target.
330  
331 Note that source and target is not provided as waypoints, neither do the properties sx,sy,tx,ty describe waypoints.
332 Waypoints describe anchor mid-points for an Edge and are absolute by default.
333 However you can have them interpreted as being relative by using the 'relativeWaypoints' property.
334  
335 =cut
336  
337 sub addWaypoint {
338 0 ▶ my ($self, @coords) = @_;
Subroutine addWaypoint: not called CC=4 SCAR=30.0
Pod documented
339 0 ▶ confess "waypoints have to be added as one pair of x,y coords : addWaypoint(x,y)" unless (@coords == 2);
Branch: 1 branch
BranchTrueFalseTotal
unless @coords == 2 0 0 0
340 0 ▶ confess "waypoint coords must be floatingpoint values" unless ($coords[0] =~ m/$match{'float'}/ and $coords[1] =~ m/$match{'float'}/);
Branch: 1 branch
BranchTrueFalseTotal
unless $coords[0] =~ /$yEd::Edge::match{"float"}/ and $coords[1] =~ /$yEd::Edge::match{"float"}/ 0 0 0
Condition0%0/3
$coords[0] =~ /$yEd::Edge::match{"float"}/ and $coords[1] =~ /$yEd::Edge::match{"float"}/
!ll&&!rl&&r
000
MC/DC0%0/2
$coords[0] =~ /$yEd::Edge::match{"float"}/ and $coords[1] =~ /$yEd::Edge::match{"float"}/
$coords[0] =~ /$yEd::Edge::match{"float"}/ $coords[1] =~ /$yEd::Edge::match{"float"}/
Truth table0%0/3
A and B
A= $coords[0] =~ /$yEd::Edge::match{"float"}/B= $coords[1] =~ /$yEd::Edge::match{"float"}/
ABresult
0X0
100
111
341 0 push @{$self->{'waypoints'}}, \@coords;
342 0 return;
343 }
344  
345 =head2 waypoints
346  
347 Acts as a getter with no parameters provided and returns an array of all Waypoints attached to this Edge.
348  
349 If an array of coordinates is provided (where each coordinate is an array of 2 elements (x,y)), this Edge's waypoints are replaced by the given ones.
350  
351 =cut
352  
353 sub waypoints {
354 0 ▶ my ($self, @wps) = @_;
Subroutine waypoints: not called CC=7 SCAR=40.3
Pod documented
355 0 ▶ if (@wps) {
Branch: 1 branch
BranchTrueFalseTotal
if (@wps) { } 0 0 0
356 0 foreach my $wp (@wps) {
357 0 ▶ confess "waypoint array has to consist of 2-element arrayrefs, which represent x,y coords" unless (ref($wp) eq 'ARRAY' and @{$wp} == 2);
Branch: 1 branch
BranchTrueFalseTotal
unless ref $wp eq "ARRAY" and @{$wp;} == 2 0 0 0
Condition0%0/3
ref $wp eq "ARRAY" and @{$wp;} == 2
!ll&&!rl&&r
000
MC/DC0%0/2
ref $wp eq "ARRAY" and @{$wp;} == 2
ref $wp eq "ARRAY" @{$wp;} == 2
Truth table0%0/3
A and B
A= ref $wp eq "ARRAY"B= @{$wp;} == 2
ABresult
0X0
100
111
358 0 ▶ confess "waypoint coords must be floatingpoint values (bad pair: (@{$wp}))" unless ($wp->[0] =~ m/$match{'float'}/ and $wp->[1] =~ m/$match{'float'}/);
Branch: 1 branch
BranchTrueFalseTotal
unless $wp->[0] =~ /$yEd::Edge::match{"float"}/ and $wp->[1] =~ /$yEd::Edge::match{"float"}/ 0 0 0
Condition0%0/3
$wp->[0] =~ /$yEd::Edge::match{"float"}/ and $wp->[1] =~ /$yEd::Edge::match{"float"}/
!ll&&!rl&&r
000
MC/DC0%0/2
$wp->[0] =~ /$yEd::Edge::match{"float"}/ and $wp->[1] =~ /$yEd::Edge::match{"float"}/
$wp->[0] =~ /$yEd::Edge::match{"float"}/ $wp->[1] =~ /$yEd::Edge::match{"float"}/
Truth table0%0/3
A and B
A= $wp->[0] =~ /$yEd::Edge::match{"float"}/B= $wp->[1] =~ /$yEd::Edge::match{"float"}/
ABresult
0X0
100
111
359 }
360 0 $self->{'waypoints'} = \@wps;
361 0 return;
362 } else {
363 0 return @{$self->{'waypoints'}};
364 }
365 }
366  
367 =head2 clearWaypoints
368  
369 Removes all waypoints from this edge.
370  
371 =cut
372  
373 sub clearWaypoints {
374 0 ▶ $_[0]->{'waypoints'} = [];
Subroutine clearWaypoints: not called CC=1 SCAR=6.9
Pod documented
375 0 return;
376 }
377  
378 # Labels
379  
380 =head2 addNewLabel
381  
382 Takes a value for the text property of Labels followed by optional Label properties ('property' => 'value', ...) and creates and adds a new Label from it.
383  
384 Returns a ref to the Label object.
385  
386 =cut
387  
388 sub addNewLabel {
389 0 ▶ my $self = shift;
Subroutine addNewLabel: not called CC=1 SCAR=6.9
Pod documented
390 0 my $label = yEd::Label::EdgeLabel->new(@_);
391 0 $self->addLabel($label);
392 0 return $label;
393 }
394  
395 =head2 addLabel
396  
397 Takes yEd::Label::EdgeLabel object and adds it.
398  
399 =cut
400  
401 sub addLabel {
402 0 ▶ my ($self, $label) = @_;
Subroutine addLabel: not called CC=2 SCAR=17.9
Pod documented
403 0 ▶ confess "only yEd::Label::EdgeLabel's can be added" unless ($label->isa('yEd::Label::EdgeLabel'));
Branch: 1 branch
BranchTrueFalseTotal
unless $label->isa("yEd::Label::EdgeLabel") 0 0 0
404 0 push @{$self->{'labels'}}, $label;
405 0 return;
406 }
407  
408 =head2 labels
409  
410 Acts as a getter with no parameters provided and returns an array of all Labels attached to this Edge.
411  
412 If an array of yEd::Label::EdgeLabel objects is provided, this Edge's Labels are replaced by the given Labels.
413  
414 =cut
415  
416 sub labels {
417 0 ▶ my ($self, @labels) = @_;
Subroutine labels: not called CC=4 SCAR=30.0
Pod documented
418 0 ▶ if (@labels) {
Branch: 1 branch
BranchTrueFalseTotal
if (@labels) { } 0 0 0
419 0 foreach my $label (@labels) {
420 0 ▶ confess "only yEd::Label::EdgeLabel's can be added" unless ($label->isa('yEd::Label::EdgeLabel'));
Branch: 1 branch
BranchTrueFalseTotal
unless $label->isa("yEd::Label::EdgeLabel") 0 0 0
421 }
422 0 $self->{'labels'} = \@labels;
423 0 return;
424 } else {
425 0 return @{$self->{'labels'}};
426 }
427 }
428  
429 =head2 clearLabels
430  
431 Removes all Labels from this Edge.
432  
433 =cut
434  
435 sub clearLabels {
436 0 ▶ $_[0]->{'labels'} = [];
Subroutine clearLabels: not called CC=1 SCAR=6.9
Pod documented
437 0 return;
438 }
439  
440 =head2 getLabelsByProperties
441  
442 Takes arguments of the form 'property1 => value, property2 => value2, ...'.
443  
444 Returns a list of all Labels that matches the given filter.
445  
446 =cut
447  
448 sub getLabelsByProperties {
449 0 ▶ my ($self, @properties) = @_;
Subroutine getLabelsByProperties: not called CC=3 SCAR=24.8
Pod documented
450 0 my @labels;
451 0 foreach my $label ($self->labels()) {
452 0 ▶ push @labels, $label if $label->hasProperties(@properties);
Branch: 1 branch
BranchTrueFalseTotal
if $label->hasProperties(@properties) 0 0 0
453 }
454 0 return @labels;
455 }
456  
457 # LineStyle
458 sub lineColor {
459 0 ▶ return _PROPERTY($match{'color'}, @_);
Subroutine lineColor: not called CC=1 SCAR=6.9
Pod documented
460 }
461 sub lineType {
462 0 ▶ return _PROPERTY($match{'linetype'}, @_);
Subroutine lineType: not called CC=1 SCAR=6.9
Pod documented
463 }
464 sub lineWidth {
465 0 ▶ return _PROPERTY($match{'ufloat'}, @_);
Subroutine lineWidth: not called CC=1 SCAR=6.9
Pod documented
466 }
467  
468 # Arrows
469 sub sArrow {
470 0 ▶ return _PROPERTY($match{'arrowtype'}, @_);
Subroutine sArrow: not called CC=1 SCAR=6.9
Pod documented
471 }
472 sub tArrow {
473 0 ▶ return _PROPERTY($match{'arrowtype'}, @_);
Subroutine tArrow: not called CC=1 SCAR=6.9
Pod documented
474 }
475  
476 sub _build {
477 0 ▶ my $self = shift;
Subroutine _build: not called CC=1 SCAR=6.9
478 0 my $node = $self->_createEdgeNode();
479 0 my $root = $self->_addRootNode($node);
480 0 my $type = $self->_addTypeNode($root);
481 0 $self->_addPathNode($type);
482 0 $self->_addLineStyleNode($type);
483 0 $self->_addArrowsNode($type);
484 0 $self->_addLabelsNode($type);
485 0 $self->_addAdditionalNodes($type);
486 0 return $node;
487 }
488 sub _createEdgeNode {
489 0 ▶ my $self = shift;
Subroutine _createEdgeNode: not called CC=2 SCAR=17.9
490 0 my $node = XML::LibXML::Element->new('edge');
491 0 $node->setAttribute('id', $self->id());
492 0 $node->setAttribute('source', $self->source()->id());
493 0 $node->setAttribute('target', $self->target()->id());
494 0 foreach my $dk (@{$self->{'datakeys'}}) {
495 0 $node->addNewChild('', 'data')->setAttribute('key', $dk);
496 }
497 0 return $node;
498 }
499 sub _addRootNode {
500 0 ▶ my ($self, $node) = @_;
Subroutine _addRootNode: not called CC=1 SCAR=6.9
501 0 my $root = $node->addNewChild('', 'data');
502 0 $root->setAttribute('key', $self->{'rootkey'});
503 0 return $root;
504 }
505 sub _addTypeNode {
506 # add type node here and return it (e.g. <y:ArcEdge>)
507 0 ▶ confess 'you may not build a yEd::Edge base class object, override this method in a specialized subclass';
Subroutine _addTypeNode: not called CC=1 SCAR=6.9
508 }
509 sub _addPathNode {
510 0 ▶ my ($self, $node) = @_;
Subroutine _addPathNode: not called CC=3 SCAR=24.8
511 0 my $path = $node->addNewChild('', 'y:Path');
512 0 $path->setAttribute('sx', $self->sx());
513 0 $path->setAttribute('sy', $self->sy());
514 0 $path->setAttribute('tx', $self->tx());
515 0 $path->setAttribute('ty', $self->ty());
516 0 my @prev = $self->source()->absCenter();
517 0 $prev[0] += $self->sx(); # <-calculated absolute coords for the source anchor
518 0 $prev[1] += $self->sy(); # <-'
519 0 foreach my $coords ($self->waypoints()) {
520 0 my $x = $coords->[0];
521 0 my $y = $coords->[1];
522 0 ▶ if ($self->relativeWaypoints()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->relativeWaypoints) 0 0 0
523 0 $x += $prev[0];
524 0 $y += $prev[1];
525 0 $prev[0] = $x;
526 0 $prev[1] = $y;
527 }
528 0 my $wp = $path->addNewChild('', 'y:Point');
529 0 $wp->setAttribute('x', $x);
530 0 $wp->setAttribute('y', $y);
531 }
532 }
533 sub _addLineStyleNode {
534 0 ▶ my ($self, $node) = @_;
Subroutine _addLineStyleNode: not called CC=2 SCAR=17.9
535 0 my $ls = $node->addNewChild('', 'y:LineStyle');
536 0 ▶ $ls->setAttribute('color', $self->lineColor() eq 'none' ? '#000000' : $self->lineColor());
Branch: 1 branch
BranchTrueFalseTotal
$self->lineColor eq 'none' ? : 0 0 0
537 0 $ls->setAttribute('type', $self->lineType());
538 0 $ls->setAttribute('width', $self->lineWidth());
539 }
540 sub _addArrowsNode {
541 0 ▶ my ($self, $node) = @_;
Subroutine _addArrowsNode: not called CC=1 SCAR=6.9
542 0 my $arrows = $node->addNewChild('', 'y:Arrows');
543 0 $arrows->setAttribute('source', $self->sArrow());
544 0 $arrows->setAttribute('target', $self->tArrow());
545 }
546 sub _addLabelsNode {
547 0 ▶ my ($self, $node) = @_;
Subroutine _addLabelsNode: not called CC=2 SCAR=17.9
548 0 foreach my $label ($self->labels()) {
549 0 $node->addChild($label->_build());
550 }
551 }
552 ▶sub _addAdditionalNodes {
Subroutine _addAdditionalNodes: not called CC=1 SCAR=0.0
553 # add type specific data here (e.g. <y:Arc ...)
554 }
555  
556 =head2 setProperties getProperties hasProperties
557  
558 As described at L<yEd::PropertyBasedObject>
559  
560 =head1 SEE ALSO
561  
562 L<yEd::Document> for further informations about the whole package
563  
564 L<yEd::PropertyBasedObject> for further basic information about properties and their additional functions
565  
566 The specialized Edges:
567  
568 L<yEd::Edge::ArcEdge>
569  
570 L<yEd::Edge::BezierEdge>
571  
572 L<yEd::Edge::GenericEdge>
573  
574 L<yEd::Edge::PolyLineEdge>
575  
576 L<yEd::Edge::QuadCurveEdge>
577  
578 L<yEd::Edge::SplineEdge>
579  
580 =cut
581  
582 1 1;
↑ Summary PropertyBasedObject.pm »