00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef __SO_VECTORIZE_CGM_ACTION_
00025 #define __SO_VECTORIZE_CGM_ACTION_
00026
00027 #include <HardCopy/SoVectorizeAction.h>
00028
00047 class SoCGMVectorOutput : public SoVectorOutput
00048 {
00049
00050 public:
00051
00055 SoCGMVectorOutput ();
00056
00061 virtual ~SoCGMVectorOutput ();
00062
00063 public:
00064
00071 SoNONUNICODE virtual SbBool openFile(const char* file_name);
00072
00077 virtual SbBool openFile( const SbString& file_name );
00078
00079 public:
00080
00086 void setBinary(SbBool flag = TRUE)
00087 { m_binary = flag; }
00088
00092 SbBool isBinary() const
00093 { return m_binary; }
00094
00095 public:
00096
00107 void setVersion(int vers = 1)
00108 { m_cgm_version = vers; }
00109
00113 int getVersion() const
00114 { return m_cgm_version; }
00115
00116 public:
00117
00122 void setIndexed(SbBool flag = TRUE)
00123 { m_indexed = flag; }
00124
00128 SbBool isIndexed() const
00129 { return m_indexed; }
00130 private:
00131 SbBool m_binary;
00132 int m_cgm_version;
00133 SbBool m_indexed;
00134 };
00135
00158 class SoVectorizeCGMAction : public SoVectorizeAction {
00159
00160 SO_ACTION_HEADER(SoVectorizeCGMAction);
00161
00162 public:
00163
00167 SoVectorizeCGMAction();
00168
00172 virtual ~SoVectorizeCGMAction();
00173
00177 SoCGMVectorOutput *getCGMVectorOutput() const;
00178
00179 #if 1 SoDEPRECATED
00182 SoCGMVectorOutput *getOutput() const;
00183
00184 #endif
00186 private:
00187
00190 static void initClass();
00191 static void exitClass();
00192
00193
00194
00195
00196 private:
00197 virtual void printPolyMark(const SbVec4f *points,
00198 int num_points,
00199 const SbColor *colors,
00200 SbBool color_flag,
00201 float size);
00202 #ifndef NO_TGS_OIV
00203 virtual void printPolyMark(const SbVec4f *points,
00204 int num_points,
00205 const SbColor *colors,
00206 SbBool color_flag,
00207 SoMarkerSet *markerSet);
00208 virtual void printImage(const SbVec4f &origin,
00209 const unsigned char *imagePixels,
00210 SbVec2s &sourceSize,
00211 SbVec2s &requestedSize,
00212 int numComponents,
00213 SoImage::HorAlignment horAlign,
00214 SoImage::VertAlignment vertAlign);
00215 #endif
00216 virtual void printPolyLine(const SbVec4f *points,
00217 int num_points,
00218 const SbColor *colors,
00219 SbBool color_flag,
00220 float thickness,
00221 u_short linePattern,
00222 int linePatternScaleFactor = 1);
00223 virtual void printPolygon(const SbVec4f *points,
00224 int num_points,
00225 const SbColor *colors,
00226 SbBool color_flag,
00227 const SbString &category,
00228 const SbString &name,
00229 const unsigned char *pattern);
00230 virtual void printText2(const SbVec4f point,
00231 const SbColor color,
00232 const SbString& font_name,
00233 float font_size,
00234 const SbString& string,
00235 int justif,
00236 float angle);
00237
00238
00239 virtual void printBorder();
00240 virtual void printBackground();
00241
00242 private:
00243
00244 virtual void writeHeader ();
00245 virtual void writeFooter ();
00246
00247
00248 virtual void setHardwareClip();
00249
00250
00251 SbBox2f getClippingLimits() const;
00252
00253 private:
00254
00255 void assignColor(SbColor color,
00256 float linewidth,
00257 int *pen_color,
00258 SbColor *return_colors);
00259 void PWriteChar(unsigned int c_param);
00260 void PWriteWord(unsigned int word);
00261 char *RSHORT(int i, float r);
00262 void Pbegmf(const SbString& name);
00263 void Pmfversion(int version);
00264 void Pmfdesc(const SbString& description);
00265 void Pmfelemlist(const SbString& names);
00266 void Pvdctype(int type);
00267 void Pintegerprec(int minint, int maxint);
00268 void Prealprec(double minreal, double maxreal, int digits);
00269 void Pindexprec(int minint,int maxint);
00270 void Pcolrindexprec(int maxin);
00271 void Pcolrvalueext(int br, int bg, int bb, int wr, int wg, int w);
00272 void Pmaxcolrindex(int maxind);
00273 void Pcolrprec(int maxcomp);
00274 void Pfontlist(int nfont, const SbString font[]);
00275 void Pbegpic(const SbString& name);
00276 void Pscalemode(int specmode,double factor);
00277 void Plinewidth(double width);
00278 void Plinewidthmode(int width);
00279 void Pmarkersizemode(int mode);
00280 void Pedgewidth(double width);
00281 void Pedgewidthmode(int mode);
00282 void Pbackcolr(float r, float g, float b);
00283 void Pcolrmode(int colourmode);
00284 void Pbegpicbody();
00285 void Pvdcrealprec(double minreal, double maxreal, int digits);
00286 void Pvdcext(float x_min, float y_min, float size_x, float size_y);
00287 void Pedgevis(int sw);
00288 void Pendmf();
00289 void Pendpic();
00290 int PStrLen(const SbString& str);
00291 void Plinecap_join(int cap, int join, float limit);
00292 void Plineedgetype(int index, float size, int nbdash, int *dash);
00293 void Plinecolr(int colour);
00294 void Plinecolr(SbColor colour);
00295 void Pline(int n, const SbVec4f *points);
00296 void Pcolrtable(int index, int ncol, SbColor *colors);
00297 void Pmarkertype(int type);
00298 void Pmarkersize(double size);
00299 void Pmarkercolr(int colour);
00300 void Pmarkercolr(SbColor colour);
00301 void Pmarker(int n, const SbVec4f *points);
00302 void Pintstyle(int style);
00303 void Pfillcolr(int colour);
00304 void Pfillcolr(SbColor colour);
00305 void Ppolygon(int n, const SbVec4f* points);
00306 void Ptextcolr(int colour);
00307 void Ptextcolr(SbColor colour);
00308 void Pcharori(double upx, double upy, double bax, double bay);
00309 void Pcharheight(double height);
00310 void Ptextfontindex(int index);
00311 void Ptextprec(int precision);
00312 void Ptextpath(int path);
00313 void Pcharspace(double spacing);
00314 void Pcharexpan(double expansion);
00315 void Ptext010(SbVec4f pt,int final, const SbString& str);
00316 void Ptextjustif(int justif);
00317 void Pcliprect(float x_min, float y_min, float x_max, float y_max);
00318 void Plinetype(int type);
00319 void PtranspcellcolrI(unsigned int indicator, unsigned int indexColor);
00320 void PtranspcellcolrD(unsigned int indicator, SbColor &directColor);
00321
00322 void PWriteVDC(double v);
00323 void PWritePoint(SbVec4f p);
00324 void PWriteColorD(int r, int g, int b);
00325 void PWriteHeader(int classe, int id, int length);
00326 void PWriteBuffer(const SbString& str, int len);
00327 void PWriteString(const SbString& str);
00328 void PWriteInt(unsigned int l);
00329 void PWriteEnum(unsigned int l);
00330 void PWriteIndex(int l);
00331 void PWriteColorI(unsigned int l);
00332 void PWriteReal(double r);
00333
00334
00335 void fillWriteBufferChar(char c) ;
00336 void flushWriteBuffer() ;
00337
00338
00339 int m_currentColor;
00340 EndLineStyle m_currentLineEndStyle;
00341 JoinLineStyle m_currentLineJoinsStyle;
00342 float m_currentMiterLimit;
00343 float m_currentThickness;
00344 u_short m_currentLinePattern;
00345 int m_currentPatternScaleFactor;
00346 float m_scaleFont;
00347 SbString m_fontname;
00348 int m_justification;
00349 float m_textAngle;
00350 int m_currentPattableIndex;
00351 int m_nbPattableIndex;
00352
00353
00354 int m_cgmMarkerColor;
00355 int m_cgmLineColor;
00356 int m_cgmPolygonColor;
00357 int m_cgmTextColor;
00358 SbColor m_cgmPolygonColorRGB;
00359
00360
00361 SbPList m_patternList;
00362
00363
00364 int PIntPrec;
00365 int PRealPrec;
00366 int PIndexPrec;
00367 int PColorMode;
00368 int PColorIndexPrec;
00369 int PColorPrec;
00370 int PVDCType;
00371 int PVDCIntPrec;
00372 int PVDCRealPrec;
00373 int PLineWidthMode;
00374 int PMarkerSizeMode;
00375 int PEdgeWidthMode;
00376 int PHeaderLenght;
00377 int PCharWritten;
00378 int WordSync;
00379
00380
00381 int m_indFillWriteBuffer ;
00382 int m_writeBufferSize ;
00383 char *m_writeBuffer ;
00384 };
00385
00386
00387
00388 #endif //__SO_VECTORIZE_CGM_ACTION_
00389
00390
00391