#  Copyright (c) 1997-2007
#  Ewgenij Gawrilow, Michael Joswig (Technische Universitaet Berlin, Germany)
#  http://www.math.tu-berlin.de/polymake,  mailto:polymake@math.tu-berlin.de
#
#  This program is free software; you can redistribute it and/or modify it
#  under the terms of the GNU General Public License as published by the
#  Free Software Foundation; either version 2, or (at your option) any
#  later version: http://www.gnu.org/licenses/gpl.txt.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#-----------------------------------------------------------------------------
#  $Project: polymake $$Id: jreality.rules 7586 2007-01-23 17:51:31Z gawrilow $

CONFIGURE : common::jreality_configure

package JReality::Viewer;

global_method jreality.graph: draw(Visual::Graph, @) {
   my ($self, $Graph)=@_;
   my $nodes=$Graph->get_number_nodes;
   my @edges=$Graph->get_all_edges;
   my @parameters = ( name => $Graph->Name,
		      points => $Graph->Coord,
		      pointSet_dim => Modules::common::dim($Graph->Coord),
		      lines => \@edges,
		      lineSet_arrow_flag => ($Graph->Directed ? "show" : "hide"),
		      vertex_labels($Graph),
		      vertex_colors($Graph, $nodes, "NodeColor"),
		      vertex_thicknesses($Graph, $nodes, "NodeStyle"),
		      colors($Graph, $Graph->edges, "EdgeColor", $Visual::Color::edges, "line"),
		      thicknesses($Graph, $Graph->edges, "EdgeStyle", 1, "line"),
		      visible($Graph),
		    );

   $self->append(new JReality::wire(@parameters));
}


# Local Variables:
# mode: perl
# c-basic-offset:3
# End:
