| 1 | package yEd::Node; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 3 | ▶ | use yEd::PropertyBasedObject; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 3 | ▶ | use yEd::Label::NodeLabel; | ||||||||||||||||||||||||||
|
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 | |||||||||||||||||||||||||||||
| 9 | =head1 NAME | ||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | yEd::Node - Base class for Nodes | ||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | This is the base class for Nodes. | ||||||||||||||||||||||||||||
| 16 | It may not be instanciated, instead use one of the specialized types as described in the L</SUPPORTED FEATURES> section. | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | Have a look at the C<addNewNode()> function of L<yEd::Document>, it is the preferred way to create Nodes. | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | For saving Node templates see L<yEd::Document>'s C<addNewNodeTemplate()>, C<addTemplateNode()> and the related functions. | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | =head1 SUPPORTED FEATURES | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | The following Node types are currently supported: | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | =over 4 | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | =item * | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | L<yEd::Node::ShapeNode> basic shape type nodes | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | =item * | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | L<yEd::Node::GenericNode> see link for a list of which Nodes of yEd actually are GenericNodes | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | =back | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | The following types and features are currently not supported (and it's not sure they'll ever be): | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | =over 4 | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | =item * | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | Group/Folder type Nodes (e.g. group 'Group Nodes') | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | =item * | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | Table type Nodes (e.g. group "Swimlane Nodes and Tables") | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | =item * | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | SVG type Nodes (e.g. group "People") | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | =item * | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | Adding meta data to Nodes or edit the present ones (e.g. URL, description) | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | =back | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | All other basic features of Nodes (yEd Version 3.13) are supported. | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | Support beyond yEd: | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | =over 4 | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | =item * | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | You may specify Nodes to be relative to other Nodes (see C<relative> property) | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | =item * | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | You may add multiple Labels to a single Node (yEd will handle it properly) | ||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | =back | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | =head1 PROPERTIES | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | =head2 layer | ||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | Type: uint | ||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | Default: 0 | ||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | The drawing pane layer this Node is on. | ||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | See L<yEd::Document> for details about using layers. | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | =head2 relative | ||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | Type: yEd::Node or 0 to erase relation | ||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | Default: 0 | ||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | If a Node reference is set here, this Nodes x and y properties will be interpreted as being relative to the given Node. | ||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | See L<yEd::Document> for details about relative objects. | ||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||
| 98 | =head2 id | ||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | This property is read only and returns the Nodes ID. | ||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | See L<yEd::Document> for details about object identifiers. | ||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | =head2 x | ||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | Type: float | ||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | Default: 0 | ||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||
| 110 | The x position (upper left corner). | ||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||
| 112 | =head2 y | ||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | Type: float | ||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||
| 116 | Default: 0 | ||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||
| 118 | The y position (upper left corner). | ||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | =head2 height | ||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||
| 122 | Type: ufloat | ||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||
| 124 | Default: 30 | ||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | The height of the Node. | ||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||
| 128 | =head2 width | ||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||
| 130 | Type: ufloat | ||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||
| 132 | Default: 30 | ||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||
| 134 | The width of the Node. | ||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||
| 136 | =head2 fillColor | ||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||
| 138 | Type: '#0000fa' (rgb) or '#000000cc' (rgb + transparency) java.awt.Color hex form or 'none' | ||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||
| 140 | Default: '#ffcc00' | ||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||
| 142 | The background color. | ||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||
| 144 | =head2 fillColor2 | ||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||
| 146 | Type: '#0000fa' (rgb) or '#000000cc' (rgb + transparency) java.awt.Color hex form or 'none' | ||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||
| 148 | Default: 'none' | ||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||
| 150 | The second background color (will be ignored if fillColor is 'none'). | ||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||
| 152 | =head2 borderColor | ||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||
| 154 | Type: '#0000fa' (rgb) or '#000000cc' (rgb + transparency) java.awt.Color hex form or 'none' | ||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||
| 156 | Default: '#000000' | ||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||
| 158 | The color for the border line. | ||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||
| 160 | =head2 borderType | ||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||
| 162 | Type: descrete values ( line | dotted | dashed | dashed_dotted ) | ||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||
| 164 | Default: 'line' | ||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||
| 166 | Linetype of the border. | ||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||
| 168 | =head2 borderWidth | ||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||
| 170 | Type: ufloat | ||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||
| 172 | Default: 1 | ||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||
| 174 | The width of the border. | ||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||
| 176 | =head1 SUBROUTINES/METHODS | ||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||
| 178 | =head2 new | ||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||
| 180 | Creates a new instance of a Node. | ||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||
| 182 | An ID must be provided as first parameter. | ||||||||||||||||||||||||||||
| 183 | This value may be any string or number but must be unique among the whole L<yEd::Document>. | ||||||||||||||||||||||||||||
| 184 | If you don't want to bother with IDs use the C<addNewNode()> function of L<yEd::Document> instead, it will take care of the IDs. | ||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||
| 186 | Further parameters to set properties are optional (C<property1 =E<gt> value, property2 =E<gt> value2, ...>). | ||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||
| 188 | =head3 EXAMPLE | ||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||
| 190 | my $node = yEd::Node::GenericNode->new('myid1', 'x' => 500, 'y' => -33.7); | ||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||
| 192 | =cut | ||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||
| 194 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 195 | 0 | confess 'you may not instantiate a yEd::Node base class object'; | |||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||
| 198 | =head2 copy | ||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||
| 200 | Creates a copy of this Node and returns it. | ||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||
| 202 | Also copies all attached Labels. | ||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||
| 204 | An ID must be given as first parameter as described in the Node classes constructors, it will be applied to the copy. | ||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||
| 206 | You may optionally specify properties in the form C<property1 =E<gt> value, property2 =E<gt> value2, ...> to change these properties for the returned copy. | ||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||
| 208 | If this Node is relative to another one you may want to set a new relation partner for the copy, change its relative position or make it absolute. | ||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||
| 210 | =head3 EXAMPLE | ||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||
| 212 | my $node2 = $node->copy('id2', 'x' => 89.5, 'y' => -33.7); | ||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||
| 214 | =cut | ||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||
| 216 | 0 | ▶ | sub copy { | ||||||||||||||||||||||||||
|
Subroutine
copy: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 217 | 0 | my ($self, $id, @p) = @_; | |||||||||||||||||||||||||||
| 218 | 0 | my $ref = ref $self; | |||||||||||||||||||||||||||
| 219 | 0 | my $o = $ref->new($id); | |||||||||||||||||||||||||||
| 220 | 0 | $o->setProperties($self->getProperties()); | |||||||||||||||||||||||||||
| 221 | 0 | $o->setProperties(@p); | |||||||||||||||||||||||||||
| 222 | 0 | foreach my $l ($self->labels()) { | |||||||||||||||||||||||||||
| 223 | 0 | $o->addLabel($l->copy()); | |||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||
| 225 | 0 | return $o; | |||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||
| 228 | 3 | ▶ | sub _init { | ||||||||||||||||||||||||||
|
Subroutine
_init: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 229 | 3 | my ($self, $id, @properties) = @_; | |||||||||||||||||||||||||||
| 230 | 3 | ▶ | confess 'node id missing for node creation' unless (defined $id); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 231 | 3 | $self->{'properties'}{'id'} = $id; | |||||||||||||||||||||||||||
| 232 | 3 | $self->{'datakeys'} = [ 'd4', 'd5' ]; | |||||||||||||||||||||||||||
| 233 | 3 | $self->{'rootkey'} = 'd6'; | |||||||||||||||||||||||||||
| 234 | # defaults | ||||||||||||||||||||||||||||
| 235 | 3 | $self->relative(0); | |||||||||||||||||||||||||||
| 236 | 3 | $self->x(0); | |||||||||||||||||||||||||||
| 237 | 3 | $self->y(0); | |||||||||||||||||||||||||||
| 238 | 3 | $self->height(30); | |||||||||||||||||||||||||||
| 239 | 3 | $self->width(30); | |||||||||||||||||||||||||||
| 240 | 3 | $self->fillColor('#ffcc00'); | |||||||||||||||||||||||||||
| 241 | 3 | $self->fillColor2('none'); | |||||||||||||||||||||||||||
| 242 | 3 | $self->borderColor('#000000'); | |||||||||||||||||||||||||||
| 243 | 3 | $self->borderType('line'); | |||||||||||||||||||||||||||
| 244 | 3 | $self->borderWidth(1); | |||||||||||||||||||||||||||
| 245 | 3 | $self->clearLabels(); | |||||||||||||||||||||||||||
| 246 | 3 | $self->layer(0); | |||||||||||||||||||||||||||
| 247 | 3 | $self->{'edges'} = {}; | |||||||||||||||||||||||||||
| 248 | # user values | ||||||||||||||||||||||||||||
| 249 | 3 | $self->setProperties(@properties); | |||||||||||||||||||||||||||
| 250 | 3 | return $self; | |||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||
| 253 | # "virtual" properties | ||||||||||||||||||||||||||||
| 254 | 9 | ▶ | sub layer { | ||||||||||||||||||||||||||
|
Subroutine
layer: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 255 | 9 | return _PROPERTY($match{'uint'}, @_); | |||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||
| 257 | 3 | ▶ | sub _checkloop { | ||||||||||||||||||||||||||
|
Subroutine
_checkloop: called CC=3 SCAR=11.2
| |||||||||||||||||||||||||||||
| 258 | 3 | my $self = shift; | |||||||||||||||||||||||||||
| 259 | 3 | my $node = $self; | |||||||||||||||||||||||||||
| 260 | 3 | my $count = 0; | |||||||||||||||||||||||||||
| 261 | 3 | ▶ | do { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 262 | 3 | $node = $node->relative(); | |||||||||||||||||||||||||||
| 263 | 3 | $count++; | |||||||||||||||||||||||||||
| 264 | 3 | ▶ | confess "loop detected: relative node $self (id: " . $self->id() . ") found itself $count nodes later in hierarchy" if ($node == $self); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 265 | } while ($node); | ||||||||||||||||||||||||||||
| 266 | } | ||||||||||||||||||||||||||||
| 267 | 24 | ▶ | sub relative { | ||||||||||||||||||||||||||
|
Subroutine
relative: called CC=6 SCAR=19.2
Pod
documented
| |||||||||||||||||||||||||||||
| 268 | 24 | my ($self, $value) = @_; | |||||||||||||||||||||||||||
| 269 | 24 | my $key = 'relative'; | |||||||||||||||||||||||||||
| 270 | 24 | ▶ | if (defined $value) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 271 | 3 | ▶ | confess "value must be a yEd::Node (or one of its subtypes) (given value: $value)" unless ($value == 0 or $value->isa('yEd::Node')); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$value == 0 or $value->isa("yEd::Node")
MC/DC0%0/2
$value == 0 or $value->isa("yEd::Node")
$value == 0
$value->isa("yEd::Node")
Truth table33%1/3
A or B
A= $value == 0B= $value->isa("yEd::Node")
| |||||||||||||||||||||||||||||
| 272 | 3 | ▶ | confess "Did you really think making a Node relative to itself would be a good idea?" if ($value and $value == $self); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$value and $value == $self
MC/DC0%0/2
$value and $value == $self
$value
$value == $self
Truth table33%1/3
A and B
A= $valueB= $value == $self
| |||||||||||||||||||||||||||||
| 273 | 3 | $self->{'properties'}{$key} = $value; | |||||||||||||||||||||||||||
| 274 | 3 | $self->_checkloop(); | |||||||||||||||||||||||||||
| 275 | 3 | return; | |||||||||||||||||||||||||||
| 276 | } else { | ||||||||||||||||||||||||||||
| 277 | 21 | return $self->{'properties'}{$key}; | |||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||
| 279 | } | ||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||
| 281 | # node | ||||||||||||||||||||||||||||
| 282 | 24 | ▶ | sub id { | ||||||||||||||||||||||||||
|
Subroutine
id: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 283 | 24 | return _PROPERTY('ro', @_); | |||||||||||||||||||||||||||
| 284 | } | ||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||
| 286 | 12 | ▶ | sub _registerEdge { | ||||||||||||||||||||||||||
|
Subroutine
_registerEdge: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||
| 287 | 12 | my ($self, $edge) = @_; | |||||||||||||||||||||||||||
| 288 | 12 | ▶ | if ($edge->isa('yEd::Edge')) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 289 | 12 | $self->{'edges'}{$edge}{'count'}++; | |||||||||||||||||||||||||||
| 290 | 12 | $self->{'edges'}{$edge}{'ref'} = $edge; | |||||||||||||||||||||||||||
| 291 | } | ||||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||
| 293 | 0 | ▶ | sub _deregisterEdge { | ||||||||||||||||||||||||||
|
Subroutine
_deregisterEdge: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 294 | 0 | my ($self, $edge) = @_; | |||||||||||||||||||||||||||
| 295 | 0 | ▶ | if ($edge->isa('yEd::Edge')) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 296 | 0 | $self->{'edges'}{$edge}{'count'}--; | |||||||||||||||||||||||||||
| 297 | 0 | ▶ | delete $self->{'edges'}{$edge} unless ($self->{'edges'}{$edge}{'count'}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 298 | } | ||||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||
| 301 | =head2 absX | ||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||
| 303 | Returns the absolute x value for this Node which equals C<$node-E<gt>x()> unless C<$node-E<gt>relative($node2)> was set. | ||||||||||||||||||||||||||||
| 304 | In this case C<$node-E<gt>absX()> is C<$node2-E<gt>absX()> + C<$node-E<gt>x()>. | ||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||
| 306 | =head3 EXAMPLE | ||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||
| 308 | # before you do $node->relative(0) you may want to make coords absolute: | ||||||||||||||||||||||||||||
| 309 | $node->x($node->absX()); | ||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||
| 311 | =cut | ||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||
| 313 | 8 | ▶ | sub absX { | ||||||||||||||||||||||||||
|
Subroutine
absX: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||
| 314 | 8 | my $self = shift; | |||||||||||||||||||||||||||
| 315 | 8 | my $x = $self->x(); | |||||||||||||||||||||||||||
| 316 | 8 | ▶ | $x += $self->relative()->absX() if ($self->relative()); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 317 | 8 | return $x; | |||||||||||||||||||||||||||
| 318 | } | ||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||
| 320 | =head2 absY | ||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||
| 322 | Returns the absolute y value for this Node which equals C<$node-E<gt>y()> unless C<$node-E<gt>relative($node2)> was set. | ||||||||||||||||||||||||||||
| 323 | In this case C<$node-E<gt>absY()> is C<$node2-E<gt>absY()> + C<$node-E<gt>y()>. | ||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||
| 325 | =head3 EXAMPLE | ||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||
| 327 | # before you do $node->relative(0) you may want to make coords absolute: | ||||||||||||||||||||||||||||
| 328 | $node->y($node->absY()); | ||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||
| 330 | =cut | ||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||
| 332 | 8 | ▶ | sub absY { | ||||||||||||||||||||||||||
|
Subroutine
absY: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||
| 333 | 8 | my $self = shift; | |||||||||||||||||||||||||||
| 334 | 8 | my $y = $self->y(); | |||||||||||||||||||||||||||
| 335 | 8 | ▶ | $y += $self->relative()->absY() if ($self->relative()); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 336 | 8 | return $y; | |||||||||||||||||||||||||||
| 337 | } | ||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||
| 339 | =head2 absCenter | ||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||
| 341 | Returns the absolute (x,y) values for this Node's center (as an array of 2 elements). | ||||||||||||||||||||||||||||
| 342 | Note that normal coords indicate the upper left corner of a Node. | ||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||
| 344 | =head3 EXAMPLE | ||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||
| 346 | my ($xc, $yc) = $node->absCenter(); | ||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||
| 348 | =cut | ||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||
| 350 | 6 | ▶ | sub absCenter { | ||||||||||||||||||||||||||
|
Subroutine
absCenter: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 351 | 6 | my $self = shift; | |||||||||||||||||||||||||||
| 352 | return ( | ||||||||||||||||||||||||||||
| 353 | 6 | $self->absX() + 0.5 * $self->width(), | |||||||||||||||||||||||||||
| 354 | $self->absY() + 0.5 * $self->height() | ||||||||||||||||||||||||||||
| 355 | ); | ||||||||||||||||||||||||||||
| 356 | } | ||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||
| 358 | =head2 getEdges | ||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||
| 360 | Returns an array of all Edges connected to this Node. | ||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||
| 362 | =head3 EXAMPLE | ||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||
| 364 | foreach my $edge ($node->getEdges()) { ... | ||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||
| 366 | =cut | ||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||
| 368 | 0 | ▶ | sub getEdges { | ||||||||||||||||||||||||||
|
Subroutine
getEdges: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 369 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 370 | 0 | my @edges; | |||||||||||||||||||||||||||
| 371 | 0 | foreach my $edge (keys %{$self->{'edges'}}) { | |||||||||||||||||||||||||||
| 372 | 0 | push @edges, $self->{'edges'}{$edge}{'ref'}; | |||||||||||||||||||||||||||
| 373 | } | ||||||||||||||||||||||||||||
| 374 | 0 | return @edges; | |||||||||||||||||||||||||||
| 375 | } | ||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||
| 377 | # Labels | ||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||
| 379 | =head2 addNewLabel | ||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||
| 381 | Takes a value for the C<text> property of Labels followed by optional Label properties (C<property1 =E<gt> value, property2 =E<gt> value2, ...>) and creates and adds a new Label from it. | ||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||
| 383 | Returns a ref to the Label object. | ||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||
| 385 | =head3 EXAMPLE | ||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||
| 387 | my $label = $node->addNewLabel('hello world', 'alignment' => 'left'); | ||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||
| 389 | =cut | ||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||
| 391 | 1 | ▶ | sub addNewLabel { | ||||||||||||||||||||||||||
|
Subroutine
addNewLabel: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 392 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 393 | 1 | my $label = yEd::Label::NodeLabel->new(@_); | |||||||||||||||||||||||||||
| 394 | 1 | $self->addLabel($label); | |||||||||||||||||||||||||||
| 395 | 1 | return $label; | |||||||||||||||||||||||||||
| 396 | } | ||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||
| 398 | =head2 addLabel | ||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||
| 400 | Takes a L<yEd::Label::NodeLabel> object and adds it. | ||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||
| 402 | =head3 EXAMPLE | ||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||
| 404 | $node->addLabel($label); | ||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||
| 406 | =cut | ||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||
| 408 | 1 | ▶ | sub addLabel { | ||||||||||||||||||||||||||
|
Subroutine
addLabel: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||
| 409 | 1 | my ($self, $label) = @_; | |||||||||||||||||||||||||||
| 410 | 1 | ▶ | confess "only yEd::Label::NodeLabel's can be added" unless ($label->isa('yEd::Label::NodeLabel')); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 411 | 1 | push @{$self->{'labels'}}, $label; | |||||||||||||||||||||||||||
| 412 | 1 | return; | |||||||||||||||||||||||||||
| 413 | } | ||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||
| 415 | =head2 labels | ||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||
| 417 | Acts as a getter with no parameters provided and returns an array of all Labels attached to this Node. | ||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||
| 419 | If an array of NodeLabel objects is provided, this Node's Labels are replaced by the given Labels. | ||||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||
| 421 | =head3 EXAMPLE | ||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||
| 423 | # this will make a copy of the array but not the Labels itself | ||||||||||||||||||||||||||||
| 424 | $node->labels($node2->labels()); | ||||||||||||||||||||||||||||
| 425 | # if you want a copy rather than shared refs use Label's copy() function: | ||||||||||||||||||||||||||||
| 426 | $node->clearLabels(); # if there may be any | ||||||||||||||||||||||||||||
| 427 | foreach my $l ($node2->labels()) { | ||||||||||||||||||||||||||||
| 428 | $node->addLabel($l->copy()); | ||||||||||||||||||||||||||||
| 429 | } | ||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||
| 431 | =cut | ||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||
| 433 | 2 | ▶ | sub labels { | ||||||||||||||||||||||||||
|
Subroutine
labels: called CC=4 SCAR=19.7
Pod
documented
| |||||||||||||||||||||||||||||
| 434 | 2 | my ($self, @labels) = @_; | |||||||||||||||||||||||||||
| 435 | 2 | ▶ | if (@labels) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 436 | 0 | foreach my $label (@labels) { | |||||||||||||||||||||||||||
| 437 | 0 | ▶ | confess "only yEd::Label::NodeLabel's can be added" unless ($label->isa('yEd::Label::NodeLabel')); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 438 | } | ||||||||||||||||||||||||||||
| 439 | 0 | $self->{'labels'} = \@labels; | |||||||||||||||||||||||||||
| 440 | 0 | return; | |||||||||||||||||||||||||||
| 441 | } else { | ||||||||||||||||||||||||||||
| 442 | 2 | return @{$self->{'labels'}}; | |||||||||||||||||||||||||||
| 443 | } | ||||||||||||||||||||||||||||
| 444 | } | ||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||
| 446 | =head2 clearLabels | ||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||
| 448 | Removes all Labels from this Node. | ||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||
| 450 | =head3 EXAMPLE | ||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||
| 452 | $node->clearLabels(); | ||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||
| 454 | =cut | ||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||
| 456 | 3 | ▶ | sub clearLabels { | ||||||||||||||||||||||||||
|
Subroutine
clearLabels: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 457 | 3 | $_[0]->{'labels'} = []; | |||||||||||||||||||||||||||
| 458 | 3 | return; | |||||||||||||||||||||||||||
| 459 | } | ||||||||||||||||||||||||||||
| 460 | |||||||||||||||||||||||||||||
| 461 | =head2 getLabelsByProperties | ||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||
| 463 | Takes arguments of the form C<property1 =E<gt> value, property2 =E<gt> value2, ...>. | ||||||||||||||||||||||||||||
| 464 | |||||||||||||||||||||||||||||
| 465 | Returns a list of all Labels that matches the given filter. | ||||||||||||||||||||||||||||
| 466 | |||||||||||||||||||||||||||||
| 467 | =head3 EXAMPLE | ||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||
| 469 | my @bigfatlabels = $node->getLabelsByProperties('fontSize' => 20, 'fontStyle' => 'bold'); | ||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||
| 471 | =cut | ||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||
| 473 | 0 | ▶ | sub getLabelsByProperties { | ||||||||||||||||||||||||||
|
Subroutine
getLabelsByProperties: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 474 | 0 | my ($self, @properties) = @_; | |||||||||||||||||||||||||||
| 475 | 0 | my @labels; | |||||||||||||||||||||||||||
| 476 | 0 | foreach my $label ($self->labels()) { | |||||||||||||||||||||||||||
| 477 | 0 | ▶ | push @labels, $label if $label->hasProperties(@properties); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 478 | } | ||||||||||||||||||||||||||||
| 479 | 0 | return @labels; | |||||||||||||||||||||||||||
| 480 | } | ||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||
| 482 | # Geometry | ||||||||||||||||||||||||||||
| 483 | 11 | ▶ | sub x { | ||||||||||||||||||||||||||
|
Subroutine
x: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 484 | 11 | return _PROPERTY($match{'float'}, @_); | |||||||||||||||||||||||||||
| 485 | } | ||||||||||||||||||||||||||||
| 486 | 11 | ▶ | sub y { | ||||||||||||||||||||||||||
|
Subroutine
y: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 487 | 11 | return _PROPERTY($match{'float'}, @_); | |||||||||||||||||||||||||||
| 488 | } | ||||||||||||||||||||||||||||
| 489 | 11 | ▶ | sub height { | ||||||||||||||||||||||||||
|
Subroutine
height: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 490 | 11 | return _PROPERTY($match{'ufloat'}, @_); | |||||||||||||||||||||||||||
| 491 | } | ||||||||||||||||||||||||||||
| 492 | 11 | ▶ | sub width { | ||||||||||||||||||||||||||
|
Subroutine
width: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 493 | 11 | return _PROPERTY($match{'ufloat'}, @_); | |||||||||||||||||||||||||||
| 494 | } | ||||||||||||||||||||||||||||
| 495 | |||||||||||||||||||||||||||||
| 496 | # Fill | ||||||||||||||||||||||||||||
| 497 | 7 | ▶ | sub fillColor { | ||||||||||||||||||||||||||
|
Subroutine
fillColor: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 498 | 7 | return _PROPERTY($match{'color'}, @_); | |||||||||||||||||||||||||||
| 499 | } | ||||||||||||||||||||||||||||
| 500 | 5 | ▶ | sub fillColor2 { | ||||||||||||||||||||||||||
|
Subroutine
fillColor2: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 501 | 5 | return _PROPERTY($match{'color'}, @_); | |||||||||||||||||||||||||||
| 502 | } | ||||||||||||||||||||||||||||
| 503 | |||||||||||||||||||||||||||||
| 504 | # BorderStyle | ||||||||||||||||||||||||||||
| 505 | 7 | ▶ | sub borderColor { | ||||||||||||||||||||||||||
|
Subroutine
borderColor: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 506 | 7 | return _PROPERTY($match{'color'}, @_); | |||||||||||||||||||||||||||
| 507 | } | ||||||||||||||||||||||||||||
| 508 | 5 | ▶ | sub borderType { | ||||||||||||||||||||||||||
|
Subroutine
borderType: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 509 | 5 | return _PROPERTY($match{'linetype'}, @_); | |||||||||||||||||||||||||||
| 510 | } | ||||||||||||||||||||||||||||
| 511 | 5 | ▶ | sub borderWidth { | ||||||||||||||||||||||||||
|
Subroutine
borderWidth: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 512 | 5 | return _PROPERTY($match{'ufloat'}, @_); | |||||||||||||||||||||||||||
| 513 | } | ||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||
| 515 | 2 | ▶ | sub _build { | ||||||||||||||||||||||||||
|
Subroutine
_build: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 516 | 2 | my $self = shift; | |||||||||||||||||||||||||||
| 517 | 2 | my $node = $self->_createNodeNode(); | |||||||||||||||||||||||||||
| 518 | 2 | my $root = $self->_addRootNode($node); | |||||||||||||||||||||||||||
| 519 | 2 | my $type = $self->_addTypeNode($root); | |||||||||||||||||||||||||||
| 520 | 2 | $self->_addGeometryNode($type); | |||||||||||||||||||||||||||
| 521 | 2 | $self->_addFillNode($type); | |||||||||||||||||||||||||||
| 522 | 2 | $self->_addBorderNode($type); | |||||||||||||||||||||||||||
| 523 | 2 | $self->_addLabelsNode($type); | |||||||||||||||||||||||||||
| 524 | 2 | $self->_addAdditionalNodes($type); | |||||||||||||||||||||||||||
| 525 | 2 | return $node; | |||||||||||||||||||||||||||
| 526 | } | ||||||||||||||||||||||||||||
| 527 | 2 | ▶ | sub _createNodeNode { | ||||||||||||||||||||||||||
|
Subroutine
_createNodeNode: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 528 | 2 | my $self = shift; | |||||||||||||||||||||||||||
| 529 | 2 | my $node = XML::LibXML::Element->new('node'); | |||||||||||||||||||||||||||
| 530 | 2 | $node->setAttribute('id', $self->id()); | |||||||||||||||||||||||||||
| 531 | 2 | foreach my $dk (@{$self->{'datakeys'}}) { | |||||||||||||||||||||||||||
| 532 | 4 | $node->addNewChild('', 'data')->setAttribute('key', $dk); | |||||||||||||||||||||||||||
| 533 | } | ||||||||||||||||||||||||||||
| 534 | 2 | return $node; | |||||||||||||||||||||||||||
| 535 | } | ||||||||||||||||||||||||||||
| 536 | 2 | ▶ | sub _addRootNode { | ||||||||||||||||||||||||||
|
Subroutine
_addRootNode: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 537 | 2 | my ($self, $node) = @_; | |||||||||||||||||||||||||||
| 538 | 2 | my $root = $node->addNewChild('', 'data'); | |||||||||||||||||||||||||||
| 539 | 2 | $root->setAttribute('key', $self->{'rootkey'}); | |||||||||||||||||||||||||||
| 540 | 2 | return $root; | |||||||||||||||||||||||||||
| 541 | } | ||||||||||||||||||||||||||||
| 542 | 0 | ▶ | sub _addTypeNode { | ||||||||||||||||||||||||||
|
Subroutine
_addTypeNode: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 543 | # add type node here and return it (e.g. <y:ShapeNode>) | ||||||||||||||||||||||||||||
| 544 | 0 | confess 'you may not build a yEd::Node base class object, override this method in a specialized subclass'; | |||||||||||||||||||||||||||
| 545 | } | ||||||||||||||||||||||||||||
| 546 | 2 | ▶ | sub _addGeometryNode { | ||||||||||||||||||||||||||
|
Subroutine
_addGeometryNode: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 547 | 2 | my ($self, $node) = @_; | |||||||||||||||||||||||||||
| 548 | 2 | my $geo = $node->addNewChild('', 'y:Geometry'); | |||||||||||||||||||||||||||
| 549 | 2 | $geo->setAttribute('height', $self->height()); | |||||||||||||||||||||||||||
| 550 | 2 | $geo->setAttribute('width', $self->width()); | |||||||||||||||||||||||||||
| 551 | 2 | $geo->setAttribute('x', $self->absX()); | |||||||||||||||||||||||||||
| 552 | 2 | $geo->setAttribute('y', $self->absY()); | |||||||||||||||||||||||||||
| 553 | } | ||||||||||||||||||||||||||||
| 554 | 2 | ▶ | sub _addFillNode { | ||||||||||||||||||||||||||
|
Subroutine
_addFillNode: called CC=3 SCAR=11.6
| |||||||||||||||||||||||||||||
| 555 | 2 | my ($self, $node) = @_; | |||||||||||||||||||||||||||
| 556 | 2 | my $fill = $node->addNewChild('', 'y:Fill'); | |||||||||||||||||||||||||||
| 557 | 2 | ▶ | if ($self->fillColor() eq 'none') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 558 | 0 | $fill->setAttribute('hasColor', 'false'); | |||||||||||||||||||||||||||
| 559 | } else { | ||||||||||||||||||||||||||||
| 560 | 2 | $fill->setAttribute('color', $self->fillColor()); | |||||||||||||||||||||||||||
| 561 | 2 | ▶ | $fill->setAttribute('color2', $self->fillColor2()) unless ($self->fillColor2() eq 'none'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 562 | } | ||||||||||||||||||||||||||||
| 563 | 2 | $fill->setAttribute('transparent', 'false'); | |||||||||||||||||||||||||||
| 564 | } | ||||||||||||||||||||||||||||
| 565 | 2 | ▶ | sub _addBorderNode { | ||||||||||||||||||||||||||
|
Subroutine
_addBorderNode: called CC=2 SCAR=7.1
| |||||||||||||||||||||||||||||
| 566 | 2 | my ($self, $node) = @_; | |||||||||||||||||||||||||||
| 567 | 2 | my $border = $node->addNewChild('', 'y:BorderStyle'); | |||||||||||||||||||||||||||
| 568 | 2 | ▶ | if ($self->borderColor() eq 'none') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 569 | 0 | $border->setAttribute('hasColor', 'false'); | |||||||||||||||||||||||||||
| 570 | } else { | ||||||||||||||||||||||||||||
| 571 | 2 | $border->setAttribute('color', $self->borderColor()); | |||||||||||||||||||||||||||
| 572 | } | ||||||||||||||||||||||||||||
| 573 | 2 | $border->setAttribute('type', $self->borderType()); | |||||||||||||||||||||||||||
| 574 | 2 | $border->setAttribute('width', $self->borderWidth()); | |||||||||||||||||||||||||||
| 575 | } | ||||||||||||||||||||||||||||
| 576 | 2 | ▶ | sub _addLabelsNode { | ||||||||||||||||||||||||||
|
Subroutine
_addLabelsNode: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 577 | 2 | my ($self, $node) = @_; | |||||||||||||||||||||||||||
| 578 | 2 | foreach my $label ($self->labels()) { | |||||||||||||||||||||||||||
| 579 | 1 | $node->addChild($label->_build()); | |||||||||||||||||||||||||||
| 580 | } | ||||||||||||||||||||||||||||
| 581 | } | ||||||||||||||||||||||||||||
| 582 | 0 | ▶ | sub _addAdditionalNodes { | ||||||||||||||||||||||||||
|
Subroutine
_addAdditionalNodes: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 583 | # add type specific data here (e.g. <y:Shape ...) | ||||||||||||||||||||||||||||
| 584 | } | ||||||||||||||||||||||||||||
| 585 | |||||||||||||||||||||||||||||
| 586 | =head2 setProperties getProperties hasProperties | ||||||||||||||||||||||||||||
| 587 | |||||||||||||||||||||||||||||
| 588 | As described at L<yEd::PropertyBasedObject> | ||||||||||||||||||||||||||||
| 589 | |||||||||||||||||||||||||||||
| 590 | =head1 SEE ALSO | ||||||||||||||||||||||||||||
| 591 | |||||||||||||||||||||||||||||
| 592 | L<yEd::Document> for further informations about the whole package | ||||||||||||||||||||||||||||
| 593 | |||||||||||||||||||||||||||||
| 594 | L<yEd::PropertyBasedObject> for further basic information about properties and their additional functions | ||||||||||||||||||||||||||||
| 595 | |||||||||||||||||||||||||||||
| 596 | The specialized Nodes: | ||||||||||||||||||||||||||||
| 597 | |||||||||||||||||||||||||||||
| 598 | L<yEd::Node::ShapeNode> | ||||||||||||||||||||||||||||
| 599 | |||||||||||||||||||||||||||||
| 600 | L<yEd::Node::GenericNode> | ||||||||||||||||||||||||||||
| 601 | |||||||||||||||||||||||||||||
| 602 | =cut | ||||||||||||||||||||||||||||
| 603 | |||||||||||||||||||||||||||||
| 604 | 3 | 1; | |||||||||||||||||||||||||||