1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
|
/*
* Copyright (C) 1993-2009 Robert & Jeremy Laine
* See AUTHORS file for a full list of contributors.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef SAILWRITER_DXF_H
#define SAILWRITER_DXF_H
#include "filewriter.h"
#include "sailcpp/panelgroup.h"
#include <iostream>
#include <fstream>
/** An abstract class containing the methods needed for DXF writing.
*/
class CSailDxfWriter : public CFileWriter<CPanelGroup>
{
public:
/** The constructor.
*/
CSailDxfWriter() : CFileWriter<CPanelGroup>(".dxf", "DXF files")
{}
;
void writeBegin(ofstream &out, const QString &filename) const;
void writeEnd(ofstream &out) const;
void writeAtom(ofstream &out, int code, const QString& content) const;
void writeFace(ofstream &out, CPoint3d p0, CPoint3d p1, CPoint3d p2, unsigned int layer) const;
void writeLayer(ofstream &out, unsigned int layer, const QString &color) const;
void writePolyline(ofstream &out, unsigned int layer, const QString &color) const;
void writeVertex(ofstream &out, CPoint3d p0, unsigned int layer) const;
};
/** A class used to write a CPanelGroup to a 2D DXF file.
*
* @ingroup FileIo
*/
class CSailDxfWriter2d : public CSailDxfWriter
{
public:
enum Dxf2dType {
NORMAL,
BLOCKS,
SPLIT,
};
CSailDxfWriter2d(enum Dxf2dType format) : type(format) {};
void write(const CPanelGroup &sail, const QString &filename) const;
protected:
void writePanel(ofstream &out, const CPanel &panel, unsigned int layer) const;
void writeNormal(const CPanelGroup &sail, const QString &filename) const;
void writeBlocks(const CPanelGroup &sail, const QString &filename) const;
void writeSplit(const CPanelGroup &sail, const QString &filename) const;
Dxf2dType type;
};
/** A class used to write a CPanelGroup to a 3D DXF file.
*
* @ingroup FileIo
*/
class CSailDxfWriter3d : public CSailDxfWriter
{
public:
enum Dxf3dType {
NORMAL,
SPLIT,
};
CSailDxfWriter3d(enum Dxf3dType format) : type(format) {};
void write(const CPanelGroup &sail, const QString &filename) const;
protected:
void writePanel(ofstream &out, const CPanel &panel, unsigned int layer) const;
void writeNormal(const CPanelGroup &sail, const QString &filename) const;
void writeSplit(const CPanelGroup &sail, const QString &filename) const;
Dxf3dType type;
};
#endif
|