Files
envi-code/SourceCode/Code2026/tg_shs/shs_pipebase/TGripImp.cpp
T
2026-09-28 15:28:50 +08:00

88 lines
2.1 KiB
C++

#include "stdafx.h"
#include "TGripImp.h"
#include "TSupportFunc.h"
#if (ADS>15)
const TCHAR* GripCback::GripToolTipFunc(AcDbGripData* pThis)
{
TDb::GripAppData* pAppData = (TDb::GripAppData*)pThis->appData();
if (pAppData->pOwner != NULL)
{
TDbInterfacesObj* pObj = TDbInterfacesObj::cast(pAppData->pOwner);
if (pObj != NULL)
{
CString sText;
pObj->GetGripText(pAppData->nIndex,sText);
_tcscpy(pAppData->szTip,sText);
}
}
return pAppData->szTip;
}
bool GripCback::WorldDrawfunc( AcDbGripData* pThis,
AcGiWorldDraw* pWd,
const AcDbObjectId& entId,
AcDbGripOperations::DrawType type,
AcGePoint3d* cursor,
double dGripSize)
{
AcGePoint3d point = pThis->gripPoint();
AcGeVector3d normal(0,0,1);
AcGePoint3d ptGe[2],ptRec[4];
TDb::GripAppData* pAppData = (TDb::GripAppData*)pThis->appData();
if (pAppData->ePos >= TDb::eCommand0 && pAppData->ePos <= TDb::eCommand3)
{
//按 5 个像素点
int nColor = pWd->subEntityTraits().color();
pWd->subEntityTraits().setColor(255);
AcGiFillType eFill = pWd->subEntityTraits().fillType();
pWd->subEntityTraits().setFillType(kAcGiFillAlways);
// modify begin
// double dCmd = TSupportFunc::PixelToWcs(5);
// double dOne = TSupportFunc::PixelToWcs(1);
double dCmd = dGripSize;
double dOne = dGripSize/5;
// modify end by cq 2015-12-15 14:59:11 TFS9463 风管在布局里面选中后夹点变得很大 计算像素大小错误
//水平
ptGe[0] = point;
ptGe[0].x -= dCmd;
ptGe[1] = point;
ptGe[1].x += dCmd;
ptRec[0] = ptGe[0];
ptRec[0].y -= dOne;
ptRec[1] = ptGe[0];
ptRec[1].y += dOne;
ptRec[2] = ptGe[1];
ptRec[2].y += dOne;
ptRec[3] = ptGe[1];
ptRec[3].y -= dOne;
pWd->geometry().polygon(4,ptRec);
//垂直
ptGe[0] = point;
ptGe[0].y += dCmd;
ptGe[1] = point;
ptGe[1].y -= dCmd;
ptRec[0] = ptGe[0];
ptRec[0].x -= dOne;
ptRec[1] = ptGe[0];
ptRec[1].x += dOne;
ptRec[2] = ptGe[1];
ptRec[2].x += dOne;
ptRec[3] = ptGe[1];
ptRec[3].x -= dOne;
pWd->geometry().polygon(4,ptRec);
pWd->subEntityTraits().setFillType(eFill);
pWd->subEntityTraits().setColor(nColor);
}
return true;
}
#endif