////////////////////////////////////////////////////////////////////////////// //文件: SegY文件操作类 //主要功能: // 完成剖面、切片切的功能,管理已切好的剖面、切片 //程序编写: 2011-11-29 // // ///////////////////////////////////////////////////////////////////////////// #pragma once #include "AttachBase.h" #include "BuilderBase.h" #include "RowColRange.h" namespace NSeis { //需要绑定一个CBuilderBase对象 class AFX_EXT_CLASS CSeisBox : public CAttachBase { public: CSeisBox(void); ~CSeisBox(void); //指针仅是指向,内部不进行删除 CBuilderBase* GetBuilder() { return (CBuilderBase*)GetInput(); } CSeisSurvey3D& GetSurvey() { return GetBuilder()->GetSurvey(); } void Clear(); void operator = (CSeisBox& id); bool CreateCubeSection(int nMode); //nMode=1,六面体, nMode=2为交叉剖面 //将所有剖面及切片颜色设置为指定颜色,并重新生成材质 bool CreateTexture(CColorBase& cb, int nBPP); bool CreateTexture(); //////////////////////////////////////////////////////////////////////////// //Create函数中返回int值为生成结果在列表中的索引号,-1表示生成失败 ///////////////////////////////////////////////////////////////////////////// //生成切片或剖面,输出结果为线道号坐标,内部存储对象为CMeshRand2D //EOrientation方向可以为主测线、联络测线、切片三个方向 // 根据定义的曲线生成不规则切片或剖面,曲线为线道号坐标 int CreateRandMeshRC(IN CCurve* pCurve, EOrientation curOri); // 根据定义的曲线生成不规则切片或剖面,曲线为实际坐标 int CreateRandMeshXY(IN CCurve* pCurve, EOrientation curOri); ///////////////////////////////////////////////////////////////////////////// //生成切片,内部存储对象为CMesh2D // 获得等时切片,输出结果为线道号坐标 int CreateSliceUp(float z_value, bool bLineValue = false); // 根据解释层位等数据读取不等时切片,输入的曲面中坐标为线道号 // dn:输出曲面,坐标为线道号 // pInsuf:输入曲面,坐标为线道号 int CreateSliceRC(IN CDimension2D* pInSuf, bool bLineValue = true); // 根据解释层位等数据读取不等时切片,输入的曲面中坐标为实际坐标 // dn:输出曲面,坐标为实际坐标 // pInsuf:输入曲面,坐标为实际坐标 int CreateSliceXY(IN CDimension2D* pInSuf, bool bLineValue = true); ///////////////////////////////////////////////////////////////////////////// //生成不规则测线剖面,内部存储对象为CSeisLineData // 根据定义的曲线生成不规则剖面,曲线为XY平面的线道号坐标 int CreateRandLineRC(IN CCurve* pCurve); // 根据定义的曲线生成不规则剖面,曲线为XY平面的实际坐标 int CreateRandLineXY(IN CCurve* pCurve); ////////////////////////////////////////////////////////////////////////////////////////// //线道号将根据areaSnapStep状态是否进行取整 //读取一条主测线地震剖面 int CreateInline(float row_line_num, bool bReMemory = true); //读取一条联络测线地震剖面 int CreateCrossline(float col_line_num, bool bReMemory = true); // 重新计算内部线道号和时间 void CalculateItem(CCubeRange& ro,CCubeRange& rn); void SetCubeRange(CCubeRange& range) { m_range = range; } CCubeRange& GetCubeRange() { return m_range; } bool WriteSegy(LPCTSTR lpszFileName); //根据当前指定的范围写子体 ////////////////////////////////////////////////////////////////////////////////////// //> start //> 切片中涉及到的类型,为了保存设置信息 enum ESectionType { modeNone = 0, modeInline = 1, ///< 主测线剖面 modeCrossLine, ///< 联络线剖面, 指针为CSeisLineData对象 modeSlice, ///< 等时切片 modeSurfaceSlice, ///< 沿层切片, 指针为CMesh2D对象 modeRandomLine, ///< 任意线剖面, 指针为CSeisLineData对象 modeRandomSlice, ///< 任意线切片, 指针为CMeshRand2D对象,也可以为剖面方向 }; ////////////////////////////////////////////////////////////////////// //基础类型 class AFX_EXT_CLASS CSectionItem : public CAttachBase { public: CSectionItem(CSeisBox* pParentList) { SetParentList(pParentList); m_type = modeNone; m_pTexture = NULL; m_nBPP = 32; } ~CSectionItem(void); virtual void Clear(); virtual bool CreateTexture() { return false; } virtual CTexture* GetTexture() { return m_pTexture; } virtual bool RecreateSection() { return m_pParentList->RecreateSection(this); } //获得曲面绑定的曲线空间坐标 virtual bool GetCurveCoordRC(CCurve& cv, bool bIsMaxRange) { return false; } void SetParentList(CSeisBox* pParentList) { m_pParentList = pParentList; } void operator = (CSectionItem& si); ESectionType m_type; CColorBase m_colbar; int m_nBPP; CTexture* m_pTexture; CSeisBox* m_pParentList; }; //克隆一个新元素对象,返回其指针,需要在外部删除 int GetCount() { return m_sections.size(); } CSectionItem* CloneItem(IN CSectionItem* pItem); CSectionItem* GetAt(int nIndex) { return m_sections[nIndex]; } CSectionItem* operator[] (int nIndex) { return m_sections[nIndex]; } void RemoveAt(int nIndex); void Remove(CSectionItem* pItem); bool IsEmpty(); //使用其内部的参数重新生成所有剖面 bool RecreateSection(void); //根据指定索引,使用其内部的参数重新生成剖面 bool RecreateSection(int nIndex); //使用指定的参数的剖面信息重新生成剖面,一般情况下是在其参数修改后调用 bool RecreateSection(CSectionItem* pItem); virtual int AfterCreate(CSectionItem* pItem); //返回在数组中的索引号 //获得指定项显示曲面的最大最小值 bool GetItemMaxMin(CSectionItem* pItem, double& dmin, double& dmax); ////////////////////////////////////////////////////////////////////////////////////////////// //其它类型 class AFX_EXT_CLASS CSectionItemLine : public CSectionItem { public: CSectionItemLine(CSeisBox* pParentList); CSeisLineData* GetData(){ return (CSeisLineData*)GetInput(); } EOrientation GetOrientation() { return GetData()->GetOrientation(); } //获得曲面绑定的曲线空间坐标 virtual bool GetCurveCoordRC(CCurve& cv, bool bIsMaxRange); virtual void Clear(); virtual bool CreateTexture(); void operator = (CSectionItemLine& id); float line_value; //主测线或联络测线号 }; class AFX_EXT_CLASS CSectionItemRandLine : public CSectionItemLine { public: CSectionItemRandLine(CSeisBox* pParentList); virtual void Clear(); void operator = (CSectionItemRandLine& id); //获得曲面绑定的曲线空间坐标 virtual bool GetCurveCoordRC(CCurve& cv, bool bIsMaxRange); CCurve* m_pCurve; //保存原始定义的曲线 }; class AFX_EXT_CLASS CSectionItemSlice : public CSectionItem { public: CSectionItemSlice(CSeisBox* pParentList); CMesh2D* GetData() { return (CMesh2D*)GetInput(); } virtual bool CreateTexture(); virtual void Clear(); void operator = (CSectionItemSlice& id); //获得曲面绑定的曲线空间坐标 virtual bool GetCurveCoordRC(CCurve& cv, bool bIsMaxRange); float zslice_value; //为等时切片时的时间值,沿层切片不使用该参数 bool m_bLineValue; }; class AFX_EXT_CLASS CSectionItemSurfaceSlice : public CSectionItemSlice { public: CSectionItemSurfaceSlice(CSeisBox* pParentList); virtual void Clear(); void operator = (CSectionItemSurfaceSlice& id); //需要单独处理 //获得曲面绑定的曲线空间坐标 virtual bool GetCurveCoordRC(CCurve& cv, bool bIsMaxRange) { return false; } //仅是指向 CDimension2D* m_pSurface; }; class AFX_EXT_CLASS CSectionItemRandSlice : public CSectionItem { public: CSectionItemRandSlice(CSeisBox* pParentList); virtual bool CreateTexture(); //获得曲面绑定的曲线空间坐标 virtual bool GetCurveCoordRC(CCurve& cv, bool bIsMaxRange); virtual void Clear(void); CMeshRand2D* GetData() { return (CMeshRand2D*)GetInput(); } void operator = (CSectionItemRandSlice& id); CCurve* m_pCurve; EOrientation m_ori; }; //> stop ////////////////////////////////////////////////////////////////////////////////////// protected: TObjectSet m_sections; //生成的所有剖面或切片 CCubeRange m_range; //体范围,所有剖面或切片所在的最大最小范围 }; //体管理,包括整个体及子体的管理 class AFX_EXT_CLASS CSeisCubeSet : public TObjectSet , public CAttachBase { public: CSeisCubeSet(); virtual ~CSeisCubeSet(); //输入pInput指针可是指向,也可内部自动删除 virtual bool AttachInput(void* pBuilderBase, bool bAutoDelete = false); virtual void Clear(); CBuilderBase* GetBuilder() { return (CBuilderBase*)GetInput(); } CSeisSurvey3D& GetSurvey() { return GetBuilder()->GetSurvey(); } //nMode=0,不生成剖面 //nMode=1,六面体, //nMode=2,为交叉剖面 int CreateCube(int nMode); //自动建立一个全范围体 int CreateCube(CCubeRange range, int nMode);//生成子体,返回索引号 }; }//namespace