Files
envi-code/SourceCode/Code2026/tg_shs/shs_siteplan/DrawRoadCmd.cpp
T

114 lines
2.6 KiB
C++
Raw Normal View History

2026-10-04 00:04:20 +08:00
#include "stdafx.h"
2026-09-28 15:28:50 +08:00
2026-10-04 00:04:20 +08:00
#include "DrawRoadDlg.h" // 引入绘制道路对话框头文件
2026-09-28 15:28:50 +08:00
#include "TRoadDragJig.h"
#include "RoadFillterMgr.h"
//////////////////////////////////////////////////////////////
//
2026-10-04 00:04:20 +08:00
// 命令函数:道路绘制
2026-09-28 15:28:50 +08:00
//
//////////////////////////////////////////////////////////////
using namespace RoadDrag;
CStateData* ConRoadStateClass(TRoadDragContext::ESequence eSequence, TRoadDragJig *pJig, TRoadDragContext *pContex)
{
switch (eSequence)
{
case TRoadDragContext::eFirstIn:
return new CFirstInState(pJig, pContex);
break;
case TRoadDragContext::eLineRoad:
return new CLineRoadState(pJig, pContex);
break;
case TRoadDragContext::eNextLineRoad:
return new CNextLineRoadState(pJig, pContex);
break;
case TRoadDragContext::eThirdLineRoad:
return new CThirdLineRoadState(pJig, pContex);
break;
case TRoadDragContext::eArcRoad:
return new CArcRoadState(pJig, pContex);
break;
case TRoadDragContext::eNextArcRoad:
return new CNextArcRoadState(pJig, pContex);
break;
case TRoadDragContext::eArcMidRoad:
return new CMidArcRoadState(pJig, pContex);
break;
default:
return NULL;
break;
}
}
void DrawRoadCmd()
{
CDrawRoadDlg dlg(acedGetAcadFrame());
{
CAcModuleResourceOverride vTemp;
if ( !dlg.Create(dlg.IDD, acedGetAcadFrame()) )
return;
}
dlg.ShowWindow(SW_SHOW);
acedGetAcadDwgView()->SetFocus();
2026-10-04 00:04:20 +08:00
// jig负责控制实时显示
2026-09-28 15:28:50 +08:00
TRoadDragJig jig(&dlg);
2026-10-04 00:04:20 +08:00
// 道路手工绘制时,保存的上下文,以及一些相关数据
2026-09-28 15:28:50 +08:00
TRoadDragContext context(&dlg);
2026-10-04 00:04:20 +08:00
// 道路绘制状态类,供jig调用
2026-09-28 15:28:50 +08:00
CStateData *pState = NULL;
while (context.GetSequenceState() != TRoadDragContext::eSequenceCancel &&
context.GetSequenceState() != TRoadDragContext::eSequenceOk)
{
ASSERT(pState == NULL);
pState = ConRoadStateClass(context.GetSequenceState(), &jig, &context);
jig.SetState(pState);
jig.DoIt();
delete pState;
pState = NULL;
}
dlg.SetCmdNum(0);
if (IsWindow(dlg.m_hWnd))
dlg.DestroyWindow();
}
//////////////////////////////////////////////////////////////
//
2026-10-04 00:04:20 +08:00
// 命令函数:道路圆角
2026-09-28 15:28:50 +08:00
//
//////////////////////////////////////////////////////////////
void FilletRoadCmd()
{
CRoadFillterMgr mgrFillt;
BOOL ret = FALSE;
2026-10-04 00:04:20 +08:00
// 选择道路边线
2026-09-28 15:28:50 +08:00
while(TRUE)
{
if (!mgrFillt.SelectRoad())
{
return;
}
mgrFillt.MakeFilroadConnect();
if (mgrFillt.IsSameCenter())
2026-10-04 00:04:20 +08:00
{// 如果是同圆心的,需要对道路两两进行一次分组(道路的两边)(识别出来道路)
2026-09-28 15:28:50 +08:00
mgrFillt.GroupConnect();
}
2026-10-04 00:04:20 +08:00
// 执行倒角
2026-09-28 15:28:50 +08:00
if (!mgrFillt.FilltRoad())
2026-10-04 00:04:20 +08:00
acedPrompt(_T("\nz,无法正确倒角!"));
2026-09-28 15:28:50 +08:00
mgrFillt.Draw();
mgrFillt.ReleaseMem();
}
}