128 lines
4.8 KiB
C++
128 lines
4.8 KiB
C++
// Copyright (C), 1998-2007, Beijing Tangent Engineering Software Co. Ltd.
|
|
// = FileName: RoadDataCenterNew.h
|
|
// = Version: 8.5
|
|
// = Author: lgh
|
|
// = Date: 2010-9-27 9:40:07
|
|
// = Description: 道路数据处理中心。
|
|
// = Maintainers:
|
|
#pragma once
|
|
|
|
|
|
//#include "CADEnt.h"
|
|
#include "CADEntEdgeAdapter.h"
|
|
#include "Road.h"
|
|
#include "InterStruct.h"
|
|
|
|
/*
|
|
关于道路的边线处理规则:
|
|
边线跟道路发生相交生成的interStruct结构体数组跟道路做处理,处理的时候,interStruct需要处理,并且生成对应的路边。
|
|
相对应的路边,生成相对于interStruct之前的变现,并且处理倒角。
|
|
*/
|
|
|
|
struct ROAD_EDGE_STRUCT
|
|
{
|
|
AcAryLineEntEdgeAdapterPtr lineEdges; // 线段边线
|
|
AcAryArcEntEdgeAdapterPtr arcEdges; // 弧线边线
|
|
|
|
ArAryEntEdgeAdapterPointer arEnt; // 跟道路发生相交的CADent,用来负责重绘。
|
|
AcAryInterStructPointer intersOriginAll; // 包含所有的Inters. 负责最后清空内存。
|
|
|
|
AcAryInterStructPointer leftIntersIn, rightIntersIn;
|
|
AcAryInterStructPointer leftIntersAll, rightIntersAll;
|
|
};
|
|
|
|
struct ROAD_MID_STRUCT
|
|
{
|
|
AcAryLineEntEdgeAdapterPtr lineMids;
|
|
AcAryArcEntEdgeAdapterPtr arcMids;
|
|
|
|
AcAryInterStructPointer intersOriginAll; // 包含所有的Inters. 负责最后清空内存。
|
|
|
|
AcAryInterStructPointer leftInterMid;
|
|
AcAryInterStructPointer rightInterMid;
|
|
};
|
|
|
|
class CRoadDataCenterNew
|
|
{
|
|
public:
|
|
CRoadDataCenterNew(void);
|
|
~CRoadDataCenterNew(void);
|
|
|
|
// 添加道路,直线型,或者弧线型。
|
|
virtual void AddLineRoad(const CLineRoad &lineRoad);
|
|
virtual void AddArcRoad(const CArcRoad &arcRoad);
|
|
|
|
// 数据回退
|
|
virtual void RoolBack() const;
|
|
void ClearStep() const;
|
|
|
|
// 对道路的interStruct排序 //
|
|
static void SortInterStructsSimp(const AcGeLineSeg2d &lineDir, bool bSequence, AcAryInterStructPointer &arInterPointer);
|
|
static void SortInterStructsSimp(const AcGeCircArc2d &arcDir, bool bSequence, AcAryInterStructPointer &arInterPointer);
|
|
|
|
protected:
|
|
// 选择实体
|
|
static void SelectEntInCAD(const AcGePoint2d &ptLeftDown, const AcGePoint2d &ptRightUp,
|
|
AcAryLineEntEdgeAdapterPtr &lineEdges, AcAryArcEntEdgeAdapterPtr &arcEdges,
|
|
AcAryLineEntEdgeAdapterPtr &lineMids, AcAryArcEntEdgeAdapterPtr &arcMids);
|
|
|
|
//把单线实体处理为道路左边的实体,和道路右边的实体,并且携带信息,这些实体将会被处理
|
|
void DealLeftAndRightEnt(const CLineRoad &lineRoad, ROAD_MID_STRUCT &rms, ROAD_EDGE_STRUCT &res);
|
|
void DealLeftAndRightEnt(const CArcRoad &arcRoad, ROAD_MID_STRUCT &rms, ROAD_EDGE_STRUCT &res);
|
|
// 保存所有的rms的interStruct实体
|
|
static void SaveMidInterStruct(ROAD_MID_STRUCT &rms);
|
|
|
|
// 判断道路的过滤方式,目前的方式有:保留第一个,不保留第一个(间隔取路),可能还会增加其他的过滤方式。
|
|
CFilterMode FindFilterMode(const AcGeLineSeg2d &lineDir, bool bSequence, const AcAryInterStructPointer &aryInterPointer); // 道路应该执行何种过滤
|
|
CFilterMode FindFilterMode(const AcGeCircArc2d &arcDir, bool bSequence, const AcAryInterStructPointer &aryInterPointer); // 道路应该执行何种过滤
|
|
|
|
static int InterStuctRealIn(const AcAryInterStructPointer &aryAll, AcAryInterStructPointer &aryRealIn);
|
|
|
|
// 把相交结构体合并了。
|
|
void CombinInterStruct(const AcAryLineInterStruct &lineInters, const AcAryArcInterStruct &arcInters,
|
|
AcAryInterStructPointer &arInterPointer);
|
|
// 关于删除短的拆分线
|
|
static void RemoveShortInterStruct(AcAryInterStructPointer &aryInterStruct, double dTolLen);
|
|
static void RemoveShortInterStruct(ROAD_EDGE_STRUCT &res, double dTolLen);
|
|
// 如果当前道路被拆分出一些短小的“段”,因为不好对当前道路边线处理,则修改interStruct的内外属性,使之成为外部相交
|
|
static void ReTestInterStruct(ROAD_EDGE_STRUCT &res, const CRoad *pRoad, double dTolLen, bool bOldClock = false);
|
|
static void ReTestInterStruct(AcAryInterStructPointer &aryInterStruct, TGGeCurveSegment &curveSeg, double dTolLen, bool bOldClock = false);
|
|
|
|
// 生成道路边线。
|
|
static void CreateRoadEdgeStruct(ROAD_EDGE_STRUCT &res);
|
|
static void Clear(ROAD_EDGE_STRUCT &res, ROAD_MID_STRUCT &rms);
|
|
|
|
template <class TRoadDir>
|
|
friend void SortInterStructs(const TRoadDir &roadDir, bool bSequence, AcAryInterStructPointer &arInterPointer);
|
|
|
|
};
|
|
|
|
template <class TRoadDir>
|
|
void SortInterStructs(const TRoadDir &roadDir, bool bSequence, AcAryInterStructPointer &arInterPointer)
|
|
{
|
|
AcAryInterStructPointer arComplexStart, arComplexEnd, arSimple;
|
|
for (int i = 0; i < (int)arInterPointer.length(); i++)
|
|
{
|
|
if (arInterPointer[i]->IsComplexOut())
|
|
{
|
|
if (arInterPointer[i]->Position() == eRoadStartOut)
|
|
arComplexStart.append(arInterPointer[i]);
|
|
else if (arInterPointer[i]->Position() == eRoadEndOut)
|
|
arComplexEnd.append(arInterPointer[i]);
|
|
}
|
|
else
|
|
arSimple.append(arInterPointer[i]);
|
|
}
|
|
|
|
CRoadDataCenterNew::SortInterStructsSimp(roadDir, bSequence, arComplexStart);
|
|
CRoadDataCenterNew::SortInterStructsSimp(roadDir, bSequence, arComplexEnd);
|
|
CRoadDataCenterNew::SortInterStructsSimp(roadDir, bSequence, arSimple);
|
|
|
|
ClearAcaryAll(arInterPointer);
|
|
arInterPointer.append(arComplexStart);
|
|
arInterPointer.append(arSimple);
|
|
arInterPointer.append(arComplexEnd);
|
|
}
|
|
|
|
|