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.

125 lines
3.3 KiB
C++

//////////////////////////////////////////////////////////////////////////////
//文件: 曲面文件操作类,扩展三维坐标
//主要功能:
// 用于保存网格类,该网格类的第三方坐标可以为一个,也可以为多个
//程序编写: 2011-5-5
//
//
/////////////////////////////////////////////////////////////////////////////
#pragma once
#include "SeisSurvey3D.h"
#include "Texture.h"
namespace NCube
{
class AFX_EXT_CLASS CMeshCoor3D : public CMeshBase
{
public:
CMeshCoor3D(void);
~CMeshCoor3D(void);
EOrientation GetOrientation() { return m_eOrientation; }
void SetOrientation(EOrientation ori) { m_eOrientation = ori; }
bool CreateTexture(CTexture* pTex, CColorBase& cb, int nBPP);
void operator =(CMeshCoor3D& mb);
public:
EOrientation m_eOrientation;
};
//二维水平或垂直曲面类,该曲面可以是一个平面类型的,也可以是一个曲面类型的
//平面类型时:第三方坐标均相同,仅一个值;
//曲面类型时:第三方坐标与网格数相同,每个网格点对应一个
class AFX_EXT_CLASS CMesh2D : public CMeshCoor3D
{
public:
CMesh2D(void);
~CMesh2D(void);
enum ECoorType
{
typeSameOne = 1, //第三个坐标仅有一个相同值
typePerOne //每一个数据点处均有一个第三个坐标
};
//仅有一个相同第三个坐标
int CreateSameOne( double x0, double y0, double z0,
int m, int n, double dm, double dn, EOrientation ori);
//每一个数据点处有一个第三个坐标时
//需要设置每一个点处的第三方坐标值,然后必须设置第三个坐标的范围
int CreatePerOne( double x0, double y0, double z0,
int m, int n, double dm, double dn, EOrientation ori);
virtual void Empty();
double Value(double x0, double y0, double z0);
inline double Value(double x0, double y0) { return m_pMesh->Value(x0, y0);}
//设置原点坐标(最小坐标)
void SetCoordinate(double x0, double y0, double z0);
CPoint3D GetMaxPoint();
CPoint3D GetMinPoint();
bool GetCurveCoord(CCurve& cv, bool bIsMaxRange); //获得所定义曲线的空间坐标
double xmin(void);
double xmax(void);
double ymin(void);
double ymax(void);
double zmin(void);
double zmax(void);
CPoint3D GetCoordinate(int i, int j);
void GetCoordinate(int i, int j, CPoint3D& pt);
double x(int i, int j);
double y(int i, int j);
double z(int i, int j);
CMesh2D& operator = (CMesh2D& md);
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);
//操作第三个坐标的函数//////////////////////////////////////////////////////////////////
double GetCoor3RD(int i, int j);
void SetCoor3RD(int i, int j, double coor);
void SetCoor3RD(int i, int j, CPoint3D& pt); //根据方向设置第三个坐标
inline double GetCoor3RD(int nIndex) { return m_pCoor3RD[nIndex]; }
inline void SetCoor3RD(int nIndex, double coor) { m_pCoor3RD[nIndex] = coor; }
int GetCoor3RDCount(void); //获得第三个坐标的个数
void GetCoor3RDRange(); //自动获得第三个坐标的范围
inline void SetCoor3RDRange(double dmin, double dmax)
{
m_dCoor3RDRange[0] = dmin;
m_dCoor3RDRange[1] = dmax;
}
protected:
//切片的方向,对应如下:
// 方向 第三方坐标为
// Inline x
// Crossline y
// ZSlice z
//第三个坐标
double* m_pCoor3RD; //根据定义的曲面的方向不同,所代表的值也不同
ECoorType m_eCoorType; //第三个坐标的类型
double m_dCoor3RDRange[2]; //第三个坐标的最小最大范围
};
}//namespace
using namespace NCube;