#  Copyright (c) 1997-2004
#  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: postscript.rules,v 1.4 2004/10/26 19:00:19 gawrilow Exp $


package Postscript;

# a postscript file viewer, e.g. ghostscript
custom $viewer;

CONFIGURE {
  $viewer=find_via_path(qw( gv kghostview ggv ghostview ))
  or die "No known PostScript viewer program found,\n",
         "please specify your favorite viewer in the customization file.\n";
}

# topic: customize/Postscript
# All numeric constants defined here are in postscript points (1/72")

# height of DIN A4 sheet
custom $Hpaper=841;

# width of DIN A4 sheet
custom $Wpaper=595;

# vertical margin
custom $Hmargin=50;

# horizontal margin
custom $Wmargin=30;

# text labels
custom $fontname="Times-Roman";

# text labels
custom $fontsize=10;

# normal line width
custom $line_width=1;

# spacing between points (lines) and labels
custom $text_spacing=3;

# options passed to the viewer
custom $viewer_options="";

use Postscript;

# Create a PostScript (tm) drawing and show it with your favorite viewer (default is @c gv.)
label postscript

package Postscript::Viewer;

global_method postscript.geometry: draw(Visual::PointSet, @) {
   my ($self, $P)=@_;
   $self->current_page->addPointSet(new Postscript::PointSet($P));
}

global_method postscript.geometry: draw(Visual::Polygon, @) {
   my ($self, $P)=@_;
   $self->current_page->addPointSet(new Postscript::Polygon($P));
}

global_method postscript.geometry: draw(Visual::Polygons, @) {
   my ($self, $P)=@_;
   $self->current_page->addPointSet(new Postscript::Polygons($P));
}


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