Open Inventor Release 2023.2.3
 
Loading...
Searching...
No Matches
SoVectorizeCGMAction.h
Go to the documentation of this file.
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2023 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : VSG (MMM YYYY)
22**=======================================================================*/
23
24#ifndef __SO_VECTORIZE_CGM_ACTION_
25#define __SO_VECTORIZE_CGM_ACTION_
26
28
47{
48
49 public:
50
55
61
62 public:
63
70 SoNONUNICODE virtual SbBool openFile(const char* file_name);
71
76 virtual SbBool openFile( const SbString& file_name );
77
78 public:
79
85 void setBinary(SbBool flag = TRUE)
86 { m_binary = flag; }
87
92 { return m_binary; }
93
94 public:
95
106 void setVersion(int vers = 1)
107 { m_cgm_version = vers; }
108
112 int getVersion() const
113 { return m_cgm_version; }
114
115 public:
116
121 void setIndexed(SbBool flag = TRUE)
122 { m_indexed = flag; }
123
128 { return m_indexed; }
129 private:
130 SbBool m_binary;
131 int m_cgm_version;
132 SbBool m_indexed;
133};
134
157
159
160 public:
161
166
171
176
177private:
181 static void initClass();
182 static void exitClass();
183
184 /*****************************************************************************/
185
186
187 private:
188 virtual void printPolyMark(const SbVec4f *points,
189 int num_points,
190 const SbColor *colors,
191 SbBool color_flag,
192 float size);
193#ifndef NO_TGS_OIV
194 virtual void printPolyMark(const SbVec4f *points,
195 int num_points,
196 const SbColor *colors,
197 SbBool color_flag,
198 SoMarkerSet *markerSet);
199 virtual void printImage(const SbVec4f &origin,
200 const unsigned char *imagePixels,
201 SbVec2s &sourceSize,
202 SbVec2s &requestedSize,
203 int numComponents,
204 SoImage::HorAlignment horAlign,
205 SoImage::VertAlignment vertAlign);
206#endif
207 virtual void printPolyLine(const SbVec4f *points,
208 int num_points,
209 const SbColor *colors,
210 SbBool color_flag,
211 float thickness,
212 u_short linePattern,
213 int linePatternScaleFactor = 1);
214 virtual void printPolygon(const SbVec4f *points,
215 int num_points,
216 const SbColor *colors,
217 SbBool color_flag,
218 const SbString &category,
219 const SbString &name,
220 const unsigned char *pattern);
221 virtual void printText2(const SbVec4f point,
222 const SbColor color,
223 const SbString& font_name,
224 float font_size,
225 const SbString& string,
226 int justif,
227 float angle);
228
229 // Print the border and the background
230 virtual void printBorder();
231 virtual void printBackground();
232
233 private:
234 // Write header and footer
235 virtual void writeHeader ();
236 virtual void writeFooter ();
237
238 // Set hardware clipping
239 virtual void setHardwareClip();
240
241 // Compute clipping limits
242 SbBox2f getClippingLimits() const;
243
244 private:
245 // Miscellaneous methods
246 void assignColor(SbColor color,
247 float linewidth,
248 int *pen_color,
249 SbColor *return_colors);
250 void PWriteChar(unsigned int c_param);
251 void PWriteWord(unsigned int word);
252 char *RSHORT(int i, float r);
253 void Pbegmf(const SbString& name);
254 void Pmfversion(int version);
255 void Pmfdesc(const SbString& description);
256 void Pmfelemlist(const SbString& names);
257 void Pvdctype(int type);
258 void Pintegerprec(int minint, int maxint);
259 void Prealprec(double minreal, double maxreal, int digits);
260 void Pindexprec(int minint,int maxint);
261 void Pcolrindexprec(int maxin);
262 void Pcolrvalueext(int br, int bg, int bb, int wr, int wg, int w);
263 void Pmaxcolrindex(int maxind);
264 void Pcolrprec(int maxcomp);
265 void Pfontlist(int nfont, const SbString font[]);
266 void Pbegpic(const SbString& name);
267 void Pscalemode(int specmode,double factor);
268 void Plinewidth(double width);
269 void Plinewidthmode(int width);
270 void Pmarkersizemode(int mode);
271 void Pedgewidth(double width);
272 void Pedgewidthmode(int mode);
273 void Pbackcolr(float r, float g, float b);
274 void Pcolrmode(int colourmode);
275 void Pbegpicbody();
276 void Pvdcrealprec(double minreal, double maxreal, int digits);
277 void Pvdcext(float x_min, float y_min, float size_x, float size_y);
278 void Pedgevis(int sw);
279 void Pendmf();
280 void Pendpic();
281 int PStrLen(const SbString& str);
282 void Plinecap_join(int cap, int join, float limit);
283 void Plineedgetype(int index, float size, int nbdash, int *dash);
284 void Plinecolr(int colour);
285 void Plinecolr(SbColor colour);
286 void Pline(int n, const SbVec4f *points);
287 void Pcolrtable(int index, int ncol, SbColor *colors);
288 void Pmarkertype(int type);
289 void Pmarkersize(double size);
290 void Pmarkercolr(int colour);
291 void Pmarkercolr(SbColor colour);
292 void Pmarker(int n, const SbVec4f *points);
293 void Pintstyle(int style);
294 void Pfillcolr(int colour);
295 void Pfillcolr(SbColor colour);
296 void Ppolygon(int n, const SbVec4f* points);
297 void Ptextcolr(int colour);
298 void Ptextcolr(SbColor colour);
299 void Pcharori(double upx, double upy, double bax, double bay);
300 void Pcharheight(double height);
301 void Ptextfontindex(int index);
302 void Ptextprec(int precision);
303 void Ptextpath(int path);
304 void Pcharspace(double spacing);
305 void Pcharexpan(double expansion);
306 void Ptext010(SbVec4f pt,int final, const SbString& str);
307 void Ptextjustif(int justif);
308 void Pcliprect(float x_min, float y_min, float x_max, float y_max);
309 void Plinetype(int type);
310 void PtranspcellcolrI(unsigned int indicator, unsigned int indexColor);
311 void PtranspcellcolrD(unsigned int indicator, SbColor &directColor);
312
313 void PWriteVDC(double v);
314 void PWritePoint(SbVec4f p);
315 void PWriteColorD(int r, int g, int b);
316 void PWriteHeader(int classe, int id, int length);
317 void PWriteBuffer(const SbString& str, int len);
318 void PWriteString(const SbString& str);
319 void PWriteInt(unsigned int l);
320 void PWriteEnum(unsigned int l);
321 void PWriteIndex(int l);
322 void PWriteColorI(unsigned int l);
323 void PWriteReal(double r);
324
325 // Buffering management
326 void fillWriteBufferChar(char c) ;
327 void flushWriteBuffer() ;
328
329 // data
330 int m_currentColor;
331 EndLineStyle m_currentLineEndStyle;
332 JoinLineStyle m_currentLineJoinsStyle;
333 float m_currentMiterLimit;
334 float m_currentThickness;
335 u_short m_currentLinePattern;
336 int m_currentPatternScaleFactor;
337 float m_scaleFont;
338 SbString m_fontname;
339 int m_justification;
340 float m_textAngle;
341 int m_currentPattableIndex;
342 int m_nbPattableIndex;
343
344 // For CGM.
345 int m_cgmMarkerColor;
346 int m_cgmLineColor;
347 int m_cgmPolygonColor;
348 int m_cgmTextColor;
349 SbColor m_cgmPolygonColorRGB;
350
351 // For Pattern
352 SbPList m_patternList;
353 /****************************************************************************/
354 // For Miscellaneous functions.
355 int PIntPrec;
356 int PRealPrec;
357 int PIndexPrec;
358 int PColorMode;
359 int PColorIndexPrec;
360 int PColorPrec;
361 int PVDCType;
362 int PVDCIntPrec;
363 int PVDCRealPrec;
364 int PLineWidthMode;
365 int PMarkerSizeMode;
366 int PEdgeWidthMode;
367 int PHeaderLenght;
368 int PCharWritten;
369 int WordSync;
370
371 // Buffering management
372 int m_indFillWriteBuffer ;
373 int m_writeBufferSize ;
374 char *m_writeBuffer ;
375};
376
377/*****************************************************************************/
378
379#endif //__SO_VECTORIZE_CGM_ACTION_
380
381
#define TRUE
Possible value of SbBool.
Definition SbBase.h:77
#define SO_ACTION_HEADER(className)
Definition SoSubAction.h:69
2D box class.
Definition SbBox.h:1798
Color vector class.
Definition SbColor.h:82
List of generic (void *) pointers.
Definition SbPList.h:77
Class for smart character strings.
Definition SbString.h:202
2D vector class.
Definition SbVec.h:700
4D vector class.
Definition SbVec.h:2214
<a href="IconLegend.html"><img src="extHC.gif" alt="HardCopy" border="0"></a> Class used to write ve...
virtual ~SoCGMVectorOutput()
Destructor.
SoCGMVectorOutput()
Constructor.
SbBool isBinary() const
Gets the output mode.
virtual SoNONUNICODE SbBool openFile(const char *file_name)
Opens named file (sets file pointer to result) .
virtual SbBool openFile(const SbString &file_name)
Opens named file (sets file pointer to result) .
void setIndexed(SbBool flag=TRUE)
Sets the color mode.
void setBinary(SbBool flag=TRUE)
Sets the output mode.
SbBool isIndexed() const
Gets the color mode.
int getVersion() const
Gets the version of the output CGM file.
void setVersion(int vers=1)
Sets the version of the output CGM file.
VertAlignment
Vertical alignment.
Definition SoImage.h:146
HorAlignment
Horizontal alignment.
Definition SoImage.h:130
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Extension of Poi...
<a href="IconLegend.html"><img src="extHC.gif" alt="HardCopy" border="0"></a> Abstract class used to...
<a href="IconLegend.html"><img src="extHC.gif" alt="HardCopy" border="0"></a> Abstract class for vec...
EndLineStyle
End line style.
JoinLineStyle
Join line style.
<a href="IconLegend.html"><img src="extHC.gif" alt="HardCopy" border="0"></a> Realizes the vectoriza...
SoVectorizeCGMAction()
Constructor.
SoCGMVectorOutput * getCGMVectorOutput() const
Returns the SoCGMVectorOutput instance in action.
virtual ~SoVectorizeCGMAction()
Destructor.
int SbBool
Boolean type.
Definition SbBase.h:87
size_t size() const