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