1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
|
#############################################################################
# (c) by Tels 2004 - 2005. An empty filler cell. Part of Graph::Easy.
#
#############################################################################
package Graph::Easy::Node::Cell;
use Graph::Easy::Node;
use strict;
use warnings;
use vars qw(@ISA $VERSION);
@ISA = qw/Graph::Easy::Node/;
$VERSION = '0.76';
#############################################################################
sub _init
{
# generic init, override in subclasses
my ($self,$args) = @_;
$self->{class} = '';
$self->{name} = '';
$self->{'x'} = 0;
$self->{'y'} = 0;
# default: belongs to no node
$self->{node} = undef;
foreach my $k (sort keys %$args)
{
if ($k !~ /^(node|graph|x|y)\z/)
{
require Carp;
Carp::confess ("Invalid argument '$k' passed to Graph::Easy::Node::Cell->new()");
}
$self->{$k} = $args->{$k};
}
$self;
}
sub _correct_size
{
my $self = shift;
$self->{w} = 0;
$self->{h} = 0;
$self;
}
sub node
{
# return the node this cell belongs to
my $self = shift;
$self->{node};
}
sub as_ascii
{
'';
}
sub as_html
{
'';
}
sub group
{
my $self = shift;
$self->{node}->group();
}
1;
__END__
=head1 NAME
Graph::Easy::Node::Cell - An empty filler cell
=head1 SYNOPSIS
use Graph::Easy;
use Graph::Easy::Edge;
my $graph = Graph::Easy->new();
my $node = $graph->add_node('A');
my $path = Graph::Easy::Node::Cell->new(
graph => $graph, node => $node,
);
...
print $graph->as_ascii();
=head1 DESCRIPTION
A C<Graph::Easy::Node::Cell> is used to reserve a cell in the grid for nodes
that occupy more than one cell.
You should not need to use this class directly.
=head1 METHODS
=head2 error()
$last_error = $cell->error();
$cvt->error($error); # set new messages
$cvt->error(''); # clear error
Returns the last error message, or '' for no error.
=head2 node()
my $node = $cell->node();
Returns the node this filler cell belongs to.
=head1 SEE ALSO
L<Graph::Easy>.
=head1 AUTHOR
Copyright (C) 2004 - 2005 by Tels L<http://bloodgate.com>.
See the LICENSE file for more details.
=cut
|