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.

97 lines
3.3 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.

//////////////////////////////////////////////////////////////////////////////
//文件: 曲面文件操作类,该曲面具有三维坐标
//主要功能:
// 用于保存定义的任意线网格类,该网格类的坐标为一条曲线
//程序编写: 2011-5-5
//
//
/////////////////////////////////////////////////////////////////////////////
#pragma once
#include "DrawModel\curve.h"
#include "Mesh2D.h"
namespace NCube
{
//任意线曲面保存
class AFX_EXT_CLASS CMeshRand2D : public CMeshCoor3D
{
public:
CMeshRand2D(void);
~CMeshRand2D(void);
virtual void Empty(void);
//初始化参数,包括计算所有曲面的行列数,间隔,内存申请等
//pCurve曲线坐标
//aveStep平均步长将根据该步长计算每个线段间有多少道数据
// 为了保证每个坐标节点处对应一道数据,每线段间的步长会有一定的上下浮动
//startRange、endRange当前方向的开始结束值一般为该方向的最大最小值
bool Initial(CCurve& curve, double aveStep, double rangeStart, double rangeEnd, double rangeStep, EOrientation curOri);
bool Initial(CCurve& curve, double aveStep, TIntervalStep<double> range, EOrientation curOri);
//按照固定步长生成,坐标节点将根据步长有所改变
bool InitialFixedStep(CCurve& curve, double fixedStep, TIntervalStep<double> range, EOrientation curOri);
//曲线坐标是基于xy平面的
//绑定指定的剖面并根据剖面面的X坐标在曲线中插值平面坐标按照固定步长生成
bool AttachSection(CCurve& survey_xy, CGrid* pGridSection, EMeshType mtype);
CMeshRand2D& operator =(CMeshRand2D& mr);
//坐标曲线操作
bool GetCurveCoord(CCurve& cv, bool bIsMaxRange); //获得所定义曲线的空间坐标
int GetIndexTrace(int nCurveNodeIndex); //获得坐标曲线节点对应的数据道索引
double GetIndexTraceStep(int nCurveNodeIndex); //获得坐标曲线节点(该节点与前一节点组成的线段)对应的数据道步长
double GetPercent(int nCurveNodeIndex) //获得曲线节点所占的百分比数
{
return m_pCoor->l[nCurveNodeIndex]/m_pCoor->l[m_pCoor->num-1];
}
//道操作
bool GetTraceCoord(int nTraceIndex, dfPoint& pt, bool bIsMaxRange); //获得指定道的坐标
dfPoint GetCoordinate(int i, int j);
bool GetCoordinate(int i, int j, dfPoint& pt); //获得网格节点的实际空间坐标
void GetOriCoord(int j, CPoint3D& pt); //获得方向坐标
int Write(LPCTSTR lpszFileName);
void Write(CFile& fw, const short& ver);
int Read(CFile& fr, const short& ver);
virtual void Serialize(CArchive& ar, const short &ver);
bool WriteSegy(LPCTSTR lpszFileName);
protected:
int FindCurveNodeIndex(int nTraceIndex); //利用二分法快速定位
//每个坐标点的参数
class CPointIndex
{
public:
CPointIndex() { m_nTraceIndex = 0; m_dStep = 0; }
bool operator==( const CPointIndex& cs ) const { return m_nTraceIndex == cs.m_nTraceIndex; }
int m_nTraceIndex; //坐标所对应的道索引号
double m_dStep; //计算时该道的间隔,第一个点为原始间隔
};
CCurve* m_pCoor;//曲线坐标根据方向不同所代表的坐标也不同与范围m_range相结合形成三方向坐标
//切面沿Z值方向时=oriZslice 在XY形成的平面上画任意线坐标X为X坐标Y为Y
// X值方向时=oriInline 在YZ形成的平面上画任意线坐标X为Y坐标Y为Z
// Y值方向时=oriCrossline在XZ形成的平面上画任意线坐标X为X坐标Y为Z
TIntervalStep<double> m_range; //当前方向的开始结束值
//切面沿Z值方向时范围为Z值的最大最小
// X值方向时范围为X值的最大最小
// Y值方向时范围为Y值的最大最小
TTypeSet<CPointIndex> m_indexSet; //坐标对应的索引集
};
}//namespace
using namespace NCube;