ultimatepp/bazaar/DXF/Line.cpp
micio f26735b2fb Bazaar : added DXF package for cad DXF files writing
git-svn-id: svn://ultimatepp.org/upp/trunk@5269 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2012-08-11 15:22:03 +00:00

32 lines
672 B
C++

#include "DXF.h"
// private constructor -- may be created only by DXFEntities
DXFLine::DXFLine(DXFEntities *e) : DXFEntity(e, "LINE")
{
p1 = p2 = Pointf(0,0);
}
Vector<Pointf> DXFLine::GetPoints(void) const
{
return Vector<Pointf>() << p1 << p2;
}
DXFLine &DXFLine::SetPoints(Pointf const &_p1, Pointf const &_p2)
{
p1 = T(_p1);
p2 = T(_p2);
return *this;
}
bool DXFLine::Write(Stream &s)
{
// call base class write
if(!DXFEntity::Write(s))
return false;
// output line points
s << "100\nAcDbLine\n";
s << "10\n" << p1.x << "\n20\n" << p1.y << "\n30\n" << 0.0 << "\n";
s << "11\n" << p2.x << "\n21\n" << p2.y << "\n31\n" << 0.0 << "\n";
return true;
}