////////////////////////////////////////////////////////////////////////////// //文件: SegY文件操作类 //主要功能: // //程序编写: 2011-4-1 // // ///////////////////////////////////////////////////////////////////////////// #pragma once #include "DrawModel\ObjectSet.h" #include "SeisTraceData.h" #include "Texture.h" #include "Mesh2D.h" namespace NSeis { class CSeisLinePar { public: CSeisLinePar(); enum EColorType { colTypeSeis252 = 1, //地震剖面颜色级别,变密度颜色为252种 colTypeMesh = 2 //曲面颜色级别,为真彩色级 }; double Uniform(double a, double b) { //归一化振幅数据 a /= b; a *= m_dScaleFactor; //为了设置颜色区间时方便,将其控制在(-100, 100)内, 或不变 return a; } double m_dScaleFactor; //振幅放大因子,在地震剖面中为100,在MESH网格中为1 EColorType m_colorType; EUniformType m_uniformType; //归一化类型 }; //存储一个地震剖面的振幅数据,该剖面来自于二三维数据体,与之前的CTraceData类相似 class AFX_EXT_CLASS CSeisLineData { public: CSeisLineData(void); ~CSeisLineData(void); //创建振幅保存数组,为nCol道数据,每道数据为nRow个采样点,每个采样点字节长度根据类型获得 //内部按照列进行保存,每列连续数据为nRow个 bool Create(CSize sz, CFileSegy::EDataType eDataType = CFileSegy::typeIbmFloat); bool Create(int nRow, int nCol, CFileSegy::EDataType eDataType = CFileSegy::typeIbmFloat); virtual void Clear(); bool CreateTexture(CTexture* pTex, CColorBase& cb, int nBPP); bool ToMesh2D(CMesh2D& md); bool CreateFormMesh2D(CMesh2D& md); protected: //返回的指针需要外部使用delete删除,维数为剖面的行(x)列(y)数 unsigned char* CreateTexture(CColorBase& cb, int nBPP); public: int GetTotalBytes() { return m_traces[0]->GetBytesLength() * GetTraceCount(); } //获得数据的总字节数 int GetSampleCount() { return m_size.cx; } //每道数据的采样点个数 int GetTraceCount() { return m_size.cy; } //总道数 CFileSegy::EDataType GetDataType() { return m_eDataType; } //获得数据类型 EOrientation GetOrientation() { return m_eOrientation; } void SetOrientation(EOrientation eo) { m_eOrientation = eo; } inline CSize GetSize(void) { return m_size; } inline void SetSize(CSize sz) { m_size = sz; } //设置行列数,需要与add配合使用 inline void add( CSeisTraceData* td ) { m_traces += td; m_size.cy+=1; } inline CSeisTraceData* operator[](int nCol) const { return m_traces[nCol]; } inline CSeisTraceData* GetTrace(int nCol) const { return m_traces[nCol]; } //获得指定道数据指针 float GetValue(int nRow, int nCol); //获得指定行列的数据点(振幅值) CSeisTraceDataInfo& GetTraceDataInfo(int nCol) { return m_traces[nCol]->GetDataInfo(); } bool GetCurveCoordRC(CCurve& cv, bool bIsMaxRange); //获得所定义曲线的空间坐标 bool GetTraceCoordRC(int nTraceIndex, dfPoint& pt, bool bIsMaxRange); //获得指定道的坐标 bool GetCurveCoordXY(CCurve& cv, bool bIsMaxRange); //获得所定义曲线的空间坐标 bool GetTraceCoordXY(int nTraceIndex, dfPoint& pt, bool bIsMaxRange); //获得指定道的坐标 double GetMaxValue(int nCol) { return GetTraceDataInfo(nCol).m_dMaxValue;} //获得最大值, 0<=nRow& range) { m_zRange = range; } TInterval& GetTimeRange() { return m_zRange; } CCubeRange GetCubeRange(); //获得该剖面所涉及的最大最小线道号范围 void Serialize(CArchive& ar, const short &ver); bool WriteMesh(LPCTSTR lpszFileName); bool WriteTraceDataInfo(LPCTSTR lpszFileName); //写道统计信息 bool WriteSegy(LPCTSTR lpszFileName, unsigned short sample_interval = 1000); void WriteSegyTrace(CFileSegy& fw, int nTraceIndex, unsigned short sample_interval, char* pTraceHeader=NULL); void SetLinePar(CSeisLinePar& par) { m_sectionPar = par; } CSeisLinePar& GetLinePar() { return m_sectionPar; } protected: NSet::TObjectSet m_traces; //道数据 CSize m_size; //行列数,行cx:每道数据采样点个数,列cy:总共多少道数据, bool m_bLock; //该剖面是否锁定,锁定后该剖面仅能显示、不能编辑 CFileSegy::EDataType m_eDataType; //数据类型 EOrientation m_eOrientation; //剖面类型,是主测线剖面、联络测线剖面,还是自定义线剖面 TInterval m_zRange; //Z轴的开始、结束时间 CSeisLinePar m_sectionPar; }; }//namespace