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.

114 lines
3.7 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.

//////////////////////////////////////////////////////////////////////////////
//文件: SegY文件操作类
//主要功能:
//
//程序编写: 2011-4-1
//
//
/////////////////////////////////////////////////////////////////////////////
#pragma once
#include "SeisSampleInfo.h"
#include "SeisSurvey2D.h"
namespace NSeis
{
/////////////////////////////////////////////////////////////////////////////////////
//2D数据体的线定位信息每一条CLineData为一条线
class AFX_EXT_CLASS CSeisIndexLine2D
{
public:
CSeisIndexLine2D();
~CSeisIndexLine2D();
bool NextTrace(int& col); //获得下一道的道号,也就是增加了一个步长
bool PrevTrace(int& col); //获得上一道的道号,也就是减少了一个步长
bool GetIndexPoint(int col, OUT CSeisIndexPoint& gp); //根据道号获得坐标及文件定位
CPoint2D GetCoordinate(int col); //根据道号插值坐标,该道号可以不在曲线道号范围内
int GetCoorCount(); //获得坐标点个数
int GetCoordinate(CPointList& dp); //获得坐标点点中L为道号
int GetSurveyCurve(CSurveyLine* pCurve); //获得测线,包括坐标、桩号、名称等值
//根据参数测线重置索引中的坐标,该曲线中必须有桩号L索引中的桩号必须与之匹配
int MatchingCoordinate(CCurve* pInCurve);
int size() const { return segments.size(); } //返回线段的个数
int GetTraceCount() const; //获得总道数
bool GetRange(TInterval<int>& range) const; //获得道号范围
int GetRange(CRect8& range); //获得坐标范围,返回参与运算的点个数
CSeisSampleInfo& GetSampleInfo(){ return m_sampleInfo; }
void WriteDFD(CFile& fw); //将inline测线保存为DFD文件以便检查是否正确
void Write(CFile& fw, const short& ver);
int Read(CFile& fr, const short& ver);
void Serialize(CArchive& ar, const short &ver);
//对二维测线坐标进行数据冗余,为了减少内在占用及提高加载速度
void CoorRedundant(double dError = 1e-3);
void operator=(CSeisIndexLine2D& sl);
///////////////////////////////////////////////////////////////////////////////////////
class AFX_EXT_CLASS CSegment2D : public TIntervalStep<int>
{
public:
//可以有任意多个坐标点坐标中的z值是对应的道号
TTypeSet<CPoint3D> coors; //每道的坐标集合其中Z值是与坐标相对应的道号这样坐标个数可以是>=2的任意个数
TIntervalStep<__int64> m_pos; //对应道号在文件中的位置,
//根据道号获得坐标及文件定位
bool GetIndexPoint(int col, OUT CSeisIndexPoint& gp); //根据道号获得坐标
void GetPointWithIndex(int nIndex, OUT CSeisIndexPoint& gp); //根据坐标索引获得坐标
int GetRange(CRect8& range); //获得坐标范围
int GetCoorCount(); //获得坐标点个数
int GetCoordinate(CPointList& dp); //获得坐标点点中l为道号
inline void operator=(CSegment2D& sg)
{
*(TIntervalStep<int>*)this = *(TIntervalStep<int>*)&sg;
m_pos = sg.m_pos;
coors = sg.coors;
}
};
////////////////////////////////////////////////////////////////////////////////////////
CString m_strFileName; //与该体数据对应的SegY文件
CSeisSampleInfo m_sampleInfo; //地震剖面的采样点信息
CString line_name; //线号
TObjectSet<CSegment2D> segments; //道的集合,考虑使用CSegment2D仅是为了防止道号间隔不同的情况
};
//管理二维SegY文件中的线道号、坐标及道在文件中的位置每个剖面是一个CLineData对象
class AFX_EXT_CLASS CSeisIndex2D : public TObjectSet<CSeisIndexLine2D>
{
public:
CSeisIndex2D(void);
~CSeisIndex2D(void);
int GetRange(CRect8& range); //获得坐标范围,返回参与运算的点个数
int FindLine (LPCTSTR lpszLineName) const;
bool GetIndexPoint(LPCTSTR lpszLineName, int col, OUT CSeisIndexPoint& gp);
bool GetSurvey2D(CSeisSurvey2D& sd);
void WriteDFD(LPCTSTR lpszFileName); //将测线保存为DFD文件以便检查是否正确
void Write(LPCTSTR lpszFileName);
void Write(CFile& fw, const short& ver);
int Read(CFile& fr, const short& ver);
void Serialize(CArchive& ar, const short &ver);
void operator = (CSeisIndex2D& si);
};
}//namespace