arx 代码
// <summary> Writes members out to the drawing filer. </summary>Acad::ErrorStatus TPG_Drawable::dwgOutFields(AcDbDwgFiler* filer) const
{
Acad::ErrorStatus es = TPG_Object::dwgOutFields(filer);
if (es != Acad::eOk)
return es;
Utilities::FilerUtilities::FileOutEntity(filer, mBody); Utilities::FilerUtilities::FileOutEntities(filer, mEdges);
filer->writePoint3d(mPlacement);
filer->writeVector3d(mOffset);
return filer->filerStatus();
}
/// <summary> Reads memebers in from the drawing filer. </summary>
Acad::ErrorStatus TPG_Drawable::dwgInFields(AcDbDwgFiler* filer)
{
Acad::ErrorStatus es = TPG_Object::dwgInFields(filer);
if (es != Acad::eOk)
return es;
Utilities::FilerUtilities::FileInEntity(filer, static_cast<AcDbEntity*&>(mBody));
Utilities::FilerUtilities::FileInEntities(filer, mEdges);
filer->readPoint3d(&mPlacement);
filer->readVector3d(&mOffset);
return filer->filerStatus();
}
/// <summary> Writes out the properties of a single entity. </summary>
static Acad::ErrorStatus FileOutEntity(AcDbDwgFiler* filer, const AcDbEntity* entity)
{
Adesk::Boolean isDef = entity ? Adesk::kTrue : Adesk::kFalse;
filer->writeBoolean(isDef);
if (isDef)
{
AcString name = entity->isA()->name();
filer->writeString(name);
entity->dwgOutFields(filer);
}
return filer->filerStatus();
}
/// <summary> Reads in the properties of a single entity. </summary>
static Acad::ErrorStatus FileInEntity(AcDbDwgFiler* filer, AcDbEntity*& entity)
{
if (entity)
{
delete entity;
entity = nullptr;
}
Adesk::Boolean isDef = Adesk::kFalse;
AcString name = L"";
filer->readBoolean(&isDef);
if (isDef)
{
filer->readString(name);
AcRxClass* rx = static_cast<AcRxClass*>(acrxClassDictionary->at(name));
if (rx)
{
entity = static_cast<AcDbEntity*>(rx->create());
if (entity)
entity->dwgInFields(filer);
else
filer->setFilerStatus(Acad::eNotAnEntity);
}
}
return filer->filerStatus();
}
页:
[1]