Merge branch 'main' of http://git.hivekion.com:3000/jiayulong/logplus
This commit is contained in:
commit
2cdfbe0c6d
|
Before Width: | Height: | Size: 479 B After Width: | Height: | Size: 479 B |
|
|
@ -68,12 +68,15 @@ void MyUnitUI::setParams(QString &strParams)
|
||||||
QAction *MyUnitUI::createAction()
|
QAction *MyUnitUI::createAction()
|
||||||
{
|
{
|
||||||
//下面, 平台显示按钮, 如需要平台显示解开注释
|
//下面, 平台显示按钮, 如需要平台显示解开注释
|
||||||
m_pAction = new QAction();
|
// m_pAction = new QAction();
|
||||||
m_pAction->setText("直方图");
|
|
||||||
m_pAction->setToolTip("直方图");
|
|
||||||
m_pAction->setIcon( QIcon(":/image/zfu.png"));
|
|
||||||
m_pAction->setProperty("PluginName", PLUGINUNIT);
|
|
||||||
|
|
||||||
|
if(m_pAction)
|
||||||
|
{
|
||||||
|
m_pAction->setText("直方图"); // 按钮显示文字
|
||||||
|
m_pAction->setToolTip("直方图"); // 鼠标移动到按钮显示tip
|
||||||
|
m_pAction->setIcon( QIcon(":/image/zfu.png")); // 按钮显示图片
|
||||||
|
m_pAction->setProperty("PluginName", PLUGINUNIT); // 模块名字
|
||||||
|
}
|
||||||
return m_pAction;
|
return m_pAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1,207 +0,0 @@
|
||||||
#include "cloudalgorithmaccess.h"
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QEventLoop>
|
|
||||||
#include <QTimer>
|
|
||||||
#include <QApplication>
|
|
||||||
#include <QDir>
|
|
||||||
#include <QtNetwork/QTcpSocket>
|
|
||||||
#include <QtNetwork/QNetworkProxy>
|
|
||||||
|
|
||||||
CloudAlgorithmAccess::CloudAlgorithmAccess(QObject *parent) : QObject(parent)
|
|
||||||
{
|
|
||||||
m_tcpSocket = new QTcpSocket(this);
|
|
||||||
m_responseResult.clear();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
QByteArray CloudAlgorithmAccess::sendHttpPost(const QString &host, int port, const QString &path, const QByteArray &data)
|
|
||||||
{
|
|
||||||
// 连接服务器
|
|
||||||
m_tcpSocket->connectToHost(host, port);
|
|
||||||
if (!m_tcpSocket->waitForConnected(5000)) {
|
|
||||||
qDebug() << "Connection failed!";
|
|
||||||
return QByteArray(); // 连接失败
|
|
||||||
}
|
|
||||||
|
|
||||||
// 构建HTTP请求
|
|
||||||
QByteArray request =
|
|
||||||
"POST " + path.toUtf8() + " HTTP/1.1\r\n" +
|
|
||||||
"Host: " + host.toUtf8() + "\r\n" +
|
|
||||||
"Content-Type: application/json\r\n" +
|
|
||||||
"Content-Length: " + QByteArray::number(data.length()) + "\r\n" +
|
|
||||||
"Connection: close\r\n" +
|
|
||||||
"\r\n" +
|
|
||||||
data;
|
|
||||||
|
|
||||||
// 发送请求
|
|
||||||
m_tcpSocket->write(request); // 将request数据写入套接字的写缓冲区,并尝试发送。
|
|
||||||
m_tcpSocket->waitForBytesWritten(5000); // 等待直到数据被实际发送(即写入网络)或超时5秒。
|
|
||||||
|
|
||||||
// 等待响应
|
|
||||||
QByteArray response;
|
|
||||||
while ( m_tcpSocket->waitForReadyRead(5000)) {
|
|
||||||
response.append(m_tcpSocket->readAll());
|
|
||||||
if (m_tcpSocket->bytesAvailable() == 0 && ! m_tcpSocket->isValid()) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_tcpSocket->close();
|
|
||||||
|
|
||||||
// 提取响应体(跳过HTTP头)尝试标准分隔符 \r\n\r\n
|
|
||||||
int headerEnd = response.indexOf("\r\n\r\n");
|
|
||||||
if (headerEnd != -1) {
|
|
||||||
return response.mid(headerEnd + 4);
|
|
||||||
}
|
|
||||||
// 尝试 \n\n(某些服务器可能使用)
|
|
||||||
headerEnd = response.indexOf("\n\n");
|
|
||||||
if (headerEnd != -1) {
|
|
||||||
return response.mid(headerEnd + 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 如果找不到标准分隔符,返回原始内容
|
|
||||||
qDebug() << "警告:无法解析HTTP响应格式,返回原始内容";
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
///计算孔隙度的json拼接样例
|
|
||||||
QString CloudAlgorithmAccess::buildJson(const QVector<double>& depths, const QVector<double>& values)
|
|
||||||
{
|
|
||||||
QString json = "{";
|
|
||||||
json += QString::fromUtf8("\"methodName\":\"根据声波时差计算(默认)\",");
|
|
||||||
json += "\"coefficient\":{\"DTpm\":\"49\",\"DTpf\":\"188.9\"},";
|
|
||||||
json += "\"curvesInfo\":{\"curveSource\":\"\",\"mdList\":[";
|
|
||||||
|
|
||||||
// 添加深度数据
|
|
||||||
for (int i = 0; i < depths.size(); i++) {
|
|
||||||
if (i > 0) json += ",";
|
|
||||||
json += QString::number(depths[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
json += QString::fromUtf8("],\"curveList\":[{\"curveName\":\"纵波时差\",\"minValue\":0,\"maxValue\":0,\"valueList\":[");
|
|
||||||
|
|
||||||
// 添加声波时差数据
|
|
||||||
for (int i = 0; i < values.size(); i++) {
|
|
||||||
if (i > 0) json += ",";
|
|
||||||
json += QString::number(values[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
json += "]}]}}";
|
|
||||||
qDebug() << "json:" << json;
|
|
||||||
|
|
||||||
return json;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 解析JSON数据的函数
|
|
||||||
int CloudAlgorithmAccess::parseResponseData(QString jsonData) {
|
|
||||||
//QString jsonData = QString::fromUtf8(data);
|
|
||||||
m_responseResult.clear();
|
|
||||||
int result = ParseSuccess;
|
|
||||||
|
|
||||||
// 检查响应码
|
|
||||||
int codePos = jsonData.indexOf("\"code\":");
|
|
||||||
if (codePos == -1) {
|
|
||||||
result = ParseNoCode;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
int codeStart = jsonData.indexOf(":", codePos) + 1;
|
|
||||||
int codeEnd = jsonData.indexOf(",", codeStart);
|
|
||||||
QString codeStr = jsonData.mid(codeStart, codeEnd - codeStart).trimmed();
|
|
||||||
|
|
||||||
int code = codeStr.toInt();
|
|
||||||
if (code != 200) {
|
|
||||||
result = ParseCodeError;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 查找data数组开始位置
|
|
||||||
int dataStartPos = jsonData.indexOf("\"data\":[");
|
|
||||||
if (dataStartPos == -1) {
|
|
||||||
result = ParseDataError;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
dataStartPos = jsonData.indexOf("[", dataStartPos) + 1;
|
|
||||||
|
|
||||||
// 解析每个数据项
|
|
||||||
int pos = dataStartPos;
|
|
||||||
while (pos < jsonData.length()) {
|
|
||||||
// 查找对象开始
|
|
||||||
int objStart = jsonData.indexOf("{", pos);
|
|
||||||
if (objStart == -1) break;
|
|
||||||
|
|
||||||
// 查找对象结束
|
|
||||||
int objEnd = jsonData.indexOf("}", objStart);
|
|
||||||
if (objEnd == -1) break;
|
|
||||||
|
|
||||||
QString objStr = jsonData.mid(objStart, objEnd - objStart + 1);
|
|
||||||
|
|
||||||
ResponseData data;
|
|
||||||
|
|
||||||
// 解析depth字段
|
|
||||||
int depthPos = objStr.indexOf("\"depth\":");
|
|
||||||
if (depthPos != -1) {
|
|
||||||
int depthStart = objStr.indexOf(":", depthPos) + 1;
|
|
||||||
int depthEnd = objStr.indexOf(",", depthStart);
|
|
||||||
if (depthEnd == -1) depthEnd = objStr.indexOf("}", depthStart);
|
|
||||||
QString depthStr = objStr.mid(depthStart, depthEnd - depthStart).trimmed();
|
|
||||||
data.depth = depthStr.toDouble();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 解析value字段
|
|
||||||
int valuePos = objStr.indexOf("\"value\":");
|
|
||||||
if (valuePos != -1) {
|
|
||||||
int valueStart = objStr.indexOf(":", valuePos) + 1;
|
|
||||||
int valueEnd = objStr.indexOf(",", valueStart);
|
|
||||||
if (valueEnd == -1) valueEnd = objStr.indexOf("}", valueStart);
|
|
||||||
QString valueStr = objStr.mid(valueStart, valueEnd - valueStart).trimmed();
|
|
||||||
data.value = valueStr.toDouble();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 解析overlying_Pressure字段
|
|
||||||
int pressurePos = objStr.indexOf("\"overlying_Pressure\":");
|
|
||||||
if (pressurePos != -1) {
|
|
||||||
int pressureStart = objStr.indexOf(":", pressurePos) + 1;
|
|
||||||
int pressureEnd = objStr.indexOf(",", pressureStart);
|
|
||||||
if (pressureEnd == -1) pressureEnd = objStr.indexOf("}", pressureStart);
|
|
||||||
QString pressureStr = objStr.mid(pressureStart, pressureEnd - pressureStart).trimmed();
|
|
||||||
data.overlying_Pressure = pressureStr.toDouble();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 解析dp字段
|
|
||||||
int dpPos = objStr.indexOf("\"dp\":");
|
|
||||||
if (dpPos != -1) {
|
|
||||||
int dpStart = objStr.indexOf(":", dpPos) + 1;
|
|
||||||
int dpEnd = objStr.indexOf(",", dpStart);
|
|
||||||
if (dpEnd == -1) dpEnd = objStr.indexOf("}", dpStart);
|
|
||||||
QString dpStr = objStr.mid(dpStart, dpEnd - dpStart).trimmed();
|
|
||||||
data.dp = dpStr.toDouble();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 解析dpTrend字段
|
|
||||||
int dpTrendPos = objStr.indexOf("\"dpTrend\":");
|
|
||||||
if (dpTrendPos != -1) {
|
|
||||||
int dpTrendStart = objStr.indexOf(":", dpTrendPos) + 1;
|
|
||||||
int dpTrendEnd = objStr.indexOf(",", dpTrendStart);
|
|
||||||
if (dpTrendEnd == -1) dpTrendEnd = objStr.indexOf("}", dpTrendStart);
|
|
||||||
QString dpTrendStr = objStr.mid(dpTrendStart, dpTrendEnd - dpTrendStart).trimmed();
|
|
||||||
data.dpTrend = dpTrendStr.toDouble();
|
|
||||||
}
|
|
||||||
|
|
||||||
m_responseResult.append(data);
|
|
||||||
pos = objEnd + 1;
|
|
||||||
|
|
||||||
// 检查是否还有下一个对象
|
|
||||||
if (jsonData.indexOf("{", pos) == -1) break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
const QList<ResponseData> &CloudAlgorithmAccess::getResponseResult() const
|
|
||||||
{
|
|
||||||
return m_responseResult;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
||||||
#ifndef CLOUDALGORITHMACCESS_H
|
|
||||||
#define CLOUDALGORITHMACCESS_H
|
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
#include <QtNetwork/QNetworkAccessManager>
|
|
||||||
#include <QtNetwork/QNetworkReply>
|
|
||||||
#include <QVector>
|
|
||||||
class QTcpSocket;
|
|
||||||
// 定义数据结构体
|
|
||||||
struct ResponseData {
|
|
||||||
int depth;
|
|
||||||
double value;
|
|
||||||
double overlying_Pressure;
|
|
||||||
double dp;
|
|
||||||
double dpTrend;
|
|
||||||
};
|
|
||||||
|
|
||||||
enum ParseResult{
|
|
||||||
ParseSuccess,
|
|
||||||
ParseNoCode,
|
|
||||||
ParseCodeError,
|
|
||||||
ParseDataError
|
|
||||||
};
|
|
||||||
|
|
||||||
class CloudAlgorithmAccess : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit CloudAlgorithmAccess(QObject *parent = 0);
|
|
||||||
QByteArray sendHttpPost(const QString &host, int port, const QString &path, const QByteArray &data);
|
|
||||||
int parseResponseData(QString jsonData);
|
|
||||||
QString buildJson(const QVector<double>& depths, const QVector<double>& values);
|
|
||||||
const QList<ResponseData> &getResponseResult() const ;
|
|
||||||
|
|
||||||
private:
|
|
||||||
QTcpSocket *m_tcpSocket;
|
|
||||||
///响应数据解析完成后放入该容器中
|
|
||||||
QList<ResponseData> m_responseResult;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // CLOUDALGORITHMACCESS_H
|
|
||||||
|
|
@ -5,11 +5,11 @@ QT += core \
|
||||||
gui \
|
gui \
|
||||||
network \
|
network \
|
||||||
opengl
|
opengl
|
||||||
INCLUDEPATH += ../../common \
|
INCLUDEPATH += $$PWD/../../common \
|
||||||
../../include \
|
$$PWD/../../include \
|
||||||
# ../../../OSGParts/include \
|
# ../../../OSGParts/include \
|
||||||
../../Slfio/include \
|
$$PWD/../../Slfio/include \
|
||||||
../../BaseFun/include \
|
$$PWD/../../BaseFun/include \
|
||||||
D:/Python312/include\
|
D:/Python312/include\
|
||||||
D:/Python312/Lib/site-packages/numpy/_core/include\
|
D:/Python312/Lib/site-packages/numpy/_core/include\
|
||||||
$(QTDIR)/include \
|
$(QTDIR)/include \
|
||||||
|
|
@ -17,10 +17,10 @@ INCLUDEPATH += ../../common \
|
||||||
|
|
||||||
OBJECTS_DIR = ../obj
|
OBJECTS_DIR = ../obj
|
||||||
CONFIG(debug, debug|release){
|
CONFIG(debug, debug|release){
|
||||||
DESTDIR = ../../../Bin/app
|
DESTDIR = $$PWD/../../Bin/app
|
||||||
TARGET = $$join(TARGET,,,d) #为debug版本生成的文件增加d的后缀
|
TARGET = $$join(TARGET,,,d) #为debug版本生成的文件增加d的后缀
|
||||||
} else {
|
} else {
|
||||||
DESTDIR = ../../../BinR/app
|
DESTDIR = $$PWD/../../BinR/app
|
||||||
TARGET = $$join(TARGET,,,)
|
TARGET = $$join(TARGET,,,)
|
||||||
}
|
}
|
||||||
CONFIG += qt warn_off \
|
CONFIG += qt warn_off \
|
||||||
|
|
@ -36,7 +36,7 @@ HeadS += ../include/*.h
|
||||||
|
|
||||||
SOURCES += *.cpp
|
SOURCES += *.cpp
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
./cloudalgorithmaccess.h \
|
# ./cloudalgorithmaccess.h \
|
||||||
./pythonhandler.h
|
./pythonhandler.h
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -44,14 +44,14 @@ HEADERS += \
|
||||||
# 目标文件夹
|
# 目标文件夹
|
||||||
#CATEGORY = OSGDataModel
|
#CATEGORY = OSGDataModel
|
||||||
CONFIG(debug, debug|release){
|
CONFIG(debug, debug|release){
|
||||||
LIBS += -L../../../Bin -lslfiod
|
LIBS += -L$$PWD/../../Bin -lslfiod
|
||||||
LIBS += -L../../../Bin -lBaseFund
|
LIBS += -L$$PWD/../../Bin -lBaseFund
|
||||||
LIBS += -LD:/Python312/libs -lpython312_d
|
LIBS += -LD:/Python312/libs -lpython312_d
|
||||||
# LIBS += -L$(QTDIR)/lib -lQtNetworkd4
|
# LIBS += -L$(QTDIR)/lib -lQtNetworkd4
|
||||||
# LIBS += -LD:/Qt4.7.1/lib -lQtNetworkd4
|
# LIBS += -LD:/Qt4.7.1/lib -lQtNetworkd4
|
||||||
} else {
|
} else {
|
||||||
LIBS += -L../../../BinR -lslfio
|
LIBS += -L$$PWD/../../BinR -lslfio
|
||||||
LIBS += -L../../../BinR -lBaseFun
|
LIBS += -L$$PWD/../../BinR -lBaseFun
|
||||||
LIBS += -LD:/Python312/libs -lpython312
|
LIBS += -LD:/Python312/libs -lpython312
|
||||||
# LIBS += -LD:/Qt4.7.1/lib -lQtNetworkd4
|
# LIBS += -LD:/Qt4.7.1/lib -lQtNetworkd4
|
||||||
# LIBS += -LD:/Qt4.7.1/lib -lQtNetworkd4
|
# LIBS += -LD:/Qt4.7.1/lib -lQtNetworkd4
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
#include "basefun.h"
|
#include "basefun.h"
|
||||||
#include "DepthProgress.h"
|
#include "DepthProgress.h"
|
||||||
#include <qvector.h>
|
#include <qvector.h>
|
||||||
#include"cloudalgorithmaccess.h"
|
//#include"cloudalgorithmaccess.h"
|
||||||
#include <QTextCodec>
|
#include <QTextCodec>
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QtNetwork/QNetworkProxyFactory>
|
#include <QtNetwork/QNetworkProxyFactory>
|
||||||
|
|
|
||||||
|
|
@ -109,8 +109,8 @@ void TransparentDraggableGeoLith::drawLith(double left_Low, double right_Hight,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
double x1 = mPlot->xAxis->coordToPixel(left_Low);
|
double x1 = mPlot->xAxis->coordToPixel(left_Low)-1; //下边上移1像素-1
|
||||||
double x2 = mPlot->xAxis->coordToPixel(right_Hight);
|
double x2 = mPlot->xAxis->coordToPixel(right_Hight)+1;//上边下移1像素+1
|
||||||
double y1 = 0;
|
double y1 = 0;
|
||||||
if(mPlot->m_bShowOil)
|
if(mPlot->m_bShowOil)
|
||||||
{
|
{
|
||||||
|
|
@ -257,8 +257,8 @@ void TransparentDraggableGeoLith::drawColorLeft(double left_Low, double right_Hi
|
||||||
GetWellNameAndPath(m_Color, filename, path);
|
GetWellNameAndPath(m_Color, filename, path);
|
||||||
QString basename = filename;
|
QString basename = filename;
|
||||||
|
|
||||||
double x1 = mPlot->xAxis->coordToPixel(left_Low);
|
double x1 = mPlot->xAxis->coordToPixel(left_Low)-1; //下边上移1像素-1
|
||||||
double x2 = mPlot->xAxis->coordToPixel(right_Hight);
|
double x2 = mPlot->xAxis->coordToPixel(right_Hight)+1;//上边下移1像素+1
|
||||||
double y1 = mPlot->yAxis->coordToPixel(lY1);
|
double y1 = mPlot->yAxis->coordToPixel(lY1);
|
||||||
double y2 = mPlot->yAxis->coordToPixel(lY1+(lY2-lY1)/mPlot->m_dOilZhan);
|
double y2 = mPlot->yAxis->coordToPixel(lY1+(lY2-lY1)/mPlot->m_dOilZhan);
|
||||||
double newWidth = y2-y1;
|
double newWidth = y2-y1;
|
||||||
|
|
@ -293,8 +293,8 @@ void TransparentDraggableGeoLith::drawColorLeft(double left_Low, double right_Hi
|
||||||
//
|
//
|
||||||
mPixmap_Color->setPixmap(QPixmap(val)); // 设置图片
|
mPixmap_Color->setPixmap(QPixmap(val)); // 设置图片
|
||||||
|
|
||||||
mPixmap_Color->topLeft->setCoords(right_Hight, lY1);//right_Hight
|
mPixmap_Color->topLeft->setCoords(right_Hight, mPlot->yAxis->pixelToCoord(y1+1));//right_Hight
|
||||||
mPixmap_Color->bottomRight->setCoords(left_Low, lY1+(lY2-lY1)/mPlot->m_dOilZhan);//left_Low
|
mPixmap_Color->bottomRight->setCoords(left_Low, mPlot->yAxis->pixelToCoord(y2-1));//left_Low
|
||||||
}
|
}
|
||||||
|
|
||||||
//设置m_Oil
|
//设置m_Oil
|
||||||
|
|
@ -309,6 +309,13 @@ void TransparentDraggableGeoLith::drawOil(double left_Low, double right_Hight, d
|
||||||
{
|
{
|
||||||
mPixmap_Oil->topLeft->setCoords(0, 0); //right_Hight, lY1
|
mPixmap_Oil->topLeft->setCoords(0, 0); //right_Hight, lY1
|
||||||
mPixmap_Oil->bottomRight->setCoords(0, 0); //left_Low
|
mPixmap_Oil->bottomRight->setCoords(0, 0); //left_Low
|
||||||
|
|
||||||
|
//含油2条线
|
||||||
|
m_qcpItemLine1->start->setCoords(0, 0);
|
||||||
|
m_qcpItemLine1->end->setCoords(0, 0);
|
||||||
|
//
|
||||||
|
m_qcpItemLine2->start->setCoords(0, 0);
|
||||||
|
m_qcpItemLine2->end->setCoords(0, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -384,13 +391,34 @@ void TransparentDraggableGeoLith::drawOil(double left_Low, double right_Hight, d
|
||||||
|
|
||||||
if(mPlot->m_bCenterOil)//含油性居中
|
if(mPlot->m_bCenterOil)//含油性居中
|
||||||
{
|
{
|
||||||
mPixmap_Oil->topLeft->setCoords(xNewRight, lY1+ (lY2-lY1 -(lY2-lY1)/mPlot->m_dOilZhan) / 2.0); //right_Hight, lY1
|
double yTmp1 = mPlot->yAxis->coordToPixel(lY1+ (lY2-lY1 -(lY2-lY1)/mPlot->m_dOilZhan) / 2.0);
|
||||||
mPixmap_Oil->bottomRight->setCoords(xNewLeft, lY2- (lY2-lY1 -(lY2-lY1)/mPlot->m_dOilZhan) / 2.0); //left_Low
|
double yTmp2 = mPlot->yAxis->coordToPixel(lY2- (lY2-lY1 -(lY2-lY1)/mPlot->m_dOilZhan) / 2.0);
|
||||||
|
|
||||||
|
mPixmap_Oil->topLeft->setCoords(xNewRight, mPlot->yAxis->pixelToCoord(yTmp1+1)); //right_Hight, lY1
|
||||||
|
mPixmap_Oil->bottomRight->setCoords(xNewLeft, mPlot->yAxis->pixelToCoord(yTmp2-2)); //left_Low
|
||||||
|
|
||||||
|
if(mPlot->m_bShowColor || mPlot->m_bShowColorNum) // 绘制颜色号/显示颜色
|
||||||
|
{
|
||||||
|
//颜色1条线
|
||||||
|
m_qcpItemLine1->start->setCoords(right_Hight, mPlot->yAxis->pixelToCoord(y1));
|
||||||
|
m_qcpItemLine1->end->setCoords(left_Low, mPlot->yAxis->pixelToCoord(y1));
|
||||||
|
//第2条隐藏
|
||||||
|
m_qcpItemLine2->start->setCoords(0, 0);
|
||||||
|
m_qcpItemLine2->end->setCoords(0, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mPixmap_Oil->topLeft->setCoords(xNewRight, mPlot->yAxis->pixelToCoord(y1+1)); //right_Hight, lY1
|
mPixmap_Oil->topLeft->setCoords(xNewRight, mPlot->yAxis->pixelToCoord(y1+1)); //right_Hight, lY1
|
||||||
mPixmap_Oil->bottomRight->setCoords(xNewLeft, mPlot->yAxis->pixelToCoord(y2-1)); //left_Low
|
mPixmap_Oil->bottomRight->setCoords(xNewLeft, mPlot->yAxis->pixelToCoord(y2-2)); //left_Low
|
||||||
|
|
||||||
|
//含油2条线
|
||||||
|
m_qcpItemLine1->start->setCoords(right_Hight, mPlot->yAxis->pixelToCoord(y1));
|
||||||
|
m_qcpItemLine1->end->setCoords(left_Low, mPlot->yAxis->pixelToCoord(y1));
|
||||||
|
//
|
||||||
|
m_qcpItemLine2->start->setCoords(right_Hight, mPlot->yAxis->pixelToCoord(y2));
|
||||||
|
m_qcpItemLine2->end->setCoords(left_Low, mPlot->yAxis->pixelToCoord(y2));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//mPlot->replot();
|
//mPlot->replot();
|
||||||
|
|
@ -404,6 +432,12 @@ void TransparentDraggableGeoLith::setRange(double left_Low, double right_Hight,
|
||||||
double lY1 = mPlot->yAxis->range().lower;//+10
|
double lY1 = mPlot->yAxis->range().lower;//+10
|
||||||
double lY2 = mPlot->yAxis->range().upper;
|
double lY2 = mPlot->yAxis->range().upper;
|
||||||
|
|
||||||
|
//坐标转像素
|
||||||
|
double x1 = mPlot->xAxis->coordToPixel(left_Low);
|
||||||
|
double x2 = mPlot->xAxis->coordToPixel(right_Hight);
|
||||||
|
double left_Low2 = mPlot->xAxis->pixelToCoord(x1-2);
|
||||||
|
double right_Hight2 = mPlot->xAxis->pixelToCoord(x2+1);
|
||||||
|
|
||||||
mRect->topLeft->setCoords(left_Low, lY1);
|
mRect->topLeft->setCoords(left_Low, lY1);
|
||||||
mRect->bottomRight->setCoords(right_Hight, lY2);
|
mRect->bottomRight->setCoords(right_Hight, lY2);
|
||||||
|
|
||||||
|
|
@ -451,13 +485,13 @@ void TransparentDraggableGeoLith::setRange(double left_Low, double right_Hight,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
drawLith(left_Low, right_Hight, lY1, lY2);
|
drawLith(left_Low2, right_Hight2, lY1, lY2);
|
||||||
|
|
||||||
//位置与rect不一样,否则图像反转
|
//位置与rect不一样,否则图像反转
|
||||||
drawOil(left_Low, right_Hight, lY1, lY2);
|
drawOil(left_Low2, right_Hight2, lY1, lY2);
|
||||||
|
|
||||||
//左侧颜色
|
//左侧颜色
|
||||||
drawColorLeft(left_Low, right_Hight, lY1, lY2);
|
drawColorLeft(left_Low2, right_Hight2, lY1, lY2);
|
||||||
|
|
||||||
updateHandles();
|
updateHandles();
|
||||||
|
|
||||||
|
|
@ -501,6 +535,9 @@ void TransparentDraggableGeoLith::deleteRect()
|
||||||
mPlot->removeItem(mPixmap_Oil);
|
mPlot->removeItem(mPixmap_Oil);
|
||||||
mPlot->removeItem(mPixmap_Color);
|
mPlot->removeItem(mPixmap_Color);
|
||||||
mPlot->removeItem(mItemTitle);
|
mPlot->removeItem(mItemTitle);
|
||||||
|
//含油2边
|
||||||
|
mPlot->removeItem(m_qcpItemLine1);
|
||||||
|
mPlot->removeItem(m_qcpItemLine2);
|
||||||
|
|
||||||
//mPlot->replot();
|
//mPlot->replot();
|
||||||
this->deleteLater();
|
this->deleteLater();
|
||||||
|
|
@ -570,6 +607,14 @@ void TransparentDraggableGeoLith::initRect()
|
||||||
//mItemTitle->position->setType(QCPItemPosition::ptAxisRectRatio);
|
//mItemTitle->position->setType(QCPItemPosition::ptAxisRectRatio);
|
||||||
mItemTitle->position->setCoords(0.5, 0);
|
mItemTitle->position->setCoords(0.5, 0);
|
||||||
mItemTitle->setLayer("overlay");
|
mItemTitle->setLayer("overlay");
|
||||||
|
|
||||||
|
//含油2边
|
||||||
|
m_qcpItemLine1 = new QCPItemLine(mPlot);
|
||||||
|
m_qcpItemLine1->setPen(QPen(QColor(0, 0, 0, 200)));
|
||||||
|
//
|
||||||
|
m_qcpItemLine2 = new QCPItemLine(mPlot);
|
||||||
|
m_qcpItemLine2->setPen(QPen(QColor(0, 0, 0, 200)));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransparentDraggableGeoLith::updateHandles()
|
void TransparentDraggableGeoLith::updateHandles()
|
||||||
|
|
|
||||||
|
|
@ -87,6 +87,10 @@ public:
|
||||||
QString mstrTitle="";
|
QString mstrTitle="";
|
||||||
QString m_strUuid = "";
|
QString m_strUuid = "";
|
||||||
|
|
||||||
|
//含油 2边
|
||||||
|
QCPItemLine *m_qcpItemLine1;
|
||||||
|
QCPItemLine *m_qcpItemLine2;
|
||||||
|
|
||||||
QString m_Lith;
|
QString m_Lith;
|
||||||
QString m_Oil;
|
QString m_Oil;
|
||||||
QString m_Color;
|
QString m_Color;
|
||||||
|
|
|
||||||
|
|
@ -181,9 +181,14 @@ void TransparentDraggableGujing::setRange(double left_Low, double right_Hight, b
|
||||||
mRect->bottomRight->setCoords(right_Hight, lY2);
|
mRect->bottomRight->setCoords(right_Hight, lY2);
|
||||||
|
|
||||||
//位置与rect不一样,否则图像反转
|
//位置与rect不一样,否则图像反转
|
||||||
mPixmap->topLeft->setCoords(right_Hight, lY1);
|
double x1 = mPlot->xAxis->coordToPixel(left_Low);
|
||||||
mPixmap->bottomRight->setCoords(left_Low, lY2);
|
double x2 = mPlot->xAxis->coordToPixel(right_Hight);
|
||||||
drawResult(left_Low, right_Hight, lY1, lY2);
|
double left_Low2 = mPlot->xAxis->pixelToCoord(x1-2);
|
||||||
|
double right_Hight2 = mPlot->xAxis->pixelToCoord(x2+1);
|
||||||
|
//
|
||||||
|
mPixmap->topLeft->setCoords(right_Hight2, lY1);
|
||||||
|
mPixmap->bottomRight->setCoords(left_Low2, lY2);
|
||||||
|
drawResult(left_Low2, right_Hight2, lY1, lY2);
|
||||||
|
|
||||||
// 设置父锚点,定位点
|
// 设置父锚点,定位点
|
||||||
mItemTitle->position->setCoords((mRect->topLeft->coords().x() + mRect->bottomRight->coords().x())/2,
|
mItemTitle->position->setCoords((mRect->topLeft->coords().x() + mRect->bottomRight->coords().x())/2,
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,8 @@ TransparentDraggableSwallCore::TransparentDraggableSwallCore(QMyCustomPlot *pare
|
||||||
m_strUuid = strUuid;
|
m_strUuid = strUuid;
|
||||||
|
|
||||||
//图片高度(需要根据高度宏定义,重新计算)
|
//图片高度(需要根据高度宏定义,重新计算)
|
||||||
double h = SideWallCoreHeight * g_dPixelPerCm; //0.4cm //40;
|
// double h = SideWallCoreHeight * g_dPixelPerCm; //0.4cm //40;
|
||||||
m_fImageHeight = h/2.0;
|
// m_fImageHeight = h/2.0;
|
||||||
|
|
||||||
//
|
//
|
||||||
initRect();
|
initRect();
|
||||||
|
|
@ -101,10 +101,10 @@ void TransparentDraggableSwallCore::drawLith(double left_Low, double right_Hight
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
double x1 = mPlot->xAxis->coordToPixel((left_Low+right_Hight)/2)+m_fImageHeight;
|
double x1 = mPlot->xAxis->coordToPixel((left_Low+right_Hight)/2)+m_fImageHeight-1; //下边上移1像素-1
|
||||||
double x2 = mPlot->xAxis->coordToPixel((left_Low+right_Hight)/2);
|
double x2 = mPlot->xAxis->coordToPixel((left_Low+right_Hight)/2)+1;//上边下移1像素+1
|
||||||
double y1 = mPlot->yAxis->coordToPixel(lY1)+(m_fLeftSpace+m_fTriangleLen);
|
double y1 = mPlot->yAxis->coordToPixel(lY1)+(m_fLeftSpace+m_fTriangleLen);
|
||||||
double y2 = mPlot->yAxis->coordToPixel(lY1)+m_fImageWidth+(m_fLeftSpace+m_fTriangleLen);
|
double y2 = mPlot->yAxis->coordToPixel(lY1)+(m_fLeftSpace+m_fTriangleLen)+m_fImageWidth-1;
|
||||||
|
|
||||||
bool bWidthBig = false;
|
bool bWidthBig = false;
|
||||||
double newWidth = y2-y1;
|
double newWidth = y2-y1;
|
||||||
|
|
@ -152,35 +152,36 @@ void TransparentDraggableSwallCore::drawLith(double left_Low, double right_Hight
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QString path,filename;
|
// QString path,filename;
|
||||||
GetWellNameAndPath(filePath, filename, path);
|
// GetWellNameAndPath(filePath, filename, path);
|
||||||
QString basename = filename;
|
// QString basename = filename;
|
||||||
|
// QString val=filePath;
|
||||||
|
// QImage image(newWidth, newHeight, QImage::Format_RGB32);
|
||||||
|
// QPainter painter(&image);
|
||||||
|
// QRectF fillRect(0,0,newWidth, newHeight);
|
||||||
|
// painter.fillRect(fillRect,Qt::white);
|
||||||
|
// //
|
||||||
|
// bool isOne=true;
|
||||||
|
// bool isStech=true;
|
||||||
|
// bool isHorizon=false;
|
||||||
|
// float cm = g_dPixelPerCm;//一厘米对应的像素个数
|
||||||
|
// QColor bkColor = QColor(255,255,255,0);
|
||||||
|
|
||||||
QString val=filePath;
|
// float GeoResult = m_drawGeo.seleGeo("岩性符号库", basename, &painter, fillRect, isOne, isStech, isHorizon, cm, bkColor);
|
||||||
QImage image(newWidth, newHeight, QImage::Format_RGB32);
|
|
||||||
QPainter painter(&image);
|
// val=GetImagePath()+"TempNew";
|
||||||
QRectF fillRect(0,0,newWidth, newHeight);
|
// QDir ss;
|
||||||
painter.fillRect(fillRect,Qt::white);
|
// if(!ss.exists(val)) {
|
||||||
|
// ss.mkdir(val);
|
||||||
|
// }
|
||||||
|
// val+=QDir::separator();
|
||||||
|
// val+=basename+".png";
|
||||||
|
// image.save(val);
|
||||||
//
|
//
|
||||||
bool isOne=true;
|
// mPixmap_Lith->setPixmap(QPixmap(val)); // 设置图片
|
||||||
bool isStech=true;
|
|
||||||
bool isHorizon=false;
|
|
||||||
float cm = g_dPixelPerCm;//一厘米对应的像素个数
|
|
||||||
QColor bkColor = QColor(255,255,255,0);
|
|
||||||
|
|
||||||
float GeoResult = m_drawGeo.seleGeo("岩性符号库", basename, &painter, fillRect, isOne, isStech, isHorizon, cm, bkColor);
|
|
||||||
|
|
||||||
val=GetImagePath()+"TempNew";
|
|
||||||
QDir ss;
|
|
||||||
if(!ss.exists(val)) {
|
|
||||||
ss.mkdir(val);
|
|
||||||
}
|
|
||||||
val+=QDir::separator();
|
|
||||||
val+=basename+".png";
|
|
||||||
image.save(val);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
mPixmap_Lith->setPixmap(QPixmap(val)); // 设置图片
|
mPixmap_Lith->setPixmap(QPixmap(m_Lith)); // 设置图片
|
||||||
}
|
}
|
||||||
mPixmap_Lith->topLeft->setCoords(mPlot->xAxis->pixelToCoord(x2), mPlot->yAxis->pixelToCoord(y1));//right_Hight+1
|
mPixmap_Lith->topLeft->setCoords(mPlot->xAxis->pixelToCoord(x2), mPlot->yAxis->pixelToCoord(y1));//right_Hight+1
|
||||||
mPixmap_Lith->bottomRight->setCoords(mPlot->xAxis->pixelToCoord(x1), mPlot->yAxis->pixelToCoord(y2));//left_Low-1
|
mPixmap_Lith->bottomRight->setCoords(mPlot->xAxis->pixelToCoord(x1), mPlot->yAxis->pixelToCoord(y2));//left_Low-1
|
||||||
|
|
@ -200,8 +201,8 @@ void TransparentDraggableSwallCore::drawOil(double left_Low, double right_Hight,
|
||||||
}
|
}
|
||||||
|
|
||||||
double x1 = mPlot->xAxis->coordToPixel((left_Low+right_Hight)/2);
|
double x1 = mPlot->xAxis->coordToPixel((left_Low+right_Hight)/2);
|
||||||
double x2 = mPlot->xAxis->coordToPixel((left_Low+right_Hight)/2)-m_fImageHeight;
|
double x2 = mPlot->xAxis->coordToPixel((left_Low+right_Hight)/2)-m_fImageHeight;//
|
||||||
double y1 = mPlot->yAxis->coordToPixel(lY1)+(m_fLeftSpace+m_fTriangleLen);
|
double y1 = mPlot->yAxis->coordToPixel(lY1)+(m_fLeftSpace+m_fTriangleLen)+0.333*m_fImageWidth;
|
||||||
double y2 = mPlot->yAxis->coordToPixel(lY1)+m_fImageWidth+(m_fLeftSpace+m_fTriangleLen);
|
double y2 = mPlot->yAxis->coordToPixel(lY1)+m_fImageWidth+(m_fLeftSpace+m_fTriangleLen);
|
||||||
|
|
||||||
bool bWidthBig = false;
|
bool bWidthBig = false;
|
||||||
|
|
@ -274,27 +275,51 @@ void TransparentDraggableSwallCore::setRange(double left_Low, double right_Hight
|
||||||
double lY1 = mPlot->yAxis->range().lower;//+10
|
double lY1 = mPlot->yAxis->range().lower;//+10
|
||||||
double lY2 = mPlot->yAxis->range().upper;
|
double lY2 = mPlot->yAxis->range().upper;
|
||||||
|
|
||||||
mRect->topLeft->setCoords(left_Low, lY1+(m_fLeftSpace+m_fTriangleLen));
|
//坐标转像素
|
||||||
mRect->bottomRight->setCoords(right_Hight, lY1+(m_fLeftSpace+m_fTriangleLen)+m_fImageWidth+m_fColorWordLen);
|
double x1 = mPlot->xAxis->coordToPixel(left_Low);
|
||||||
|
double x2 = mPlot->xAxis->coordToPixel(right_Hight);
|
||||||
|
double left_Low2 = mPlot->xAxis->pixelToCoord(x1-2);
|
||||||
|
double right_Hight2 = mPlot->xAxis->pixelToCoord(x2+1);
|
||||||
|
double y1 = mPlot->yAxis->coordToPixel(lY1);
|
||||||
|
double y2 = mPlot->yAxis->coordToPixel(lY2);
|
||||||
|
|
||||||
drawLith(left_Low, right_Hight, lY1, lY2);
|
mRect->topLeft->setCoords(left_Low, mPlot->yAxis->pixelToCoord(y1+(m_fLeftSpace+m_fTriangleLen)+m_fImageWidth));
|
||||||
|
mRect->bottomRight->setCoords(right_Hight, mPlot->yAxis->pixelToCoord(y1+(m_fLeftSpace+m_fTriangleLen)+m_fImageWidth+m_fColorWordLen));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
drawLith(left_Low2, right_Hight2, lY1, lY2);
|
||||||
|
|
||||||
|
drawOil(left_Low2, right_Hight2, lY1, lY2);
|
||||||
|
|
||||||
|
mItemTitle->position->setCoords(mPlot->xAxis->pixelToCoord(x2+8),
|
||||||
|
mPlot->yAxis->pixelToCoord(y1+(m_fLeftSpace+m_fTriangleLen)+m_fImageWidth+12));
|
||||||
|
|
||||||
drawOil(left_Low, right_Hight, lY1, lY2);
|
|
||||||
|
|
||||||
mItemTitle->position->setCoords(mRect->bottomRight->coords().x(),
|
|
||||||
lY1+(m_fLeftSpace+m_fTriangleLen)+m_fImageWidth+20);
|
|
||||||
|
|
||||||
//三角形2边
|
//三角形2边
|
||||||
m_qcpItemLine1->start->setCoords((left_Low+right_Hight)/2, lY1+m_fLeftSpace);
|
m_qcpItemLine1->start->setCoords((left_Low+right_Hight)/2, mPlot->yAxis->pixelToCoord(y1+m_fLeftSpace));
|
||||||
m_qcpItemLine1->end->setCoords(left_Low, lY1+(m_fLeftSpace+m_fTriangleLen));
|
m_qcpItemLine1->end->setCoords(left_Low, mPlot->yAxis->pixelToCoord(y1+(m_fLeftSpace+m_fTriangleLen)));
|
||||||
//
|
//
|
||||||
m_qcpItemLine2->start->setCoords((left_Low+right_Hight)/2, lY1+m_fLeftSpace);
|
m_qcpItemLine2->start->setCoords((left_Low+right_Hight)/2, mPlot->yAxis->pixelToCoord(y1+m_fLeftSpace));
|
||||||
m_qcpItemLine2->end->setCoords(right_Hight, lY1+(m_fLeftSpace+m_fTriangleLen));
|
m_qcpItemLine2->end->setCoords(right_Hight, mPlot->yAxis->pixelToCoord(y1+(m_fLeftSpace+m_fTriangleLen)));
|
||||||
//
|
//
|
||||||
m_qcpItemLine3->start->setCoords((left_Low+right_Hight)/2, lY1+m_fLeftSpace);
|
m_qcpItemLine3->start->setCoords((left_Low+right_Hight)/2, mPlot->yAxis->pixelToCoord(y1+m_fLeftSpace));
|
||||||
m_qcpItemLine3->end->setCoords((left_Low+right_Hight)/2, lY1+(m_fLeftSpace+m_fTriangleLen));
|
m_qcpItemLine3->end->setCoords((left_Low+right_Hight)/2, mPlot->yAxis->pixelToCoord(y1+(m_fLeftSpace+m_fTriangleLen)+m_fImageWidth));
|
||||||
|
//
|
||||||
|
m_qcpItemLine4->start->setCoords(right_Hight, mPlot->yAxis->pixelToCoord(y1+(m_fLeftSpace+m_fTriangleLen)));
|
||||||
|
m_qcpItemLine4->end->setCoords(right_Hight, mPlot->yAxis->pixelToCoord(y1+(m_fLeftSpace+m_fTriangleLen)+m_fImageWidth+m_fColorWordLen));
|
||||||
|
//
|
||||||
|
m_qcpItemLine5->start->setCoords(left_Low, mPlot->yAxis->pixelToCoord(y1+(m_fLeftSpace+m_fTriangleLen)));
|
||||||
|
m_qcpItemLine5->end->setCoords(left_Low, mPlot->yAxis->pixelToCoord(y1+(m_fLeftSpace+m_fTriangleLen)+m_fImageWidth+m_fColorWordLen));
|
||||||
|
//
|
||||||
|
m_qcpItemLine6->start->setCoords(right_Hight, mPlot->yAxis->pixelToCoord(y1+(m_fLeftSpace+m_fTriangleLen)+m_fImageWidth));
|
||||||
|
m_qcpItemLine6->end->setCoords(left_Low, mPlot->yAxis->pixelToCoord(y1+(m_fLeftSpace+m_fTriangleLen)+m_fImageWidth));
|
||||||
|
//
|
||||||
|
m_qcpItemLine7->start->setCoords(right_Hight, mPlot->yAxis->pixelToCoord(y1+(m_fLeftSpace+m_fTriangleLen)+m_fImageWidth+m_fColorWordLen));
|
||||||
|
m_qcpItemLine7->end->setCoords(left_Low, mPlot->yAxis->pixelToCoord(y1+(m_fLeftSpace+m_fTriangleLen)+m_fImageWidth+m_fColorWordLen));
|
||||||
|
|
||||||
updateHandles();
|
//updateHandles();
|
||||||
//刷新,针对批量修改不在此处刷新,后面统一刷新
|
//刷新,针对批量修改不在此处刷新,后面统一刷新
|
||||||
if(bReplot)
|
if(bReplot)
|
||||||
{
|
{
|
||||||
|
|
@ -339,6 +364,10 @@ void TransparentDraggableSwallCore::deleteRect()
|
||||||
mPlot->removeItem(m_qcpItemLine1);
|
mPlot->removeItem(m_qcpItemLine1);
|
||||||
mPlot->removeItem(m_qcpItemLine2);
|
mPlot->removeItem(m_qcpItemLine2);
|
||||||
mPlot->removeItem(m_qcpItemLine3);
|
mPlot->removeItem(m_qcpItemLine3);
|
||||||
|
mPlot->removeItem(m_qcpItemLine4);
|
||||||
|
mPlot->removeItem(m_qcpItemLine5);
|
||||||
|
mPlot->removeItem(m_qcpItemLine6);
|
||||||
|
mPlot->removeItem(m_qcpItemLine7);
|
||||||
|
|
||||||
//mPlot->replot();
|
//mPlot->replot();
|
||||||
this->deleteLater();
|
this->deleteLater();
|
||||||
|
|
@ -361,7 +390,7 @@ void TransparentDraggableSwallCore::initRect()
|
||||||
mRect = new QCPItemRect(mPlot);
|
mRect = new QCPItemRect(mPlot);
|
||||||
mRect->setLayer("overlay"); // 确保在最上层
|
mRect->setLayer("overlay"); // 确保在最上层
|
||||||
mRect->setBrush(QBrush(QColor(255, 255, 255, 50))); // 半透明蓝色100, 100, 255, 50
|
mRect->setBrush(QBrush(QColor(255, 255, 255, 50))); // 半透明蓝色100, 100, 255, 50
|
||||||
mRect->setPen(QPen(QColor(0, 0, 0, 200)));
|
mRect->setPen(QPen(QColor(0, 0, 0, 255)));
|
||||||
|
|
||||||
// // 创建左右边界控制点
|
// // 创建左右边界控制点
|
||||||
// mLeftHandle = new QCPItemRect(mPlot);
|
// mLeftHandle = new QCPItemRect(mPlot);
|
||||||
|
|
@ -401,7 +430,7 @@ void TransparentDraggableSwallCore::initRect()
|
||||||
mItemTitle = new QCPItemText(mPlot);
|
mItemTitle = new QCPItemText(mPlot);
|
||||||
mItemTitle->setText(mstrTitle);
|
mItemTitle->setText(mstrTitle);
|
||||||
//mItemTitle->setBrush(QBrush(Qt::red));
|
//mItemTitle->setBrush(QBrush(Qt::red));
|
||||||
mItemTitle->setFont(QFont("Arial", 12, QFont::Bold));
|
mItemTitle->setFont(QFont("Arial", 6, QFont::Light));
|
||||||
mItemTitle->setColor(Qt::black);
|
mItemTitle->setColor(Qt::black);
|
||||||
mItemTitle->setPositionAlignment(Qt::AlignTop | Qt::AlignHCenter);
|
mItemTitle->setPositionAlignment(Qt::AlignTop | Qt::AlignHCenter);
|
||||||
mItemTitle->position->setType(QCPItemPosition::ptPlotCoords);
|
mItemTitle->position->setType(QCPItemPosition::ptPlotCoords);
|
||||||
|
|
@ -418,6 +447,18 @@ void TransparentDraggableSwallCore::initRect()
|
||||||
//
|
//
|
||||||
m_qcpItemLine3 = new QCPItemLine(mPlot);
|
m_qcpItemLine3 = new QCPItemLine(mPlot);
|
||||||
m_qcpItemLine3->setPen(QPen(QColor(0, 0, 0, 200)));
|
m_qcpItemLine3->setPen(QPen(QColor(0, 0, 0, 200)));
|
||||||
|
//
|
||||||
|
m_qcpItemLine4 = new QCPItemLine(mPlot);
|
||||||
|
m_qcpItemLine4->setPen(QPen(QColor(0, 0, 0, 200)));
|
||||||
|
//
|
||||||
|
m_qcpItemLine5 = new QCPItemLine(mPlot);
|
||||||
|
m_qcpItemLine5->setPen(QPen(QColor(0, 0, 0, 200)));
|
||||||
|
//
|
||||||
|
m_qcpItemLine6 = new QCPItemLine(mPlot);
|
||||||
|
m_qcpItemLine6->setPen(QPen(QColor(0, 0, 0, 200)));
|
||||||
|
//
|
||||||
|
m_qcpItemLine7 = new QCPItemLine(mPlot);
|
||||||
|
m_qcpItemLine7->setPen(QPen(QColor(0, 0, 0, 200)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransparentDraggableSwallCore::updateHandles()
|
void TransparentDraggableSwallCore::updateHandles()
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,10 @@ public:
|
||||||
QCPItemLine *m_qcpItemLine1;
|
QCPItemLine *m_qcpItemLine1;
|
||||||
QCPItemLine *m_qcpItemLine2;
|
QCPItemLine *m_qcpItemLine2;
|
||||||
QCPItemLine *m_qcpItemLine3;
|
QCPItemLine *m_qcpItemLine3;
|
||||||
|
QCPItemLine *m_qcpItemLine4;
|
||||||
|
QCPItemLine *m_qcpItemLine5;
|
||||||
|
QCPItemLine *m_qcpItemLine6;
|
||||||
|
QCPItemLine *m_qcpItemLine7;
|
||||||
|
|
||||||
QString m_Lith;
|
QString m_Lith;
|
||||||
QString m_Oil;
|
QString m_Oil;
|
||||||
|
|
@ -99,12 +103,12 @@ public:
|
||||||
|
|
||||||
//
|
//
|
||||||
float m_fLeftSpace=0; //左侧空白长度
|
float m_fLeftSpace=0; //左侧空白长度
|
||||||
float m_fTriangleLen=40;//三角形长度
|
float m_fTriangleLen=16;//三角形长度
|
||||||
//
|
//
|
||||||
float m_fImageWidth=70;//图片长度
|
float m_fImageWidth=45;//图片长度
|
||||||
float m_fImageHeight=20;//图片高度(需要根据高度宏定义,重新计算)
|
float m_fImageHeight=16;//图片高度(需要根据高度宏定义,重新计算)
|
||||||
//
|
//
|
||||||
float m_fColorWordLen=40;//颜色文字长度
|
float m_fColorWordLen=30;//颜色文字长度
|
||||||
|
|
||||||
//鼠标形状
|
//鼠标形状
|
||||||
bool m_bArrow = false;
|
bool m_bArrow = false;
|
||||||
|
|
|
||||||
|
|
@ -2801,6 +2801,9 @@ void FormDraw::setColWidth(int iNewWidth)
|
||||||
{
|
{
|
||||||
form->setConclusionProportion(0);
|
form->setConclusionProportion(0);
|
||||||
}
|
}
|
||||||
|
//道宽改变后,避免井壁取心等组件变形,需要重新刷新
|
||||||
|
form->resetPosition();
|
||||||
|
|
||||||
form->replot();//屏蔽,缩减时间
|
form->replot();//屏蔽,缩减时间
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4961,7 +4961,7 @@ void QMyCustomPlot::addSwallCoreToPlot(double Depth, QString LithologyImage, QSt
|
||||||
//左侧空白
|
//左侧空白
|
||||||
dragRect->m_fLeftSpace = Sideleft*g_dPixelPerCm;
|
dragRect->m_fLeftSpace = Sideleft*g_dPixelPerCm;
|
||||||
// 设置初始范围
|
// 设置初始范围
|
||||||
double h = SideWallCoreHeight * g_dPixelPerCm; //0.4cm //40;
|
double h = 32;//SideWallCoreHeight * g_dPixelPerCm; //0.4cm //40;
|
||||||
double x1 = this->xAxis->coordToPixel(Depth);
|
double x1 = this->xAxis->coordToPixel(Depth);
|
||||||
//
|
//
|
||||||
double Depth2 = this->xAxis->pixelToCoord(x1-h);
|
double Depth2 = this->xAxis->pixelToCoord(x1-h);
|
||||||
|
|
@ -9511,3 +9511,79 @@ void QMyCustomPlot::s_changeLineName(QString strUuid, QString strSlfName, QStrin
|
||||||
s_ReloadPlot(strUuid, strSlfName, strNewLineName);
|
s_ReloadPlot(strUuid, strSlfName, strNewLineName);
|
||||||
//RefreshItems_Jiegutext();
|
//RefreshItems_Jiegutext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//固井结论
|
||||||
|
void QMyCustomPlot::resetPosition_Gujing()
|
||||||
|
{
|
||||||
|
TransparentDraggableGujing *pDraggableRect =NULL;
|
||||||
|
QMap<QString,QObject *>::Iterator it = m_mapDraggable_Gujing.begin();
|
||||||
|
while( it != m_mapDraggable_Gujing.end() )
|
||||||
|
{
|
||||||
|
pDraggableRect = (TransparentDraggableGujing*)it.value();
|
||||||
|
it++;
|
||||||
|
//
|
||||||
|
QCPRange tmpRange = pDraggableRect->getRange();
|
||||||
|
pDraggableRect->setRange(tmpRange.lower, tmpRange.upper, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//井壁取心
|
||||||
|
void QMyCustomPlot::resetPosition_SwallCore()
|
||||||
|
{
|
||||||
|
TransparentDraggableSwallCore *pDraggableRect =NULL;
|
||||||
|
QMap<QString,QObject *>::Iterator it = m_mapDraggable_SwallCore.begin();
|
||||||
|
while( it != m_mapDraggable_SwallCore.end() )
|
||||||
|
{
|
||||||
|
pDraggableRect = (TransparentDraggableSwallCore*)it.value();
|
||||||
|
it++;
|
||||||
|
//
|
||||||
|
QCPRange tmpRange = pDraggableRect->getRange();
|
||||||
|
pDraggableRect->setRange(tmpRange.lower, tmpRange.upper, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//录井剖面
|
||||||
|
void QMyCustomPlot::resetPosition_GeoLith()
|
||||||
|
{
|
||||||
|
TransparentDraggableGeoLith *pDraggableRect =NULL;
|
||||||
|
QMap<QString,QObject *>::Iterator it = m_mapDraggable_GeoLith.begin();
|
||||||
|
while( it != m_mapDraggable_GeoLith.end() )
|
||||||
|
{
|
||||||
|
pDraggableRect = (TransparentDraggableGeoLith*)it.value();
|
||||||
|
it++;
|
||||||
|
//
|
||||||
|
QCPRange tmpRange = pDraggableRect->getRange();
|
||||||
|
pDraggableRect->setRange(tmpRange.lower, tmpRange.upper, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//地质层位
|
||||||
|
void QMyCustomPlot::resetPosition_Layer()
|
||||||
|
{
|
||||||
|
TransparentDraggableLayer *pDraggableRect =NULL;
|
||||||
|
QMap<QString,QObject *>::Iterator it = m_mapDraggable_Layer.begin();
|
||||||
|
while( it != m_mapDraggable_Layer.end() )
|
||||||
|
{
|
||||||
|
pDraggableRect = (TransparentDraggableLayer*)it.value();
|
||||||
|
it++;
|
||||||
|
//
|
||||||
|
QCPRange tmpRange = pDraggableRect->getRange();
|
||||||
|
pDraggableRect->setRange(tmpRange.lower, tmpRange.upper, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//道宽改变后,避免井壁取心等组件变形,需要重新刷新
|
||||||
|
void QMyCustomPlot::resetPosition()
|
||||||
|
{
|
||||||
|
//固井结论
|
||||||
|
resetPosition_Gujing();
|
||||||
|
//井壁取心
|
||||||
|
resetPosition_SwallCore();
|
||||||
|
//录井剖面
|
||||||
|
resetPosition_GeoLith();
|
||||||
|
//地质层位
|
||||||
|
resetPosition_Layer();
|
||||||
|
|
||||||
|
//刷新
|
||||||
|
replot();
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,18 @@ public:
|
||||||
void setShowProperty(QVariant val, int ntag);
|
void setShowProperty(QVariant val, int ntag);
|
||||||
void setConclusionProportion(int nCopro);
|
void setConclusionProportion(int nCopro);
|
||||||
void setShowPos(int nSPos);
|
void setShowPos(int nSPos);
|
||||||
|
|
||||||
|
//道宽改变后,避免井壁取心等组件变形,需要重新刷新
|
||||||
|
void resetPosition();
|
||||||
|
//固井结论
|
||||||
|
void resetPosition_Gujing();
|
||||||
|
//井壁取心
|
||||||
|
void resetPosition_SwallCore();
|
||||||
|
//录井剖面
|
||||||
|
void resetPosition_GeoLith();
|
||||||
|
//地质层位
|
||||||
|
void resetPosition_Layer();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//virtual void mouseMoveEvent(QMouseEvent *event);
|
//virtual void mouseMoveEvent(QMouseEvent *event);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user