Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

EPSPlot.h

Go to the documentation of this file.
00001 /*
00002     File:       EPSPlot.h
00003 
00004     Purpose:    Defines vanilla class for doing 2D plotting and producing eps output.
00005                 adopted from Paul Heckbert's libplo/ps.c
00006     
00007     Author:     Paul Heckbert, Andrew Willmott
00008 */
00009 
00010 #ifndef __EPSPlot__
00011 #define __EPSPlot__
00012 
00013 #include "gcl/Geometry.h"
00014 #include "gcl/Colour.h"
00015 #include "cl/String.h"
00016 
00017 
00018 enum { lineDashed, lineDotted, lineSolid };
00019 
00020 class EPSPlot
00021 {
00022 public:
00023     EPSPlot();
00024     
00025     Void    Open(const Char *filename);
00026     Void    Close();
00027     
00028     Void    MoveTo(GCLReal x, GCLReal y);
00029     Void    LineTo(GCLReal x, GCLReal y);
00030     Void    SetWidth(GCLReal width);
00031     Void    LineStyle(Int style);
00032     Void    Dot(GCLReal x, GCLReal y, GCLReal r);
00033     Void    Circle(GCLReal x, GCLReal y, GCLReal r);
00034     Void    DrawText(GCLReal x, GCLReal y, Char *string);
00035 
00036     Void    SetColour(const Colour &c);
00037     
00038     Void    SetOutputSize(GCLReal size);        // measured in 1/72 of an inch.
00039             // Must be called before an 'Open'.
00040     Void    SetPort(GCLReal left, GCLReal bottom, 
00041                 GCLReal right, GCLReal top, Bool centred);
00042             // If 'centred' is true, the origin will be at the centre of the port,
00043             // otherwise it will be placed at the bottom-left. Other positions
00044             // for the origin can be achieved by using 'Translate' after calling
00045             // SetPort.
00046             // If you want more than one view setup,
00047             // you must Push/Pop around the previous one.
00048             
00049     Void    Push();
00050     Void    Pop();
00051     Void    Translate(GCLReal tx, GCLReal ty);
00052     Void    Scale(GCLReal sx, GCLReal sy);
00053     Void    Rotate(GCLReal angle);
00054 
00055     Void    Comment(StrConst string);
00056 
00057     Bool    level2;
00058     // Warning: Adobe "Illustrator" can't handle level2, so it's off
00059     // by default.
00060 
00061 protected:
00062     Void    Stroke();
00063 
00064     FILE    *file;
00065     Bool    drawn;
00066     GCLReal scale;
00067     Char    *font;
00068     GCLReal width;
00069     GCLReal worldScale;
00070 };
00071 
00072 #endif

Generated at Sat Aug 5 00:16:58 2000 for Graphics Class Library by doxygen 1.1.0 written by Dimitri van Heesch, © 1997-2000