1
//------------------------------------------------------------------------------
3
// This file is part of Toolkit for Conceptual Modeling (TCM).
4
// (c) copyright 1999, Vrije Universiteit Amsterdam.
5
// Author: Frank Dehne (frank@cs.vu.nl).
7
// TCM is free software; you can redistribute it and/or modify
8
// it under the terms of the GNU General Public License as published by
9
// the Free Software Foundation; either version 2 of the License, or
10
// (at your option) any later version.
12
// TCM is distributed in the hope that it will be useful,
13
// but WITHOUT ANY WARRANTY; without even the implied warranty of
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
// GNU General Public License for more details.
17
// You should have received a copy of the GNU General Public License
18
// along with TCM; if not, write to the Free Software
19
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21
//-----------------------------------------------------------------------------
22
#ifndef _FIGGRAFPORT_H
23
#define _FIGGRAFPORT_H
28
/// Fig Grafport Class
29
class FigGrafport: public Grafport {
30
/*@Doc: {\large {\bf scope:} GUI} */
32
/// open grafport to filename, When filename = "", stdout is used.
33
FigGrafport(const char *fileName);
35
virtual ~FigGrafport();
38
bool IsSucces() {return succes;}
40
// Sizes, refreshments etc.
42
void ClearArea(double, double, double, double) {}
46
void SetLineWidth(unsigned n);
50
void SetBackgroundColor(const string *);
52
void SetBackgroundColor(const char *);
54
void SetForegroundColor(const string *);
56
void SetForegroundColor(const char *);
58
// Drawing Rectangles.
60
void DrawRectangle(double x, double y, double wd, double ht);
62
void FillRectangle(double x, double y, double wd, double ht);
65
void DrawUnzoomedRectangle(double x, double y, double wd, double ht);
69
void DrawStringLeft(double x, double y, const char *str);
71
void DrawStringCentered(double x, double y, const char *str);
73
void DrawStringRight(double x, double y, const char *str);
75
void DrawUnzoomedStringLeft(double x, double y, const char *str);
77
void DrawUnzoomedStringCentered(double x, double y, const char *str);
79
void DrawStringLeftUnderlined(double x, double y, const char *str);
81
void DrawStringCenteredUnderlined(double x, double y, const char *str);
83
void DrawStringRightUnderlined(double x, double y, const char *str);
87
// void DrawLine(double x1, double y1, double x2, double y2);
89
void DrawUnzoomedLine(double x1, double y1, double x2, double y2);
94
void DrawPoint(double x, double y);
98
void DrawEllipse(double x, double y, double wd, double ht);
100
void FillEllipse(double x, double y, double wd, double ht);
104
/* virtual */ void FillSegment(double x, double y, double wd, double ht,
108
/// draw n lines between the first n points in list.
109
void DrawPolygon(const Point *points, int n);
111
void FillPolygon(const Point *points, int n);
113
/* virtual */ void FillPolygon(const DPoint *points, int n);
116
/// generate Fig header.
117
void Header(bool landscape=False);
119
/// set grafport font.
120
void SetFont(XFont *font);
123
void SetPageSize(double x, double y) {width = x; height = y;}
125
void SetFactor(double f) {factor = f;}
128
void SetTexFonts(bool b) {texFonts=b;}
130
bool IsTexFonts() {return texFonts;}
134
/* virtual */ void DrawSimpleArc(double x, double y,
135
double wd, double ht, int arc1, int arc2);
137
/* virtual */ void DrawSimplePolygon(const DPoint *points,
140
/* virtual */ void DrawSimpleCurve(const DPoint *p);
142
void FillCurve(const DPoint *p);
144
static void MakeFigString(string *str);
149
/// Factor to convert X coordinates to Fig coordinates.
150
static const double F;
152
/// Load built-in Fig colors.
155
/// Xfig pen color number, set by SetForeground.
157
/// Xfig fill color number, set by FillXXXX.
177
void DrawFigPolyLine(List<DPoint *> *points,
178
int sub_type, double radius = -1);
180
void DrawFigRectangle(double x, double y, double wd, double ht,
181
int sub_type, double radius = -1);
183
void DrawFigEllipse(double x, double y, double rd_x, double rd_y, int sub_type);
185
void DrawFigText(double x, double y, const char *text, int sub_type);
194
void GetFigStringSize(const char *str, double &ht, double &wd);