//-----------------------------------------------------------------------------
//----- RivilisPointMonitor.cpp : Implementation of RivilisPointMonitor
//-----------------------------------------------------------------------------
#include "StdAfx.h"
#include <dbobjptr2.h>
#include "RivilisPointMonitor.h"
//-----------------------------------------------------------------------------
ACRX_CONS_DEFINE_MEMBERS(RivilisPointMonitor, AcEdInputPointMonitor, 1)
//-----------------------------------------------------------------------------
RivilisPointMonitor::RivilisPointMonitor(AcApDocument *pDoc) : AcEdInputPointMonitor(), mpDocument(pDoc) {
if (pDoc)
{
pDoc->inputPointManager()->addPointMonitor(this);
pDoc->inputPointManager()->turnOnForcedPick();
}
}
//-----------------------------------------------------------------------------
RivilisPointMonitor::~RivilisPointMonitor() {
Detach();
}
//-----------------------------------------------------------------------------
void RivilisPointMonitor::Attach(AcApDocument *pDoc) {
Detach();
if (mpDocument == NULL)
{
if ((mpDocument = pDoc) != NULL)
{
pDoc->inputPointManager()->addPointMonitor(this);
pDoc->inputPointManager()->turnOnForcedPick();
}
}
}
void RivilisPointMonitor::Detach() {
if (mpDocument)
{
mpDocument->inputPointManager()->turnOffForcedPick();
mpDocument->inputPointManager()->removePointMonitor(this);
mpDocument = NULL;
}
}
AcApDocument *RivilisPointMonitor::Subject() const {
return (mpDocument);
}
bool RivilisPointMonitor::IsAttached() const {
return (mpDocument != NULL);
}
//-----------------------------------------------------------------------------
bool RivilisPointMonitor::excludeFromOsnapCalculation(
const AcArray<AcDbObjectId> &nestedEntity,
Adesk::GsMarker gsSelectionMark
) {
return (AcEdInputPointMonitor::excludeFromOsnapCalculation(nestedEntity, gsSelectionMark));
}
//-----------------------------------------------------------------------------
Acad::ErrorStatus RivilisPointMonitor::monitorInputPoint(
bool &appendToTooltipStr,
ACHAR *&additionalTooltipString,
AcGiViewportDraw *drawContext,
AcApDocument *document,
bool pointComputed,
int history,
const AcGePoint3d &lastPoint,
const AcGePoint3d &rawPoint,
const AcGePoint3d &grippedPoint,
const AcGePoint3d &cartesianSnappedPoint,
const AcGePoint3d &osnappedPoint,
AcDb::OsnapMask osnapMask,
const AcArray<AcDbCustomOsnapMode *> &customOsnapModes,
AcDb::OsnapMask osnapOverrides,
const AcArray<AcDbCustomOsnapMode *> &customOsnapOverrides,
const AcArray<AcDbObjectId> &apertureEntities,
const AcArray<AcDbObjectIdArray, AcArrayObjectCopyReallocator<AcDbObjectIdArray> > &nestedApertureEntities,
const AcArray<Adesk::GsMarker> &gsSelectionMark,
const AcArray<AcDbObjectId> &keyPointEntities,
const AcArray<AcDbObjectIdArray, AcArrayObjectCopyReallocator<AcDbObjectIdArray> > &nestedKeyPointEntities,
const AcArray<Adesk::GsMarker> &keyPointGsSelectionMark,
const AcArray<AcGeCurve3d *> &alignmentPaths,
const AcGePoint3d &computedPoint,
const ACHAR *tooltipString
) {
appendToTooltipStr = false;
if (pointComputed)
{
if (apertureEntities.length() > 0)
{
AcDbSmartObjectPointer<AcDbEntity> pEnt(apertureEntities.first(), AcDb::kForRead);
if (pEnt.openStatus() == Acad::eOk)
{
TCHAR mtooltipStr[1024]; _tcsncpy(mtooltipStr, _T("\0"), 1024);
_tcscpy(mtooltipStr, _T("Iam ]]><Bold>BOLD</Bold><LineBreak/><![CDATA[Iam ]]><Italic>Italic</Italic><LineBreak/><![CDATA[Iam Normal"));
appendToTooltipStr = true;
additionalTooltipString = _tcsdup(mtooltipStr);
}
}
}
return (Acad::eOk);
}