#ifndef TRANSPARENTDRAGGABLESWALLCORE_H #define TRANSPARENTDRAGGABLESWALLCORE_H #include #include "qmycustomplot.h" #include #include #include "geometryutils.h" #include #include "GeoIndicatorGenerator.h" #pragma execution_character_set("utf-8") // 强制指定执行字符集为 UTF-8 class TransparentDraggableSwallCore : public QObject { Q_OBJECT public: explicit TransparentDraggableSwallCore(QMyCustomPlot *parentPlot, QString strUuid="", double minWidth = 1.0, QString strTitle = ""); ~TransparentDraggableSwallCore(); void DrawSVGNormal(QPainter* painter,QString svgFileName,QRectF borderRect,bool IsWellSectonHorizonLayout); //拉伸 void DrawSVGSteched(QPainter* painter,QString svgFileName,QRectF borderRect,bool IsWellSectonHorizonLayout); //平铺 void DrawSVGTiled(QPainter* painter,QString svgFileName,QRectF borderRect,bool IsWellSectonHorizonLayout); //设置最小宽度 void setMinWidth(double minWidth); //设置标题 void setTitle(QString strTitle); //设置解释结论 void setLith(QString filePath); void drawLith(double left_Low, double right_Hight, double lY1, double lY2); //设置m_Oil void setOil(QString filePath); void drawOil(double left_Low, double right_Hight, double lY1, double lY2); // 设置矩形范围 void setRange(double left_Low, double right_Hight); // 获取当前范围 QCPRange getRange(); // 设置矩形颜色 void setColor(const QColor &color); // 删除框图 void deleteRect(); signals: void rangeChanged(QCPRange newRange); private: void initRect(); void updateHandles() ; private slots: void onDelRect(); void onMousePress(QMouseEvent *event); void onMouseMove(QMouseEvent *event); void onMouseRelease(QMouseEvent *event); double getMyLower(); double getMyUpper(); private: QMyCustomPlot *mPlot; QCPItemRect *mRect; // QCPItemRect *mLeftHandle; // QCPItemRect *mRightHandle; QCPItemPixmap *mPixmap_Lith; QCPItemPixmap *mPixmap_Oil; //QCPItemPixmap *mPixmap_Color; QCPItemText *mItemTitle; QString mstrTitle=""; QString m_strUuid = ""; //三角形2边 QCPItemLine *m_qcpItemLine1; QCPItemLine *m_qcpItemLine2; QCPItemLine *m_qcpItemLine3; QString m_Lith; QString m_Oil; //QString m_Color; int m_ind; GeoIndicatorGenerator m_drawGeo; enum DragMode { DragNone, DragLeft, DragRight, DragRect }; DragMode mDragMode = DragNone; //double mDragStartX = 0; double mDragStartY = 0; QCPRange mDragStartRange; // 添加最小宽度成员变量 double mMinWidth; // float m_fLeftSpace=0; //左侧空白长度 float m_fTriangleLen=40;//三角形长度 // float m_fImageWidth=70;//图片长度 float m_fImageHeight=20;//图片高度 // float m_fColorWordLen=40;//颜色文字长度 }; #endif // TRANSPARENTDRAGGABLESWALLCORE_H