IvfDxfWriter.h

00001 //
00002 // Copyright 1999-2006 by Structural Mechanics, Lund University.
00003 //
00004 // This library is free software; you can redistribute it and/or
00005 // modify it under the terms of the GNU Library General Public
00006 // License as published by the Free Software Foundation; either
00007 // version 2 of the License, or (at your option) any later version.
00008 //
00009 // This library is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 // Library General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU Library General Public
00015 // License along with this library; if not, write to the Free Software
00016 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00017 // USA.
00018 //
00019 // Please report all bugs and problems to "ivf@byggmek.lth.se".
00020 //
00021 //
00022 // Written by Jonas Lindemann
00023 //
00024 
00025 #ifndef _CIvfDxfWriter_h_
00026 #define _CIvfDxfWriter_h_
00027 
00028 #include <ivffile/IvfFileWriter.h>
00029 #include <ivfmath/IvfMatrixStack.h>
00030 
00031 IvfSmartPointer(CIvfDxfWriter);
00032 
00036 class IVFFILE_API CIvfDxfWriter : public CIvfFileWriter {
00037 private:
00038         std::fstream m_file;
00039         CIvfMatrixStackPtr m_matrixStack;
00040         std::string m_currentLayer;
00041         int m_currentColor;
00042 protected:
00043         void processShape(CIvfShape* shape);
00044         
00045         void dxfTag(int number, const char* value);
00046         void dxfInt(int number, int value);
00047         void dxfFloat(int number, double value);
00048         void dxfBeginSection(const char* value);
00049         void dxfEndSection();
00050         void dxfBeginTables();
00051         void dxfEndTables();
00052         void dxfBeginTable(const char* value);
00053         void dxfEndTable();
00054         void dxfBeginLayer();
00055         void dxfEndLayer();
00056         void dxfBeginEntitites();
00057         void dxfEndEntitites();
00058         void dxfColor(int number);
00059         void dxfLineType(const char* name);
00060         void dxfLine();
00061         void dxfLayer(const char* value);
00062         void dxfFirstPoint(double x, double y, double z);
00063         void dxfSecondPoint(double x, double y, double z);
00064         void dxfThirdPoint(double x, double y, double z);
00065         void dxfFourthPoint(double x, double y, double z);
00066         void dxfPolyline();
00067         void dxfPolylineIntro();
00068         void dxfPolylineFlag(int flag);
00069         void dxfVertex();
00070         void dxfEndSeq();
00071         void dxfSolid();
00072         void dxfEndOfFile();
00073         void dxf3DFace();
00074         
00075         void quad(
00076                         double x1, double y1, double z1,
00077                         double x2, double y2, double z2,
00078                         double x3, double y3, double z3,
00079                         double x4, double y4, double z4
00080                 );
00081         
00082         void tri(
00083                         double x1, double y1, double z1,
00084                         double x2, double y2, double z2,
00085                         double x3, double y3, double z3
00086                 );
00087 
00088         void pushMatrix();
00089         void translate(double dx, double dy, double dz);
00090         void rotate(double vx, double vy, double vz, double theta);
00091         void popMatrix();
00092 
00093         void transform(double &x, double &y, double &z);
00094         
00095         void setCurrentLayer(const char* layerName);
00096         void setCurrentColor(int color);
00097 public:
00098         CIvfDxfWriter();
00099         virtual ~CIvfDxfWriter();
00100         
00101         void write();
00102         
00103         IvfClassInfo("CIvfDxfWriter",CIvfFileWriter);
00104 };
00105 
00106 #endif 

Generated on Fri Sep 1 15:36:46 2006 for Interactive Visualisation Framework - Ivf++ by  doxygen 1.4.6-NO