logplus/DrawBase/include/DrawBase.h

202 lines
6.9 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef DrawBase_H
#define DrawBase_H
//格线类型
//字体对齐方式
// #include "VecCoordinate.h"
#define LEFT Qt::AlignLeft
#define RIGHT Qt::AlignRight// 1
#define CENTER Qt::AlignCenter// 2
#define VCENTER Qt::AlignVCenter//3
#pragma warning( push ,0)
#include "OSGFramework.h"
// #include "QtWellTrackNode.h"
// #include "QtWellSceneManager.h"
#include "ObjWelllog.h"
// #include "HeadObj.h"
// #include "QtWellLogTrackNode.h"
#include "drawbase_global.h"
// #include "VecCoordinate.h"
#include <QImage>
#pragma warning( pop )
//#ifdef _WINDOWS
//#ifdef DRAWBASE_LIB
//#define DRAWBASE_EXPORT __declspec(dllexport)
//#else
//#define DRAWBASE_EXPORT __declspec(dllimport)
//#endif
//#else
//#define DRAWBASE_EXPORT
//#endif
BEGIN_OSGGRAPHICS_NAMESPACE;
struct DRAWBASE_EXPORT ColorMessage
{
int ColorNum; //颜色级数
int Mode; //调色方式
QColor Color[256]; //定义颜色数组
};
// 边结构数据类型
typedef struct Edge{
int ymax; // 边的最大y坐标
float x; // 与当前扫描线的交点x坐标
float dx; // 边所在直线斜率的倒数
struct Edge * pNext; // 指向下一条边
} Edge, * LPEdge;
struct DRAWBASE_EXPORT WaveMessage
{
int WaveType; // 绘图类型0-波形1-填充2-变密度
int Mode; //绘填充或变密度图形时的填充方式1-正半周,-1--负半周0-全周
float m_Left; //波列左刻度时间
float m_Right; //波列右刻度时间
float m_MaxRange; //波列最大幅度
float m_Base; //波列基值
int m_WaveSpace; //绘制波列间隔数即每隔m_WaveSpace个点画一个波列
float m_WaveHight; //波列高度
QColor WaveColor; //波列曲线的颜色
QColor FillColor; //填充的颜色
ColorMessage m_ColorMessage;
};
class DRAWBASE_EXPORT CDrawBase/*:public CQtWellLogTrackNode*/
{
// Q_OBJECT
public:
CDrawBase();
virtual ~CDrawBase();
virtual void Destory();
public:
// virtual float ConvertY(eCoordType eInCoordType, double flDep,
// eCoordType eOutCoordType );
float ConvertY(float fDep);
virtual void _Build();
virtual void DrawCurve(QPainter* pdc,QRectF mrt);
virtual void _UpdateHUD();
double getYOSGGlobalFromPixel(double y);
double getXOSGGlobalFromPixel(double x);
double getYGeoNormalFromPixel(double y);
double getYGeoFromOSGGlobal(double yOSGGlobal);
double getXGeoFromOSGGlobal(double xOSGGlobal,bool IsWF=0);
// osg::Vec3d OSGPixleToOSGLocal(osg::Vec3d vOSGPixel );
double getYFromOSGPixel(double y);
double getXFromOSGPixel(double x,bool IsWF=0,bool CalType=0);
// float YConvertToGEO(float y);
// float XConvertToGEO(float x);
// virtual void _Update( eUpdateEvent e,CObjectEventParam *pEventParam );
virtual void Refurbish();
virtual void ReadData();
virtual void SaveData();
virtual void InitProperty();
virtual void GetProperty();
void JudgePixel(QImage &pDC,QColor bc,unsigned char *strPixel);
void JudgePixel(unsigned char *iptrn,unsigned char *strPixel);
void FillLith(QPainter *pDC,QPointF *lpPoints,int nCount,QColor crFore,QColor crBack,QPointF *pixels,int *pointn,int nWidth,int nHeight);
void LineFillLith(QPainter *hdc,int x1,int x2,int y,int penw,QColor crFore,QColor crBack,QPointF *pixels,int *pointn,int nWidth,int nHeight);
void LineFillLith(QPainter *hdc,int x1,int x2,int y,int ipen,QColor crFore,QColor crBack,QImage image,int x0,int y0);
void FillLith(QPainter *pDC,QPointF *lpPoints,int nCount,QColor crFore,QColor crBack,QImage image,int x0,int y0);
void DrawLith(QPainter *pDC,QPointF *pt,int nPoint,QBrush FhName,QColor pForeColor,QColor bkColor);
int LITH_HEIGHT,LITH_WIDTH;
int nHeight;
int nWidth;
/*Slf_WAVE WaveInfo;*/
float m_nVertRatio,m_nHoriRatio,m_DepthScale,m_MMScale,m_HDepthScale;
int m_Ishorizontal;
bool m_IsPrint;
int DrawDev;
float m_PlotSdep,m_PlotEdep;//,m_MoveSdep,m_MoveEdep,m_MoveDep;
MyDataTypeEnum v,vCurve;
char* m_Value,*m_BackData;
QBrush m_brush;
float m_SDep,m_EDep,m_Rlev;
bool mIsCut,m_bSecond; //第二比例
float m_LeftVal; //左刻度
float m_RightVal; //右刻度
int m_nMaxAmp; //最大幅度
int m_nWaveHeight; //波形幅度
float m_flRlev2; //二维曲线采样间隔
float m_flStart,m_flEnd; //二维曲线开始值、结束值
int m_nSamples; //每深度间隔的数据点
int m_PointNum;
float *m_WaveValue; //波列数组
short *m_ShortWaveValue; //波列数组
Slf_WAVE WaveInfo; //波列基本信息
// WaveMessage mWaveMes; //波列设置消息
void GetDepth(QPainter *pDC,QRectF &mrt,QRectF &rt,
float &sdep,//屏幕显示起始斜深
float &edep,//屏幕显示终止斜深
float &sdepc,//水平位移显示下,斜深对应的水平位移;垂深显示下,斜深对应的垂深;
float &edepc);//水平位移显示下,斜深对应的水平位移;垂深显示下,斜深对应的垂深;
int iIndex;
QString sName;
QString sUnit;
QString sFilePath;
float ScreenWidth;
float ScreenHeight;
float ComputeCurvePos(float flVal,float lsc,float rsc,float lps,float rps,int iType,float scale,float flMin=-99999,float flMax=99999);
float ComputePosToCurveVal(float x,float lsc,float rsc,float lps,float rps,int iType,float scale,float flMin=-99999,float flMax=99999);
// void WriteStr(QPainter *pDC,QRectF rt1,CString cs,LOGFONT lf,
// QColor crColor,int iAlign,
// BOOL bVert,float flHoriRatio,int iBkMode,QColor crBack,UINT nFormat);
public:
/**
* @brief 设置来自document的sheet句柄
*/
// void SetWellSheet(CSheet* wellSheet);
/**
* @brief 控制图头部分显示属性
*/
virtual void SettingHeaderElements();
/**
* @brief 绘制曲线道头
*/
virtual void DrawHead(QPainter *pPainter,QRectF rect,QRectF trect=QRectF());
/**
* @brief 绘制曲线体
*/
virtual void DrawClient(QPainter *pPainter,QRectF rt);
virtual void GetClientItem(float sdep,float edep, QVector<QLine> &lines);
virtual void DrawSidelines(QPainter *pPainter,QRectF rt);
double GetDdep();
public:
double GetData(int RepCode,char *buffer);
void SetData(int RepCode,char *buffer,float yy);
// CItemText *m_pLeftText; //左刻度
// CItemText *m_pRightText;//右刻度
// CItemText *m_pUnitText; //单位
// CItemText *m_pCurveNameText;//曲线名称
// virtual CQtWellTrackNode * GetWellTrackNode(); //得到wellNode实例
protected:
CObjWellLog *m_pWellLog;
// CSheet* m_pWellSheet;
protected:
private:
//FontMessage *MyFontMes; //字体类型
// private:
/**
* @brief 初始化波列显示参数
*/
/**
* @brief 初始化波列属性
*/
/**
* @brief 更新色标颜色
* @param colorMode:显示模式0灰度1渐变
*/
// HeadObj* hHeadObj;
// ClientItem* m_pWave;
};
END_OSGGRAPHICS_NAMESPACE
#endif // DrawBase_H