OSGFramework 适配 linux

This commit is contained in:
jinyuan 2026-05-15 09:45:44 +08:00
parent 97e4f21d99
commit 3f9dd8a9c3
6 changed files with 1137 additions and 908 deletions

View File

@ -1,40 +1,40 @@
#ifdef _WINDOWS #ifdef WIN32
#ifdef OSGFRAMEWORK_LIB #ifdef OSGFRAMEWORK_LIB
#define OSGFRAMEWORK_EXPORT __declspec(dllexport) #define OSGFRAMEWORK_EXPORT __declspec(dllexport)
#else #else
#define OSGFRAMEWORK_EXPORT __declspec(dllimport) #define OSGFRAMEWORK_EXPORT __declspec(dllimport)
#endif #endif
#else #else
#define OSGFRAMEWORK_EXPORT #define OSGFRAMEWORK_EXPORT
#endif #endif
#define BEGIN_OSGGRAPHICS_NAMESPACE \ #define BEGIN_OSGGRAPHICS_NAMESPACE \
namespace pai {\ namespace pai {\
namespace graphics{\ namespace graphics{\
#define END_OSGGRAPHICS_NAMESPACE \ #define END_OSGGRAPHICS_NAMESPACE \
};\ };\
};\ };\
using namespace pai::graphics; using namespace pai::graphics;
#define DIGITIZER_ZVALUE 1 #define DIGITIZER_ZVALUE 1
#define OSG_BACKGROUD_COLOR osg::Vec4f(1,1,1,1 ) #define OSG_BACKGROUD_COLOR osg::Vec4f(1,1,1,1 )
//#define OSG_BACKGROUD_COLOR osg::Vec4f(0.5,0.5,0.5,1 ) //#define OSG_BACKGROUD_COLOR osg::Vec4f(0.5,0.5,0.5,1 )
#define ZVALUE_ViewerLine -3 #define ZVALUE_ViewerLine -3
#define ZVALUE_ViewerRuler -2 #define ZVALUE_ViewerRuler -2
#define ZVALUE_HUDFill -1 #define ZVALUE_HUDFill -1
#define ZVALUE_HUDGeometry -0.5 #define ZVALUE_HUDGeometry -0.5
#define ZVALUE_HUDRuler -0.0 #define ZVALUE_HUDRuler -0.0
#pragma warning( disable: 4251 ) #pragma warning( disable: 4251 )

View File

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

View File

@ -1,202 +1,202 @@
/** /**
* @file VecViewCommand.h * @file VecViewCommand.h
* @brief Action插件集合管理类 * @brief Action插件集合管理类
* @date 2014-5-26 * @date 2014-5-26
* @author: liyonggang * @author: liyonggang
*/ */
#ifndef PAI_FRAME_OSGVIEWCOMMAND_H #ifndef PAI_FRAME_OSGVIEWCOMMAND_H
#define PAI_FRAME_OSGVIEWCOMMAND_H #define PAI_FRAME_OSGVIEWCOMMAND_H
#pragma warning( push ,0) #pragma warning( push ,0)
#include <QAction> #include <QAction>
#include "OSGFramework.h" #include "OSGFramework.h"
#include "BaseObject.h" #include "BaseObject.h"
#pragma warning( pop ) #pragma warning( pop )
#pragma warning( disable: 4251 ) #pragma warning( disable: 4251 )
BEGIN_OSGGRAPHICS_NAMESPACE; BEGIN_OSGGRAPHICS_NAMESPACE;
class CVecSceneManager; class CVecSceneManager;
/** /**
* @class Action的数据描述 * @class Action的数据描述
*/ */
struct OSGFRAMEWORK_EXPORT sAction struct OSGFRAMEWORK_EXPORT sAction
{ {
public: public:
sAction(); sAction();
sAction( QString strIcon1,std::wstring strText1,bool bChecked1,bool bCheckAble1 ,QUuid DigitizerIDOrBuilderOjectID,QString slotFunctionName1,QKeySequence keyShortcut1 = QKeySequence () ); sAction( QString strIcon1,std::wstring strText1,bool bChecked1,bool bCheckAble1 ,QUuid DigitizerIDOrBuilderOjectID,QString slotFunctionName1,QKeySequence keyShortcut1 = QKeySequence () );
public: public:
QString strIcon; QString strIcon;
std::wstring strText; std::wstring strText;
bool bChecked; bool bChecked;
bool bCheckAble; bool bCheckAble;
QUuid m_DigitizerIDOrBuilderOjectID;//(开关digitizer ID) 或 (显示隐藏UI builder的object ID) QUuid m_DigitizerIDOrBuilderOjectID;//(开关digitizer ID) 或 (显示隐藏UI builder的object ID)
QKeySequence keyShortcut; QKeySequence keyShortcut;
QString slotFunctionName; QString slotFunctionName;
}; };
/** /**
* @class Action插件集合管理类 * @class Action插件集合管理类
*/ */
class OSGFRAMEWORK_EXPORT CVecViewCommand : public QObject class OSGFRAMEWORK_EXPORT CVecViewCommand : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
/** /**
* @brief * @brief
*/ */
CVecViewCommand( ); CVecViewCommand( );
void InitSceneManager( CVecSceneManager *pSceneManager ); void InitSceneManager( CVecSceneManager *pSceneManager );
CVecSceneManager* GetSceneManager(); CVecSceneManager* GetSceneManager();
/** /**
* @brief Action,Actioin * @brief Action,Actioin
* @param viewCommandID : command ID * @param viewCommandID : command ID
* @bChecked : Checkable的Action,Checked * @bChecked : Checkable的Action,Checked
*/ */
bool DoAction( QUuid viewCommandID,bool bChecked ); bool DoAction( QUuid viewCommandID,bool bChecked );
/** /**
* @brief Command ID查找QAction * @brief Command ID查找QAction
*/ */
QAction* GetAction( QUuid viewCommandID,bool bCreateIfNotExist = true ); QAction* GetAction( QUuid viewCommandID,bool bCreateIfNotExist = true );
/** /**
* @brief Action checked and Enabled * @brief Action checked and Enabled
*/ */
bool GetActionVisble( QUuid viewCommandID ); bool GetActionVisble( QUuid viewCommandID );
//返回当前视口安装的所有的Action //返回当前视口安装的所有的Action
QMap<QUuid,QObject* >& GetAllActions(); QMap<QUuid,QObject* >& GetAllActions();
/** /**
* @brief QAction * @brief QAction
*/ */
static void BuildActionGeneral( CVecViewCommand &viewCommand,QUuid viewCommandID ); static void BuildActionGeneral( CVecViewCommand &viewCommand,QUuid viewCommandID );
/** /**
* @brief view commandID查找Digitizer ID * @brief view commandID查找Digitizer ID
*/ */
static QUuid GetDigitizerIDByViewCommandID( QUuid viewCommandID ); static QUuid GetDigitizerIDByViewCommandID( QUuid viewCommandID );
// Action槽函数 // Action槽函数
private slots: private slots:
void slotActionClicked(bool bChecked); void slotActionClicked(bool bChecked);
private: private:
//批量的根据插件注册的元数据创建QAction //批量的根据插件注册的元数据创建QAction
void CreatActions( QList<QUuid> listviewCommandID ); void CreatActions( QList<QUuid> listviewCommandID );
// Cache Action // Cache Action
void AddUIElementToMap( QUuid viewCommandID,QObject *pAction ); void AddUIElementToMap( QUuid viewCommandID,QObject *pAction );
// 根据插件注册的元数据创建QAction // 根据插件注册的元数据创建QAction
QAction* _CreateAction( QUuid viewCommandID ); QAction* _CreateAction( QUuid viewCommandID );
private: private:
CVecSceneManager *m_pSceneMgr; CVecSceneManager *m_pSceneMgr;
QMap<QUuid/*Action ID*/,QObject* /*Action*/ >m_mapUIElement; //cache Action QMap<QUuid/*Action ID*/,QObject* /*Action*/ >m_mapUIElement; //cache Action
}; };
typedef void (*BUILDUIELEMENT_FUNC )(CVecViewCommand &,QUuid); typedef void (*BUILDUIELEMENT_FUNC )(CVecViewCommand &,QUuid);
typedef void (*UIELEMENTACTION_FUNC )(CVecViewCommand &,QUuid,bool); typedef void (*UIELEMENTACTION_FUNC )(CVecViewCommand &,QUuid,bool);
/** /**
* @class Action函数指针Action"" * @class Action函数指针Action""
*/ */
struct OSGFRAMEWORK_EXPORT sUIELEMENTFunction struct OSGFRAMEWORK_EXPORT sUIELEMENTFunction
{ {
public: public:
sUIELEMENTFunction() sUIELEMENTFunction()
{ {
buildFunc = NULL; buildFunc = NULL;
ActionSlot = NULL; ActionSlot = NULL;
} }
sUIELEMENTFunction( BUILDUIELEMENT_FUNC buildFunc1,UIELEMENTACTION_FUNC ActionSlot1 ) sUIELEMENTFunction( BUILDUIELEMENT_FUNC buildFunc1,UIELEMENTACTION_FUNC ActionSlot1 )
{ {
buildFunc = buildFunc1; buildFunc = buildFunc1;
ActionSlot = ActionSlot1; ActionSlot = ActionSlot1;
} }
BUILDUIELEMENT_FUNC buildFunc; BUILDUIELEMENT_FUNC buildFunc;
UIELEMENTACTION_FUNC ActionSlot; UIELEMENTACTION_FUNC ActionSlot;
}; };
/** /**
* @brief ViewComand的创建和槽的函数指针 * @brief ViewComand的创建和槽的函数指针
*/ */
OSGFRAMEWORK_EXPORT QMap< QUuid/*Action ID*/,sUIELEMENTFunction >& GetmapUIElementFunc(); OSGFRAMEWORK_EXPORT QMap< QUuid/*Action ID*/,sUIELEMENTFunction >& GetmapUIElementFunc();
/** /**
* @brief View Command * @brief View Command
* @param viewCommandID :Command ID * @param viewCommandID :Command ID
* @param s : Command () * @param s : Command ()
* @param pSlotAction: Command对应的"" * @param pSlotAction: Command对应的""
*/ */
OSGFRAMEWORK_EXPORT void RegisterViewAction( QUuid viewCommandID,sAction s,UIELEMENTACTION_FUNC pSlotAction); OSGFRAMEWORK_EXPORT void RegisterViewAction( QUuid viewCommandID,sAction s,UIELEMENTACTION_FUNC pSlotAction);
/** /**
* @brief ViewComand的元数据: * @brief ViewComand的元数据:
*/ */
OSGFRAMEWORK_EXPORT QMap<QUuid/*Action ID*/,sAction >& _GetMapActionData(); OSGFRAMEWORK_EXPORT QMap<QUuid/*Action ID*/,sAction >& _GetMapActionData();
OSGFRAMEWORK_EXPORT CVecViewCommand& GetGlobalCommand(); OSGFRAMEWORK_EXPORT CVecViewCommand& GetGlobalCommand();
/** /**
* @class View Command注册的元数据 * @class View Command注册的元数据
*/ */
struct OSGFRAMEWORK_EXPORT sRegisterViewAction struct OSGFRAMEWORK_EXPORT sRegisterViewAction
{ {
QUuid actionID; QUuid actionID;
sAction s; sAction s;
UIELEMENTACTION_FUNC pSlotAction; UIELEMENTACTION_FUNC pSlotAction;
}; };
/** /**
* @class View Command自动注册的辅助类 * @class View Command自动注册的辅助类
*/ */
class OSGFRAMEWORK_EXPORT CRegisterViewActionAuto class OSGFRAMEWORK_EXPORT CRegisterViewActionAuto
{ {
public: public:
CRegisterViewActionAuto( sRegisterViewAction *pRegisterViewAction ) CRegisterViewActionAuto( sRegisterViewAction *pRegisterViewAction )
{ {
while( pRegisterViewAction ) while( pRegisterViewAction )
{ {
if( (*pRegisterViewAction).actionID.isNull() ) break; if( (*pRegisterViewAction).actionID.isNull() ) break;
RegisterViewAction( pRegisterViewAction->actionID, pRegisterViewAction->s, pRegisterViewAction->pSlotAction ); RegisterViewAction( pRegisterViewAction->actionID, pRegisterViewAction->s, pRegisterViewAction->pSlotAction );
++pRegisterViewAction; ++pRegisterViewAction;
} }
} }
}; };
//view Comand 插件注册宏 //view Comand 插件注册宏
#define BEGIN_REGISTER_VIEWCOMMAND()\ #define BEGIN_REGISTER_VIEWCOMMAND()\
sRegisterViewAction g_sRegisterViewActionData[]={\ sRegisterViewAction g_sRegisterViewActionData[]={\
#define END_REGISTER_VIEWCOMMAND()\ #define END_REGISTER_VIEWCOMMAND()\
,{QUuid(),sAction(),NULL } };\ ,{QUuid(),sAction(),NULL } };\
CRegisterViewActionAuto g_CRegisterViewActionAuto( g_sRegisterViewActionData ); CRegisterViewActionAuto g_CRegisterViewActionAuto( g_sRegisterViewActionData );
//自动注册示例代码 //自动注册示例代码
//BEGIN_REGISTER_VIEWCOMMAND() //BEGIN_REGISTER_VIEWCOMMAND()
//VIEW_COMMAND_ITEM( GetViewCmdID_ViewAll(),"viewall.png" , "View All",false,false,"",_SlotViewAll) //VIEW_COMMAND_ITEM( GetViewCmdID_ViewAll(),"viewall.png" , "View All",false,false,"",_SlotViewAll)
//END_REGISTER_VIEWCOMMAND() //END_REGISTER_VIEWCOMMAND()
#define VIEW_COMMAND_ITEM( viewCommandID,actionIcon,actionText, actionbChecked, actionbCheckAble,DigitizerIDOrBuilderOjectID,slotFunction )\ #define VIEW_COMMAND_ITEM( viewCommandID,actionIcon,actionText, actionbChecked, actionbCheckAble,DigitizerIDOrBuilderOjectID,slotFunction )\
{ viewCommandID,sAction( actionIcon,actionText,actionbChecked,actionbCheckAble,DigitizerIDOrBuilderOjectID,#slotFunction),slotFunction } { viewCommandID,sAction( actionIcon,actionText,actionbChecked,actionbCheckAble,DigitizerIDOrBuilderOjectID,#slotFunction),slotFunction }
#define VIEW_COMMAND_ITEM_SHORCUT( viewCommandID,actionIcon,actionText, actionbChecked, actionbCheckAble,DigitizerIDOrBuilderOjectID,slotFunction,actionshortcut )\ #define VIEW_COMMAND_ITEM_SHORCUT( viewCommandID,actionIcon,actionText, actionbChecked, actionbCheckAble,DigitizerIDOrBuilderOjectID,slotFunction,actionshortcut )\
{ viewCommandID,sAction( actionIcon,actionText,actionbChecked,actionbCheckAble,DigitizerIDOrBuilderOjectID,#slotFunction,actionshortcut),slotFunction } { viewCommandID,sAction( actionIcon,actionText,actionbChecked,actionbCheckAble,DigitizerIDOrBuilderOjectID,#slotFunction,actionshortcut),slotFunction }
END_OSGGRAPHICS_NAMESPACE; END_OSGGRAPHICS_NAMESPACE;
using namespace pai::graphics; using namespace pai::graphics;
#endif #endif

View File

@ -1,80 +1,82 @@
#------------------------------------------------- #-------------------------------------------------
# #
# Project created by QtCreator 2024-07-11T18:44:51 # Project created by QtCreator 2024-07-11T18:44:51
# #
#------------------------------------------------- #-------------------------------------------------
QT += core gui widgets QT += core gui widgets
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = OSGFramework TARGET = OSGFramework
TEMPLATE = lib TEMPLATE = lib
# The following define makes your compiler emit warnings if you use # The following define makes your compiler emit warnings if you use
# any feature of Qt which has been marked as deprecated (the exact warnings # any feature of Qt which has been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the # depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it. # deprecated API in order to know how to port your code away from it.
DEFINES += OSGFRAMEWORK_LIB DEFINES += OSGFRAMEWORK_LIB
DEFINES += _WINDOWS DEFINES += _WINDOWS
DEFINES += _TIMESPEC_DEFINED DEFINES += _TIMESPEC_DEFINED
# You can also make your code fail to compile if you use deprecated APIs. # You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line. # In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt. # You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
CONFIG += console \ CONFIG += console \
# static \ # static \
c++11 \ c++11 \
shared\ shared\
dll dll
# Default rules for deployment. # Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target !isEmpty(target.path): INSTALLS += target
CONFIG(debug, debug|release){ CONFIG(debug, debug|release){
DESTDIR = $$PWD/../../Bin DESTDIR = $$PWD/../../Bin
TARGET = $$join(TARGET,,,d) #为debug版本生成的文件增加d的后缀 TARGET = $$join(TARGET,,,d) #为debug版本生成的文件增加d的后缀
} else { } else {
DESTDIR = $$PWD/../../BinR DESTDIR = $$PWD/../../BinR
TARGET = $$join(TARGET,,,) TARGET = $$join(TARGET,,,)
} }
FORMS += FORMS +=
HEADERS += \ HEADERS += \
../include/VecViewCommand.h \ ../include/VecViewCommand.h \
SOURCES += \ SOURCES += \
VecViewCommand.cpp VecViewCommand.cpp
INCLUDEPATH += ../include INCLUDEPATH += ../include
INCLUDEPATH += ../CallManage INCLUDEPATH += ../CallManage
INCLUDEPATH += ../../Slfio/include INCLUDEPATH += ../../Slfio/include
INCLUDEPATH += ../../common INCLUDEPATH += ../../common
INCLUDEPATH += ../../BaseFun/include INCLUDEPATH += ../../BaseFun/include
INCLUDEPATH += ../../OSGDataModel/include INCLUDEPATH += ../../OSGDataModel/include
INCLUDEPATH += ../../DataMgr/include INCLUDEPATH += ../../DataMgr/include
INCLUDEPATH += ../../Workflow/include \ win32 {
../../Workflow/WFEngine/IOService/include \ INCLUDEPATH += ../../Workflow/include
../../Workflow/WFEngine/Module/include \ }
../../Workflow/WFCrystal/SysUtility/utils/include \ INCLUDEPATH += ../../Workflow/WFEngine/IOService/include \
../../Workflow/WFEngine/ObjectModel/ObjectModel/include \ ../../Workflow/WFEngine/Module/include \
../../Workflow/WFEngine/ObjectModel/ObjectModelBase/include ../../Workflow/WFCrystal/SysUtility/utils/include \
../../Workflow/WFEngine/ObjectModel/ObjectModel/include \
CONFIG(debug, debug|release){ ../../Workflow/WFEngine/ObjectModel/ObjectModelBase/include
LIBS += -L$$PWD/../../Bin -lslfiod
LIBS += -L$$PWD/../../Bin -lBaseFund CONFIG(debug, debug|release){
LIBS += -L$$PWD/../../Bin -lOSGDataModeld LIBS += -L$$PWD/../../Bin -lslfiod
LIBS += -L$$PWD/../../Bin -lDataMgrd LIBS += -L$$PWD/../../Bin -lBaseFund
} else { LIBS += -L$$PWD/../../Bin -lOSGDataModeld
LIBS += -L$$PWD/../../BinR -lslfio LIBS += -L$$PWD/../../Bin -lDataMgrd
LIBS += -L$$PWD/../../BinR -lBaseFun } else {
LIBS += -L$$PWD/../../BinR -lOSGDataModel LIBS += -L$$PWD/../../BinR -lslfio
LIBS += -L$$PWD/../../BinR -lDataMgr LIBS += -L$$PWD/../../BinR -lBaseFun
} LIBS += -L$$PWD/../../BinR -lOSGDataModel
LIBS += -L$$PWD/../../BinR -lDataMgr
}

View File

@ -0,0 +1,227 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 16.0.1, 2026-03-16T17:37:59. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
<value type="QByteArray">{b6aced14-228a-4a04-b357-4d18ec1a3aad}</value>
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="qlonglong">0</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
<valuemap type="QVariantMap">
<value type="bool" key="EditorConfiguration.AutoDetect">true</value>
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
<value type="QString" key="language">Cpp</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
</valuemap>
</valuemap>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
<value type="QString" key="language">QmlJS</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
</valuemap>
</valuemap>
<value type="qlonglong" key="EditorConfiguration.CodeStyle.Count">2</value>
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
<value type="int" key="EditorConfiguration.IndentSize">4</value>
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
<value type="int" key="EditorConfiguration.LineEndingBehavior">0</value>
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
<value type="int" key="EditorConfiguration.PreferAfterWhitespaceComments">0</value>
<value type="bool" key="EditorConfiguration.PreferSingleLineComments">false</value>
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">2</value>
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
<value type="int" key="EditorConfiguration.TabSize">8</value>
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
<value type="bool" key="EditorConfiguration.UseIndenter">false</value>
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
<value type="QString" key="EditorConfiguration.ignoreFileTypes">*.md, *.MD, Makefile</value>
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
<value type="bool" key="EditorConfiguration.skipTrailingWhitespace">true</value>
<value type="bool" key="EditorConfiguration.tintMarginArea">true</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.PluginSettings</variable>
<valuemap type="QVariantMap">
<valuemap type="QVariantMap" key="AutoTest.ActiveFrameworks">
<value type="bool" key="AutoTest.Framework.Boost">true</value>
<value type="bool" key="AutoTest.Framework.CTest">false</value>
<value type="bool" key="AutoTest.Framework.Catch">true</value>
<value type="bool" key="AutoTest.Framework.GTest">true</value>
<value type="bool" key="AutoTest.Framework.QtQuickTest">true</value>
<value type="bool" key="AutoTest.Framework.QtTest">true</value>
</valuemap>
<value type="bool" key="AutoTest.ApplyFilter">false</value>
<valuemap type="QVariantMap" key="AutoTest.CheckStates"/>
<valuelist type="QVariantList" key="AutoTest.PathFilters"/>
<value type="int" key="AutoTest.RunAfterBuild">0</value>
<value type="bool" key="AutoTest.UseGlobal">true</value>
<valuemap type="QVariantMap" key="ClangTools">
<value type="bool" key="ClangTools.AnalyzeOpenFiles">true</value>
<value type="bool" key="ClangTools.BuildBeforeAnalysis">true</value>
<value type="QString" key="ClangTools.DiagnosticConfig">Builtin.DefaultTidyAndClazy</value>
<value type="int" key="ClangTools.ParallelJobs">10</value>
<value type="bool" key="ClangTools.PreferConfigFile">true</value>
<valuelist type="QVariantList" key="ClangTools.SelectedDirs"/>
<valuelist type="QVariantList" key="ClangTools.SelectedFiles"/>
<valuelist type="QVariantList" key="ClangTools.SuppressedDiagnostics"/>
<value type="bool" key="ClangTools.UseGlobalSettings">true</value>
</valuemap>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value type="QString" key="DeviceType">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.13.0 MSVC2017 64bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.13.0 MSVC2017 64bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{b0d37dc0-4759-4799-8369-0bb44b3e17ec}</value>
<value type="qlonglong" key="ProjectExplorer.Target.ActiveBuildConfiguration">1</value>
<value type="qlonglong" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="qlonglong" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="int" key="EnableQmlDebugging">0</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">E:\ALogplus\logplus\build\OSGFramework_Qt_5_13_0_msvc2017_64-Debug</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">E:/ALogplus/logplus/build/OSGFramework_Qt_5_13_0_msvc2017_64-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">构建</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">构建</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">清除</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">清除</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">E:\ALogplus\logplus\build\OSGFramework_Qt_5_13_0_msvc2017_64-Release</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">E:/ALogplus/logplus/build/OSGFramework_Qt_5_13_0_msvc2017_64-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">构建</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">构建</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">清除</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">清除</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="int" key="QtQuickCompiler">0</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">部署</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">部署</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.DeployConfiguration.CustomData"/>
<value type="bool" key="ProjectExplorer.DeployConfiguration.CustomDataEnabled">false</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
<value type="int" key="Analyzer.Valgrind.Callgrind.CostFormat">0</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<valuelist type="QVariantList" key="CustomOutputParsers"/>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="bool" key="PE.EnvironmentAspect.PrintOnRun">false</value>
<value type="QString" key="PerfRecordArgsId">-e cpu-cycles --call-graph &quot;dwarf,4096&quot; -F 250</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey"></value>
<value type="bool" key="ProjectExplorer.RunConfiguration.Customized">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.TargetCount</variable>
<value type="qlonglong">1</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<value type="int">22</value>
</data>
<data>
<variable>Version</variable>
<value type="int">22</value>
</data>
</qtcreator>

View File

@ -1,362 +1,362 @@
#pragma warning(push, 0) #pragma warning(push, 0)
#include <assert.h> #include <assert.h>
#include <QCoreApplication> #include <QCoreApplication>
#include <QColorDialog> #include <QColorDialog>
#include "VecViewCommand.h" #include "VecViewCommand.h"
// #include "VecSceneManager.h" // #include "VecSceneManager.h"
#include "geometryutils.h" #include "geometryutils.h"
#include "ObjectID.h" #include "ObjectID.h"
// #include "PaiAction.h" // #include "PaiAction.h"
#pragma warning(pop) #pragma warning(pop)
BEGIN_OSGGRAPHICS_NAMESPACE; BEGIN_OSGGRAPHICS_NAMESPACE;
sAction::sAction() sAction::sAction()
{ {
bChecked = false; bChecked = false;
bCheckAble = false; bCheckAble = false;
} }
sAction::sAction( QString strIcon1,std::wstring strText1,bool bChecked1,bool bCheckAble1 , sAction::sAction( QString strIcon1,std::wstring strText1,bool bChecked1,bool bCheckAble1 ,
QUuid DigitizerIDOrBuilderOjectID,QString slotFunctionName1,QKeySequence keyShortcut1 ) QUuid DigitizerIDOrBuilderOjectID,QString slotFunctionName1,QKeySequence keyShortcut1 )
{ {
strIcon = strIcon1; strIcon = strIcon1;
strText = strText1; strText = strText1;
bChecked = bChecked1; bChecked = bChecked1;
bCheckAble = bCheckAble1; bCheckAble = bCheckAble1;
keyShortcut = keyShortcut1; keyShortcut = keyShortcut1;
m_DigitizerIDOrBuilderOjectID = DigitizerIDOrBuilderOjectID; m_DigitizerIDOrBuilderOjectID = DigitizerIDOrBuilderOjectID;
slotFunctionName = slotFunctionName1; slotFunctionName = slotFunctionName1;
} }
QMap<QUuid,sAction > *g_pMapAction = NULL; QMap<QUuid,sAction > *g_pMapAction = NULL;
OSGFRAMEWORK_EXPORT QMap<QUuid,sAction >& _GetMapActionData() OSGFRAMEWORK_EXPORT QMap<QUuid,sAction >& _GetMapActionData()
{ {
if( !g_pMapAction ) if( !g_pMapAction )
{ {
g_pMapAction = new QMap<QUuid,sAction >(); g_pMapAction = new QMap<QUuid,sAction >();
} }
return *g_pMapAction ; return *g_pMapAction ;
} }
QUuid CVecViewCommand::GetDigitizerIDByViewCommandID( QUuid viewCommandID ) QUuid CVecViewCommand::GetDigitizerIDByViewCommandID( QUuid viewCommandID )
{ {
QMap<QUuid,sAction >& map = _GetMapActionData(); QMap<QUuid,sAction >& map = _GetMapActionData();
if( !map.contains( viewCommandID ) ) if( !map.contains( viewCommandID ) )
{ {
return QUuid(); return QUuid();
} }
//得到digitizer ID or Builder object ID //得到digitizer ID or Builder object ID
QUuid DigitizerID = map[viewCommandID].m_DigitizerIDOrBuilderOjectID; QUuid DigitizerID = map[viewCommandID].m_DigitizerIDOrBuilderOjectID;
if( DigitizerID.isNull( ) ) return DigitizerID; if( DigitizerID.isNull( ) ) return DigitizerID;
// //是否是digitizer ID // //是否是digitizer ID
// if( !CVecDigitizer::GetFatory().IsSupport( DigitizerID ) ) // if( !CVecDigitizer::GetFatory().IsSupport( DigitizerID ) )
// { // {
// DigitizerID = QUuid(); // DigitizerID = QUuid();
// } // }
return DigitizerID; return DigitizerID;
} }
bool _SlotDigitizerOrBuilder( CVecViewCommand &viewCommand,QUuid viewCommandID,bool bShow ) bool _SlotDigitizerOrBuilder( CVecViewCommand &viewCommand,QUuid viewCommandID,bool bShow )
{ {
//无viewCommandID //无viewCommandID
QMap<QUuid,sAction >& map = _GetMapActionData(); QMap<QUuid,sAction >& map = _GetMapActionData();
if( !map.contains( viewCommandID ) ) if( !map.contains( viewCommandID ) )
{ {
return false; return false;
} }
//得到digitizer ID or Builder object ID //得到digitizer ID or Builder object ID
QUuid id = map[viewCommandID].m_DigitizerIDOrBuilderOjectID; QUuid id = map[viewCommandID].m_DigitizerIDOrBuilderOjectID;
if( id.isNull( ) ) return false ; if( id.isNull( ) ) return false ;
bool bSucces(false); bool bSucces(false);
// //处理digitizer ID // //处理digitizer ID
// if( CVecDigitizer::GetFatory().IsSupport( id ) ) // if( CVecDigitizer::GetFatory().IsSupport( id ) )
// { // {
// //特殊处理Well Section window pick ID // //特殊处理Well Section window pick ID
// if( id == GetDigitizerID_Pick() ) // if( id == GetDigitizerID_Pick() )
// { // {
// if(viewCommand.GetSceneManager()->GetVecWindow()->GetWindowType() ==GetWindowTypeID_QtWellSection()) id = GetDigitizerID_QtWellWindowPick(); // if(viewCommand.GetSceneManager()->GetVecWindow()->GetWindowType() ==GetWindowTypeID_QtWellSection()) id = GetDigitizerID_QtWellWindowPick();
// else if(viewCommand.GetSceneManager()->GetVecWindow()->GetWindowType() == GetWindowTypeID_QtMultiWellSection()) id = GetDigitizerID_MultiWell(); // else if(viewCommand.GetSceneManager()->GetVecWindow()->GetWindowType() == GetWindowTypeID_QtMultiWellSection()) id = GetDigitizerID_MultiWell();
// else if(viewCommand.GetSceneManager()->GetVecWindow()->GetWindowType() == GetWindowTypeID_QtGeoGuideSection() ) id = GetDigitizerID_QtWellWindowPick() ; // else if(viewCommand.GetSceneManager()->GetVecWindow()->GetWindowType() == GetWindowTypeID_QtGeoGuideSection() ) id = GetDigitizerID_QtWellWindowPick() ;
// } // }
// bSucces = true; // bSucces = true;
// if( bShow) // if( bShow)
// { // {
// viewCommand.GetSceneManager()->GetEventHander().SwitchDigitizer( id,QUuid() ); // viewCommand.GetSceneManager()->GetEventHander().SwitchDigitizer( id,QUuid() );
// }else // }else
// { // {
// ///此处特殊处理 单井窗口 // ///此处特殊处理 单井窗口
// if(viewCommand.GetSceneManager()->GetVecWindow()->GetWindowType() ==GetWindowTypeID_QtWellSection()) viewCommand.DoAction( GetDigitizerID_QtWellWindowPick(),true ); // if(viewCommand.GetSceneManager()->GetVecWindow()->GetWindowType() ==GetWindowTypeID_QtWellSection()) viewCommand.DoAction( GetDigitizerID_QtWellWindowPick(),true );
// else if(viewCommand.GetSceneManager()->GetVecWindow()->GetWindowType() == GetWindowTypeID_QtMultiWellSection()) viewCommand.DoAction( GetDigitizerID_MultiWell(),true ); // else if(viewCommand.GetSceneManager()->GetVecWindow()->GetWindowType() == GetWindowTypeID_QtMultiWellSection()) viewCommand.DoAction( GetDigitizerID_MultiWell(),true );
// else if(viewCommand.GetSceneManager()->GetVecWindow()->GetWindowType() == GetWindowTypeID_QtGeoGuideSection() ) viewCommand.DoAction( GetDigitizerID_QtWellWindowPick(),true ); // else if(viewCommand.GetSceneManager()->GetVecWindow()->GetWindowType() == GetWindowTypeID_QtGeoGuideSection() ) viewCommand.DoAction( GetDigitizerID_QtWellWindowPick(),true );
// else // else
// { // {
// viewCommand.DoAction( GetDigitizerID_Pick(),true ); // viewCommand.DoAction( GetDigitizerID_Pick(),true );
// } // }
// } // }
// }else // }else
// { // {
// //处理Builder Object ID // //处理Builder Object ID
// CVecNodeBuilder *pBuilder = viewCommand.GetSceneManager()->GetBuilder( id ); // CVecNodeBuilder *pBuilder = viewCommand.GetSceneManager()->GetBuilder( id );
// if( pBuilder ) // if( pBuilder )
// { // {
// bSucces = true; // bSucces = true;
// pBuilder->SetEnable( bShow ); // pBuilder->SetEnable( bShow );
// } // }
// } // }
return bSucces; return bSucces;
} }
void CVecViewCommand::BuildActionGeneral(CVecViewCommand &viewCommand,QUuid viewCommandID) void CVecViewCommand::BuildActionGeneral(CVecViewCommand &viewCommand,QUuid viewCommandID)
{ {
viewCommand.AddUIElementToMap( viewCommandID,viewCommand._CreateAction(viewCommandID) ); viewCommand.AddUIElementToMap( viewCommandID,viewCommand._CreateAction(viewCommandID) );
} }
CVecSceneManager* CVecViewCommand::GetSceneManager() CVecSceneManager* CVecViewCommand::GetSceneManager()
{ {
return m_pSceneMgr; return m_pSceneMgr;
} }
QMap< QUuid,sUIELEMENTFunction >* g_MapAction = NULL; QMap< QUuid,sUIELEMENTFunction >* g_MapAction = NULL;
OSGFRAMEWORK_EXPORT QMap< QUuid,sUIELEMENTFunction >& GetmapUIElementFunc() OSGFRAMEWORK_EXPORT QMap< QUuid,sUIELEMENTFunction >& GetmapUIElementFunc()
{ {
if( !g_MapAction ) if( !g_MapAction )
{ {
g_MapAction = new QMap< QUuid,sUIELEMENTFunction >(); g_MapAction = new QMap< QUuid,sUIELEMENTFunction >();
} }
return *g_MapAction; return *g_MapAction;
} }
CVecViewCommand::CVecViewCommand() CVecViewCommand::CVecViewCommand()
{ {
m_pSceneMgr = NULL; m_pSceneMgr = NULL;
} }
void CVecViewCommand::slotActionClicked(bool bChecked ) void CVecViewCommand::slotActionClicked(bool bChecked )
{ {
QAction *pAction = dynamic_cast<QAction *>( this->sender() ); QAction *pAction = dynamic_cast<QAction *>( this->sender() );
if( pAction ) if( pAction )
{ {
DoAction( (QUuid)( pAction->data().toString() ),bChecked ); DoAction( (QUuid)( pAction->data().toString() ),bChecked );
} }
} }
bool CVecViewCommand::DoAction(QUuid viewCommandID,bool bChecked) bool CVecViewCommand::DoAction(QUuid viewCommandID,bool bChecked)
{ {
QUuid currentid; QUuid currentid;
// if(m_pSceneMgr&&m_pSceneMgr->GetCurrentDigitzer()) currentid=m_pSceneMgr->GetCurrentDigitzer()->GetDigitizerID(); // if(m_pSceneMgr&&m_pSceneMgr->GetCurrentDigitzer()) currentid=m_pSceneMgr->GetCurrentDigitzer()->GetDigitizerID();
//CWaitCursor waitCursor; //CWaitCursor waitCursor;
bool bSuccess(true); bool bSuccess(true);
// set action state // set action state
QAction* pAction = GetAction( viewCommandID ); QAction* pAction = GetAction( viewCommandID );
if( pAction ) if( pAction )
{ {
pAction->setChecked( bChecked ); pAction->setChecked( bChecked );
} }
//执行槽函数 //执行槽函数
UIELEMENTACTION_FUNC pActionSlot = GetmapUIElementFunc().value(viewCommandID).ActionSlot; UIELEMENTACTION_FUNC pActionSlot = GetmapUIElementFunc().value(viewCommandID).ActionSlot;
if( pActionSlot ) if( pActionSlot )
{ {
bSuccess = true; bSuccess = true;
(*pActionSlot)(*this,viewCommandID,bChecked); (*pActionSlot)(*this,viewCommandID,bChecked);
}else }else
{ {
bSuccess = _SlotDigitizerOrBuilder( *this,viewCommandID,bChecked ); bSuccess = _SlotDigitizerOrBuilder( *this,viewCommandID,bChecked );
} }
// 收集Action互斥数据 // 收集Action互斥数据
QList< QList< QUuid > > listMutexAll; QList< QList< QUuid > > listMutexAll;
if( listMutexAll.empty() ) if( listMutexAll.empty() )
{ {
QList<QUuid> listViewPostion; QList<QUuid> listViewPostion;
listViewPostion << GetViewCmdID_ViewAbove() << GetViewCmdID_ViewBelow() << GetViewCmdID_ViewEast() listViewPostion << GetViewCmdID_ViewAbove() << GetViewCmdID_ViewBelow() << GetViewCmdID_ViewEast()
<< GetViewCmdID_ViewWest()<< GetViewCmdID_ViewSouth()<< GetViewCmdID_ViewNorth(); << GetViewCmdID_ViewWest()<< GetViewCmdID_ViewSouth()<< GetViewCmdID_ViewNorth();
listMutexAll << listViewPostion; listMutexAll << listViewPostion;
// digitizer Action互斥 // digitizer Action互斥
QList<QUuid> listDigitizerModel; QList<QUuid> listDigitizerModel;
{ {
QMap<QUuid,sAction >&mapAction = _GetMapActionData(); QMap<QUuid,sAction >&mapAction = _GetMapActionData();
QMap<QUuid,sAction >::Iterator it = mapAction.begin(); QMap<QUuid,sAction >::Iterator it = mapAction.begin();
for( ; it!= mapAction.end() ; ++it ) for( ; it!= mapAction.end() ; ++it )
{ {
// if( CVecDigitizer::GetFatory().IsSupport( it.value().m_DigitizerIDOrBuilderOjectID ) ) // if( CVecDigitizer::GetFatory().IsSupport( it.value().m_DigitizerIDOrBuilderOjectID ) )
// { // {
// listDigitizerModel << it.key(); // listDigitizerModel << it.key();
// } // }
} }
} }
listMutexAll << listDigitizerModel; listMutexAll << listDigitizerModel;
} }
//执行Action互斥 //执行Action互斥
if( bChecked ) if( bChecked )
{ {
foreach( QList< QUuid > listMutex,listMutexAll ) foreach( QList< QUuid > listMutex,listMutexAll )
{ {
if( !listMutex.contains(viewCommandID) ) continue; if( !listMutex.contains(viewCommandID) ) continue;
foreach( QUuid eOther,listMutex ) foreach( QUuid eOther,listMutex )
{ {
if( eOther != viewCommandID ) if( eOther != viewCommandID )
{ {
QAction *pActionOther = GetAction( eOther ); QAction *pActionOther = GetAction( eOther );
if( pActionOther ) if( pActionOther )
{ {
pActionOther->setChecked( false ); pActionOther->setChecked( false );
} }
} }
} }
break; break;
} }
} }
return bSuccess ; return bSuccess ;
} }
QAction* CVecViewCommand::GetAction( QUuid viewCommandID,bool bCreateIfNotExist ) QAction* CVecViewCommand::GetAction( QUuid viewCommandID,bool bCreateIfNotExist )
{ {
//创建Action //创建Action
if( !m_mapUIElement.contains( viewCommandID ) ) if( !m_mapUIElement.contains( viewCommandID ) )
{ {
QList< QUuid > listTypes; QList< QUuid > listTypes;
listTypes << viewCommandID; listTypes << viewCommandID;
if( bCreateIfNotExist ) if( bCreateIfNotExist )
{ {
CreatActions( listTypes ); CreatActions( listTypes );
} }
} }
if(m_mapUIElement.contains( viewCommandID ) ) if(m_mapUIElement.contains( viewCommandID ) )
{ {
return dynamic_cast<QAction* >( m_mapUIElement.value( viewCommandID ) ); return dynamic_cast<QAction* >( m_mapUIElement.value( viewCommandID ) );
} }
return NULL; return NULL;
} }
void CVecViewCommand::CreatActions( QList<QUuid> listUIElementType ) void CVecViewCommand::CreatActions( QList<QUuid> listUIElementType )
{ {
QMap<QUuid,sAction >&mapAction = _GetMapActionData(); QMap<QUuid,sAction >&mapAction = _GetMapActionData();
foreach( QUuid viewCommandID,listUIElementType ) foreach( QUuid viewCommandID,listUIElementType )
{ {
//已经有了 //已经有了
if( m_mapUIElement.contains( viewCommandID ) ) if( m_mapUIElement.contains( viewCommandID ) )
{ {
continue; continue;
} }
// 如果是有ID,但Digitizer 或Builder都没有实现那么就不创建此Action // 如果是有ID,但Digitizer 或Builder都没有实现那么就不创建此Action
if( mapAction.contains( viewCommandID ) ) if( mapAction.contains( viewCommandID ) )
{ {
QUuid id = mapAction[viewCommandID].m_DigitizerIDOrBuilderOjectID; QUuid id = mapAction[viewCommandID].m_DigitizerIDOrBuilderOjectID;
// if( !id.isNull() ) // if( !id.isNull() )
// { // {
// bool bDigitizerID = CVecDigitizer::GetFatory().IsSupport( id ) ; // bool bDigitizerID = CVecDigitizer::GetFatory().IsSupport( id ) ;
// bool bBuilderID = false; // bool bBuilderID = false;
// if( m_pSceneMgr ) // if( m_pSceneMgr )
// { // {
// bBuilderID = m_pSceneMgr->GetBuilder( id ) ? true : false; // bBuilderID = m_pSceneMgr->GetBuilder( id ) ? true : false;
// } // }
// if( (!bDigitizerID) && (!bBuilderID) ) // if( (!bDigitizerID) && (!bBuilderID) )
// { // {
// continue; // continue;
// } // }
// } // }
} }
//创建此Action //创建此Action
BUILDUIELEMENT_FUNC pCreateFunction = GetmapUIElementFunc().value( viewCommandID).buildFunc; BUILDUIELEMENT_FUNC pCreateFunction = GetmapUIElementFunc().value( viewCommandID).buildFunc;
if( pCreateFunction ) if( pCreateFunction )
{ {
(*pCreateFunction)(*this,viewCommandID); (*pCreateFunction)(*this,viewCommandID);
} }
} }
} }
QAction* CVecViewCommand::_CreateAction( QUuid viewCommandID ) QAction* CVecViewCommand::_CreateAction( QUuid viewCommandID )
{ {
QMap<QUuid,sAction >&mapAction = _GetMapActionData(); QMap<QUuid,sAction >&mapAction = _GetMapActionData();
if( !mapAction.contains(viewCommandID) ) return NULL; if( !mapAction.contains(viewCommandID) ) return NULL;
// 根据插件注册的元数据创建QAction // 根据插件注册的元数据创建QAction
QAction *pAction( NULL ); QAction *pAction( NULL );
{ {
sAction &sAction = mapAction[viewCommandID]; sAction &sAction = mapAction[viewCommandID];
// pAction = new gui::PaiAction( sAction.strIcon.isEmpty() ? QIcon() : QIcon( ::GetImagePath() + sAction.strIcon ), // pAction = new gui::PaiAction( sAction.strIcon.isEmpty() ? QIcon() : QIcon( ::GetImagePath() + sAction.strIcon ),
// QStringFromWCharArray(sAction.strText.c_str(),-1 ),m_pSceneMgr ? dynamic_cast<QObject*>(m_pSceneMgr->GetVecViwer()) : (QObject*)this ); // QStringFromWCharArray(sAction.strText.c_str(),-1 ),m_pSceneMgr ? dynamic_cast<QObject*>(m_pSceneMgr->GetVecViwer()) : (QObject*)this );
pAction->setData( viewCommandID.toString() ); pAction->setData( viewCommandID.toString() );
pAction->setCheckable( sAction.bCheckAble ); pAction->setCheckable( sAction.bCheckAble );
pAction->setChecked( sAction.bChecked ); pAction->setChecked( sAction.bChecked );
if( !sAction.keyShortcut.isEmpty() ) if( !sAction.keyShortcut.isEmpty() )
{ {
pAction->setShortcut( sAction.keyShortcut ); pAction->setShortcut( sAction.keyShortcut );
} }
connect( pAction,SIGNAL(triggered ( bool )),SLOT(slotActionClicked(bool)) ); connect( pAction,SIGNAL(triggered ( bool )),SLOT(slotActionClicked(bool)) );
} }
return pAction ; return pAction ;
} }
void CVecViewCommand::AddUIElementToMap( QUuid viewCommandID,QObject *pUI ) void CVecViewCommand::AddUIElementToMap( QUuid viewCommandID,QObject *pUI )
{ {
m_mapUIElement[viewCommandID] = pUI; m_mapUIElement[viewCommandID] = pUI;
//Do action //Do action
QAction *pAction = dynamic_cast<QAction *>(pUI ); QAction *pAction = dynamic_cast<QAction *>(pUI );
if( pAction && pAction->isCheckable() ) if( pAction && pAction->isCheckable() )
{ {
DoAction( viewCommandID,pAction->isChecked() ); DoAction( viewCommandID,pAction->isChecked() );
} }
} }
bool CVecViewCommand::GetActionVisble( QUuid viewCommandID ) bool CVecViewCommand::GetActionVisble( QUuid viewCommandID )
{ {
bool bVisble(false); bool bVisble(false);
QAction *pAction = GetAction( viewCommandID,false ); QAction *pAction = GetAction( viewCommandID,false );
if( pAction ) if( pAction )
{ {
bVisble = pAction->isChecked() && pAction->isEnabled(); bVisble = pAction->isChecked() && pAction->isEnabled();
} }
return bVisble ; return bVisble ;
} }
void CVecViewCommand::InitSceneManager(CVecSceneManager *pSceneManager) void CVecViewCommand::InitSceneManager(CVecSceneManager *pSceneManager)
{ {
m_pSceneMgr = pSceneManager; m_pSceneMgr = pSceneManager;
} }
QMap<QUuid,QObject* >& CVecViewCommand::GetAllActions() QMap<QUuid,QObject* >& CVecViewCommand::GetAllActions()
{ {
return m_mapUIElement; return m_mapUIElement;
} }
OSGFRAMEWORK_EXPORT void RegisterViewAction( QUuid viewCommandID,sAction s,UIELEMENTACTION_FUNC pSlotAction) OSGFRAMEWORK_EXPORT void RegisterViewAction( QUuid viewCommandID,sAction s,UIELEMENTACTION_FUNC pSlotAction)
{ {
_GetMapActionData()[ viewCommandID ] = s; _GetMapActionData()[ viewCommandID ] = s;
GetmapUIElementFunc()[ viewCommandID ] = sUIELEMENTFunction( CVecViewCommand::BuildActionGeneral, GetmapUIElementFunc()[ viewCommandID ] = sUIELEMENTFunction( CVecViewCommand::BuildActionGeneral,
pSlotAction ); pSlotAction );
} }
OSGFRAMEWORK_EXPORT CVecViewCommand& GetGlobalCommand() OSGFRAMEWORK_EXPORT CVecViewCommand& GetGlobalCommand()
{ {
static CVecViewCommand s; static CVecViewCommand s;
return s; return s;
} }
END_OSGGRAPHICS_NAMESPACE; END_OSGGRAPHICS_NAMESPACE;