43 for (i=0; (fname[i] != 0) && (fname[i] !=
'.'); i++) {
49 snprintf(s, 255,
"%s-%d.ps", f, ++
gFileNum);
56 if ((fic_repr = fopen(
addFileNum(ficName),
"w+")) == NULL) {
58 cout<<
"Impossible de creer ou d'ouvrir "<<ficName<<endl;
64 fprintf(fic_repr,
"%%!PS-Adobe-3.0 \n");
66 fprintf(fic_repr,
"%%%%BoundingBox: 0 0 450 %d\n",(
int)floor((hauteur*450/largeur)+1));
68 fprintf(fic_repr,
"/unit {%f mul} def\n\n",450/largeur);
69 fprintf(fic_repr,
"0 %f unit translate\n",hauteur);
70 fprintf(fic_repr,
"1 -1 scale\n\n");
71 fprintf(fic_repr,
"0.6 unit setlinewidth\n");
73 fprintf(fic_repr,
"/Times-Roman findfont %% Get the basic font for text\n");
75 fprintf(fic_repr,
"10 unit scalefont %% Scale the font to 10 units\n");
76 fprintf(fic_repr,
"setfont %% Make it the current font\n\n");
81 fprintf(fic_repr,
"showpage\n");
85 void PSDev::rect(
double x,
double y,
double l,
double h,
const char*,
const char*)
87 fprintf(fic_repr,
"gsave\n");
88 fprintf(fic_repr,
"newpath\n");
90 fprintf(fic_repr,
"1.0 unit setlinewidth\n");
91 fprintf(fic_repr,
"%f unit %f unit moveto\n",x,y);
92 fprintf(fic_repr,
"0 unit %f unit rlineto\n",h);
93 fprintf(fic_repr,
"%f unit 0 unit rlineto\n",l);
94 fprintf(fic_repr,
"0 unit %f unit rlineto\n",-h);
95 fprintf(fic_repr,
"closepath\n");
96 fprintf(fic_repr,
"stroke\n");
97 fprintf(fic_repr,
"grestore\n");
100 void PSDev::triangle(
double x,
double y,
double l,
double h,
const char*,
const char*,
bool leftright)
102 fprintf(fic_repr,
"gsave\n");
103 fprintf(fic_repr,
"newpath\n");
105 fprintf(fic_repr,
"1.0 unit setlinewidth\n");
106 fprintf(fic_repr,
"%f unit %f unit moveto\n",x,y);
107 fprintf(fic_repr,
"0 unit %f unit rlineto\n",h);
108 fprintf(fic_repr,
"%f unit 0 unit rlineto\n",l);
109 fprintf(fic_repr,
"0 unit %f unit rlineto\n",-h);
110 fprintf(fic_repr,
"closepath\n");
111 fprintf(fic_repr,
"stroke\n");
112 fprintf(fic_repr,
"grestore\n");
117 fprintf(fic_repr,
"gsave\n");
118 fprintf(fic_repr,
"newpath\n");
119 fprintf(fic_repr,
"%f unit %f unit %f unit 0 360 arc\n",x,y,rayon);
120 fprintf(fic_repr,
"fill\n");
121 fprintf(fic_repr,
"grestore\n");
128 fprintf(fic_repr,
"gsave\n");
129 fprintf(fic_repr,
"newpath\n");
130 fprintf(fic_repr,
"0.3 setgray\n");
131 fprintf(fic_repr,
"%f unit %f unit moveto\n",x,y);
132 fprintf(fic_repr,
"%f rotate\n",rotation);
133 fprintf(fic_repr,
"%f unit %f unit rlineto\n",(
double)-4,(
double)-2);
134 fprintf(fic_repr,
"%f rotate\n",(
double)-rotation);
135 fprintf(fic_repr,
"%f unit %f unit moveto\n",x,y);
136 fprintf(fic_repr,
"%f rotate\n",rotation);
137 fprintf(fic_repr,
"%f unit %f unit rlineto\n",(
double)-4,(
double)+2);
138 fprintf(fic_repr,
"closepath\n");
139 fprintf(fic_repr,
"stroke\n");
140 fprintf(fic_repr,
"grestore\n");
144 fprintf(fic_repr,
"gsave\n");
145 fprintf(fic_repr,
"newpath\n");
146 fprintf(fic_repr,
"0.3 setgray\n");
147 fprintf(fic_repr,
"%f unit %f unit moveto\n",x,y);
148 fprintf(fic_repr,
"%f rotate\n",rotation);
149 fprintf(fic_repr,
"%f unit %f unit rlineto\n",(
double)4,(
double)-2);
150 fprintf(fic_repr,
"%f rotate\n",(
double)-rotation);
151 fprintf(fic_repr,
"%f unit %f unit moveto\n",x,y);
152 fprintf(fic_repr,
"%f rotate\n",rotation);
153 fprintf(fic_repr,
"%f unit %f unit rlineto\n",(
double)4,(
double)+2);
154 fprintf(fic_repr,
"closepath\n");
155 fprintf(fic_repr,
"stroke\n");
156 fprintf(fic_repr,
"grestore\n");
162 fprintf(fic_repr,
"gsave\n");
163 fprintf(fic_repr,
"newpath\n");
164 fprintf(fic_repr,
"0.3 setgray\n");
165 fprintf(fic_repr,
"%f unit %f unit moveto\n",x-cote/2,y);
166 fprintf(fic_repr,
"0 unit %f unit rlineto\n",-cote);
167 fprintf(fic_repr,
"%f unit 0 unit rlineto\n",cote);
168 fprintf(fic_repr,
"0 unit %f unit rlineto\n",cote);
169 fprintf(fic_repr,
"closepath\n");
170 fprintf(fic_repr,
"stroke\n");
171 fprintf(fic_repr,
"grestore\n");
176 fprintf(fic_repr,
"gsave\n");
177 fprintf(fic_repr,
"0.3 setgray\n");
178 fprintf(fic_repr,
"newpath\n");
179 fprintf(fic_repr,
"%f unit %f unit moveto\n",x1,y1);
180 fprintf(fic_repr,
"%f unit %f unit lineto\n",x2,y2);
181 fprintf(fic_repr,
"stroke\n");
182 fprintf(fic_repr,
"grestore\n");
187 fprintf(fic_repr,
"gsave\n");
188 fprintf(fic_repr,
"newpath\n");
189 fprintf(fic_repr,
"0.6 setgray\n");
190 fprintf(fic_repr,
"0.8 unit setlinewidth\n");
191 fprintf(fic_repr,
"%f unit %f unit moveto\n",x1,y1);
192 fprintf(fic_repr,
"%f unit %f unit lineto\n",x2,y2);
193 fprintf(fic_repr,
"stroke\n");
194 fprintf(fic_repr,
"grestore\n");
197 void PSDev::text(
double x,
double y,
const char* nom,
const char* link)
199 fprintf(fic_repr,
"newpath\n");
201 fprintf(fic_repr,
"%f unit %f unit moveto\n",(x-0)-(strlen(nom)-1)*3.8,y+2);
202 fprintf(fic_repr,
"gsave\n");
203 fprintf(fic_repr,
"1 -1 scale\n\n");
204 fprintf(fic_repr,
"(%s) show\n",nom);
205 fprintf(fic_repr,
"grestore\n");
210 fprintf(fic_repr,
"gsave\n");
211 fprintf(fic_repr,
"/Times-Roman findfont %% Get the basic font for text\n");
212 fprintf(fic_repr,
"7 unit scalefont %% Scale the font to 10 points\n");
213 fprintf(fic_repr,
"setfont %% Make it the current font\n\n");
214 fprintf(fic_repr,
"newpath\n");
215 fprintf(fic_repr,
"%f unit %f unit moveto\n",(x+2),y+1.2);
216 fprintf(fic_repr,
"1 -1 scale\n");
217 fprintf(fic_repr,
"(%s) show\n",label);
218 fprintf(fic_repr,
"grestore\n");
225 fprintf(fic_repr,
"newpath\n");
226 fprintf(fic_repr,
"%f unit %f unit moveto\n",x,y+4);
227 fprintf(fic_repr,
"%f unit %f unit rlineto\n",(
double)4,(
double)-4);
228 fprintf(fic_repr,
"closepath\n");
232 fprintf(fic_repr,
"newpath\n");
233 fprintf(fic_repr,
"%f unit %f unit moveto\n",x,y-4);
234 fprintf(fic_repr,
"%f unit %f unit rlineto\n",(
double)-4,(
double)4);
235 fprintf(fic_repr,
"closepath\n");
237 fprintf(fic_repr,
"stroke\n");
240 void PSDev::Error(
const char* message,
const char* reason,
int nb_error,
double x,
double y,
double largeur)
242 fprintf(fic_repr,
"gsave\n");
243 fprintf(fic_repr,
"/Times-Roman findfont %% Get the basic font for text\n");
244 fprintf(fic_repr,
"17 unit scalefont %% Scale the font to 10 points\n");
245 fprintf(fic_repr,
"setfont %% Make it the current font\n\n");
246 fprintf(fic_repr,
"newpath\n");
247 fprintf(fic_repr,
"%f unit %f unit moveto\n",(x-8)-(strlen(message)-1)*3.8,y-10);
248 fprintf(fic_repr,
"1 -1 scale\n");
249 fprintf(fic_repr,
"(%s) show\n",message);
250 fprintf(fic_repr,
"1 -1 scale\n");
251 fprintf(fic_repr,
"%f unit %f unit moveto\n",(x-8)-(strlen(reason)-1)*3.8,y+10);
252 fprintf(fic_repr,
"1 -1 scale\n");
253 fprintf(fic_repr,
"(%s) show\n",reason);
254 fprintf(fic_repr,
"grestore\n");
void rect(double, double, double, double, const char *, const char *)
void markSens(double, double, int)
static char * addFileNum(const char *fname)
void dasharray(double, double, double, double)
PSDev(const char *, double, double)
void trait(double, double, double, double)
void text(double, double, const char *, const char *link)
void rond(double, double, double)
void Error(const char *, const char *, int, double, double, double)
void triangle(double x, double y, double l, double h, const char *color, const char *link, bool leftright)
void carre(double, double, double)
void label(double, double, const char *)
void fleche(double, double, double, int)