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


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


// If this ASSERT fails, then the pixel size is really position-

// dependent.

//

ASSERT(!vportDrawContext->viewport()->isPerspective());

vportDrawContext->viewport()->getNumPixelsInUnitSquare(AcGePoint3d::kOrigin, pixelArea);

double halfGlyphSizeInDCS =

acdbCustomOsnapManager->osnapGlyphSize() * pixelArea.x / 2.0;

// Draw an asterisk with 4 segments.

//

sSegmentPoints[0].set(

mCurDCSLoc.x-halfGlyphSizeInDCS,

mCurDCSLoc.y-halfGlyphSizeInDCS, 0.0);

sSegmentPoints[1].set(

mCurDCSLoc.x+halfGlyphSizeInDCS,

mCurDCSLoc.y+halfGlyphSizeInDCS, 0.0);

vportDrawContext->geometry().polylineDc( 2, &(sSegmentPoints[0]));

sSegmentPoints[0].set(

mCurDCSLoc.x-halfGlyphSizeInDCS,

mCurDCSLoc.y+halfGlyphSizeInDCS, 0.0);

sSegmentPoints[1].set(

mCurDCSLoc.x+halfGlyphSizeInDCS,

mCurDCSLoc.y-halfGlyphSizeInDCS, 0.0);

vportDrawContext->geometry().polylineDc( 2, &(sSegmentPoints[0]));

sSegmentPoints[0].set(

mCurDCSLoc.x-halfGlyphSizeInDCS,

mCurDCSLoc.y, 0.0);

sSegmentPoints[1].set(

mCurDCSLoc.x+halfGlyphSizeInDCS,

mCurDCSLoc.y, 0.0);

vportDrawContext->geometry().polylineDc( 2, &(sSegmentPoints[0]));

sSegmentPoints[0].set(

mCurDCSLoc.x,

mCurDCSLoc.y-halfGlyphSizeInDCS, 0.0);

sSegmentPoints[1].set(

mCurDCSLoc.x,

mCurDCSLoc.y+halfGlyphSizeInDCS, 0.0);

vportDrawContext->geometry().polylineDc( 2, &(sSegmentPoints[0]));

};

 

AcmeSocketGlyph* pSocketGlyph = NULL;

 

// Master object for the socket custom Osnap mode.

//

class AcmeSocketMode : public AcDbCustomOsnapMode {

public:

virtual const char*

localModeString() const {return "SOCket"};

virtual const char*

globalModeString() const {return "SOCket"};

virtual const AcRxClass*

entityOsnapClass() const {return AcmeSocketInfo::desc());

virtual AcGiGlyph*

glyph() const {return pSocketGlyph;);

virtual const char*

tooltipString() const {return "Socket to Me?" };

};

 

static AcmeSocketMode* pSocketMode = NULL;

 




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



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