所以这很酷。这有点像在抓地力中存储自己的自定义类。
像
这样简单的东西
- //
- class MyAppData
- {
- private:
- int m_val;
- public:
- MyAppData (int val): m_val(val){}
- virtual ~MyAppData(){ }
- void printval(void){acutPrintf(_T("\nGrip# %ld"),m_val);}
- int Val() const { return m_val; }
- };
然后
-
- Acad::ErrorStatus ExtCircle::getGripPoints (
- AcDbGripDataPtrArray &grips, const double curViewUnitSize, const int gripSize,
- const AcGeVector3d &curViewDir, const int bitflags) const
- {
- assertReadEnabled () ;
- AcDbGripData *pGrpCenter = new AcDbGripData();
- pGrpCenter->setGripPoint(this->center());
- pGrpCenter->setAppData((void*)new MyAppData(100));
- grips.append(pGrpCenter);
- double ang = 0.0;
- for(int idx = 1 ; idx center();
- p.x += this->radius() *cos(ang);
- p.y += this->radius() *sin(ang);
- ang += 6.28318531 / 32;
- pGrp->setGripPoint(p);
- // give the AcDbGripData a ptr
- pGrp->setAppData((void*)_data);
- pGrp->setAlternateBasePoint(new AcGePoint3d(this->center()));
- grips.append(pGrp);
- // keep a copy of ptr to free later
- ptrs->push_back(_data);
- }
- return Acad::eOk;
- }
然后
- Acad::ErrorStatus ExtCircle::moveGripPointsAt (
- const AcDbVoidPtrArray &gripAppData, const AcGeVector3d &offset,
- const int bitflags) {
- assertWriteEnabled();
- for(int i = 0; i Val())
- {
- case 100:
- transformBy(AcGeMatrix3d::translation(offset));
- break;
- default:
- this->setRadius(offset.length());
- }
- // run a method from the class
- p->printval();
- }
- return Acad::eOk;
- }
|