109 lines
3.6 KiB
C++
109 lines
3.6 KiB
C++
#include "stdafx.h"
|
|
#include "RoadEdgeCreater.h"
|
|
#include "RoolBackNew.h"
|
|
#include "RoadDataCenterNew.h"
|
|
|
|
CRoadDataCenterNew::CRoadDataCenterNew(void)
|
|
{
|
|
}
|
|
|
|
CRoadDataCenterNew::~CRoadDataCenterNew(void)
|
|
{
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CRoadDataCenterNew::AddLineRoad(const CLineRoad &lineRoad)
|
|
{
|
|
CDataRoolBack::AddNewStep();
|
|
|
|
// 从CAD中大致选择实体
|
|
ROAD_EDGE_STRUCT res;
|
|
ROAD_MID_STRUCT rms;
|
|
AcGePoint2d ptLeftDown, ptRightUp;
|
|
lineRoad.ToRegionSys(ptLeftDown, ptRightUp);
|
|
SelectEntInCAD(ptLeftDown, ptRightUp, res.lineEdges, res.arcEdges, rms.lineMids, rms.arcMids);
|
|
|
|
// CAD中的实体被处理为这些携带相关信息的结构。
|
|
// 处理成道路结构体
|
|
DealLeftAndRightEnt(lineRoad, rms, res);
|
|
|
|
// 对左边的,和右边的arInterStruct分别执行合并
|
|
SortInterStructs(lineRoad.LeftLine(), true, res.leftIntersAll);
|
|
SortInterStructs(lineRoad.RightLine(), true, res.rightIntersAll);
|
|
// 将细小的线段删除。防止引起错误。(刚刚处理完毕之后就进行该项操作。)
|
|
RemoveShortInterStruct(res, lineRoad.TolLen());
|
|
ReTestInterStruct(res, &(lineRoad), lineRoad.TolLen());
|
|
|
|
InterStuctRealIn(res.leftIntersAll, res.leftIntersIn);
|
|
InterStuctRealIn(res.rightIntersAll, res.rightIntersIn);
|
|
|
|
// 过滤模式,--在计算所有的interStruct之后,道路边线的裁剪规则(哪一段应该删除,哪一段应该显示)
|
|
CFilterMode leftFilter, rightFilter;
|
|
leftFilter = FindFilterMode(lineRoad.LeftLine(), true, res.leftIntersIn);
|
|
rightFilter = FindFilterMode(lineRoad.RightLine(), true, res.rightIntersIn);
|
|
|
|
CLineRoadEdgeCreater lineEdgeCreater(&lineRoad,
|
|
res.leftIntersAll, res.rightIntersAll,
|
|
res.leftIntersIn, res.rightIntersIn,
|
|
rms.leftInterMid, rms.rightInterMid,
|
|
leftFilter, rightFilter);
|
|
lineEdgeCreater.MakeCorner();
|
|
lineEdgeCreater.MakeRoad();
|
|
CreateRoadEdgeStruct(res);
|
|
Clear(res, rms);
|
|
}
|
|
|
|
|
|
|
|
void CRoadDataCenterNew::AddArcRoad(const CArcRoad &arcRoad)
|
|
{
|
|
CDataRoolBack::AddNewStep();
|
|
|
|
// 从CAD中大致选择实体
|
|
ROAD_MID_STRUCT rms;
|
|
ROAD_EDGE_STRUCT res;
|
|
AcGePoint2d ptLeftDown, ptRightUp;
|
|
arcRoad.ToRegionSys(ptLeftDown, ptRightUp);
|
|
SelectEntInCAD(ptLeftDown, ptRightUp, res.lineEdges, res.arcEdges, rms.lineMids, rms.arcMids);
|
|
|
|
// CAD中的实体被处理为这些携带相关信息的结构。
|
|
// 处理成道路结构体
|
|
DealLeftAndRightEnt(arcRoad, rms, res);
|
|
|
|
// 对左边的,和右边的arInterStruct分别执行合并
|
|
SortInterStructs(arcRoad.LeftArc(), true, res.leftIntersAll);
|
|
SortInterStructs(arcRoad.RightArc(), true, res.rightIntersAll);
|
|
// 将细小的线段删除。防止引起错误。(刚刚处理完毕之后就进行该项操作。)
|
|
RemoveShortInterStruct(res, arcRoad.TolLen());
|
|
ReTestInterStruct(res, &(arcRoad), arcRoad.TolLen(), arcRoad.MidArc().isClockWise() == Adesk::kTrue ? true : false);
|
|
|
|
InterStuctRealIn(res.leftIntersAll, res.leftIntersIn);
|
|
InterStuctRealIn(res.rightIntersAll, res.rightIntersIn);
|
|
|
|
// 过滤模式,--在计算所有的interStruct之后,道路边线的裁剪规则(哪一段应该删除,哪一段应该显示)
|
|
CFilterMode leftFilter, rightFilter;
|
|
leftFilter = FindFilterMode(arcRoad.LeftArc(), true, res.leftIntersIn);
|
|
rightFilter = FindFilterMode(arcRoad.RightArc(), true, res.rightIntersIn);
|
|
|
|
CArcRoadEdgeCreater arcEdgeCreater(&arcRoad, res.leftIntersAll, res.rightIntersAll, res.leftIntersIn, res.rightIntersIn,
|
|
rms.leftInterMid, rms.rightInterMid, leftFilter, rightFilter);
|
|
arcEdgeCreater.MakeCorner();
|
|
arcEdgeCreater.MakeRoad();
|
|
CreateRoadEdgeStruct(res);
|
|
Clear(res, rms);
|
|
}
|
|
|
|
void CRoadDataCenterNew::RoolBack() const
|
|
{
|
|
CDataRoolBack::RoolAStep();
|
|
}
|
|
|
|
void CRoadDataCenterNew::ClearStep()const
|
|
{
|
|
CDataRoolBack::ClearAllStep();
|
|
}
|
|
|