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


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


private:

Adesk::Int16 mIntval;

AcDbHardOwnershipId mObjId;

};

ACRX_DXF_DEFINE_MEMBERS(AsdkOwnerDemo, AcDbObject,

AcDb::kDHL_CURRENT, AcDb::kMReleaseCurrent, 0,

ASDKOWNERDEMO, OWNERSHIP);

// Gets the value of the integer data member.

//

Adesk::Int16

AsdkOwnerDemo::intData()

{

assertReadEnabled();

return mIntval;

}

// Sets the value of the integer data member.

//

Acad::ErrorStatus

AsdkOwnerDemo::setIntData(const Adesk::Int16& val)

{

assertWriteEnabled();

mIntval = val;

return Acad::eOk;

}

// Returns a copy of the ownership ID data member.

//

AcDbHardOwnershipId

AsdkOwnerDemo::idData()

{

assertReadEnabled();

return mObjId;

}

// Sets the value of the ownership ID data member.

//

Acad::ErrorStatus

AsdkOwnerDemo::setIdData(const AcDbHardOwnershipId& ownedId)

{

if (ownedId.asOldId() == 0L) {

return Acad::eInvalidInput;

}

assertWriteEnabled();

mObjId = ownedId;

// Now set the backpointer. A transaction is used for

// opening the object, so if the object is already

// open it won’t prevent this setting from taking place.

//

AcDbObject *pObj;

AcTransaction *pTrans

= actrTransactionManager->startTransaction();

pTrans->getObject(pObj, ownedId, AcDb::kForWrite);

pObj->setOwnerId(objectId());

actrTransactionManager->endTransaction();

return Acad::eOk;

}

// Files data in from a DWG file.

//

Acad::ErrorStatus

AsdkOwnerDemo::dwgInFields(AcDbDwgFiler* filer)

{

assertWriteEnabled();

AcDbObject::dwgInFields(filer);

// For wblock filing we wrote out our owner as a hard

// pointer Id so now we need to read it in to keep things

// in sync.

//

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

AcDbHardPointerId id;

filer->readItem(&id);

}

filer->readItem(&mIntval);

filer->readItem(&mObjId);

return filer->filerStatus();

}

// Files data out to a DWG file.

//

Acad::ErrorStatus

AsdkOwnerDemo::dwgOutFields(AcDbDwgFiler* filer) const

{

assertReadEnabled();

AcDbObject::dwgOutFields(filer);




Начало  Назад  Вперед



Книжный магазин