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.

151 lines
4.4 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 "RowColRange.h"
#include "CoorTransform.h"
#include "SeisSampleInfo.h"
#include "SeisSurvey2D.h"
namespace NSeis
{
enum EOrientation
{
oriInline = 0,
oriCrossline = 1,
oriZslice = 2,
oriRandline = 3 //仅在CSeisLineData中使用
};
//! Defines policy for 2D and 3D Data type
enum EPolicy2D3D
{
polOnly3D = 0,
polBoth2DAnd3D = 1,
polOnly2D = 2
};
enum EAreaStyle
{
areaWork = 0x00000001, //使用工作区
areaSnapStep = 0x00000002, //按照整步长计算
areaAutoDelete = 0x00000004, //是否自动删除
};
//三维地震测网信息,包括该测网的:
// 1、坐标与线道号的相互转换
// 2、经纬度定义信息
// 3、内部包括两个体用户显示的线道号及Z方向范围及步长工作体测网体
class AFX_EXT_CLASS CSeisSurvey3D
{
public:
CSeisSurvey3D(void);
~CSeisSurvey3D(void);
public:
CPoint2D toXY(int row, int col) { return m_b2c.toXY(row, col); }
CPoint2D toXY( const CRowCol& rc ) { return m_b2c.toXY(rc); }
CPoint2D toXY( const CPoint2D& rc ) { return m_b2c.toXY(rc.x0, rc.y0); }
CRowCol toRC( const CPoint2D& pt );
CRowCol toRC( double x, double y );
CPoint2D toRCF( const CPoint2D& pt );
CPoint2D toRCF( double x, double y );
void toRCF( CCurve& cv, bool bAutoLocation = true ); //将实际坐标转换为线道号坐标
void toXY( CCurve& cv, bool bAutoLocation = true ); //将线道号坐标转换为实际坐标
CRowCol RCF2RC( const CPoint2D& pt );
/*!<\note CRowCol will be snapped using work step. */
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
//Start Work
bool IsWork() { return (m_nFlags & areaWork) ? true:false; }
void EnableWork(bool bWork);
//根据EnableWork设定的状态获得是整个工区还是工作工区的参数
TIntervalStep<int> inlRange();
TIntervalStep<int> crlRange();
TIntervalStep<float>& zRange();
CCubeRange& GetCubeRange() { return IsWork() ? m_workCube : m_surveyCube; }
void GetRange(CPoint3D& minpt, CPoint3D& maxpt);
CPoint3D minCoord();
CPoint3D maxCoord();
bool isInside(const CRowCol&) const;
void WriteSurvey(LPCTSTR lpszFileName);
//生成实际二维曲线
bool GetSurvey2D(CSeisSurvey2D& sd, LPCTSTR lpszInlHead = NULL, LPCTSTR lpszCrlHead = NULL);
//End Work
////////////////////////////////////////////////////////////////////////////////////////
int inlSnap(double row);
int crlSnap(double col);
float zSnap(double z);
int inlStep() const;
int crlStep() const;
float zStep() const;
double inlDistance(); //!< 获得实际线间隔步长,单位:米……
double crlDistance(); //!< 获得实际道间隔步长,单位:米……
void Write(CFile& fw, const short& ver);
int Read(CFile& fr, const short& ver);
void Serialize(CArchive& ar, const short &ver);
public:
void setWorkRange(const CCubeRange& cr);
//!< 根据坐标设置工作范围
//!< 参数: bGetSnapPoint 是否根据整步长线道号设置最大最小范围坐标
void setWorkRangeXY(CPoint3D& ptMin, CPoint3D& ptMax, bool bGetSnapPoint=false);
void setWorkRangeRC(CPoint3D& ptMin, CPoint3D& ptMax, bool bGetSnapPoint=false);
bool IsSnapStep() { return (m_nFlags & areaSnapStep) ? true:false; }
void EnableSnapStep(bool bSnap);
/*!< Orientation is determined by rotating the inline axis to the crossline axis. */
bool isClockWise() const;
/*!< It's the angle (0 to pi/2) between the X-axis and the Inline-axis (not an inline) */
double computeAngleXInl();
/*!<Gives a ballpark figure of how to scale XY to make it comparable to Z. */
static double defaultXYtoZScale( CUnit::EType unit_z, CUnit::EType unit_xy );
/*!<Gives a ballpark figure of how to scale Z to make it comparable to XY. */
double zScale() const;
void InitZRange(CSeisSampleInfo& si);
bool InitCoorTransform(CDimension3D* pMesh3D); //初始化坐标变换
public:
CCubeRange m_surveyCube; //测网的全部范围,缺省情况下两个范围相同
CCubeRange m_workCube; //用户设置的显示范围
CUnit::EType m_unit_xy; //xy方向的坐标单位
CUnit::EType m_unit_z; //z方向的坐标单位
CCoorTransform m_b2c; //线道号与坐标的相互转换
//CProjection m_l2c; //经纬度与坐标的相互转换
//是否使用显示体
//是否按照步长计算
DWORD m_nFlags; //一些开关设置
};
}//namespace
using namespace NSeis;