| 1 | package yEd::Node::ShapeNode; | ||||||||||||||||||||||||||||
| 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 base qw(yEd::Node); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | =head1 NAME | ||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | yEd::Node::ShapeNode - Basic shape node type | ||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | Use this class to create basic shape Nodes. | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | These are all the Nodes from yEd's "Shape Nodes" group. | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | Make sure to have a look at L<yEd::Node>, the properties and functions described there will not be repeated here. | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | =head1 SUPPORTED FEATURES | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | The ShapeNode type specific features are fully supported. | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | For basic Node type feature support and which node types are supported see L<yEd::Node>. | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | =head1 PROPERTIES | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | =head2 all properties from base class | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | L<yEd::Node> | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | =head2 shape | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | Type: descrete values ( roundrectangle | rectangle | ellipse | parallelogram | hexagon | triangle | rectangle3d | octagon | diamond | trapezoid | trapezoid2 ) | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | Default: 'roundrectangle' | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | The shape used for this node. | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | =head2 shadowColor | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | Type: '#0000fa' (rgb) or '#000000cc' (rgb + transparency) java.awt.Color hex form or 'none' | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | Default: '#b3a691' | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | The color of the Node's shadow. | ||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | =head2 shadowX | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | Type: 'float' | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | Default: 0 | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | The x offset of the Node's shadow. | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | =head2 shadowY | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | Type: 'float' | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | Default: 0 | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | The y offset of the Node's shadow. | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | =head1 SUBROUTINES/METHODS | ||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | =head2 all functions from base class | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | L<yEd::Node> | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | =cut | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | 3 | my $shapes = '^(?:roundrectangle|rectangle|ellipse|parallelogram|hexagon|triangle|rectangle3d|octagon|diamond|trapezoid|trapezoid2)$'; | |||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | 2 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 74 | 2 | my ($class, @args) = @_; | |||||||||||||||||||||||||||
| 75 | 2 | my $self = bless {}, $class; | |||||||||||||||||||||||||||
| 76 | 2 | return $self->_init(@args); | |||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | 2 | ▶ | sub _init { | ||||||||||||||||||||||||||
|
Subroutine
_init: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 80 | 2 | my ($self, @args) = @_; | |||||||||||||||||||||||||||
| 81 | 2 | $self->shape('roundrectangle'); | |||||||||||||||||||||||||||
| 82 | 2 | $self->shadowColor('#b3a691'); | |||||||||||||||||||||||||||
| 83 | 2 | $self->shadowX(0); | |||||||||||||||||||||||||||
| 84 | 2 | $self->shadowY(0); | |||||||||||||||||||||||||||
| 85 | 2 | $self->SUPER::_init(@args); | |||||||||||||||||||||||||||
| 86 | 2 | return $self; | |||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | 3 | ▶ | sub shape { | ||||||||||||||||||||||||||
|
Subroutine
shape: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 90 | 3 | return _PROPERTY($shapes, @_); | |||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | 2 | ▶ | sub shadowColor { | ||||||||||||||||||||||||||
|
Subroutine
shadowColor: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 94 | 2 | return _PROPERTY($match{'color'}, @_); | |||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | 3 | ▶ | sub shadowX { | ||||||||||||||||||||||||||
|
Subroutine
shadowX: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 98 | 3 | return _PROPERTY($match{'float'}, @_); | |||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | 3 | ▶ | sub shadowY { | ||||||||||||||||||||||||||
|
Subroutine
shadowY: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 102 | 3 | return _PROPERTY($match{'float'}, @_); | |||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||
| 105 | 1 | ▶ | sub _addTypeNode { | ||||||||||||||||||||||||||
|
Subroutine
_addTypeNode: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 106 | 1 | my ($self, $node) = @_; | |||||||||||||||||||||||||||
| 107 | 1 | return $node->addNewChild('', 'y:ShapeNode'); | |||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||
| 109 | 1 | ▶ | sub _addAdditionalNodes { | ||||||||||||||||||||||||||
|
Subroutine
_addAdditionalNodes: called CC=3 SCAR=14.8
| |||||||||||||||||||||||||||||
| 110 | 1 | my ($self, $node) = @_; | |||||||||||||||||||||||||||
| 111 | 1 | my $shape = $node->addNewChild('', 'y:Shape'); | |||||||||||||||||||||||||||
| 112 | 1 | $shape->setAttribute('type', $self->shape()); | |||||||||||||||||||||||||||
| 113 | 1 | ▶ | if ($self->shadowX() != 0 or $self->shadowY() != 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->shadowX != 0 or $self->shadowY != 0
MC/DC0%0/2
$self->shadowX != 0 or $self->shadowY != 0
$self->shadowX != 0
$self->shadowY != 0
Truth table33%1/3
A or B
A= $self->shadowX != 0B= $self->shadowY != 0
| |||||||||||||||||||||||||||||
| 114 | 0 | my $shadow = $node->addNewChild('', 'y:DropShadow'); | |||||||||||||||||||||||||||
| 115 | 0 | $shadow->setAttribute('color', $self->shadowColor()); | |||||||||||||||||||||||||||
| 116 | 0 | $shadow->setAttribute('offsetX', $self->shadowX()); | |||||||||||||||||||||||||||
| 117 | 0 | $shadow->setAttribute('offsetY', $self->shadowY()); | |||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||
| 121 | =head1 SEE ALSO | ||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||
| 123 | L<yEd::Document> for further informations about the whole package | ||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||
| 125 | L<yEd::PropertyBasedObject> for further basic information about properties and their additional functions | ||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||
| 127 | L<yEd::Node> for information about the Node base class and which other Node types are currently supported | ||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||
| 129 | =cut | ||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||
| 131 | 3 | 1; | |||||||||||||||||||||||||||