Document.pm

filter: Statementstmt 62.3% 136 / 218 Branchbran 20.0% 14 / 70 Conditioncond 3.7% 1 / 27 MC/DCmcdc 0.0% 0 / 16 Subroutinesub 64.4% 29 / 45 Podpod 100% 30 / 30 totaltotal 51.7% 210 / 406 CC 56 SCAR 24.6
CC
56
Cov
48%
removeNode
56.0
getTemplateEdge
30.0
addNewLabelTemplate
20.0
CRAP 11.7
« Label/EdgeLabel.pm ↑ Summary Node/GenericNode.pm »
1 package yEd::Document;
2  
3 3 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use warnings FATAL => 'all';
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶use XML::LibXML;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 3 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 3 ▶use yEd::Label::EdgeLabel;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 3 ▶use yEd::Label::NodeLabel;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 3 ▶use yEd::Edge::ArcEdge;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 3 ▶use yEd::Edge::BezierEdge;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 3 ▶use yEd::Edge::GenericEdge;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 3 ▶use yEd::Edge::PolyLineEdge;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 3 ▶use yEd::Edge::QuadCurveEdge;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 3 ▶use yEd::Edge::SplineEdge;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 3 ▶use yEd::Node::ShapeNode;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 3 ▶use yEd::Node::GenericNode;
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 =head1 NAME
20  
21 yEd::Document - pure perl API to easily create yEd-loadable Documents from scratch (using XML::LibXML)
22  
23 =head1 VERSION
24  
25 Version 1.01
26  
27 =cut
28  
29 3 our $VERSION = '1.01';
30  
31 =head1 DEPENDENCIES
32  
33 =over 4
34
35 =item *
36
37 L<XML::LibXML>
38  
39 =back
40  
41 =head1 INTENTION
42  
43 This package is intended to offer a way to create yEd Documents from scratch without having to deal with XML at all.
44  
45 It is ment to help automating the task of creating graphical overviews of platforms, workflows, dependencies, ...
46  
47 Since it doesn't support all the features of a yEd created Document you can only create Documents, loading Documents into the package is not supported, yet.
48  
49 =head1 SUPPORTED FEATURES
50  
51 This package and all available features have been developed and tested for yEd version 3.13.
52  
53 If you find it doesn't work on another version or a specific platform, please let me know (see sections L</BUGS> and/or L</SUPPORT>)).
54  
55 Object features are supported as described at
56  
57 =over 4
58
59 =item *
60
61 L<yEd::Node>
62
63 =item *
64
65 L<yEd::Edge>
66
67 =item *
68
69 L<yEd::Label>
70
71 =back
72  
73 and its subclasses.
74  
75 The Document itself supports basic templating (section L</TEMPLATING>), layers (section L</LAYERS>) and id management (section L</OBJECT IDENTIFIERS>).
76  
77 You can also use relative coords for positioning your entities and use this feature for basic grouping (section L</RELATIVE OBJECTS>).
78  
79 All entities are property based and can also be selected by properties (see L<yEd::PropertyBasedObject>).
80  
81 =head1 SYNOPSIS
82  
83 This package provides a pure object oriented implementation, so only use functions and properties of yEd::Document and the other types in the context of a blessed instance.
84  
85 Minimal example (creating an empty, yEd loadable Document):
86  
87 use yEd::Document;
88 # create the document
89 $d = yEd::Document->new();
90 # build the document
91 $xmlstring = $d->buildDocument();
92 # or
93 $d->buildDocument('/mypath/mydocument');
94  
95 Example of different ways to create a Node with Label (all have the same effect on the Document):
96  
97 # the manual approach
98 my $n = yEd::Node::ShapeNode->new('myid1');
99 $n->x(50);
100 $n->y(150);
101 my $l = yEd::Label::NodeLabel->new('hello world');
102 $n->addLabel($l);
103 $doc->addNode($n);
104  
105 # a slightly more user friendly approach
106 # provide the propertys with constructor and don't deal with IDs
107 my $n = yEd::Node::ShapeNode->new($doc->getFreeId(), 'x' => 50, 'y' => 150);
108 # directly add the label
109 my $l = $n->addNewLabel('hello world');
110 $doc->addNode($n);
111  
112 # or do it all in two lines
113 my $n = $doc->addNewNode('ShapeNode', 'x' => 50, 'y' => 150);
114 my $l = $n->addNewLabel('hello world');
115  
116 # or in one if you don't need the node ref (label ref is returned)
117 my $l = $doc->addNewNode('ShapeNode', 'x' => 50, 'y' => 150)->addNewLabel('hello world');
118  
119 # or use templating if you need many copies of the same node
120 my $l = $doc->addNewNodeTemplate('mytemplate', 'ShapeNode', 'x' => 50, 'y' => 150)->addNewLabel('hello world');
121 my $n = $doc->addTemplateNode('mytemplate');
122 # you can use $n to modify the copy (e.g. coords), you can also provide new properties with the call to addTemplateNode()
123 # creating edges can be done in nearly the same ways
124  
125 Example of using relative entities and layers (ready to run):
126  
127 use strict;
128 use yEd::Document;
129
130 my $d = yEd::Document->new();
131 # play around with these values and note that the edge will always keep its right angles :)
132 my $sx = -15; # -0.5 * default width
133 my $sy = 15; # 0.5 * default height -> lower left corner of source
134 my $tx = 15; # 0.5 * default width
135 my $ty = 15; # 0.5 * default height -> lower right corner of target
136 my $distance = 250;
137
138 # place the absolute "root" node
139 my $grouproot = $d->addNewNode('ShapeNode', 'x' => 1000, 'y' => 1000);
140 # place another node $distance units to its right (or left if negative)
141 my $n = $d->addNewNode('ShapeNode', 'x' => $distance, 'y' => 0, 'relative' => $grouproot);
142 # place an edge on both which will go 50 units down, then $distance units (modified by anchor offsets) right/left (and then up again to connect to its target)
143 my $e = $d->addNewEdge('PolyLineEdge', $grouproot, $n, 'relativeWaypoints' => 1, 'sx' => $sx, 'sy' => $sy, 'tx' => $tx, 'ty' => $ty);
144 $e->waypoints([0,50],[$distance - $sx + $tx,0]);
145 # place a circle on top of $grouproot to make the "group movement" visible in yEd
146 my $c = $d->addNewNode('ShapeNode','shape' => 'ellipse', 'layer' => 1, 'x' => 1000, 'y' => 1000);
147 $d->addNewEdge('PolyLineEdge', $n, $c, 'tArrow' => 'standard', 'sArrow' => 'standard');
148 # you can now move the whole "group" by modifying $grouproot's x and y values (uncomment it and watch the difference in yEd)
149 #$grouproot->setProperties('x' => 778.88, 'y' => 900);
150
151 $d->buildDocument('test');
152  
153 Example of using templating (ready to run):
154  
155 use strict;
156 use yEd::Document;
157
158 my $d = yEd::Document->new();
159
160 # preparing the templates
161 $d->addNewLabelTemplate('headline', 'NodeLabel', 'The house of Santa Claus', 'positionModell' => 'sandwich-n', 'fontSize' => 20);
162 $d->addNewNodeTemplate('housenode', 'ShapeNode', 'shape' => 'ellipse', 'fillColor' => '#0000ff');
163 my $wall = $d->addNewEdgeTemplate('wall', 'GenericEdge', 'lineWidth' => 5, 'fillColor' => '#0000ff', 'tArrow' => 'standard');
164 $wall->addNewLabel('This', 'positionModell' => 'three_center-scentr', 'textColor' => '#005500', 'backgroundColor' => '#cccccc');
165 $d->addEdgeTemplate('roof', $wall, 'fillColor' => '#ff0000');
166
167 # adding the nodes
168 my $n = $d->addTemplateNode('housenode', 'y' => 300);
169 my $n1 = $d->addTemplateNode('housenode');
170 my $n2 = $d->addTemplateNode('housenode', 'x' => 300);
171 my $n3 = $d->addTemplateNode('housenode', 'x' => 300, 'y' => 300);
172 # adding a node that wasn't defined as a template
173 my $n4 = $d->addNewNode('ShapeNode', 'x' => 150, 'y' => -150, 'shape' => 'triangle', 'fillColor' => '#ff0000');
174 $n4->addLabel($d->getTemplateLabel('headline'));
175
176 # adding the edges
177 $d->addTemplateEdge('wall',$n,$n1);
178 ($d->addTemplateEdge('wall',$n1,$n2)->labels())[0]->text('is');
179 ($d->addTemplateEdge('wall',$n2,$n)->labels())[0]->text('the');
180 ($d->addTemplateEdge('wall',$n,$n3)->labels())[0]->text('house');
181 ($d->addTemplateEdge('wall',$n3,$n2)->labels())[0]->text('of');
182 ($d->addTemplateEdge('roof',$n2,$n4)->labels())[0]->text('San-');
183 ($d->addTemplateEdge('roof',$n4,$n1)->labels())[0]->text('ta');
184 ($d->addTemplateEdge('wall',$n1,$n3)->labels())[0]->text('Claus');
185
186 $d->buildDocument('santa_claus');
187  
188 =head1 OBJECT IDENTIFIERS
189  
190 All Nodes and Edges of a Document must have an unique ID.
191  
192 If you only use the yEd::Document's C<addNew...()> functions and templating features you won't have to care for IDs.
193  
194 But if you need to externally create Nodes or Edges from its classes you will have to provide the ID yourself.
195  
196 In this case it is up to you to ensure unique values unless you obtain the IDs via yEd::Document's C<getFreeId()> function.
197  
198 This automatically created IDs will always be positive integer values, but if you provide your own IDs you can use almost anything.
199  
200 If you load and save a Document in yEd all IDs will be converted to yEd's syntax ('n0','n1',...,'e0','e1',...).
201  
202 =head1 TEMPLATING
203  
204 If you have to add many copies of the same modification of a Node, Edge or Label have a look at yEd::Document's template functions (each with a 'Template' in its name).
205  
206 These offer the ability to save an object's configuration and return and/or add copies of it.
207  
208 For Nodes and Edges added Labels will be copied along with the template.
209  
210 For Nodes that are relative to other Nodes you may want to call C<relative(0)> or C<relative($newTarget)> on the copy (or provide it with the properties parameter).
211  
212 For Edges all waypoints are copied along with the template, this may not be what you want unless the Edge's C<relativeWaypoints> property is set, consider calling C<clearWaypoints()> on the copy.
213  
214 Have a look at the 'Example of using templating' in the section L</SYNOPSIS>.
215  
216 =head1 RELATIVE OBJECTS
217  
218 A Node or Edge-waypoint by default will be absolute, this is its x and y values are directly applied to the drawing pane.
219  
220 However you can change a Node to be relative to a given other Node by using the Node's C<relative> property.
221 In this case x and y are values that are added to the other Node's absolute position to determine the Node's position.
222 The other Node however may be relative to yet another Node, too.
223 Just make sure you don't create dependency loops. ;)
224  
225 If you manually cut the relation of two Nodes by setting C<relative(0)> on the dependend Node, the provided C<x> and C<y> value will not be changed but only interpreted as being absolute further on.
226 If you want to cut the relation without changing the Node's current absolute position call C<$n-E<gt>x($n-E<gt>absX())> and C<$n-E<gt>y($n-E<gt>absY())> BEFORE the call to C<$n-E<gt>relative(0)>.
227  
228 Note that the C<x> and C<y> coords of a Node refer to its upper left corner or rather the upper left corner of the Node's surrounding rectangle (e.g. for ellipse ShapeNodes).
229 Consider this if you do any Node positioning math in your scripts.
230  
231 Edges do have such a property, too, it is called C<relativeWaypoints> but is a boolean value in contrast to Node's property.
232 If set to a true value any waypoints added to this Edge will be positioned relative to the previous waypoint.
233 The first waypoint's position will be calculated relative to the Edge's anchor point on its C<source> Node (C<sx>,C<sy>).
234  
235 If you change from C<relativeWaypoints(1)> to C<relativeWaypoints(0)> there will be no conversion of the waypoint coords by default (same behavior as for Nodes).
236  
237 Note that the source Node anchor point (C<sx>,C<sy>) is relative to the Node's center (C<sx> = C<sy> = 0) (as is true for the C<target> anchor).
238 This is somehow inconsistent as the Node's coords don't describe its center (you can obtain a Node's center by using its C<absCenter()> function).
239 Consider this if you do any positioning math in your scripts.
240 However for relative waypoints you will likely have the desired bahavior by default, since first waypoint is relative to the anchor point which's absolute position is automatically computed for you by this package.
241  
242 Have a look at the 'Example of using relative entities and layers' in the section L</SYNOPSIS>.
243  
244 Tip: If you create "groups" with the reative feature always build your group on top of a root node that spans the whole area of the group.
245 If you need the Nodes to not be surrounded by a background root Node simply make it invisible (no fill color, no border).
246 This way you can always ask your root Node for the C<width> and C<height> of the whole "group" if you need these values for calculation. :)
247  
248 Note that this way of "grouping" has no effect in yEd, it does only exist within the code.
249  
250 =cut
251  
252 #TODO: VirtualGroupNode Type ? invisible rectangle ShapeNode that allows adding relative Nodes and autosizes itself on Node addition/removal .. ?.
253  
254 =head1 LAYERS
255  
256 yEd Documents / Nodes do only support "virtual" layering which is saved to the graphml file by giving the Nodes a special order (first Node defined is drawn first).
257  
258 This concept has been adopted by this package.
259 The layer is described as a property of each Node, named C<layer> (Edges do not support layering, they will always be drawn on top the Nodes).
260 Its default value is 0 which is the bottom layer.
261 You can define the layer of a Node as any positive integer value, where a higher value is "more in front".
262  
263 Within a single layer the drawing order of Nodes is undefined, if they overlap or need a special order because of other reasons use different layers.
264  
265 Like with any other property you may obtain a list of all Nodes on a specified layer by using C<getNodesByProperties()> (e.g. C<getNodesByProperties('layer' =E<gt> 3>).
266  
267 Have a look at the 'Example of using relative entities and layers' in the section L</SYNOPSIS>.
268  
269 =head1 SUBROUTINES/METHODS
270  
271 =head2 new
272  
273 Creates a new instance of yEd::Document and initializes it.
274  
275 =head3 EXAMPLE
276  
277 my $doc = yEd::Document->new();
278  
279 =cut
280  
281 1 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
282 1 my $self = {};
283 1 bless $self, shift;
284 1 $self->resetDocument();
285 1 $self->{'dummynode'} = yEd::Node::ShapeNode->new('noid');
286 1 return $self;
287 }
288  
289 3 my %graphmlAttr = (
290 'xmlns'=> 'http://graphml.graphdrawing.org/xmlns',
291 'xmlns:xsi'=> 'http://www.w3.org/2001/XMLSchema-instance',
292 'xmlns:y' => 'http://www.yworks.com/xml/graphml',
293 'xmlns:yed' => 'http://www.yworks.com/xml/yed/3',
294 'xsi:schemaLocation' => 'http://graphml.graphdrawing.org/xmlns http://www.yworks.com/xml/schema/graphml/1.1/ygraphml.xsd',
295 );
296 3 my %docKeyAttr = (
297 'd0' => { 'for' => 'graph', 'attr.type' => 'string', 'attr.name' => 'Description' },
298 'd1' => { 'for' => 'port', 'yfiles.type' => 'portgraphics' },
299 'd2' => { 'for' => 'port', 'yfiles.type' => 'portgeometry' },
300  
301 'd4' => { 'for' => 'node', 'attr.type' => 'string', 'attr.name' => 'url' },
302 'd5' => { 'for' => 'node', 'attr.type' => 'string', 'attr.name' => 'description' },
303 'd6' => { 'for' => 'node', 'yfiles.type' => 'nodegraphics' },
304 'd7' => { 'for' => 'graphml', 'yfiles.type' => 'resources' },
305 'd8' => { 'for' => 'edge', 'attr.type' => 'string', 'attr.name' => 'url' },
306 'd9' => { 'for' => 'edge', 'attr.type' => 'string', 'attr.name' => 'description' },
307 'd10' => { 'for' => 'edge', 'yfiles.type' => 'edgegraphics' },
308 );
309  
310 =head2 resetDocument
311  
312 Resets (empties) and reinitializes this Document.
313  
314 Previously registered templates will be kept.
315  
316 =head3 EXAMPLE
317  
318 $doc->resetDocument();
319  
320 =cut
321  
322 1 ▶sub resetDocument {
Subroutine resetDocument: called CC=4 SCAR=13.9
Pod documented
323 1 my $self = shift;
324 1 $self->{'DOC'} = XML::LibXML::Document->new('1.0', 'UTF-8');
325 1 $self->{'DOC'}->setStandalone(0);
326 1 $self->{'ROOT'} = $self->{'DOC'}->createElement('graphml');
327 1 foreach my $key (keys %graphmlAttr) {
328 5 $self->{'ROOT'}->setAttribute($key => $graphmlAttr{$key});
329 }
330 1 foreach my $id (keys %docKeyAttr) {
331 10 my $keyelement = $self->{'ROOT'}->addNewChild('', 'key');
332 10 $keyelement->setAttribute('id' => $id);
333 10 foreach my $key (keys %{$docKeyAttr{$id}}) {
334 25 $keyelement->setAttribute($key => $docKeyAttr{$id}{$key});
335 }
336 }
337 1 $self->{'nodes'} = {};
338 1 $self->{'edges'} = {};
339 1 $self->{'lastid'} = 0;
340 1 return;
341 }
342  
343 =head2 buildDocument
344  
345 Builds the Document and returns it as a string.
346  
347 If a filename is provided (without the ending) it will additionally be written into filename.graphml .
348  
349 =head3 EXAMPLE
350  
351 my $xml = $doc->buildDocument();
352 my $xml = $doc->buildDocument('/path/to/mydoc');
353  
354 =cut
355  
356 1 ▶sub buildDocument {
Subroutine buildDocument: called CC=10 SCAR=25.8
Pod documented
357 1 my $self = shift;
358 1 my $filename = shift;
359 1 my $graph = $self->{'ROOT'}->addNewChild('', 'graph');
360 1 $graph->setAttribute('edgedefault' => 'directed');
361 1 $graph->setAttribute('id' => 'G');
362 1 $graph->addNewChild('', 'data')->setAttribute('key' => 'd0');
363 1 ▶ for (my $l = 0; $l <= $self->getFrontLayer(); $l++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($l <= $self->getFrontLayer) 1 1 2
364 1 foreach my $n ($self->getNodesByProperties('layer' => $l)) {
365 2 ▶ if (my $n2 = $n->relative()) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $n2 = $n->relative) 0 2 2
366 0 ▶ confess "node $n2 (id: " . $n2->id() . ") as referenced by relative node $n (id: " . $n->id() . ") is not part of this document" unless ($self->hasNodeId($n2->id()));
Branch: 1 branch
BranchTrueFalseTotal
unless $self->hasNodeId($n2->id) 0 0 0
367 }
368 2 $graph->addChild($n->_build());
369 }
370 }
371 1 foreach my $e ($self->getEdges()) {
372 6 foreach my $n ($e->getNodes()) {
373 6 ▶ confess "node $n (id: " . $n->id() . ") as referenced by edge $e (id: " . $e->id() . ") is not part of this document" unless ($self->hasNodeId($n->id()));
Branch: 1 branch
BranchTrueFalseTotal
unless $self->hasNodeId($n->id) 0 6 6
374 }
375 6 $graph->addChild($e->_build());
376 }
377 1 my $datablock = $self->{'ROOT'}->addNewChild('', 'data');
378 1 $datablock->setAttribute('key' => 'd7');
379 1 $datablock->addNewChild('', 'y:Resources');
380 1 $self->{'DOC'}->setDocumentElement($self->{'ROOT'});
381 1 my $out = $self->{'DOC'}->toString();
382 1 ▶ if ($filename) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename) 0 1 1
383 0 $filename .= '.graphml';
384 0 ▶ open( OUTFILE, '>', $filename ) or confess "couldn't open $filename for write access";
Branch: 1 branch
BranchTrueFalseTotal
open OUTFILE, ">", $filename or confess("couldn't open $filename for write access") 0 0 0
385 0 print OUTFILE $out;
386 0 close OUTFILE;
387 }
388 1 return $out;
389 }
390  
391 =head2 getFreeId
392  
393 Returns the next still free C<id>, that can be used for creating new Nodes or Edges.
394  
395 This is only required if you externally create new Nodes/Edges and you could also use own values as IDs (you will then have to ensure that all IDs are unique).
396  
397 =head3 EXAMPLE
398  
399 my $myid = $doc->getFreeId();
400  
401 =cut
402  
403 8 ▶sub getFreeId {
Subroutine getFreeId: called CC=3 SCAR=11.6
Pod documented
404 8 my $self = shift;
405 8 my $id = $self->{'lastid'};
406 8 ▶ do {
Branch: 1 branch
BranchTrueFalseTotal
$self->hasNodeId($id) || $self->hasEdgeId($id) and do { do { ++$id } } 0 8 8
Condition33%1/3
$self->hasNodeId($id) or $self->hasEdgeId($id)
l!l&&r!l&&!r
008
MC/DC0%0/2
$self->hasNodeId($id) or $self->hasEdgeId($id)
$self->hasNodeId($id) $self->hasEdgeId($id)
Truth table33%1/3
A or B
A= $self->hasNodeId($id)B= $self->hasEdgeId($id)
ABresult
1X1
011
000
407 8 $id++;
408 } while ($self->hasNodeId($id) or $self->hasEdgeId($id));
409 8 $self->{'lastid'} = $id;
410 8 return $id;
411 }
412  
413 =head2 getFrontLayer
414  
415 Returns the highest C<layer> that is set for any Node of this Document.
416  
417 =head3 EXAMPLE
418  
419 my $front = $doc->getFrontLayer();
420  
421 =cut
422  
423 2 ▶sub getFrontLayer {
Subroutine getFrontLayer: called CC=3 SCAR=11.1
Pod documented
424 2 my $self = shift;
425 2 my $layer = 0;
426 2 foreach my $node ($self->getNodes()) {
427 4 ▶ $layer = $node->layer() if ($node->layer() > $layer);
Branch: 1 branch
BranchTrueFalseTotal
if $node->layer > $layer 0 4 4
428 }
429 2 return $layer;
430 }
431  
432 # Templates
433  
434 =head2 addNewLabelTemplate
435  
436 Creates a template for Labels.
437  
438 Must have parameters are: templatename (a string for accessing the template) , labeltype (Node- or EdgeLabel) , labeltext (the C<text> for the Label)
439  
440 Further parameters to set properties are optional (C<property1 =E<gt> value, property2 =E<gt> value2, ...>).
441  
442 The template Label is returned as a reference, if you modify this reference all further copies of the template will be affected !
443 Copies created earlier will not be affected since they are as said copies.
444  
445 =head3 EXAMPLE
446  
447 my $tmplLabel = $doc->addNewLabelTemplate('mytemplate', 'NodeLabel', 'hello world', 'alignment' => 'left');
448  
449 =cut
450  
451 0 ▶sub addNewLabelTemplate {
Subroutine addNewLabelTemplate: not called CC=4 SCAR=30.0
Pod documented
452 0 my ($self, $name, $type, @param) = @_;
453 0 ▶ confess 'provide templateName, labelType, labelText, [labelProperties]' unless (defined $name and defined $type and @param);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $name and defined $type and @param 0 0 0
Condition0%0/6
defined $name and defined $type and @param
!ll&&!rl&&r
000
defined $name and defined $type
!ll&&!rl&&r
000
MC/DC0%0/3
defined $name and defined $type and @param
defined $name defined $type @param
Truth table0%0/4
A and B and C
A= defined $nameB= defined $typeC= @param
ABCresult
0XX0
10X0
1100
1111
454 0 $type = 'yEd::Label::' . $type;
455 0 my $o = $type->new(@param);
456 0 return $self->addLabelTemplate($name, $o);
457 }
458  
459 =head2 addLabelTemplate
460  
461 Creates a template for Labels.
462  
463 Must have parameters are: templatename (a string for accessing the template) , label (a reference to a Label object)
464  
465 Further parameters to set properties are optional (C<property1 =E<gt> value, property2 =E<gt> value2, ...>).
466  
467 The source Label will not be changed, a copy of the Label will be used as template.
468 If you want to modify the template after adding it use the returned reference to the copy.
469  
470 =head3 EXAMPLE
471  
472 my $tmplLabel = $doc->addLabelTemplate('mytemplate', $srcLabel, 'text' => 'foo');
473  
474 =cut
475  
476 0 ▶sub addLabelTemplate {
Subroutine addLabelTemplate: not called CC=2 SCAR=17.9
Pod documented
477 0 my ($self, $name, $label,@param) = @_;
478 0 ▶ confess 'must be of type yEd::Label' unless ($label->isa('yEd::Label'));
Branch: 1 branch
BranchTrueFalseTotal
unless $label->isa("yEd::Label") 0 0 0
479 0 $self->{'labelTemplates'}{$name} = $label->copy(@param);
480 0 return $self->{'labelTemplates'}{$name};
481 }
482  
483 =head2 getTemplateLabel
484  
485 Creates a copy of a previously created Label template and returns it.
486  
487 Must have parameters are: templatename (a string for accessing the template)
488  
489 Further parameters to set properties are optional (C<property1 =E<gt> value, property2 =E<gt> value2, ...>).
490  
491 In contrast to Nodes and Edges Label templates can not be added directly because the need to be added to a Node or Edge.
492 So use this function to obtain a copy and add it somewhere yourself.
493  
494 =head3 EXAMPLE
495  
496 my $label = $doc->getTemplateLabel('mytemplate', 'text' => 'bar');
497  
498 =cut
499  
500 0 ▶sub getTemplateLabel {
Subroutine getTemplateLabel: not called CC=3 SCAR=24.8
Pod documented
501 0 my ($self, $name, @params) = @_;
502 0 ▶ confess 'provide templateName, [labelProperties]' unless (defined $name);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $name 0 0 0
503 0 ▶ confess "no such template: $name" unless (exists $self->{'labelTemplates'}{$name});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"labelTemplates"}{$name} 0 0 0
504 0 return $self->{'labelTemplates'}{$name}->copy(@params);
505 }
506  
507 =head2 addNewNodeTemplate
508  
509 Creates a template for Nodes.
510  
511 Must have parameters are: templatename (a string for accessing the template) , nodetype (Shape- or GenericNode)
512  
513 Further parameters to set properties are optional (C<property1 =E<gt> value, property2 =E<gt> value2, ...>).
514  
515 The template Node is returned as a reference, if you modify this reference all further copies of the template will be affected !
516 Copies created earlier will not be affected since they are as said copies.
517  
518 =head3 EXAMPLE
519  
520 my $tmplNode = $doc->addNewNodeTemplate('mytemplate', 'ShapeNode', 'width' => 300, 'height' => 200);
521  
522 =cut
523  
524 0 ▶sub addNewNodeTemplate {
Subroutine addNewNodeTemplate: not called CC=3 SCAR=24.8
Pod documented
525 0 my ($self, $name, $type, @param) = @_;
526 0 ▶ confess 'provide templateName, nodeType, [nodeProperties]' unless (defined $name and defined $type);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $name and defined $type 0 0 0
Condition0%0/3
defined $name and defined $type
!ll&&!rl&&r
000
MC/DC0%0/2
defined $name and defined $type
defined $name defined $type
Truth table0%0/3
A and B
A= defined $nameB= defined $type
ABresult
0X0
100
111
527 0 $type = 'yEd::Node::' . $type;
528 0 my $o = $type->new('noid', @param);
529 0 return $self->addNodeTemplate($name, $o);;
530 }
531  
532 =head2 addNodeTemplate
533  
534 Creates a template for Nodes.
535  
536 Must have parameters are: templatename (a string for accessing the template) , node (a reference to a Node object)
537  
538 Further parameters to set properties are optional (C<property1 =E<gt> value, property2 =E<gt> value2, ...>).
539  
540 The source Node will not be changed, a copy of the Node will be used as template.
541 If you want to modify the template after adding it use the returned reference to the copy.
542  
543 =head3 EXAMPLE
544  
545 my $tmplNode = $doc->addNodeTemplate('mytemplate', $srcNode, 'width' => 300, 'height' => 200);
546  
547 =cut
548  
549 0 ▶sub addNodeTemplate {
Subroutine addNodeTemplate: not called CC=2 SCAR=17.9
Pod documented
550 0 my ($self, $name, $node, @param) = @_;
551 0 ▶ confess 'must be of type yEd::Node' unless ($node->isa('yEd::Node'));
Branch: 1 branch
BranchTrueFalseTotal
unless $node->isa("yEd::Node") 0 0 0
552 0 $self->{'nodeTemplates'}{$name} = $node->copy('noid', @param);
553 0 return $self->{'nodeTemplates'}{$name};
554 }
555  
556 =head2 getTemplateNode
557  
558 Creates a copy of a previously created Node template and returns it.
559
560 Must have parameters are: templatename (a string for accessing the template)
561
562 Further parameters to set properties are optional (C<property1 =E<gt> value, property2 =E<gt> value2, ...>).
563  
564 =head3 EXAMPLE
565  
566 my $node = $doc->getTemplateNode('mytemplate', 'x' => 50, 'y' => 200);
567  
568 =cut
569  
570 0 ▶sub getTemplateNode {
Subroutine getTemplateNode: not called CC=3 SCAR=24.8
Pod documented
571 0 my ($self, $name, @params) = @_;
572 0 ▶ confess 'provide templateName, [nodeProperties]' unless (defined $name);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $name 0 0 0
573 0 ▶ confess "no such template: $name" unless (exists $self->{'nodeTemplates'}{$name});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"nodeTemplates"}{$name} 0 0 0
574 0 return $self->{'nodeTemplates'}{$name}->copy($self->getFreeId(), @params);
575 }
576  
577 =head2 addTemplateNode
578  
579 Creates a copy of a previously created Node template, adds it to the Document and returns it.
580
581 Must have parameters are: templatename (a string for accessing the template)
582
583 Further parameters to set properties are optional (C<property1 =E<gt> value, property2 =E<gt> value2, ...>).
584  
585 =head3 EXAMPLE
586  
587 my $node = $doc->addTemplateNode('mytemplate', 'x' => 50, 'y' => 200);
588  
589 =cut
590  
591 0 ▶sub addTemplateNode {
Subroutine addTemplateNode: not called CC=1 SCAR=6.9
Pod documented
592 0 my ($self, $name, @params) = @_;
593 0 my $o = $self->getTemplateNode($name, @params);
594 0 $self->addNode($o);
595 0 return $o;
596 }
597  
598 =head2 addNewEdgeTemplate
599  
600 Creates a template for Edges.
601  
602 Must have parameters are: templatename (a string for accessing the template) , edgetype (one of the supported Edge class names)
603  
604 Further parameters to set properties are optional (C<property1 =E<gt> value, property2 =E<gt> value2, ...>).
605  
606 The template Edge is returned as a reference, if you modify this reference all further copies of the template will be affected !
607 Copies created earlier will not be affected since they are as said copies.
608  
609 =head3 EXAMPLE
610  
611 my $tmplEdge = $doc->addNewEdgeTemplate('mytemplate', 'ArcEdge', 'tArrow' => 'standard');
612  
613 =cut
614  
615 0 ▶sub addNewEdgeTemplate {
Subroutine addNewEdgeTemplate: not called CC=3 SCAR=24.8
Pod documented
616 0 my ($self, $name, $type, @param) = @_;
617 0 ▶ confess 'provide templateName, edgeType, [edgeProperties]' unless (defined $name and defined $type);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $name and defined $type 0 0 0
Condition0%0/3
defined $name and defined $type
!ll&&!rl&&r
000
MC/DC0%0/2
defined $name and defined $type
defined $name defined $type
Truth table0%0/3
A and B
A= defined $nameB= defined $type
ABresult
0X0
100
111
618 0 $type = 'yEd::Edge::' . $type;
619 0 my $o = $type->new('noid', $self->{'dummynode'}, $self->{'dummynode'}, @param);
620 0 return $self->addEdgeTemplate($name, $o);;
621 }
622  
623 =head2 addEdgeTemplate
624  
625 Creates a template for Edges.
626
627 Must have parameters are: templatename (a string for accessing the template) , edge (a reference to an Edge object)
628
629 Further parameters to set properties are optional (C<property1 =E<gt> value, property2 =E<gt> value2, ...>).
630  
631 The source Edge will not be changed, a copy of the Edge will be used as template.
632 If you want to modify the template after adding it use the returned reference to the copy.
633  
634 =head3 EXAMPLE
635  
636 my $tmplEdge = $doc->addEdgeTemplate('mytemplate', $srcEdge, 'tArrow' => 'standard');
637  
638 =cut
639  
640 0 ▶sub addEdgeTemplate {
Subroutine addEdgeTemplate: not called CC=2 SCAR=17.9
Pod documented
641 0 my ($self, $name, $edge, @param) = @_;
642 0 ▶ confess 'must be of type yEd::Edge' unless ($edge->isa('yEd::Edge'));
Branch: 1 branch
BranchTrueFalseTotal
unless $edge->isa("yEd::Edge") 0 0 0
643 0 $self->{'edgeTemplates'}{$name} = $edge->copy('noid', $self->{'dummynode'}, $self->{'dummynode'}, @param);
644 0 return $self->{'edgeTemplates'}{$name};
645 }
646  
647 =head2 getTemplateEdge
648  
649 Creates a copy of a previously created Edge template and returns it.
650
651 Must have parameters are: templatename (a string for accessing the template), source, target (the new C<source> and C<target> L<yEd::Node> refs for the new Edge)
652
653 Further parameters to set properties are optional (C<property1 =E<gt> value, property2 =E<gt> value2, ...>).
654  
655 =head3 EXAMPLE
656  
657 my $edge = $doc->getTemplateEdge('mytemplate', $srcNode, $trgNode, 'tArrow' => 'standard');
658  
659 =cut
660  
661 0 ▶sub getTemplateEdge {
Subroutine getTemplateEdge: not called CC=5 SCAR=34.0
Pod documented
662 0 my ($self, $name, $s, $t, @params) = @_;
663 0 ▶ confess 'provide templateName, edgeSourceNode, edgeTargetNode, [edgeProperties]' unless (defined $name and defined $s and defined $t);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $name and defined $s and defined $t 0 0 0
Condition0%0/6
defined $name and defined $s and defined $t
!ll&&!rl&&r
000
defined $name and defined $s
!ll&&!rl&&r
000
MC/DC0%0/3
defined $name and defined $s and defined $t
defined $name defined $s defined $t
Truth table0%0/4
A and B and C
A= defined $nameB= defined $sC= defined $t
ABCresult
0XX0
10X0
1100
1111
664 0 ▶ confess "no such template: $name" unless (exists $self->{'edgeTemplates'}{$name});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"edgeTemplates"}{$name} 0 0 0
665 0 return $self->{'edgeTemplates'}{$name}->copy($self->getFreeId(), $s, $t, @params);
666 }
667  
668 =head2 addTemplateEdge
669  
670 Creates a copy of a previously created Edge template, adds it to the Document and returns it.
671
672 Must have parameters are: templatename (a string for accessing the template), source, target (the new C<source> and C<target> L<yEd::Node> refs for the new Edge)
673
674 Further parameters to set properties are optional (C<property1 =E<gt> value, property2 =E<gt> value2, ...>).
675  
676 =head3 EXAMPLE
677  
678 my $edge = $doc->addTemplateEdge('mytemplate', $srcNode, $trgNode, 'tArrow' => 'standard');
679  
680 =cut
681  
682 0 ▶sub addTemplateEdge {
Subroutine addTemplateEdge: not called CC=1 SCAR=6.9
Pod documented
683 0 my ($self, $name, $s, $t, @params) = @_;
684 0 my $o = $self->getTemplateEdge($name, $s, $t, @params);
685 0 $self->addEdge($o);
686 0 return $o;
687 }
688  
689 # Nodes
690  
691 =head2 addNewNode
692  
693 Creates a new Node, adds it and returns a reference to it.
694  
695 Must have parameters are: nodetype (Shape- or GenericNode)
696  
697 Further parameters to set properties are optional (C<property1 =E<gt> value, property2 =E<gt> value2, ...>).
698  
699 =head3 EXAMPLE
700  
701 my $node = $doc->addNewNode('ShapeNode', 'x' => 60, 'y' => 450);
702  
703 =cut
704  
705 2 ▶sub addNewNode {
Subroutine addNewNode: called CC=1 SCAR=0.0
Pod documented
706 2 my ($self, $type, @param) = @_;
707 2 $type = 'yEd::Node::' . $type;
708 2 my $node = $type->new($self->getFreeId(), @param);
709 2 $self->addNode($node);
710 2 return $node;
711 }
712  
713 =head2 addNode
714  
715 Takes a L<yEd::Node> as parameter and adds it to the Document.
716  
717 =head3 EXAMPLE
718  
719 $doc->addNode($node);
720  
721 =cut
722  
723 2 ▶sub addNode {
Subroutine addNode: called CC=3 SCAR=11.3
Pod documented
724 2 my ($self, $node) = @_;
725 2 ▶ confess 'must be of type yEd::Node' unless ($node->isa('yEd::Node'));
Branch: 1 branch
BranchTrueFalseTotal
unless $node->isa("yEd::Node") 0 2 2
726 2 ▶ confess "node ids must be unique: " . $node->id() if $self->hasNodeId($node->id());
Branch: 1 branch
BranchTrueFalseTotal
if $self->hasNodeId($node->id) 0 2 2
727 2 $self->{'nodes'}{$node->id()} = $node;
728 2 return;
729 }
730  
731 =head2 getNodes
732  
733 Returns an array of all Nodes of this Document.
734  
735 =head3 EXAMPLE
736  
737 my @nodes = $doc->getNodes();
738  
739 =cut
740  
741 3 ▶sub getNodes {
Subroutine getNodes: called CC=1 SCAR=0.0
Pod documented
742 3 return values %{$_[0]->{'nodes'}};
743 }
744  
745 =head2 getNodesByProperties
746  
747 Takes arguments of the form C<property1 =E<gt> value, property2 =E<gt> value2, ...>.
748  
749 Returns a list of all Nodes that matches the given filter.
750  
751 =head3 EXAMPLE
752  
753 my @nodes = $doc->getNodesByProperties('width' => 300);
754  
755 =cut
756  
757 1 ▶sub getNodesByProperties {
Subroutine getNodesByProperties: called CC=3 SCAR=11.1
Pod documented
758 1 my ($self, @properties) = @_;
759 1 my @nodes;
760 1 foreach my $node ($self->getNodes()) {
761 2 ▶ push @nodes, $node if $node->hasProperties(@properties);
Branch: 1 branch
BranchTrueFalseTotal
if $node->hasProperties(@properties) 2 0 2
762 }
763 1 return @nodes;
764 }
765  
766 =head2 hasNodeId
767  
768 Takes a Node's C<id> as parameter and returns true if it is present in this Document.
769  
770 =head3 EXAMPLE
771  
772 if ($doc->hasNodeId('myid1')) { ...
773  
774 =cut
775  
776 16 ▶sub hasNodeId {
Subroutine hasNodeId: called CC=2 SCAR=7.1
Pod documented
777 16 my ($self, $id) = @_;
778 16 ▶ confess 'no id provided' unless (defined $id);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $id 0 16 16
779 16 return exists $self->{'nodes'}{$id};
780 }
781  
782 =head2 getNodeById
783  
784 Takes an C<id> as parameter and returns the Node with this C<id>, if present in this Document.
785  
786 =head3 EXAMPLE
787  
788 my $node = $doc->getNodeById('myid1');
789  
790 =cut
791  
792 0 ▶sub getNodeById {
Subroutine getNodeById: not called CC=2 SCAR=17.9
Pod documented
793 0 my ($self, $id) = @_;
794 0 ▶ confess 'no id provided' unless (defined $id);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $id 0 0 0
795 0 return $self->{'nodes'}{$id};
796 }
797  
798 =head2 removeNode
799  
800 Takes a L<yEd::Node> as parameter and tries to remove it from this document.
801  
802 All connected Edges will be removed, too.
803  
804 If there are Nodes C<relative> to the given Node, they will also be removed (and their Edges and Nodes relative to these Nodes and so on, until all dependencies are resolved) unless the second (keepRelative) parameter is true.
805 In this case the absolute C<x> and C<y> values are calculated and the relationship is cut, making the orphaned Nodes absolute.
806  
807 =head3 EXAMPLE
808  
809 # in the "Example of using relative entities and layers" (see SYNOPSIS)
810 # only the cirlce will remain if you call
811 $d->removeNode($grouproot);
812 # only $grouproot and $e will be removed if you call
813 $d->removeNode($grouproot, 1);
814 # $n will then be absolute at its last position
815  
816 =cut
817  
818 0 ▶sub removeNode {
Subroutine removeNode: not called CC=7 SCAR=40.3
Pod documented
819 0 my ($self, $node, $keepRelative) = @_;
820 0 ▶ confess 'no yEd::Node provided' unless (defined $node and $node->isa('yEd::Node'));
Branch: 1 branch
BranchTrueFalseTotal
unless defined $node and $node->isa("yEd::Node") 0 0 0
Condition0%0/3
defined $node and $node->isa("yEd::Node")
!ll&&!rl&&r
000
MC/DC0%0/2
defined $node and $node->isa("yEd::Node")
defined $node $node->isa("yEd::Node")
Truth table0%0/3
A and B
A= defined $nodeB= $node->isa("yEd::Node")
ABresult
0X0
100
111
821 0 ▶ if ($self->hasNodeId($node->id())) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->hasNodeId($node->id)) 0 0 0
822 0 delete $self->{'nodes'}{$node->id()};
823 0 foreach my $e ($node->getEdges()) {
824 0 $self->removeEdge($e);
825 }
826 0 foreach my $n ($self->getNodesByProperties('relative' => $node)) {
827 0 ▶ if ($keepRelative) {
Branch: 1 branch
BranchTrueFalseTotal
if ($keepRelative) { } 0 0 0
828 0 $n->x($n->absX());
829 0 $n->y($n->absY());
830 0 $n->relative(0);
831 } else {
832 0 $self->removeNode($n);
833 }
834 }
835 }
836 0 return;
837 }
838  
839 # Edges
840  
841 =head2 addNewEdge
842  
843 Creates a new Edge, adds it and returns a reference to it.
844  
845 Must have parameters are: edgetype (one of the supported Edge class names), source, target (the C<source> and C<target> L<yEd::Node> refs for the new Edge)
846  
847 Further parameters to set properties are optional (C<property1 =E<gt> value, property2 =E<gt> value2, ...>).
848  
849 =head3 EXAMPLE
850  
851 my $edge = $doc->addNewEdge('ArcEdge', $srcNode, $trgNode, 'tArrow' => 'standard');
852  
853 =cut
854  
855 6 ▶sub addNewEdge {
Subroutine addNewEdge: called CC=1 SCAR=0.0
Pod documented
856 6 my ($self, $type, @param) = @_;
857 6 $type = 'yEd::Edge::' . $type;
858 6 my $edge = $type->new($self->getFreeId(), @param);
859 6 $self->addEdge($edge);
860 6 return $edge;
861 }
862  
863 =head2 addEdge
864  
865 Takes a L<yEd::Edge> as parameter and adds it to the Document.
866  
867 =head3 EXAMPLE
868  
869 $doc->addEdge($edge);
870  
871 =cut
872  
873 6 ▶sub addEdge {
Subroutine addEdge: called CC=3 SCAR=11.3
Pod documented
874 6 my ($self, $edge) = @_;
875 6 ▶ confess 'must be of type yEd::Edge' unless ($edge->isa('yEd::Edge'));
Branch: 1 branch
BranchTrueFalseTotal
unless $edge->isa("yEd::Edge") 0 6 6
876 6 ▶ confess 'edge ids must be unique: ' . $edge->id() if $self->hasEdgeId($edge->id());
Branch: 1 branch
BranchTrueFalseTotal
if $self->hasEdgeId($edge->id) 0 6 6
877 6 $self->{'edges'}{$edge->id()} = $edge;
878 6 return;
879 }
880  
881 =head2 getEdges
882  
883 Returns an array of all Edges of this Document.
884  
885 =head3 EXAMPLE
886  
887 my @edges = $doc->getEdges();
888  
889 =cut
890  
891 1 ▶sub getEdges {
Subroutine getEdges: called CC=1 SCAR=0.0
Pod documented
892 1 return values %{$_[0]->{'edges'}};
893 }
894  
895 =head2 getEdgesByProperties
896  
897 Takes arguments of the form C<property1 =E<gt> value, property2 =E<gt> value2, ...>.
898  
899 Returns a list of all Edges that matches the given filter.
900  
901 =head3 EXAMPLE
902  
903 my @edges = $doc->getEdgesByProperties('tArrow' => 'standard');
904  
905 =cut
906  
907 0 ▶sub getEdgesByProperties {
Subroutine getEdgesByProperties: not called CC=3 SCAR=24.8
Pod documented
908 0 my ($self, @properties) = @_;
909 0 my @edges;
910 0 foreach my $edge ($self->getEdges()) {
911 0 ▶ push @edges, $edge if $edge->hasProperties(@properties);
Branch: 1 branch
BranchTrueFalseTotal
if $edge->hasProperties(@properties) 0 0 0
912 }
913 0 return @edges;
914 }
915  
916 =head2 hasEdgeId
917  
918 Takes an Edge's C<id> as parameter and returns true if it is present in this Document.
919  
920 =head3 EXAMPLE
921  
922 if ($doc->hasEdgeId('myid1')) { ...
923  
924 =cut
925  
926 14 ▶sub hasEdgeId {
Subroutine hasEdgeId: called CC=2 SCAR=7.1
Pod documented
927 14 my ($self, $id) = @_;
928 14 ▶ confess 'no id provided' unless (defined $id);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $id 0 14 14
929 14 return exists $self->{'edges'}{$id};
930 }
931  
932 =head2 getEdgeById
933  
934 Takes an C<id> as parameter and returns the Edge with this C<id>, if present in this Document.
935  
936 =head3 EXAMPLE
937  
938 my $edge = $doc->getEdgeById('myid1');
939  
940 =cut
941  
942 0 ▶sub getEdgeById {
Subroutine getEdgeById: not called CC=2 SCAR=17.9
Pod documented
943 0 my ($self, $id) = @_;
944 0 ▶ confess 'no id provided' unless (defined $id);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $id 0 0 0
945 0 return $self->{'edges'}{$id};
946 }
947  
948 =head2 removeEdge
949  
950 Takes a L<yEd::Edge> as parameter and tries to remove it from this document.
951  
952 =head3 EXAMPLE
953  
954 $doc->removeEdge($edge);
955  
956 =cut
957  
958 0 ▶sub removeEdge {
Subroutine removeEdge: not called CC=4 SCAR=30.0
Pod documented
959 0 my ($self, $edge) = @_;
960 0 ▶ confess 'no yEd::Edge provided' unless (defined $edge and $edge->isa('yEd::Edge'));
Branch: 1 branch
BranchTrueFalseTotal
unless defined $edge and $edge->isa("yEd::Edge") 0 0 0
Condition0%0/3
defined $edge and $edge->isa("yEd::Edge")
!ll&&!rl&&r
000
MC/DC0%0/2
defined $edge and $edge->isa("yEd::Edge")
defined $edge $edge->isa("yEd::Edge")
Truth table0%0/3
A and B
A= defined $edgeB= $edge->isa("yEd::Edge")
ABresult
0X0
100
111
961 0 ▶ if ($self->hasEdgeId($edge->id())) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->hasEdgeId($edge->id)) 0 0 0
962 0 $edge->_deregisterAll();
963 0 delete $self->{'edges'}{$edge->id()};
964 }
965 0 return;
966 }
967  
968 =head1 AUTHOR
969  
970 Heiko Finzel, C<< <heikofinzel at googlemail.com> >>
971  
972 =head1 BUGS
973  
974 Please report any bugs or feature requests to C<bug-yed-document at rt.cpan.org>, or through
975 the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=yEd-Document>. I will be notified, and then you'll
976 automatically be notified of progress on your bug as I make changes.
977  
978 =head1 SUPPORT
979  
980 You can find documentation for this module with the perldoc command.
981  
982 perldoc yEd::Document
983  
984 Also see perldoc of the other classes of this package.
985  
986 You can also look for information at:
987  
988 =over 4
989  
990 =item * RT: CPAN's request tracker (report bugs here)
991  
992 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=yEd-Document>
993  
994 =item * AnnoCPAN: Annotated CPAN documentation
995  
996 L<http://annocpan.org/dist/yEd-Document>
997  
998 =item * CPAN Ratings
999  
1000 L<http://cpanratings.perl.org/d/yEd-Document>
1001  
1002 =item * Search CPAN
1003  
1004 L<http://search.cpan.org/dist/yEd-Document/>
1005  
1006 =back
1007  
1008 =head1 LICENSE AND COPYRIGHT
1009  
1010 Copyright 2014 Heiko Finzel.
1011  
1012 This program is free software; you can redistribute it and/or modify it
1013 under the terms of the the Artistic License (2.0). You may obtain a
1014 copy of the full license at:
1015  
1016 L<http://www.perlfoundation.org/artistic_license_2_0>
1017  
1018 Any use, modification, and distribution of the Standard or Modified
1019 Versions is governed by this Artistic License. By using, modifying or
1020 distributing the Package, you accept this license. Do not use, modify,
1021 or distribute the Package, if you do not accept this license.
1022  
1023 If your Modified Version has been derived from a Modified Version made
1024 by someone other than you, you are nevertheless required to ensure that
1025 your Modified Version complies with the requirements of this license.
1026  
1027 This license does not grant you the right to use any trademark, service
1028 mark, tradename, or logo of the Copyright Holder.
1029  
1030 This license includes the non-exclusive, worldwide, free-of-charge
1031 patent license to make, have made, use, offer to sell, sell, import and
1032 otherwise transfer the Package with respect to any patent claims
1033 licensable by the Copyright Holder that are necessarily infringed by the
1034 Package. If you institute patent litigation (including a cross-claim or
1035 counterclaim) against any party alleging that the Package constitutes
1036 direct or contributory patent infringement, then this Artistic License
1037 to you shall terminate on the date that such litigation is filed.
1038  
1039 Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER
1040 AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
1041 THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
1042 PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY
1043 YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR
1044 CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR
1045 CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE,
1046 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1047  
1048 =cut
1049  
1050 3 1;
« Label/EdgeLabel.pm ↑ Summary Node/GenericNode.pm »