153 lines
5.8 KiB
C++
153 lines
5.8 KiB
C++
// Copyright (C), 1998-2007, Beijing Tangent Engineering Software Co. Ltd.
|
|
// = FileName: RoadEdgeCreater.h
|
|
// = Version: 8.5
|
|
// = Author: lgh
|
|
// = Date: 2010-9-28 15:44:32
|
|
// = Description: 该类专门用来生成道路边线
|
|
// = Maintainers:
|
|
#pragma once
|
|
|
|
#include "Road.h"
|
|
#include "commonRoad.h"
|
|
|
|
class CRoadEdgeCreater
|
|
{
|
|
public:
|
|
CRoadEdgeCreater(const CRoad *pRoad,
|
|
AcAryInterStructPointer &leftInterStruct, AcAryInterStructPointer &rightInterStruct,
|
|
AcAryInterStructPointer &leftInterStructIn, AcAryInterStructPointer &rightInterStructIn,
|
|
AcAryInterStructPointer &leftInterStructMid, AcAryInterStructPointer &rightInterStructMid,
|
|
CFilterMode &leftFilterMode, CFilterMode &rightFiltMode);
|
|
virtual ~CRoadEdgeCreater(void);
|
|
|
|
virtual void MakeRoad() = 0; //
|
|
virtual void MakeCorner() = 0;
|
|
|
|
public:
|
|
|
|
BOOL IsDrawMid() const {return m_pRoad->IsDrawMid();}
|
|
// 获取关于倒角的interStruct;
|
|
CInterStruct *GetInterStructInside(bool bLeft, bool bStart)const;
|
|
CInterStruct *GetInterStructOutside(bool bLeft, bool bStart) const;
|
|
// 检测道路两一条边线的该端是否能够具备外边线,对应的本道路是否需要做倒角
|
|
bool TestOtherEdgeOfCorner(bool bIsLeft, bool bIsStart);
|
|
// 查找匹配的第一个interStruct,如果没有则返回空
|
|
static CInterStruct* FindFirstInterStruct(const AcAryInterStructPointer &arInterStruct, EPointAtRoadInDir eAtRoadDir, int &nIndex);
|
|
// 反向查找匹配的第一个interStruct,如果没有则返回空
|
|
static CInterStruct* AntiFindFirstInterStruct(const AcAryInterStructPointer &arInterStruct, EPointAtRoadInDir eAtRoadDir, int &nIndex);
|
|
|
|
// 道路边线的最后一根是否需要保留
|
|
static BOOL KeepLast(const AcAryInterStructPointer &arInterStructIn, const CFilterMode &filterMode);
|
|
|
|
// 添加倒角圆弧(保存,并非真正添加到数据库)
|
|
virtual void AddInterCircle(AcGeCircArc2d &arc, BOOL bMid = FALSE);
|
|
|
|
// 检测被识别为道路的两条边线是否和道路发生相交()
|
|
static BOOL IsOutInterStuctPair(CInterStruct *pInter1, CInterStruct *pInter2);
|
|
// 获取内部对道路执行拆分的InterStruct
|
|
static int GetInterStructRealIn(const AcAryInterStructPointer &arInterAll, const CFilterMode &filterMode, AcAryInterStructPointer &arInterRealIn);
|
|
void DrawInterCircle();
|
|
void DrawInterStruct(); // 绘制InterStruct数组。
|
|
|
|
// 删除那些在道路内的中线
|
|
void FilterMidRoad(); // 根据拐角对中线直线过滤。
|
|
void FilterMidRoad(AcAryInterStructPointer &arMidInterStruct); // 根据拐角对中线直线过滤。
|
|
|
|
// 生成道路边线,为了在模板函数中使用,作为同名函数。
|
|
void ReSetEdge(const AcGePoint2d &point, bool bStart, AcGeLineSeg2d &lineEdge);
|
|
void ReSetEdge(const AcGePoint2d &point, bool bStart, AcGeCircArc2d &arcEdge);
|
|
// 元素arCurrInterStruct中两个元素之间的距离。
|
|
static int LenBetweenElement(AcAryInterStructPointer &arCurrInterStruct,
|
|
CInterStruct *pInterStructInside,
|
|
CInterStruct *pInterStructOutside);
|
|
|
|
protected:
|
|
template <class TRoadEdge>
|
|
friend void MakeACornerTem(bool bIsLeft, bool bIsStart, TRoadEdge &leftEdge, TRoadEdge &rightEdge, TRoadEdge &midEdge, CRoadEdgeCreater *pThisCreater);
|
|
|
|
protected:
|
|
const CRoad *m_pRoad; // 要处理的道路
|
|
AcAryInterStructPointer &m_arLeftInterStruct; // 道路的上部interStruct;
|
|
AcAryInterStructPointer &m_arRightInterStruct; // 道路的下部interStruct;
|
|
|
|
AcAryInterStructPointer &m_arleftInterStructIn; // left道路内部的interSturct;
|
|
AcAryInterStructPointer &m_arrightInterStructIn; //right道路内部的interStruct;
|
|
|
|
AcAryInterStructPointer &m_arLeftMidInterStruct; // 道路 上部中线interStruct;
|
|
AcAryInterStructPointer &m_arRightMidInterStuct; // 道路的下部中线interStruct;
|
|
|
|
AcAryInterStructPointer m_arMidInterstructDump;
|
|
|
|
AcAryInterStructPointer m_arRecreateMidInterStruct; // 需要生成的中线
|
|
|
|
CFilterMode m_filterModeLeft; // 道路的过滤模式
|
|
CFilterMode m_filterModeRight;
|
|
|
|
AcAryCircArc2d m_arInterCircle;
|
|
AcAryCircArc2d m_arMidInterCircle;
|
|
};
|
|
|
|
|
|
class CLineRoadEdgeCreater : public CRoadEdgeCreater
|
|
{
|
|
public:
|
|
CLineRoadEdgeCreater (const CRoad *pRoad,
|
|
AcAryInterStructPointer &leftInterStruct, AcAryInterStructPointer &rightInterStruct,
|
|
AcAryInterStructPointer &leftInterStructin, AcAryInterStructPointer &rightInterStructin,
|
|
AcAryInterStructPointer &leftInterStructMid, AcAryInterStructPointer &rightInterStructMid,
|
|
CFilterMode &leftFilterMode, CFilterMode &rightFiltMode);
|
|
|
|
virtual void MakeRoad(); //
|
|
virtual void MakeCorner(); //
|
|
|
|
private:
|
|
// 拐角处理
|
|
void MakeACorner(bool bIsLeft, bool bIsStart);
|
|
void MakeRoadIn(AcAryInterStructPointer &arInterStructRealIn, AcGeLineSeg2d &edge);
|
|
// 添加道路边线
|
|
void AddEdge(AcGeLineSeg2d &lineSeg);
|
|
void DrawMid();
|
|
protected:
|
|
virtual void DrawRoadEdge();
|
|
protected:
|
|
AcGeLineSeg2d m_leftedge; // 左侧道路剩余未处理的部分
|
|
AcGeLineSeg2d m_rightEdge; // 右侧道路剩余未处理的部分
|
|
|
|
AcGeLineSeg2d m_midEdge; // 中线,如果需要绘制的中线,则将它转换成DbLine;
|
|
|
|
// 边线处理结果
|
|
AcAryLineSeg2d m_edgeAry;
|
|
};
|
|
|
|
class CArcRoadEdgeCreater : public CRoadEdgeCreater
|
|
{
|
|
public:
|
|
CArcRoadEdgeCreater (const CRoad *pRoad, AcAryInterStructPointer &leftInterStruct, AcAryInterStructPointer &rightInterStruct,
|
|
AcAryInterStructPointer &leftInterStructin, AcAryInterStructPointer &rightInterStructin,
|
|
AcAryInterStructPointer &leftInterStructMid, AcAryInterStructPointer &rightInterStructMid,
|
|
CFilterMode &leftFilterMode, CFilterMode &rightFiltMode);
|
|
virtual void MakeRoad(); // 生成道路
|
|
virtual void MakeCorner(); // 生成道路拐角
|
|
|
|
private:
|
|
// 处理对应的道路拐角
|
|
void MakeACorner(bool bIsLeft, bool bIsStart);
|
|
// 生成道路边线(内部的)
|
|
// arInterStructRealIn: arc道路边线上的interStruct。edge。道路的边线,(左或者右)
|
|
void MakeRoadIn(AcAryInterStructPointer &arInterStructRealIn, AcGeCircArc2d&edge);
|
|
// 添加道路边线
|
|
void AddEdge(AcGeCircArc2d &arc);
|
|
|
|
|
|
void DrawMid();
|
|
protected:
|
|
virtual void DrawRoadEdge();
|
|
protected:
|
|
AcGeCircArc2d m_leftedge; // 左侧道路剩余未处理的部分
|
|
AcGeCircArc2d m_rightEdge; // 右侧道路剩余未处理的部分
|
|
|
|
AcGeCircArc2d m_midEdge; // 中心线,如果需要绘制中心线,则将它绘制成DbArc;
|
|
|
|
// 边线处理结果
|
|
AcAryCircArc2d m_edgeAry;
|
|
}; |