| 1 | package yEd::Node::ShapeNode; | ||
| 2 | |||
| 3 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use yEd::PropertyBasedObject; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 1 | ▶ | use base qw(yEd::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 | my $shapes = '^(?:roundrectangle|rectangle|ellipse|parallelogram|hexagon|triangle|rectangle3d|octagon|diamond|trapezoid|trapezoid2)$'; | ||
| 72 | |||
| 73 | sub new { | ||
| 74 | my ($class, @args) = @_; | ||
| 75 | my $self = bless {}, $class; | ||
| 76 | return $self->_init(@args); | ||
| 77 | } | ||
| 78 | |||
| 79 | sub _init { | ||
| 80 | my ($self, @args) = @_; | ||
| 81 | $self->shape('roundrectangle'); | ||
| 82 | $self->shadowColor('#b3a691'); | ||
| 83 | $self->shadowX(0); | ||
| 84 | $self->shadowY(0); | ||
| 85 | $self->SUPER::_init(@args); | ||
| 86 | return $self; | ||
| 87 | } | ||
| 88 | |||
| 89 | sub shape { | ||
| 90 | return _PROPERTY($shapes, @_); | ||
| 91 | } | ||
| 92 | |||
| 93 | sub shadowColor { | ||
| 94 | return _PROPERTY($match{'color'}, @_); | ||
| 95 | } | ||
| 96 | |||
| 97 | sub shadowX { | ||
| 98 | return _PROPERTY($match{'float'}, @_); | ||
| 99 | } | ||
| 100 | |||
| 101 | sub shadowY { | ||
| 102 | return _PROPERTY($match{'float'}, @_); | ||
| 103 | } | ||
| 104 | |||
| 105 | sub _addTypeNode { | ||
| 106 | my ($self, $node) = @_; | ||
| 107 | return $node->addNewChild('', 'y:ShapeNode'); | ||
| 108 | } | ||
| 109 | sub _addAdditionalNodes { | ||
| 110 | my ($self, $node) = @_; | ||
| 111 | my $shape = $node->addNewChild('', 'y:Shape'); | ||
| 112 | $shape->setAttribute('type', $self->shape()); | ||
| 113 | if ($self->shadowX() != 0 or $self->shadowY() != 0) { | ||
| 114 | my $shadow = $node->addNewChild('', 'y:DropShadow'); | ||
| 115 | $shadow->setAttribute('color', $self->shadowColor()); | ||
| 116 | $shadow->setAttribute('offsetX', $self->shadowX()); | ||
| 117 | $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 | 1; | ||