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.

99 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-7-21
//
//
/////////////////////////////////////////////////////////////////////////////
#pragma once
#include "SeisReader3D.h"
#include "BuilderBase.h"
namespace NSeis
{
class AFX_EXT_CLASS CSeisBuilder3D
: public CBuilderBase
{
public:
CSeisBuilder3D(void);
~CSeisBuilder3D(void);
virtual bool AttachInput(void* pIndex3D, bool bAutoDelete = false); //参数为CSeisIndex3D对象
virtual void Clear();
virtual float GetSampleInterval(); //获得采样间隔为了写SegY剖面时使用
///< 判断是否可以启动线程当返回false时将不启动线程
virtual bool IsCanThread();
bool Load(LPCTSTR lpszSegyName, CSeisTraceHeader* pth, CSeisFileHeader* pfh=NULL);
void SetHeader(CSeisTraceHeader* pth, CSeisFileHeader* pfh);
bool InitWithIndex(); //根据建立好的索引初始化测网及读取器
bool InitFileHeader(); //根据设定的SegY文件初始化文件头
//获得三维体中的指定点的数据值
virtual double Value(double x, double y, double z);
virtual double Value(int row, int col, int k);
virtual CColorBase& GetColorBar() { return GetIndex()->GetColorBar(); }
/////////////////////////////////////////////////////////////////////////////
//读取一条主测线地震剖面
bool CreateLine(CSeisLineData& sd, CSeisIndexLine3D* pIndexLine3D, bool bReMemory=true);
//读取一条任意线剖面数据
bool CreateRandLine(CSeisLineData& sd, CSeisIndexRandomLine* pIndexRandLine, bool bReMemory=true);
//根据m_survey3D与行列号重新设置m_pIndex3D中的坐标
void ResetCoordWithRowCol();
//获得指定剖面的最大最小坐标,isCoor为true时表示获得坐标范围为false表示获得线道号范围
bool GetInlineRange(int inline_num, CPoint3D& minPoint, CPoint3D& maxPoint, bool isCoor);
bool GetCrosslineRange(int crossline_num, CPoint3D& minPoint, CPoint3D& maxPoint, bool isCoor);
inline CSeisIndex3D* GetIndex() { return (CSeisIndex3D*)GetInput(); }
inline virtual CSeisSurvey3D& GetSurvey() { return GetIndex()->GetSurvey(); }
//设置/获得 剖面时间显示范围设置显示范围时必须在InitWithIndex初始化完成后
// 参数为时间值,内部将转换为采样点索引号
void SetRangeZ(TInterval<float>& range);
// 参数为采样点索引号
void SetRangeZ(TInterval<int>& range);
inline TInterval<int> GetRangeZI() { return GetSampleInfo().GetTimeRange(); }
inline TInterval<float> GetRangeZF() { return GetSurvey().zRange(); }
inline CSeisReader3D& GetReader() { return m_reader3D; }
virtual CSeisSampleInfo& GetSampleInfo() { return GetIndex()->m_sampleInfo; }//获得采样点信息
bool IsEmpty();
void Write(CFile& fw, const short& ver);
int Read(CFile& fr, const short& ver);
void Serialize(CArchive& ar, const short &ver);
void WriteSurvey(LPCTSTR lpszFileName);
void WriteSegy(LPCTSTR lpszFileName, CSeisLineData& sd); //将指定的剖面保存为SegY文件
void WriteAscii(LPCTSTR lpszFileName, CSeisLineData& sd, CSeisTraceData::EOutType ot); //输出为指定的文本格式
CSeisBuilder3D& operator=(CSeisBuilder3D& sb);
protected:
virtual bool CreateData(); //不使用线程方式
protected:
//三维数据读取器(读取并形成剖面、切片),内部包含时间范围
CSeisReader3D m_reader3D;
//设定读取的SegY文件参数定位,可以直接使用InitFileHeader从SegY文件进行初始化
//保存从文件中初始化的参数定义,当该参数不正确时可人为进行设定
CSeisFileHeader fileHeader;
CSeisTraceHeader traceHeader;
};
}//namespace
using namespace NSeis;