logplus/OSGFramework/include/VecCoordinate.h

225 lines
8.9 KiB
C
Raw Normal View History

2026-01-17 12:49:42 +08:00
/**
* @file VecCoordinate.h
* @brief
* @date 2014-5-26
* @author: liyonggang
*/
#ifndef PAI_FRAME_CVECCOORDINATE_H
#define PAI_FRAME_CVECCOORDINATE_H
#pragma warning( push ,0)
#include <QUuid>
// #include <Vec2d>
// #include <Vec3f>
// #include <Matrix>
#include "OSGFramework.h"
// #include "VecGeoToGeoNormalCoordinate.h"
// #include "VecWindowDocument.h"
// #include "2DWindowViewInfo.h"
#pragma warning( pop )
BEGIN_OSGGRAPHICS_NAMESPACE
class CVecSceneManager;
END_OSGGRAPHICS_NAMESPACE;
BEGIN_OSGGRAPHICS_NAMESPACE;
enum eCoordType
{
//原始的用户业务坐标
eCoord_GEO,//深度,工程值
//归一化的用户业务坐标统一用户业务坐标到OSG的坐标系
eCoord_GEONormal,//对数变换、倒置坐标轴
// OSG 物体局部坐标系. 就是平常渲染时给OSG::Geometry的顶点坐标
eCoord_OSGLocal, //道内横向刻度
// OSG 全局模型坐标系,( transform by CVecSceneManager Global Model transform)
eCoord_OSGGlobal,//窗口中坐标
//相机坐标系,眼睛坐标系( 视图矩阵变化后)
eCoord_OSGCameraEye,
// 投影矩阵变化后的归一化三维坐标(x,y,z的范围都是(-1,1) )
eCoord_OSGNormal,
// OSG的视口二维像素坐标( Y轴正方向是由下到上 )
eCoord_OSGPixel,
// QT Widget的窗口二维像素坐标( Y轴正方向是由上到下 )
eCoord_GDIPixel,
// 厘米单位坐标( Y轴正方向是由上到下 )
eCoord_GDICM,
};
// /**
// * @class IVecCoordinate
// * @brief 通用的坐标转换:任意两种坐标之间的转换
// */
// class OSGFRAMEWORK_EXPORT IVecCoordinate
// {
// public:
// IVecCoordinate();
// virtual ~IVecCoordinate();
// /**
// * @brief 把点从一个坐标系统转换另外一个坐标系统
// * @param ObjectID Object ID,特别是在转为Well Section Geo坐标时有正确的Objecct ID
// * @param eInCoordType 输入点的坐标系统
// * @param inCoord 输入的顶点
// * @param eOutCoordType输出的坐标系统类型
// * @param outCoord 输出的顶点
// */
// virtual void ConvertCoord( const QUuid &ObjectID,eCoordType eInCoordType, osg::Vec3f inCoord,
// eCoordType eOutCoordType,osg::Vec3f& outCoord) = 0 ;
// /**
// * @brief 把点从一个坐标系统转换另外一个坐标系统
// * @param ObjectID Object ID,特别是在转为Well Section Geo坐标时有正确的Objecct ID
// * @param eInCoordType 输入点的坐标系统
// * @param inCoord 输入的顶点
// * @param eOutCoordType输出的坐标系统类型
// * @param outCoord 输出的顶点
// */
// virtual void ConvertCoordDouble( const QUuid &ObjectID,eCoordType eInCoordType, osg::Vec3d inCoord,
// eCoordType eOutCoordType,osg::Vec3d& outCoord ) = 0 ;
// /**
// * @brief 把"长度"从一个坐标系统转换到另外一个坐标系统
// * @param ObjectID Object ID,特别是在转为Well Section Geo坐标时有正确的Objecct ID
// * @param eInCoordType 输入点的坐标系统
// * @param inCoord 输入的长度
// * @param eOutCoordType输出的坐标系统类型
// * @param outCoord 输出的长度
// * @param bAbs 输出的长度是否取绝对值
// */
// virtual void ConvertDeltaCoord( const QUuid &ObjectID,eCoordType eInCoordType, osg::Vec3d inCoord,
// eCoordType eOutCoordType,osg::Vec3d& outCoord ,bool bAbs) = 0;
// };
// /**
// * @class IVecCoordinate
// * @brief 通用的坐标转换:任意两种坐标之间的转换
// */
// class OSGFRAMEWORK_EXPORT CVecCoordinate : public IVecCoordinate
// {
// public:
// CVecCoordinate();
// virtual void InitSceneManager(CVecSceneManager *ppSceneManager);
// /**
// * @brief 把点从一个坐标系统转换另外一个坐标系统
// * @param ObjectID Object ID,特别是在转为Well Section Geo坐标时有正确的Objecct ID
// * @param eInCoordType 输入点的坐标系统
// * @param inCoord 输入的顶点
// * @param eOutCoordType输出的坐标系统类型
// * @param outCoord 输出的顶点
// */
// virtual void ConvertCoord( const QUuid &ObjectID,eCoordType eInCoordType, osg::Vec3f inCoord,
// eCoordType eOutCoordType,osg::Vec3f& outCoord) ;
// virtual void ConvertCoordDoubleNoGEONormal( const QUuid &ObjectID,eCoordType eInCoordType, osg::Vec3d inCoord,
// eCoordType eOutCoordType,osg::Vec3d& outCoord );
// /**
// * @brief 把点从一个坐标系统转换另外一个坐标系统
// * @param ObjectID Object ID,特别是在转为Well Section Geo坐标时有正确的Objecct ID
// * @param eInCoordType 输入点的坐标系统
// * @param inCoord 输入的顶点
// * @param eOutCoordType输出的坐标系统类型
// * @param outCoord 输出的顶点
// */
// virtual void ConvertCoordDouble( const QUuid &ObjectID,eCoordType eInCoordType, osg::Vec3d inCoord,
// eCoordType eOutCoordType,osg::Vec3d& outCoord ) ;
// /**
// * @brief 把"长度"从一个坐标系统转换到另外一个坐标系统
// * @param ObjectID Object ID,特别是在转为Well Section Geo坐标时有正确的Objecct ID
// * @param eInCoordType 输入点的坐标系统
// * @param inCoord 输入的长度
// * @param eOutCoordType输出的坐标系统类型
// * @param outCoord 输出的长度
// * @param bAbs 输出的长度是否取绝对值
// */
// void ConvertDeltaCoord( const QUuid &ObjectID,eCoordType eInCoordType, osg::Vec3d inCoord,
// eCoordType eOutCoordType,osg::Vec3d& outCoord ,bool bAbs) ;
// //同ConvertCoordDouble只处理X坐标
// virtual double ConvertX( const QUuid &ObjectID,eCoordType eInCoordType, double x,
// eCoordType eOutCoordType );
// //同ConvertCoordDouble只处理Y坐标
// virtual double ConvertY( const QUuid &ObjectID,eCoordType eInCoordType, double y,
// eCoordType eOutCoordType );
// //同ConvertDeltaCoord只处理X方向长度
// virtual double ConvertDeltaX( const QUuid &ObjectID,eCoordType eInCoordType, double x,
// eCoordType eOutCoordType,bool bAbs ) ;
// //同ConvertDeltaCoord只处理Y方向长度
// virtual double ConvertDeltaY( const QUuid &ObjectID,eCoordType eInCoordType, double y,
// eCoordType eOutCoordType,bool bAbs) ;
// /**
// * @brief 每厘米像素数
// */
// void SetPixelPerCm(QPrinter *pDC);
// void SetPixelPerCm(QPainter *pDC);
// void SetPixelPerCm(double PixelPerCm);
// double GetPixelPerCm();
// /**
// * @brief 像素转为厘米
// */
// double PixelToCM( double fPixel );
// /**
// * @breif 返回对于指定的坐标系而言每个像素对应的高度
// * @param objectID 对象ID,通常为空
// * @param eOutCoordType 结果坐标系的类型
// */
// double HeightPerPixel(const QUuid& objectID,eCoordType eOutCoordType);
// /**
// * @breif 返回对于指定的坐标系而言每个像素对应的高度
// * @param objectID 对象ID,通常为空
// * @param eOutCoordType 结果坐标系的类型
// */
// double WidthPerPixel(const QUuid& objectID,eCoordType eOutCoordType);
// virtual osg::Vec3d TransfromGeo_GeoNormal(const QUuid &ObjectID, osg::Vec3d in, bool bPositive);
// bool IsXYSwap( eCoordType eInCoordType,eCoordType eOutCoordType );
// private:
// typedef osg::Vec3d (*TransfromCoordinateFunc)(CVecCoordinate *pCoordinate, const QUuid &ObjectID,osg::Vec3d in, bool bPositive);
// //坐标系统之间相互转换的函数。每个函数只负责相邻的两个坐标系之间的转换
// static osg::Vec3d TransfromGeo_GeoNormal(CVecCoordinate *pCoordinate,const QUuid &ObjectID, osg::Vec3d in, bool bPositive);
// static osg::Vec3d TransfromGeoNormal_OSGLocal(CVecCoordinate *pCoordinate,const QUuid &ObjectID, osg::Vec3d in, bool bPositive);
// static osg::Vec3d TransfromOSGLocal_Global(CVecCoordinate *pCoordinate, const QUuid &ObjectID,osg::Vec3d in, bool bPositive);
// static osg::Vec3d TransfromOSGGlobal_EyePosition(CVecCoordinate *pCoordinate,const QUuid &ObjectID, osg::Vec3d in, bool bPositive);
// static osg::Vec3d TransfromEye_NormalizedPosition(CVecCoordinate *pCoordinate,const QUuid &ObjectID, osg::Vec3d in, bool bPositive);
// static osg::Vec3d TransfromOSGNormalizedPosition_Pixel(CVecCoordinate *pCoordinate,const QUuid &ObjectID, osg::Vec3d in, bool bPositive);
// static osg::Vec3d TransfromOSGPixel_GDIPixel(CVecCoordinate *pCoordinate,const QUuid &ObjectID, osg::Vec3d in, bool bPositive);
// static osg::Vec3d TransfromGDIPixel_GDICM(CVecCoordinate *pCoordinate,const QUuid &ObjectID, osg::Vec3d in, bool bPositive);
// protected:
// C2DWindowViewInfo *m_pWindowViewInfo;
// bool m_bInitWindowViewInfo;
// protected:
// std::vector< TransfromCoordinateFunc > m_vTransfromCoordinateFunc;// 坐标转换的函数指针数组
// public:
// CVecSceneManager *m_pSceneManager;
// CVecGeoToGeoNormalCoordinate m_GeoToGeoNormalCoordinate;
// double dPixelPerCm;
// osg::Matrixd m_WindowMatrix;
// osg::Matrixd m_ProjectMatrix;
// osg::Matrixd m_ViewMatrix;
// };
END_OSGGRAPHICS_NAMESPACE;
using namespace pai::graphics;
#endif