diff --git a/bazaar/DXF/Block.h b/bazaar/DXF/Block.h index a2b725a3f..6e44b0ee2 100644 --- a/bazaar/DXF/Block.h +++ b/bazaar/DXF/Block.h @@ -13,6 +13,7 @@ class DXFBlock : public Pte friend class DXFEntities; friend class DXF; friend class DXFBlocks; + friend class DXFHeader; private: // dxf container object, if not this one diff --git a/bazaar/DXF/DXF.cpp b/bazaar/DXF/DXF.cpp index 5ea3c3c82..eb95dab50 100644 --- a/bazaar/DXF/DXF.cpp +++ b/bazaar/DXF/DXF.cpp @@ -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"); diff --git a/bazaar/DXF/Header.cpp b/bazaar/DXF/Header.cpp index 572551f25..97da1fb3c 100644 --- a/bazaar/DXF/Header.cpp +++ b/bazaar/DXF/Header.cpp @@ -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; } \ No newline at end of file diff --git a/bazaar/DXF/Header.h b/bazaar/DXF/Header.h index 9117ae0e5..1ac311d94 100644 --- a/bazaar/DXF/Header.h +++ b/bazaar/DXF/Header.h @@ -9,9 +9,15 @@ class DXFHeader friend class DXF; private: + // back link to container DXF + Ptr dxf; + // write header to stream bool Write(Stream &s); + // private constructor -- may be created only by DXF class + DXFHeader(DXF *d); + protected: public: diff --git a/bazaar/DXF/dxf_hdr.txt b/bazaar/DXF/dxf_hdr.txt index 58cbd5547..1c256cb17 100644 --- a/bazaar/DXF/dxf_hdr.txt +++ b/bazaar/DXF/dxf_hdr.txt @@ -1,7 +1,3 @@ - 0 -SECTION - 2 -HEADER 9 $ACADVER 1 @@ -30,5 +26,3 @@ $ANGBASE $HANDSEED 5 677 - 0 -ENDSEC