ObjectARX, AutoCAD. Среда программирования библиотеки C++



         

Формирование Иерархии Монопольных использований - часть 3


// Since objects of this class will be in the Named

// Objects Dictionary tree and may be hard referenced

// by some other object, to support wblock we need to

// file out our owner as a hard pointer Id so that it

// will be added to the list of objects to be wblocked

//

if (filer->filerType() == AcDb::kWblockCloneFiler)

filer->writeHardPointerId((AcDbHardPointerId)ownerId());

filer->writeItem(mIntval);

filer->writeItem(mObjId);

return filer->filerStatus();

}

// Files data in from a DXF file.

//

Acad::ErrorStatus

AsdkOwnerDemo::dxfInFields(AcDbDxfFiler* filer)

{

assertWriteEnabled();

Acad::ErrorStatus es;

if ((es = AcDbObject::dxfInFields(filer)) != Acad::eOk)

{

return es;

}

// Check if we’re at the right subclass data marker.

//

if (!filer->atSubclassData("AsdkOwnerDemo")) {

return Acad::eBadDxfSequence;

}

struct resbuf inbuf;

while (es == Acad::eOk) {

if ((es = filer->readItem(&inbuf)) == Acad::eOk) {

if (inbuf.restype == AcDb::kDxfInt16) {

mIntval = inbuf.resval.rint;

} else if (inbuf.restype == AcDb::kDxfHardOwnershipId)

{

acdbGetObjectId(mObjId,

inbuf.resval.rlname);

}

}

}

return filer->filerStatus();

}

// Files data out to a DXF file.

//

Acad::ErrorStatus

AsdkOwnerDemo::dxfOutFields(AcDbDxfFiler* filer) const

{

assertReadEnabled();

AcDbObject::dxfOutFields(filer);

filer->writeItem(AcDb::kDxfSubclass, "AsdkOwnerDemo");

filer->writeItem(AcDb::kDxfInt16, mIntval);

// Null object IDs are invalid: don’t write them out.

//

if (mObjId.asOldId() != 0L) {

filer->writeItem(AcDb::kDxfHardOwnershipId, mObjId);

}

return filer->filerStatus();

}

// Creates an AsdkOwnerDemo object (pObjC) and adds data to

// it. Then, AsdkOwnerDemo pObjC is created and set to be

// the owner of pObjC. Next, AsdkOwnerDemo pObjA is created

// and set to own pObjB. Finally, pObjA is added to a

// dictionary in the named object dictionary. Technically,

// we could just add pObjA to the named object dictionary




Содержание  Назад  Вперед