Bazaar/DXF : store current layer, linetype and color with drawing

git-svn-id: svn://ultimatepp.org/upp/trunk@5280 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
micio 2012-08-13 18:29:38 +00:00
parent 2e60b9b14d
commit 82ab8d92a2
5 changed files with 22 additions and 7 deletions

View file

@ -13,6 +13,7 @@ class DXFBlock : public Pte<DXFBlock>
friend class DXFEntities;
friend class DXF;
friend class DXFBlocks;
friend class DXFHeader;
private:
// dxf container object, if not this one

View file

@ -9,7 +9,7 @@
// constructor
// seeds handles with a number greater than the one in template
DXF::DXF() : nextHandle(0x1000), blocks(this), objects(this), tables(this)
DXF::DXF() : nextHandle(0x1000), header(this), blocks(this), objects(this), tables(this)
{
tables.AddLineType("CONTINUOUS");
tables.AddLayer("0");

View file

@ -1,9 +1,23 @@
#include "DXF.h"
//////////////////////////////////////////////////////////////////////////
// private constructor -- may be created only by DXF class
DXFHeader::DXFHeader(DXF *d)
{
dxf = d;
}
// write header to stream
bool DXFHeader::Write(Stream &s)
{
String hdr = (const char *)dxf_hdr;
s << "0\nSECTION\n2\nHEADER\n";
s << hdr;
s << "9\n$CLAYER\n8\n" << dxf->layer << "\n";
s << "9\n$CELTYPE\n6\n" << dxf->lineType << "\n";
s << "9\n$CECOLOR\n62\n" << dxf->color << "\n";
s << "9\n$CELTSCALE\n40\n1.0\n";
s << "0\nENDSEC\n";
return true;
}

View file

@ -9,9 +9,15 @@ class DXFHeader
friend class DXF;
private:
// back link to container DXF
Ptr<DXF> dxf;
// write header to stream
bool Write(Stream &s);
// private constructor -- may be created only by DXF class
DXFHeader(DXF *d);
protected:
public:

View file

@ -1,7 +1,3 @@
0
SECTION
2
HEADER
9
$ACADVER
1
@ -30,5 +26,3 @@ $ANGBASE
$HANDSEED
5
677
0
ENDSEC