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



     плющилки зерна |          

Пример заказного режима объектной привязки - часть 2


AcArray<int>& geomIdsForLines)

};

Acad::ErrorStatus

AcmeSocketForLine::getOsnapInfo(

AcDbEntity* pickedObject,

int,

const AcGePoint3d& pickPoint,

const AcGePoint3d&,

const AcGeMatrix3d& viewXform,

AcArray<AcGePoint3d>& snapPoints,

AcArray<int>& geomIdsForPts,

AcArray<AcGeCurve3d>& snapCurves,

AcArray<int>& geomIdsForLines)

{

// Protocol extension ensures that the following assertion

// is always true, but check in non-production versions

// just to be safe.

//

ASSERT(pickedObject->isKindOf(AcDbLine::desc()));

// In production, a hard cast is fastest.

AcDbLine* lineEnt = (AcDbLine*)pickedObject;

// Do computation using AcDbLine protocol, pickPoint, and

// viewXform. For example, if you want to find the closest

// socket to the pick point and return just that, set

// snapPoints and geomIdsForPts accordingly.

// But this isn’t an AutoSnap mode...

//

snapLiness.setLogicalLength(0);

geomIdsForLines.setLogicalLength(0);

}

// Actual protocol extension objects

//

static AcmeSocketInfo* pDefaultSocketInfo = NULL;

static AcmeSocketForLine* pSocketForLine = NULL;

// "SOCket" Osnap mode glyph object

//

class AcmeSocketGlyph : public AcGiGlyph

{

public:

virtual Acad::ErrorStatus

setLocation(const AcGePoint3d& dcsPoint);

virtual void

viewportDraw(AcGiViewportDraw* vportDrawContext);

private:

AcGePoint3d mCurDcsLoc;

};

Acad::ErrorStatus

AcmeSocketGlyph::setLocation(const AcGePoint3d& dcsPoint)

{

mCurDCSLoc = dcsPoint;

}

// These variables are extremely transient, and are

// made static to save constructor/destructor cost.

static AcGePoint2d& sPixelArea;

AcArray<AcGePoint3d> sSegmentPoints[2];

void

AcmeSocketGlyph::viewportDraw(AcGiViewportDraw* vportDrawContext)

{

// Taking mCurDCSLoc, the pixel size, and the AutoSnap

// marker size into account, plus anything else, such as socket

// orientation, draw the glyph.




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