You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

88 lines
3.6 KiB
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#pragma once
#include "DrawModel/Point2D.h"
#include "TrackObj.h"
//斜井道基类
class AFX_EXT_CLASS CInclinedTrack : public CTrackObj
{
protected:
//DECLARE_SERIAL(CInclinedTrack);
public:
CInclinedTrack();
CInclinedTrack(const CRect8& position);
virtual ~CInclinedTrack();
protected:
virtual void Init(); //初始化参数
public:
CCurveEx m_trajectoryLeft; //道左轨迹
CCurveEx m_trajectoryRight; //道右轨迹
//根据输入斜深计算左右边界点
bool GetBorderPoint(double inc_depth, CPoint2D& ptLeft, CPoint2D& ptRight);
//根据输入斜深s_depth到e_depth 获取边界散点 bLeftBorder true为左边界 false为右边界
bool GetBorderPoints(double s_depth, double e_depth, vector<dfPoint>& pts, bool bLeftBorder);
bool GetTrajLocation(void); //获取左右轨迹桩号
//由桩号比例获取左右道边界上的点
bool GetTrajPoint(double lratio, int& leftStart, int& rightStart, CPoint2D& ptLeft, CPoint2D& ptRight);
// 由给定桩号比例范围获取计算边界上某一段,得到的左右子边界点数相同,widthRatio为该段宽度占道宽的比例若>=1右边界直接从道右边界截取
bool GetCalcBorderSection(double ratio_start, double ratio_end, vector<dfPoint>& leftBorder, vector<dfPoint>& rightBorder, double widthRatio = 1);
//给定起止点桩号获取包含起止点在内的所有点桩号factor 为比例系数
int GetLocations(CCurve& curve, double lstart, double lend, list<double>& lstLocs, double factor = 1);
// 由给定桩号比例范围获取曲线段上的点存入vector<dfPoint>中
bool GetSubCurvePoints(CCurve& scrCurve, double ratio_start, double ratio_end, vector<dfPoint>& vecPoints);
//输入桩号和横向比例因子,获取两条曲线间的某点 2015-11-18
static bool GetPoint(CCurve& leftCurve, CCurve& rightCurve, double ll, double lr, double wratio, CPoint2D& destPt);
// Implementation
public:
virtual BOOL IsInRange(CRect8& range);//ggff
virtual void CalculateSize(CPoint2D point);
virtual void ComputeDisplayTrajectory(); //计算道轨迹
virtual void CalculateLeftBorder(CCurve* pIncurve, double dist); //由给定的曲线生成道左边界
virtual void CalculateRightBorder(CCurve* pIncurve, double dist); //由给定曲线和距离生成道右边界
virtual void DrawTrajectory(CXyDC* pDC);
//virtual void DrawTrackHeadLine(CXyDC* pDC, BOOL bFirst=FALSE); //ggff
//virtual void DrawTrackHead(CXyDC*pDC); //ggff
virtual void MoveTo(CRect8& position);
virtual void MoveHandleTo(int nHandle, CPoint2D point);
virtual BOOL Intersects(const CRect8& rect, double dHandleSize);
virtual void Serialize(CArchive& ar, const short &ver);
virtual void Draw(CXyDC* pDC);
// 画道背景
virtual void DrawFill(CXyDC* pDC);
// 计算道边界
virtual void CalcBorders();
//计算用到的左右边界
CCurveEx m_calcBorderLeft;
CCurveEx m_calcBorderRight;
protected: //计算中用到
//计算直线与CCurve的交点,startIndex为起点序号,若无返回false
bool GetCrossPoint(double a, double b, double x0, double y0, CCurve& pCur, int& startIndex, CPoint3D& cpt, double max_dist2);
//生成新的曲线 m_verticalPoints坐标在pSub上顺序与pOrig一一对应
void CreateNewCurve(CCurve& newCur);
//提取两点间结点重置桩号存入vec
void CreateSubNewCurve(int& startIndex, dfPoint& pt1, dfPoint& pt2, vector<CPoint3D>& newPts);
//深度转换为计算边界的桩号
double DepthToLocation(double dep);
double DepthToLocation(double dep, double locdepFactor);
//获取相应比例处的分割曲线
bool CreateSliptterline(CCurve& destCurve, double ratio);
//道内元素计算用到的左右边界,两条线具有相同桩号
CCurveEx* m_pOrigBorder; //基准边界
CCurveEx* m_pSubjBorder; //对侧边界
vector<dfPoint> m_verticalPoints; //基准边界在对侧边界上对应垂直CPoint3D 存储 x,y,lsub, lorig
vector<CPoint2D> m_CurveRightPtVec, m_CurveLeftPtVec; //曲线点对应的左右边界点,画杆状图时有用。
};