|
[code]//-----------------------------------------------------------------------------
//----- AcDbObject protocols
//- Dwg Filing protocol
Acad::ErrorStatus AuPolyline::dwgOutFields (AcDbDwgFiler *pFiler) const {
assertReadEnabled () ;
//----- Save parent class information first.
Acad::ErrorStatus es =AcDbPolyline::dwgOutFields (pFiler) ;
if ( es != Acad::eOk )
return (es) ;
//----- Object version number needs to be saved first
if ( (es =pFiler->writeUInt32 (AuPolyline::kCurrentVersionNumber)) != Acad::eOk )
return (es) ;
//----- Output params
//.....
//m_Hatch.dwgOutFields(pFiler);
UInt32 n=m_Array.size();
es=pFiler->writeUInt32(n);
if ( es != Acad::eOk )
return (es) ;
objArray::const_iterator it;
for (it=m_Array.begin();it!=m_Array.end();it++)
{
SOSTAV s=(*it).first;
Adesk::UInt32 s1=s;
es=pFiler->writeUInt32(s1);
if ( es != Acad::eOk )
return (es) ;
//const ACHAR* str = (*it).second->isA()->name();
//es=pFiler->writeString(str);
//if ( es != Acad::eOk )
// return (es) ;
es=(*it).second->dwgOutFields(pFiler);
if ( es != Acad::eOk )
return (es) ;
}
es=pFiler->filerStatus ();
return (pFiler->filerStatus ()) ;
}
Acad::ErrorStatus AuPolyline::dwgInFields (AcDbDwgFiler *pFiler) {
assertWriteEnabled () ;
//----- Read parent class information first.
Acad::ErrorStatus es =AcDbPolyline::dwgInFields (pFiler) ;
if ( es != Acad::eOk )
return (es) ;
//----- Object version number needs to be read first
Adesk::UInt32 version =0 ;
es =pFiler->readUInt32 (&version);
if (es != Acad::eOk )
return (es) ;
if ( version > AuPolyline::kCurrentVersionNumber )
return (Acad::eMakeMeProxy);
//- Uncomment the 2 following lines if your current object implementation cannot
//- support previous version of that object.
//if ( version < AuPolyline::kCurrentVersionNumber )
// return (Acad::eMakeMeProxy) ;
//----- Read params
//.....
Adesk::UInt32 n;
es=pFiler->readUInt32(&n);
if (es != Acad::eOk )
return (es) ;
for(int i=0;i<n;i++)
{
//using namespace AuPolyline::AcDbEntity;
SOSTAV s;
Adesk::UInt32 s1;
es=pFiler->readUInt32(&s1);
if (es != Acad::eOk )
return (es) ;
s=static_cast<SOSTAV>(s1);
ACHAR* str;
es=pFiler->readString(&str);
if (es != Acad::eOk )
return (es) ;
std::wstring ws=str;
if(ws==std::wstring(_T("MyHatch")))
{
MyHatch* pH=new MyHatch;
es=pH->dwgInFields(pFiler);
if (es != Acad::eOk )
return (es) ;
m_Array.insert(std::make_pair(s,pH));
}
else
{
acutPrintf(_T("неизвестный тип данных\n"));
return Acad::eNotOpenForRead;
}
}
es=pFiler->filerStatus ();
return (pFiler->filerStatus ()) ;
}[/code] |
|