209 lines
3.7 KiB
C++
209 lines
3.7 KiB
C++
#include "StdAfx.h"
|
|
#include "aecSectionDirJig.h"
|
|
|
|
TDbSectionDirEntity::TDbSectionDirEntity()
|
|
{}
|
|
|
|
TDbSectionDirEntity::~TDbSectionDirEntity()
|
|
{}
|
|
|
|
void TDbSectionDirEntity::SetDirToPoint(AcGePoint3d& ptTo2)
|
|
{
|
|
m_ptTo2 = ptTo2;
|
|
}
|
|
|
|
void TDbSectionDirEntity::SetBasePoint(AcGePoint3d& ptFr,AcGePoint3d& ptTo)
|
|
{
|
|
m_ptFr = ptFr;
|
|
m_ptTo = ptTo;
|
|
}
|
|
|
|
#if ARX < 18
|
|
Adesk::Boolean TDbSectionDirEntity::worldDraw (AcGiWorldDraw *mode)
|
|
{
|
|
return worldDraw2d(mode);
|
|
}
|
|
#else
|
|
Adesk::Boolean TDbSectionDirEntity::subWorldDraw (AcGiWorldDraw *mode)
|
|
{
|
|
return worldDraw2d(mode);
|
|
}
|
|
#endif
|
|
|
|
Adesk::Boolean TDbSectionDirEntity::worldDraw2d(AcGiWorldDraw *mode)
|
|
{
|
|
AcGePoint3d ptGe[5];
|
|
ptGe[0] = m_ptFr;
|
|
ptGe[1] = m_ptTo;
|
|
|
|
AcGeLine3d ln(m_ptFr,m_ptTo);
|
|
AcGePoint3d ptTo2 = ln.closestPointTo(m_ptTo2);
|
|
|
|
AcGeVector3d vt = m_ptTo2 - ptTo2;
|
|
ptGe[2] = m_ptTo + vt;
|
|
ptGe[3] = m_ptFr + vt;
|
|
ptGe[4] = ptGe[0];
|
|
mode->geometry().polyline(5,ptGe);
|
|
return Adesk::kTrue;
|
|
}
|
|
|
|
TDbSectionDirJig::TDbSectionDirJig(void)
|
|
{
|
|
m_pEnt = NULL;
|
|
}
|
|
|
|
TDbSectionDirJig::~TDbSectionDirJig(void)
|
|
{
|
|
if (m_pEnt != NULL)
|
|
delete m_pEnt;
|
|
}
|
|
|
|
void TDbSectionDirJig::SetSectionLine(ads_point ptFr,ads_point ptTo)
|
|
{
|
|
ads_point ptFr1,ptTo1;
|
|
acdbUcs2Wcs(ptFr,ptFr1,false);
|
|
acdbUcs2Wcs(ptTo,ptTo1,false);
|
|
m_ptFr = asPnt3d(ptFr1);
|
|
m_ptTo = asPnt3d(ptTo1);
|
|
}
|
|
|
|
BOOL TDbSectionDirJig::DoIt()
|
|
{
|
|
if (m_pEnt != NULL)
|
|
delete m_pEnt;
|
|
m_pEnt = new TDbSectionDirEntity;
|
|
|
|
m_pEnt->SetBasePoint(m_ptFr,m_ptTo);
|
|
|
|
AcEdJig::DragStatus eStat;
|
|
setDispPrompt(_T("\n请指定剖面的范围方向:"));
|
|
eStat = drag();
|
|
|
|
if (eStat == AcEdJig::kNormal)
|
|
{
|
|
return TRUE;
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
AcEdJig::DragStatus TDbSectionDirJig::sampler()
|
|
{
|
|
setUserInputControls( ( UserInputControls)
|
|
( AcEdJig::kAccept3dCoordinates |
|
|
AcEdJig::kNullResponseAccepted ) );
|
|
|
|
static AcGePoint3d ptMid,ptTo2;
|
|
ptMid.set( (m_ptFr.x + m_ptTo.x ) / 2.0,(m_ptFr.y + m_ptTo.y ) / 2.0,(m_ptFr.z + m_ptTo.z ) / 2.0);
|
|
|
|
AcEdJig::DragStatus eStat;
|
|
eStat = acquirePoint(m_ptTo2,ptMid);
|
|
|
|
if (eStat == AcEdJig::kNormal)
|
|
{
|
|
if ( ptTo2.isEqualTo(m_ptTo2))
|
|
{
|
|
//鼠标原地不动
|
|
return AcEdJig::kNoChange;
|
|
}
|
|
ptTo2 = m_ptTo2;
|
|
m_pEnt->SetDirToPoint(ptTo2);
|
|
}
|
|
return eStat;
|
|
}
|
|
|
|
AcDbEntity* TDbSectionDirJig::entity() const
|
|
{
|
|
return m_pEnt;
|
|
}
|
|
|
|
Adesk::Boolean TDbSectionDirJig::update()
|
|
{
|
|
return Adesk::kTrue;
|
|
}
|
|
|
|
void TDbSectionDirJig::GetDirPoint(AcGePoint3d& ptDirTo)
|
|
{
|
|
ptDirTo = m_ptTo2;
|
|
}
|
|
|
|
TDbSectionPosJig::TDbSectionPosJig(void)
|
|
{
|
|
m_pEnt = NULL;
|
|
m_ptTo.set(0.0,0.0,0.0);
|
|
}
|
|
|
|
TDbSectionPosJig::~TDbSectionPosJig(void)
|
|
{
|
|
}
|
|
|
|
BOOL TDbSectionPosJig::DoIt()
|
|
{
|
|
if (m_pEnt != NULL)
|
|
delete m_pEnt;
|
|
m_pEnt = new TDbSectionDirEntity;
|
|
//m_pEnt->SetDirToPoint(m_ptTo);
|
|
|
|
AcEdJig::DragStatus eStat;
|
|
setDispPrompt(_T("\n请指定视图的放置位置:"));
|
|
eStat = drag();
|
|
|
|
if (eStat == AcEdJig::kNormal)
|
|
{
|
|
return TRUE;
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
void TDbSectionPosJig::GetPosPoint(AcGePoint3d& ptTo)
|
|
{
|
|
ptTo = m_ptTo;
|
|
}
|
|
|
|
AcEdJig::DragStatus TDbSectionPosJig::sampler()
|
|
{
|
|
setUserInputControls( ( UserInputControls)
|
|
( AcEdJig::kAccept3dCoordinates |
|
|
AcEdJig::kNullResponseAccepted ) );
|
|
|
|
static AcGePoint3d ptTo;
|
|
|
|
AcEdJig::DragStatus eStat;
|
|
eStat = acquirePoint(m_ptTo);
|
|
|
|
if (eStat == AcEdJig::kNormal)
|
|
{
|
|
if ( ptTo.isEqualTo(m_ptTo))
|
|
{
|
|
//鼠标原地不动
|
|
return AcEdJig::kNoChange;
|
|
}
|
|
ptTo = m_ptTo;
|
|
|
|
AcGePoint3d ptFr1,ptTo1;
|
|
ptFr1 = ptTo;
|
|
ptFr1.x -= m_dW / 2.0;
|
|
ptFr1.y -= m_dH / 2.0;
|
|
|
|
ptTo1 = ptTo;
|
|
ptTo1.x -= m_dW / 2.0;
|
|
ptTo1.y += m_dH / 2.0;
|
|
|
|
m_pEnt->SetBasePoint(ptFr1,ptTo1);
|
|
|
|
ptTo1 = ptTo;
|
|
ptTo1.x += m_dW / 2.0;
|
|
m_pEnt->SetDirToPoint(ptTo1);
|
|
}
|
|
return eStat;
|
|
}
|
|
|
|
AcDbEntity* TDbSectionPosJig::entity() const
|
|
{
|
|
return m_pEnt;
|
|
}
|
|
|
|
Adesk::Boolean TDbSectionPosJig::update()
|
|
{
|
|
return Adesk::kTrue;
|
|
}
|