岩性填充,支持前景色、背景色,左填充。
This commit is contained in:
parent
95308877f0
commit
aa88e2dd1d
|
|
@ -61,7 +61,7 @@ signals:
|
|||
//岩性填充-填充
|
||||
void sig_ChangeFillMode(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName,
|
||||
QString newFillType, QString newTargetLine, QColor newColor, QString newLithosImage, QString newHeadFill,
|
||||
float vMin, float vMax);
|
||||
float vMin, float vMax, QColor frontColor, QColor backColor);
|
||||
//置顶层
|
||||
void sig_Raise(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName);
|
||||
|
||||
|
|
|
|||
|
|
@ -225,6 +225,24 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant
|
|||
ChangFillProperty();
|
||||
}
|
||||
}
|
||||
else if("岩性前景色" == m_propertyData[pProperty])
|
||||
{
|
||||
qDebug() << "岩性前景色->改变";
|
||||
//当前属性类型
|
||||
if(m_strCurrentProperty == Curve_Property)
|
||||
{
|
||||
ChangFillProperty();
|
||||
}
|
||||
}
|
||||
else if("岩性背景色" == m_propertyData[pProperty])
|
||||
{
|
||||
qDebug() << "岩性背景色->改变";
|
||||
//当前属性类型
|
||||
if(m_strCurrentProperty == Curve_Property)
|
||||
{
|
||||
ChangFillProperty();
|
||||
}
|
||||
}
|
||||
else if("头部图例" == m_propertyData[pProperty])
|
||||
{
|
||||
qDebug() << "头部图例->改变";
|
||||
|
|
@ -246,6 +264,8 @@ void PropertyWidget::ChangFillProperty()
|
|||
QString newHeadFill = "不绘制";
|
||||
float vMax = 0.0;
|
||||
float vMin = 0.0;
|
||||
QColor frontColor;//岩性前景色
|
||||
QColor backColor;//岩性背景色
|
||||
|
||||
for (auto it = m_propertyData.constBegin(); it != m_propertyData.constEnd(); ++it)
|
||||
{
|
||||
|
|
@ -311,6 +331,24 @@ void PropertyWidget::ChangFillProperty()
|
|||
}
|
||||
qDebug() << "填充岩性->" << newLithosImage;
|
||||
}
|
||||
else if(it.value()=="岩性前景色")
|
||||
{
|
||||
QtVariantProperty *pProperty = (QtVariantProperty*)it.key();
|
||||
if(pProperty->hasValue())
|
||||
{
|
||||
frontColor = pProperty->value().value<QColor>();
|
||||
}
|
||||
qDebug() << "岩性前景色->";
|
||||
}
|
||||
else if(it.value()=="岩性背景色")
|
||||
{
|
||||
QtVariantProperty *pProperty = (QtVariantProperty*)it.key();
|
||||
if(pProperty->hasValue())
|
||||
{
|
||||
backColor = pProperty->value().value<QColor>();
|
||||
}
|
||||
qDebug() << "岩性背景色->";
|
||||
}
|
||||
else if(it.value()=="头部图例")
|
||||
{
|
||||
QtVariantProperty *pProperty = (QtVariantProperty*)it.key();
|
||||
|
|
@ -331,7 +369,7 @@ void PropertyWidget::ChangFillProperty()
|
|||
{
|
||||
emit CallManage::getInstance()->sig_ChangeFillMode(m_strSlfName, m_strWellName, m_strTrackName, m_strLineName,
|
||||
newFillType, newTargetLine, newColor, newLithosImage, newHeadFill,
|
||||
vMin, vMax);
|
||||
vMin, vMax, frontColor, backColor);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -442,6 +480,8 @@ void PropertyWidget::initCurveProperty(FormInfo *formInfo, QStringList strListOt
|
|||
double dWidth = formInfo->m_dWidth;
|
||||
float vmax = formInfo->m_vmax;
|
||||
float vmin = formInfo->m_vmin;
|
||||
QColor frontColor = formInfo->m_frontColor;
|
||||
QColor backColor = formInfo->m_backColor;
|
||||
|
||||
//
|
||||
m_strSlfName = strSlfName;
|
||||
|
|
@ -507,4 +547,6 @@ void PropertyWidget::initCurveProperty(FormInfo *formInfo, QStringList strListOt
|
|||
_CreateVariantPropertyItem("岩性填充", "填充颜色", lineColor, QVariant::Color);
|
||||
_CreateVariantPropertyItem("岩性填充", "填充岩性", "./image/胜利符号库/岩性符号/砂岩.png", VariantManager::filePathTypeId());
|
||||
|
||||
_CreateVariantPropertyItem("岩性填充", "岩性前景色", frontColor, QVariant::Color);
|
||||
_CreateVariantPropertyItem("岩性填充", "岩性背景色", backColor, QVariant::Color);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,9 +43,11 @@ CustomTabWidget::~CustomTabWidget()
|
|||
|
||||
void CustomTabWidget::addTab(QWidget *widget, const QString &strTab)
|
||||
{
|
||||
m_pTabBar->addTab(strTab);
|
||||
int iIndex = m_pTabBar->addTab(strTab);
|
||||
m_pStackedWidget->addWidget(widget);
|
||||
widget->setAcceptDrops(true);
|
||||
//
|
||||
m_pTabBar->setCurrentIndex(iIndex);
|
||||
}
|
||||
|
||||
void CustomTabWidget::addTab(QWidget *page, const QIcon &icon, const QString &label)
|
||||
|
|
|
|||
414
logPlus/fileopenthread.cpp
Normal file
414
logPlus/fileopenthread.cpp
Normal file
|
|
@ -0,0 +1,414 @@
|
|||
#include "fileopenthread.h"
|
||||
#include <QFile>
|
||||
#include <QDir>
|
||||
|
||||
//#include "CallManage.h"
|
||||
#include <QFuture>
|
||||
#include <QtConcurrent/QtConcurrent>
|
||||
|
||||
extern QString g_prjname;
|
||||
|
||||
|
||||
void FileOpenThread::Open(QString fileFull)
|
||||
{
|
||||
QString strPrjname = "";
|
||||
QJsonArray wellsArray;
|
||||
|
||||
QJsonParseError jsonError;
|
||||
// 文件
|
||||
QFile file(fileFull);
|
||||
if(file.open(QIODevice::ReadOnly))
|
||||
{
|
||||
// 解析JSON
|
||||
QJsonDocument document = QJsonDocument::fromJson(file.readAll(), &jsonError);
|
||||
if (!document.isNull() && (jsonError.error == QJsonParseError::NoError))
|
||||
{
|
||||
if (document.isObject())
|
||||
{
|
||||
QJsonObject object = document.object();
|
||||
//
|
||||
if (object.contains("prjname"))
|
||||
{
|
||||
QJsonValue value = object.value("prjname");
|
||||
if (value.isString()) {
|
||||
strPrjname = value.toString();
|
||||
qDebug() << "prjname:" << strPrjname;
|
||||
|
||||
if(strPrjname != g_prjname)
|
||||
{
|
||||
file.close();
|
||||
qDebug() << "JSON 模板文件项目名称与当前项目不一致!";
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
if (object.contains("wells"))
|
||||
{
|
||||
QJsonValue value = object.value("wells");
|
||||
if (value.isArray()) {
|
||||
wellsArray = value.toArray();
|
||||
qDebug() << "wellsArray number:" << QString::number(wellsArray.size());
|
||||
//展示所有井
|
||||
DisplayWells(wellsArray);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
file.close();
|
||||
qDebug() << "JSON 模板文件读取成功!";
|
||||
} else {
|
||||
qWarning() << "JSON 模板文件打开失败:" << file.errorString();
|
||||
}
|
||||
}
|
||||
|
||||
void FileOpenThread::DisplayWells(QJsonArray wellsArray)
|
||||
{
|
||||
QMap<int, int> mapWells;
|
||||
|
||||
int id = 0;
|
||||
int iCount = wellsArray.size();
|
||||
for(int i=0; i<iCount; i++)
|
||||
{
|
||||
QJsonValue wellValue = wellsArray[i];
|
||||
|
||||
QJsonObject wellObj = wellValue.toObject();
|
||||
//
|
||||
if (wellObj.contains("id"))
|
||||
{
|
||||
QJsonValue value = wellObj.value("id");
|
||||
if (value.isDouble()) {
|
||||
id = value.toInt();
|
||||
qDebug() << "id:" << QString::number(id);
|
||||
//
|
||||
mapWells.insert(id, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(int id=0; id<iCount; id++)
|
||||
{
|
||||
if(mapWells.contains(id*2))
|
||||
{
|
||||
int iNum = mapWells.value(id*2);
|
||||
//按照id顺序,展示井
|
||||
QJsonValue wellValue = wellsArray[iNum];
|
||||
QJsonObject wellObj = wellValue.toObject();
|
||||
//
|
||||
if (wellObj.contains("info"))
|
||||
{
|
||||
QJsonValue value = wellObj.value("info");
|
||||
if (value.isObject()) {
|
||||
QJsonObject wellObjInfo = value.toObject();
|
||||
//展示其中一口井
|
||||
DisplayWell_One(wellObjInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//展示其中一口井
|
||||
void FileOpenThread::DisplayWell_One(QJsonObject wellObjInfo)
|
||||
{
|
||||
QString strWellName = "";
|
||||
QJsonArray tracksArray;
|
||||
|
||||
if (wellObjInfo.contains("WellName"))
|
||||
{
|
||||
QJsonValue value = wellObjInfo.value("WellName");
|
||||
if (value.isString()) {
|
||||
strWellName = value.toString();
|
||||
qDebug() << "WellName:" << strWellName;
|
||||
|
||||
//新建井
|
||||
//mainWindowCurve->s_NewWell(strWellName);
|
||||
emit sig_NewWell(strWellName);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
if (wellObjInfo.contains("formTracks"))
|
||||
{
|
||||
QJsonValue value = wellObjInfo.value("formTracks");
|
||||
if (value.isArray()) {
|
||||
tracksArray = value.toArray();
|
||||
qDebug() << "tracksArray number:" << QString::number(tracksArray.size());
|
||||
//展示所有道
|
||||
DisplayTracks(tracksArray);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//展示所有道
|
||||
void FileOpenThread::DisplayTracks(QJsonArray tracksArray)
|
||||
{
|
||||
QMap<int, int> mapTracks;
|
||||
|
||||
int id = 0;
|
||||
int iCount = tracksArray.size();
|
||||
for(int i=0; i<iCount; i++)
|
||||
{
|
||||
QJsonValue trackValue = tracksArray[i];
|
||||
|
||||
QJsonObject trackObj = trackValue.toObject();
|
||||
//
|
||||
if (trackObj.contains("id"))
|
||||
{
|
||||
QJsonValue value = trackObj.value("id");
|
||||
if (value.isDouble()) {
|
||||
id = value.toInt();
|
||||
qDebug() << "id:" << QString::number(id);
|
||||
//
|
||||
mapTracks.insert(id, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(int id=0; id<iCount; id++)
|
||||
{
|
||||
if(mapTracks.contains(id))
|
||||
{
|
||||
int iNum = mapTracks.value(id);
|
||||
//按照id顺序,展示道
|
||||
QJsonValue trackValue = tracksArray[iNum];
|
||||
QJsonObject trackObj = trackValue.toObject();
|
||||
//
|
||||
if (trackObj.contains("info"))
|
||||
{
|
||||
QJsonValue value = trackObj.value("info");
|
||||
if (value.isObject()) {
|
||||
QJsonObject trackObjInfo = value.toObject();
|
||||
//展示其中一道
|
||||
DisplayTrack_One(trackObjInfo, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//展示其中一道
|
||||
void FileOpenThread::DisplayTrack_One(QJsonObject trackObjInfo, int id)
|
||||
{
|
||||
QString strWellName = "";
|
||||
QString strTrackName = "";
|
||||
QJsonArray linesArray;
|
||||
|
||||
if (trackObjInfo.contains("WellName"))
|
||||
{
|
||||
QJsonValue value = trackObjInfo.value("WellName");
|
||||
if (value.isString()) {
|
||||
strWellName = value.toString();
|
||||
qDebug() << "WellName:" << strWellName;
|
||||
}
|
||||
}
|
||||
if (trackObjInfo.contains("TrackName"))
|
||||
{
|
||||
QJsonValue value = trackObjInfo.value("TrackName");
|
||||
if (value.isString()) {
|
||||
strTrackName = value.toString();
|
||||
qDebug() << "TrackName:" << strTrackName;
|
||||
}
|
||||
}
|
||||
|
||||
//新建道+曲线
|
||||
//emit mainWindow->getInstanceCallManage()->sig_NewTrack_No_Line(strWellName, strTrackName);//新建空白道,没有曲线
|
||||
emit sig_NewTrack_No_Line(strWellName, strTrackName);//新建空白道,没有曲线
|
||||
if(id>0)
|
||||
{
|
||||
//改变井宽
|
||||
emit sig_NewTrackChangeWidth(strWellName);
|
||||
//mainWindowCurve->s_NewTrackChangeWidth(strWellName);
|
||||
}
|
||||
|
||||
//
|
||||
if (trackObjInfo.contains("formInfos"))
|
||||
{
|
||||
QJsonValue value = trackObjInfo.value("formInfos");
|
||||
if (value.isArray()) {
|
||||
linesArray = value.toArray();
|
||||
qDebug() << "linesArray number:" << QString::number(linesArray.size());
|
||||
//展示所有曲线
|
||||
DisplayLines(linesArray);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//展示所有曲线
|
||||
void FileOpenThread::DisplayLines(QJsonArray linesArray)
|
||||
{
|
||||
QMap<int, int> mapLines;
|
||||
|
||||
int id = 0;
|
||||
int iCount = linesArray.size();
|
||||
for(int i=0; i<iCount; i++)
|
||||
{
|
||||
QJsonValue lineValue = linesArray[i];
|
||||
|
||||
QJsonObject lineObj = lineValue.toObject();
|
||||
//
|
||||
if (lineObj.contains("id"))
|
||||
{
|
||||
QJsonValue value = lineObj.value("id");
|
||||
if (value.isDouble()) {
|
||||
id = value.toInt();
|
||||
qDebug() << "id:" << QString::number(id);
|
||||
//
|
||||
mapLines.insert(id, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(int id=0; id<iCount; id++)
|
||||
{
|
||||
if(mapLines.contains(id))
|
||||
{
|
||||
int iNum = mapLines.value(id);
|
||||
//按照id顺序,展示曲线
|
||||
QJsonValue lineValue = linesArray[iNum];
|
||||
QJsonObject lineObj = lineValue.toObject();
|
||||
//
|
||||
if (lineObj.contains("info"))
|
||||
{
|
||||
QJsonValue value = lineObj.value("info");
|
||||
if (value.isObject()) {
|
||||
QJsonObject lineObjInfo = value.toObject();
|
||||
//展示其中一条曲线
|
||||
DisplayLine_One(lineObjInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//展示其中一条曲线
|
||||
void FileOpenThread::DisplayLine_One(QJsonObject lineObjInfo)
|
||||
{
|
||||
QString strSlfName = "";
|
||||
QString strWellName = "";
|
||||
QString strTrackName = "";
|
||||
QString strLineName = "";
|
||||
double newLeftScale = 0;
|
||||
double newRightScale = 500;
|
||||
QColor lineColor = QColor(0,0,0);
|
||||
double width = 3;
|
||||
Qt::PenStyle lineStyle = Qt::SolidLine;
|
||||
|
||||
if (lineObjInfo.contains("SlfName"))
|
||||
{
|
||||
QJsonValue value = lineObjInfo.value("SlfName");
|
||||
if (value.isString()) {
|
||||
strSlfName = value.toString();
|
||||
qDebug() << "SlfName:" << strSlfName;
|
||||
}
|
||||
}
|
||||
if (lineObjInfo.contains("WellName"))
|
||||
{
|
||||
QJsonValue value = lineObjInfo.value("WellName");
|
||||
if (value.isString()) {
|
||||
strWellName = value.toString();
|
||||
qDebug() << "WellName:" << strWellName;
|
||||
}
|
||||
}
|
||||
if (lineObjInfo.contains("TrackName"))
|
||||
{
|
||||
QJsonValue value = lineObjInfo.value("TrackName");
|
||||
if (value.isString()) {
|
||||
strTrackName = value.toString();
|
||||
qDebug() << "TrackName:" << strTrackName;
|
||||
}
|
||||
}
|
||||
if (lineObjInfo.contains("LineName"))
|
||||
{
|
||||
QJsonValue value = lineObjInfo.value("LineName");
|
||||
if (value.isString()) {
|
||||
strLineName = value.toString();
|
||||
qDebug() << "LineName:" << strLineName;
|
||||
}
|
||||
}
|
||||
|
||||
if (lineObjInfo.contains("vmin"))
|
||||
{
|
||||
QJsonValue value = lineObjInfo.value("vmin");
|
||||
if (value.isDouble()) {
|
||||
newLeftScale = value.toDouble();
|
||||
qDebug() << "vmin:" << QString::number(newLeftScale);
|
||||
}
|
||||
}
|
||||
if (lineObjInfo.contains("vmax"))
|
||||
{
|
||||
QJsonValue value = lineObjInfo.value("vmax");
|
||||
if (value.isDouble()) {
|
||||
newRightScale = value.toDouble();
|
||||
qDebug() << "vmax:" << QString::number(newRightScale);
|
||||
}
|
||||
}
|
||||
if (lineObjInfo.contains("Width"))
|
||||
{
|
||||
QJsonValue value = lineObjInfo.value("Width");
|
||||
if (value.isDouble()) {
|
||||
width = value.toDouble();
|
||||
qDebug() << "Width:" << QString::number(width);
|
||||
}
|
||||
}
|
||||
|
||||
if (lineObjInfo.contains("lineStyle"))
|
||||
{
|
||||
QJsonValue value = lineObjInfo.value("lineStyle");
|
||||
if (value.isDouble()) {
|
||||
lineStyle = (Qt::PenStyle)value.toInt();
|
||||
qDebug() << "lineStyle:" << QString::number(lineStyle);
|
||||
}
|
||||
}
|
||||
//
|
||||
if (lineObjInfo.contains("lineColorRed"))
|
||||
{
|
||||
QJsonValue value = lineObjInfo.value("lineColorRed");
|
||||
if (value.isDouble()) {
|
||||
lineColor.setRed(value.toInt());
|
||||
qDebug() << "lineColorRed:" << QString::number(value.toInt());
|
||||
}
|
||||
}
|
||||
//
|
||||
if (lineObjInfo.contains("lineColorGreen"))
|
||||
{
|
||||
QJsonValue value = lineObjInfo.value("lineColorGreen");
|
||||
if (value.isDouble()) {
|
||||
lineColor.setGreen(value.toInt());
|
||||
qDebug() << "lineColorGreen:" << QString::number(value.toInt());
|
||||
}
|
||||
}
|
||||
//
|
||||
if (lineObjInfo.contains("lineColorBlue"))
|
||||
{
|
||||
QJsonValue value = lineObjInfo.value("lineColorBlue");
|
||||
if (value.isDouble()) {
|
||||
lineColor.setBlue(value.toInt());
|
||||
qDebug() << "lineColorBlue:" << QString::number(value.toInt());
|
||||
}
|
||||
}
|
||||
//
|
||||
if (lineObjInfo.contains("lineColorAlpha"))
|
||||
{
|
||||
QJsonValue value = lineObjInfo.value("lineColorAlpha");
|
||||
if (value.isDouble()) {
|
||||
lineColor.setAlpha(value.toInt());
|
||||
qDebug() << "lineColorAlpha:" << QString::number(value.toInt());
|
||||
}
|
||||
}
|
||||
|
||||
if(strLineName!="")
|
||||
{
|
||||
//新建曲线
|
||||
//emit CallManage::getInstance()->sig_AddLine(strSlfName, strWellName, strTrackName, strLineName);
|
||||
// emit mainWindow->getInstanceCallManage()->sig_AddLine_Property(strSlfName, strWellName, strTrackName, strLineName,
|
||||
// newLeftScale, newRightScale, lineColor, width, lineStyle);
|
||||
|
||||
emit sig_AddLine_Property(strSlfName, strWellName, strTrackName, strLineName,
|
||||
newLeftScale, newRightScale, lineColor, width, lineStyle);
|
||||
}
|
||||
}
|
||||
45
logPlus/fileopenthread.h
Normal file
45
logPlus/fileopenthread.h
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
#ifndef FILEOPENTHREAD_H
|
||||
#define FILEOPENTHREAD_H
|
||||
|
||||
#include <QThread>
|
||||
#include <QColor>
|
||||
|
||||
class FileOpenThread : public QThread {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit FileOpenThread(const QString &targetFileName)
|
||||
: targetFileName(targetFileName) {}
|
||||
|
||||
signals:
|
||||
void sig_NewTrackChangeWidth(QString strWellName);//新建道后,改变井宽
|
||||
void sig_NewWell(QString strWellName);
|
||||
void sig_NewTrack_No_Line(QString strWellName, QString strTrackName);//新建空白道,没有曲线
|
||||
void sig_AddLine_Property(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName,
|
||||
double newLeftScale, double newRightScale, QColor lineColor, double width, Qt::PenStyle lineStyle);//新建曲线,带属性
|
||||
|
||||
protected:
|
||||
void run() override {
|
||||
Open(targetFileName);
|
||||
}
|
||||
|
||||
private:
|
||||
QString targetFileName;
|
||||
|
||||
public:
|
||||
//展示所有井
|
||||
void DisplayWells(QJsonArray wellsArray);
|
||||
//展示其中一口井
|
||||
void DisplayWell_One(QJsonObject wellObjInfo);
|
||||
//展示所有道
|
||||
void DisplayTracks(QJsonArray tracksArray);
|
||||
//展示其中一道
|
||||
void DisplayTrack_One(QJsonObject trackObjInfo, int id);
|
||||
//展示所有曲线
|
||||
void DisplayLines(QJsonArray linesArray);
|
||||
//展示其中一条曲线
|
||||
void DisplayLine_One(QJsonObject lineObjInfo);
|
||||
|
||||
void Open(QString fileFull);//打开
|
||||
};
|
||||
|
||||
#endif // FILEOPENTHREAD_H
|
||||
|
|
@ -49,8 +49,8 @@ FormInfo::FormInfo(QWidget *parent, QString strSlfName, QString strWellName, QSt
|
|||
//岩性填充-不填充
|
||||
connect(CallManage::getInstance(), SIGNAL(sig_ClearFillMode(QString, QString, QString, QString)), this, SLOT(s_ClearFillMode(QString, QString, QString, QString)));
|
||||
//岩性填充-填充
|
||||
connect(CallManage::getInstance(), SIGNAL(sig_ChangeFillMode(QString, QString, QString, QString, QString, QString, QColor, QString, QString, float, float)),
|
||||
this, SLOT(s_ChangeFillMode(QString, QString, QString, QString, QString, QString, QColor, QString, QString, float, float)));
|
||||
connect(CallManage::getInstance(), SIGNAL(sig_ChangeFillMode(QString, QString, QString, QString, QString, QString, QColor, QString, QString, float, float, QColor, QColor)),
|
||||
this, SLOT(s_ChangeFillMode(QString, QString, QString, QString, QString, QString, QColor, QString, QString, float, float, QColor, QColor)));
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -105,7 +105,25 @@ void FormInfo::paintEvent(QPaintEvent* event)
|
|||
{
|
||||
if(m_newFillType == "岩性模式")
|
||||
{
|
||||
painter.setBrush(QBrush(QPixmap(m_newLithosImage)));
|
||||
QColor oldFrontColor(0, 0, 0); // 原始颜色
|
||||
QColor oldBackColor(255, 255, 255); // 原始颜色
|
||||
//
|
||||
QImage image(m_newLithosImage);
|
||||
for (int y = 0; y < image.height(); ++y) {
|
||||
for (int x = 0; x < image.width(); ++x) {
|
||||
QColor pixelColor = QColor(image.pixel(x, y));
|
||||
if (pixelColor == oldFrontColor) {
|
||||
image.setPixelColor(x, y, m_frontColor); // 使用 setPixelColor 来设置新颜色
|
||||
}
|
||||
if (pixelColor == oldBackColor) {
|
||||
image.setPixelColor(x, y, m_backColor); // 使用 setPixelColor 来设置新颜色
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
painter.setBrush(QBrush(QPixmap::fromImage(image)));
|
||||
|
||||
//painter.setBrush(QBrush(QPixmap(m_newLithosImage)));
|
||||
//graph(0)->setBrush(QBrush(QPixmap(":/image/file.png")));
|
||||
}
|
||||
else if(m_newFillType == "颜色模式")
|
||||
|
|
@ -255,6 +273,27 @@ float FormInfo::getVMin()
|
|||
{
|
||||
return m_vmin;
|
||||
}
|
||||
|
||||
void FormInfo::setFrontColor(QColor frontColor)
|
||||
{
|
||||
m_frontColor = frontColor;
|
||||
}
|
||||
|
||||
QColor FormInfo::getFrontColor()
|
||||
{
|
||||
return m_frontColor;
|
||||
}
|
||||
|
||||
void FormInfo::setBackColor(QColor backColor)
|
||||
{
|
||||
m_backColor = backColor;
|
||||
}
|
||||
|
||||
QColor FormInfo::getBackColor()
|
||||
{
|
||||
return m_backColor;
|
||||
}
|
||||
|
||||
//属性-左刻度
|
||||
void FormInfo::s_ChangeLeftScale(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, double newLeftScale)
|
||||
{
|
||||
|
|
@ -336,7 +375,7 @@ void FormInfo::s_ClearFillMode(QString strSlfName, QString strWellName, QString
|
|||
//岩性填充-填充
|
||||
void FormInfo::s_ChangeFillMode(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName,
|
||||
QString newFillType, QString newTargetLine, QColor newColor, QString newLithosImage, QString newHeadFill,
|
||||
float vMin, float vMax)
|
||||
float vMin, float vMax, QColor frontColor, QColor backColor)
|
||||
{
|
||||
if(m_strSlfName == strSlfName &&
|
||||
m_strWellName == strWellName &&
|
||||
|
|
@ -349,6 +388,9 @@ void FormInfo::s_ChangeFillMode(QString strSlfName, QString strWellName, QString
|
|||
m_newColor = newColor;
|
||||
m_newLithosImage = newLithosImage;
|
||||
|
||||
m_frontColor = frontColor;
|
||||
m_backColor = backColor;
|
||||
|
||||
update();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ public slots:
|
|||
//岩性填充-填充
|
||||
void s_ChangeFillMode(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName,
|
||||
QString newFillType, QString newTargetLine, QColor newColor, QString newLithosImage, QString newHeadFill,
|
||||
float vMin, float vMax);
|
||||
float vMin, float vMax, QColor frontColor, QColor backColor);
|
||||
|
||||
public:
|
||||
QString m_strUuid;
|
||||
|
|
@ -71,6 +71,8 @@ public:
|
|||
QString m_newFillType;
|
||||
QColor m_newColor;//填充颜色
|
||||
QString m_newLithosImage = "";//岩性图片
|
||||
QColor m_frontColor;//岩性前景色
|
||||
QColor m_backColor;//岩性背景色
|
||||
|
||||
public:
|
||||
void setLineWidth(double dWidth);
|
||||
|
|
@ -85,6 +87,12 @@ public:
|
|||
void setVMin(float vmin);
|
||||
float getVMin();
|
||||
|
||||
void setFrontColor(QColor frontColor);
|
||||
QColor getFrontColor();
|
||||
|
||||
void setBackColor(QColor backColor);
|
||||
QColor getBackColor();
|
||||
|
||||
QJsonObject makeJson();
|
||||
|
||||
//public:
|
||||
|
|
|
|||
|
|
@ -58,6 +58,8 @@ void FormTrack::s_addLine(QString strSlfName, QString strWellName, QString strTr
|
|||
formInfo->setLineWidth(dWidth);
|
||||
formInfo->setVMax(vmax);
|
||||
formInfo->setVMin(vmin);
|
||||
formInfo->setFrontColor(QColor(0,0,0));
|
||||
formInfo->setBackColor(QColor(255,255,255));
|
||||
//设置高度
|
||||
ui->tableWidget->setRowHeight(row, 100);
|
||||
//
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ SOURCES += \
|
|||
customtabbar.cpp \
|
||||
customtabwidget.cpp \
|
||||
fileedit.cpp \
|
||||
fileopenthread.cpp \
|
||||
formdraw.cpp \
|
||||
formhead.cpp \
|
||||
forminfo.cpp \
|
||||
|
|
@ -73,6 +74,7 @@ HEADERS += \
|
|||
customtabbar.h \
|
||||
customtabwidget.h \
|
||||
fileedit.h \
|
||||
fileopenthread.h \
|
||||
formdraw.h \
|
||||
formhead.h \
|
||||
forminfo.h \
|
||||
|
|
@ -169,5 +171,6 @@ CONFIG(debug, debug|release){
|
|||
LIBS += -L../Bin -lOSGDataModel
|
||||
LIBS += -L../Bin -lDataOutput
|
||||
LIBS += -L../Bin/ -lCallPlugin -lHPluginManage
|
||||
LIBS += -L../Bin/ -lDataMgr
|
||||
#-lCallManage
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@
|
|||
#include "PluginName.h"
|
||||
#include "CallManage.h"
|
||||
#include "CallPlugin.h"
|
||||
#include <QFuture>
|
||||
#include <QtConcurrent/QtConcurrent>
|
||||
#include "fileopenthread.h"
|
||||
|
||||
//以下参数从配置文件读取
|
||||
int g_iIndex = 0;
|
||||
|
|
@ -56,6 +59,8 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
//loadStyle(":/qrc/qss/blacksoft.css");
|
||||
loadStyle(":/qrc/qss/flatgray.css");
|
||||
|
||||
ReadConfig();
|
||||
|
||||
initTitleBar(); //菜单栏
|
||||
initToolBar(); //工具栏
|
||||
initProjectView(); //左侧-项目区 初始化在前
|
||||
|
|
@ -114,7 +119,10 @@ void MainWindow::ReadConfig()
|
|||
//
|
||||
qtCommon->readXyRange(configPath, g_iX1, g_iX2, g_iY1, g_iY2);
|
||||
}
|
||||
|
||||
CallManage* MainWindow::getInstanceCallManage()
|
||||
{
|
||||
return CallManage::getInstance();
|
||||
}
|
||||
void MainWindow::loadStyle(const QString &qssFile)
|
||||
{
|
||||
//加载样式表
|
||||
|
|
@ -356,10 +364,29 @@ void MainWindow::s_showView()
|
|||
return;
|
||||
}
|
||||
|
||||
QFileInfo fileInfo(fileFull);
|
||||
QString fileName = fileInfo.fileName(); // 获取文件名
|
||||
|
||||
//----
|
||||
MainWindowCurve *mainWindowCurve = new MainWindowCurve();//中间工作区
|
||||
m_centerWidgets->addTab(mainWindowCurve, "解释视图");
|
||||
mainWindowCurve->s_Open(fileFull);
|
||||
m_centerWidgets->addTab(mainWindowCurve, fileName);
|
||||
|
||||
//mainWindowCurve->s_Open(fileFull);
|
||||
|
||||
//QFuture<void> future = QtConcurrent::run(std::bind(&MainWindowCurve::s_Open, mainWindowCurve, fileFull));
|
||||
//mainWindowCurve->Open(fileFull);
|
||||
|
||||
// 创建 FileSearchThread 实例
|
||||
FileOpenThread *searchThread = new FileOpenThread(fileFull);
|
||||
connect(searchThread, &FileOpenThread::sig_NewWell, mainWindowCurve, &MainWindowCurve::s_NewWell, Qt::BlockingQueuedConnection);
|
||||
connect(searchThread, &FileOpenThread::sig_NewTrackChangeWidth, mainWindowCurve, &MainWindowCurve::s_NewTrackChangeWidth, Qt::BlockingQueuedConnection);
|
||||
connect(searchThread, &FileOpenThread::sig_NewTrack_No_Line, mainWindowCurve, &MainWindowCurve::s_NewTrack_No_Line, Qt::BlockingQueuedConnection);
|
||||
connect(searchThread, &FileOpenThread::sig_AddLine_Property, mainWindowCurve, &MainWindowCurve::s_AddLine_Property, Qt::BlockingQueuedConnection);
|
||||
|
||||
//connect(searchThread, SIGNAL(sig_NewTrackChangeWidth(QString)), mainWindowCurve, SLOT(s_NewTrackChangeWidth(QString)), Qt::BlockingQueuedConnection);
|
||||
//connect(searchThread, SIGNAL(sig_NewWell(QString)), mainWindowCurve, SLOT(s_NewWell(QString)), Qt::BlockingQueuedConnection);
|
||||
// 启动搜索线程
|
||||
searchThread->start();
|
||||
}
|
||||
|
||||
void MainWindow::s_Risize()
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
#include "customtabwidget.h"
|
||||
#include "ConsoleOutputWidget.h"
|
||||
#include "PropertyWidget.h"
|
||||
#include "CallManage.h"
|
||||
|
||||
#pragma execution_character_set("utf-8")
|
||||
|
||||
|
|
@ -70,6 +71,8 @@ public:
|
|||
|
||||
void ReadConfig();
|
||||
|
||||
CallManage *getInstanceCallManage();
|
||||
|
||||
public slots:
|
||||
void s_New();
|
||||
void s_Open();
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@
|
|||
#include "CallManage.h"
|
||||
#include <QAbstractItemView>
|
||||
#include "qtcommonclass.h"
|
||||
#include <QFuture>
|
||||
#include <QtConcurrent/QtConcurrent>
|
||||
|
||||
extern int g_iOneWidth; //道宽
|
||||
extern QString g_prjname;
|
||||
|
|
@ -70,6 +72,7 @@ MainWindowCurve::MainWindowCurve(QWidget *parent) :
|
|||
|
||||
|
||||
connect(this, SIGNAL(sig_NewTrackChangeWidth(QString)), this, SLOT(s_NewTrackChangeWidth(QString)));
|
||||
connect(this, SIGNAL(sig_NewWell(QString)), this, SLOT(s_NewWell(QString)));
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -240,407 +243,9 @@ void MainWindowCurve::s_Save()
|
|||
|
||||
void MainWindowCurve::s_Open(QString fileFull)
|
||||
{
|
||||
QString strPrjname = "";
|
||||
QJsonArray wellsArray;
|
||||
|
||||
QJsonParseError jsonError;
|
||||
// 文件
|
||||
QFile file(fileFull);
|
||||
if(file.open(QIODevice::ReadOnly))
|
||||
{
|
||||
// 解析JSON
|
||||
QJsonDocument document = QJsonDocument::fromJson(file.readAll(), &jsonError);
|
||||
if (!document.isNull() && (jsonError.error == QJsonParseError::NoError))
|
||||
{
|
||||
if (document.isObject())
|
||||
{
|
||||
QJsonObject object = document.object();
|
||||
//
|
||||
if (object.contains("prjname"))
|
||||
{
|
||||
QJsonValue value = object.value("prjname");
|
||||
if (value.isString()) {
|
||||
strPrjname = value.toString();
|
||||
qDebug() << "prjname:" << strPrjname;
|
||||
|
||||
if(strPrjname != g_prjname)
|
||||
{
|
||||
file.close();
|
||||
qDebug() << "JSON 模板文件项目名称与当前项目不一致!";
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
if (object.contains("wells"))
|
||||
{
|
||||
QJsonValue value = object.value("wells");
|
||||
if (value.isArray()) {
|
||||
wellsArray = value.toArray();
|
||||
qDebug() << "wellsArray number:" << QString::number(wellsArray.size());
|
||||
//展示所有井
|
||||
DisplayWells(wellsArray);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
file.close();
|
||||
qDebug() << "JSON 模板文件读取成功!";
|
||||
} else {
|
||||
qWarning() << "JSON 模板文件打开失败:" << file.errorString();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindowCurve::DisplayWells(QJsonArray wellsArray)
|
||||
{
|
||||
//清空
|
||||
m_listWell.clear();
|
||||
ui->tableWidget_2->clear();
|
||||
QMap<int, int> mapWells;
|
||||
|
||||
int id = 0;
|
||||
int iCount = wellsArray.size();
|
||||
for(int i=0; i<iCount; i++)
|
||||
{
|
||||
QJsonValue wellValue = wellsArray[i];
|
||||
|
||||
QJsonObject wellObj = wellValue.toObject();
|
||||
//
|
||||
if (wellObj.contains("id"))
|
||||
{
|
||||
QJsonValue value = wellObj.value("id");
|
||||
if (value.isDouble()) {
|
||||
id = value.toInt();
|
||||
qDebug() << "id:" << QString::number(id);
|
||||
//
|
||||
mapWells.insert(id, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(int id=0; id<iCount; id++)
|
||||
{
|
||||
if(mapWells.contains(id*2))
|
||||
{
|
||||
int iNum = mapWells.value(id*2);
|
||||
//按照id顺序,展示井
|
||||
QJsonValue wellValue = wellsArray[iNum];
|
||||
QJsonObject wellObj = wellValue.toObject();
|
||||
//
|
||||
if (wellObj.contains("info"))
|
||||
{
|
||||
QJsonValue value = wellObj.value("info");
|
||||
if (value.isObject()) {
|
||||
QJsonObject wellObjInfo = value.toObject();
|
||||
//展示其中一口井
|
||||
DisplayWell_One(wellObjInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//展示其中一口井
|
||||
void MainWindowCurve::DisplayWell_One(QJsonObject wellObjInfo)
|
||||
{
|
||||
QString strWellName = "";
|
||||
QJsonArray tracksArray;
|
||||
|
||||
if (wellObjInfo.contains("WellName"))
|
||||
{
|
||||
QJsonValue value = wellObjInfo.value("WellName");
|
||||
if (value.isString()) {
|
||||
strWellName = value.toString();
|
||||
qDebug() << "WellName:" << strWellName;
|
||||
|
||||
//新建井
|
||||
s_NewWell(strWellName);
|
||||
m_listWell.push_back(strWellName);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
if (wellObjInfo.contains("formTracks"))
|
||||
{
|
||||
QJsonValue value = wellObjInfo.value("formTracks");
|
||||
if (value.isArray()) {
|
||||
tracksArray = value.toArray();
|
||||
qDebug() << "tracksArray number:" << QString::number(tracksArray.size());
|
||||
//展示所有道
|
||||
DisplayTracks(tracksArray);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//展示所有道
|
||||
void MainWindowCurve::DisplayTracks(QJsonArray tracksArray)
|
||||
{
|
||||
QMap<int, int> mapTracks;
|
||||
|
||||
int id = 0;
|
||||
int iCount = tracksArray.size();
|
||||
for(int i=0; i<iCount; i++)
|
||||
{
|
||||
QJsonValue trackValue = tracksArray[i];
|
||||
|
||||
QJsonObject trackObj = trackValue.toObject();
|
||||
//
|
||||
if (trackObj.contains("id"))
|
||||
{
|
||||
QJsonValue value = trackObj.value("id");
|
||||
if (value.isDouble()) {
|
||||
id = value.toInt();
|
||||
qDebug() << "id:" << QString::number(id);
|
||||
//
|
||||
mapTracks.insert(id, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(int id=0; id<iCount; id++)
|
||||
{
|
||||
if(mapTracks.contains(id))
|
||||
{
|
||||
int iNum = mapTracks.value(id);
|
||||
//按照id顺序,展示道
|
||||
QJsonValue trackValue = tracksArray[iNum];
|
||||
QJsonObject trackObj = trackValue.toObject();
|
||||
//
|
||||
if (trackObj.contains("info"))
|
||||
{
|
||||
QJsonValue value = trackObj.value("info");
|
||||
if (value.isObject()) {
|
||||
QJsonObject trackObjInfo = value.toObject();
|
||||
//展示其中一道
|
||||
DisplayTrack_One(trackObjInfo, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//展示其中一道
|
||||
void MainWindowCurve::DisplayTrack_One(QJsonObject trackObjInfo, int id)
|
||||
{
|
||||
QString strWellName = "";
|
||||
QString strTrackName = "";
|
||||
QJsonArray linesArray;
|
||||
|
||||
if (trackObjInfo.contains("WellName"))
|
||||
{
|
||||
QJsonValue value = trackObjInfo.value("WellName");
|
||||
if (value.isString()) {
|
||||
strWellName = value.toString();
|
||||
qDebug() << "WellName:" << strWellName;
|
||||
}
|
||||
}
|
||||
if (trackObjInfo.contains("TrackName"))
|
||||
{
|
||||
QJsonValue value = trackObjInfo.value("TrackName");
|
||||
if (value.isString()) {
|
||||
strTrackName = value.toString();
|
||||
qDebug() << "TrackName:" << strTrackName;
|
||||
}
|
||||
}
|
||||
|
||||
//新建道+曲线
|
||||
emit CallManage::getInstance()->sig_NewTrack_No_Line(strWellName, strTrackName);//新建空白道,没有曲线
|
||||
if(id>0)
|
||||
{
|
||||
//改变井宽
|
||||
emit sig_NewTrackChangeWidth(strWellName);
|
||||
}
|
||||
|
||||
//
|
||||
if (trackObjInfo.contains("formInfos"))
|
||||
{
|
||||
QJsonValue value = trackObjInfo.value("formInfos");
|
||||
if (value.isArray()) {
|
||||
linesArray = value.toArray();
|
||||
qDebug() << "linesArray number:" << QString::number(linesArray.size());
|
||||
//展示所有曲线
|
||||
DisplayLines(linesArray);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//展示所有曲线
|
||||
void MainWindowCurve::DisplayLines(QJsonArray linesArray)
|
||||
{
|
||||
QMap<int, int> mapLines;
|
||||
|
||||
int id = 0;
|
||||
int iCount = linesArray.size();
|
||||
for(int i=0; i<iCount; i++)
|
||||
{
|
||||
QJsonValue lineValue = linesArray[i];
|
||||
|
||||
QJsonObject lineObj = lineValue.toObject();
|
||||
//
|
||||
if (lineObj.contains("id"))
|
||||
{
|
||||
QJsonValue value = lineObj.value("id");
|
||||
if (value.isDouble()) {
|
||||
id = value.toInt();
|
||||
qDebug() << "id:" << QString::number(id);
|
||||
//
|
||||
mapLines.insert(id, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(int id=0; id<iCount; id++)
|
||||
{
|
||||
if(mapLines.contains(id))
|
||||
{
|
||||
int iNum = mapLines.value(id);
|
||||
//按照id顺序,展示曲线
|
||||
QJsonValue lineValue = linesArray[iNum];
|
||||
QJsonObject lineObj = lineValue.toObject();
|
||||
//
|
||||
if (lineObj.contains("info"))
|
||||
{
|
||||
QJsonValue value = lineObj.value("info");
|
||||
if (value.isObject()) {
|
||||
QJsonObject lineObjInfo = value.toObject();
|
||||
//展示其中一条曲线
|
||||
DisplayLine_One(lineObjInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//展示其中一条曲线
|
||||
void MainWindowCurve::DisplayLine_One(QJsonObject lineObjInfo)
|
||||
{
|
||||
QString strSlfName = "";
|
||||
QString strWellName = "";
|
||||
QString strTrackName = "";
|
||||
QString strLineName = "";
|
||||
double newLeftScale = 0;
|
||||
double newRightScale = 500;
|
||||
QColor lineColor = QColor(0,0,0);
|
||||
double width = 3;
|
||||
Qt::PenStyle lineStyle = Qt::SolidLine;
|
||||
|
||||
if (lineObjInfo.contains("SlfName"))
|
||||
{
|
||||
QJsonValue value = lineObjInfo.value("SlfName");
|
||||
if (value.isString()) {
|
||||
strSlfName = value.toString();
|
||||
qDebug() << "SlfName:" << strSlfName;
|
||||
}
|
||||
}
|
||||
if (lineObjInfo.contains("WellName"))
|
||||
{
|
||||
QJsonValue value = lineObjInfo.value("WellName");
|
||||
if (value.isString()) {
|
||||
strWellName = value.toString();
|
||||
qDebug() << "WellName:" << strWellName;
|
||||
}
|
||||
}
|
||||
if (lineObjInfo.contains("TrackName"))
|
||||
{
|
||||
QJsonValue value = lineObjInfo.value("TrackName");
|
||||
if (value.isString()) {
|
||||
strTrackName = value.toString();
|
||||
qDebug() << "TrackName:" << strTrackName;
|
||||
}
|
||||
}
|
||||
if (lineObjInfo.contains("LineName"))
|
||||
{
|
||||
QJsonValue value = lineObjInfo.value("LineName");
|
||||
if (value.isString()) {
|
||||
strLineName = value.toString();
|
||||
qDebug() << "LineName:" << strLineName;
|
||||
}
|
||||
}
|
||||
|
||||
if (lineObjInfo.contains("vmin"))
|
||||
{
|
||||
QJsonValue value = lineObjInfo.value("vmin");
|
||||
if (value.isDouble()) {
|
||||
newLeftScale = value.toDouble();
|
||||
qDebug() << "vmin:" << QString::number(newLeftScale);
|
||||
}
|
||||
}
|
||||
if (lineObjInfo.contains("vmax"))
|
||||
{
|
||||
QJsonValue value = lineObjInfo.value("vmax");
|
||||
if (value.isDouble()) {
|
||||
newRightScale = value.toDouble();
|
||||
qDebug() << "vmax:" << QString::number(newRightScale);
|
||||
}
|
||||
}
|
||||
if (lineObjInfo.contains("Width"))
|
||||
{
|
||||
QJsonValue value = lineObjInfo.value("Width");
|
||||
if (value.isDouble()) {
|
||||
width = value.toDouble();
|
||||
qDebug() << "Width:" << QString::number(width);
|
||||
}
|
||||
}
|
||||
|
||||
if (lineObjInfo.contains("lineStyle"))
|
||||
{
|
||||
QJsonValue value = lineObjInfo.value("lineStyle");
|
||||
if (value.isDouble()) {
|
||||
lineStyle = (Qt::PenStyle)value.toInt();
|
||||
qDebug() << "lineStyle:" << QString::number(lineStyle);
|
||||
}
|
||||
}
|
||||
//
|
||||
if (lineObjInfo.contains("lineColorRed"))
|
||||
{
|
||||
QJsonValue value = lineObjInfo.value("lineColorRed");
|
||||
if (value.isDouble()) {
|
||||
lineColor.setRed(value.toInt());
|
||||
qDebug() << "lineColorRed:" << QString::number(value.toInt());
|
||||
}
|
||||
}
|
||||
//
|
||||
if (lineObjInfo.contains("lineColorGreen"))
|
||||
{
|
||||
QJsonValue value = lineObjInfo.value("lineColorGreen");
|
||||
if (value.isDouble()) {
|
||||
lineColor.setGreen(value.toInt());
|
||||
qDebug() << "lineColorGreen:" << QString::number(value.toInt());
|
||||
}
|
||||
}
|
||||
//
|
||||
if (lineObjInfo.contains("lineColorBlue"))
|
||||
{
|
||||
QJsonValue value = lineObjInfo.value("lineColorBlue");
|
||||
if (value.isDouble()) {
|
||||
lineColor.setBlue(value.toInt());
|
||||
qDebug() << "lineColorBlue:" << QString::number(value.toInt());
|
||||
}
|
||||
}
|
||||
//
|
||||
if (lineObjInfo.contains("lineColorAlpha"))
|
||||
{
|
||||
QJsonValue value = lineObjInfo.value("lineColorAlpha");
|
||||
if (value.isDouble()) {
|
||||
lineColor.setAlpha(value.toInt());
|
||||
qDebug() << "lineColorAlpha:" << QString::number(value.toInt());
|
||||
}
|
||||
}
|
||||
|
||||
if(strLineName!="")
|
||||
{
|
||||
//新建曲线
|
||||
//emit CallManage::getInstance()->sig_AddLine(strSlfName, strWellName, strTrackName, strLineName);
|
||||
emit CallManage::getInstance()->sig_AddLine_Property(strSlfName, strWellName, strTrackName, strLineName,
|
||||
newLeftScale, newRightScale, lineColor, width, lineStyle);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QJsonObject MainWindowCurve::makeJson()
|
||||
{
|
||||
// 创建根对象
|
||||
|
|
@ -740,6 +345,9 @@ void MainWindowCurve::s_NewWell(QString strWellName)
|
|||
FormWell *widgetWell = new FormWell(this, strWellName);
|
||||
widgetWell->m_strUuid = m_strUuid;
|
||||
ui->tableWidget_2->setCellWidget(i, columnCount, widgetWell);
|
||||
|
||||
//
|
||||
m_listWell.push_back(strWellName);
|
||||
}
|
||||
}
|
||||
//ui->tableWidget_2->resizeColumnsToContents(); // 调整列宽以适应内容
|
||||
|
|
@ -807,6 +415,20 @@ void MainWindowCurve::s_NewTrackChangeWidth(QString strWellName)
|
|||
}
|
||||
}
|
||||
|
||||
//新建空白道,没有曲线
|
||||
void MainWindowCurve::s_NewTrack_No_Line(QString strWellName, QString strTrackName)
|
||||
{
|
||||
emit CallManage::getInstance()->sig_NewTrack_No_Line(strWellName, strTrackName);
|
||||
}
|
||||
|
||||
//新建曲线,带属性
|
||||
void MainWindowCurve::s_AddLine_Property(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName,
|
||||
double newLeftScale, double newRightScale, QColor lineColor, double width, Qt::PenStyle lineStyle)
|
||||
{
|
||||
emit CallManage::getInstance()->sig_AddLine_Property(strSlfName, strWellName, strTrackName, strLineName,
|
||||
newLeftScale, newRightScale, lineColor, width, lineStyle);
|
||||
}
|
||||
|
||||
//新建井+道+曲线(首条)
|
||||
void MainWindowCurve::NewWellAndTrack(QString strWellName, QString strSlfName, QString strLineName)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -46,25 +46,18 @@ public:
|
|||
void NewWellAndTrack(QString strWellName, QString strSlfName, QString strLineName);
|
||||
|
||||
QJsonObject makeJson();
|
||||
//展示所有井
|
||||
void DisplayWells(QJsonArray wellsArray);
|
||||
//展示其中一口井
|
||||
void DisplayWell_One(QJsonObject wellObjInfo);
|
||||
//展示所有道
|
||||
void DisplayTracks(QJsonArray tracksArray);
|
||||
//展示其中一道
|
||||
void DisplayTrack_One(QJsonObject trackObjInfo, int id);
|
||||
//展示所有曲线
|
||||
void DisplayLines(QJsonArray linesArray);
|
||||
//展示其中一条曲线
|
||||
void DisplayLine_One(QJsonObject lineObjInfo);
|
||||
|
||||
signals:
|
||||
void sig_NewTrackChangeWidth(QString strWellName);//新建道后,改变井宽
|
||||
void sig_NewWell(QString strWellName);
|
||||
|
||||
public slots:
|
||||
void s_NewWell(QString strWellName);//新建井
|
||||
void s_NewTrackChangeWidth(QString strWellName);//新建道后,改变井宽
|
||||
void s_NewTrack_No_Line(QString strWellName, QString strTrackName);//新建空白道,没有曲线
|
||||
void s_AddLine_Property(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName,
|
||||
double newLeftScale, double newRightScale, QColor lineColor, double width, Qt::PenStyle lineStyle);//新建曲线,带属性
|
||||
|
||||
void s_NewTrack();//新建道
|
||||
//
|
||||
void s_Save();//保存
|
||||
|
|
|
|||
|
|
@ -41,8 +41,8 @@ QMyCustomPlot::QMyCustomPlot(QWidget *parent, QString strSlfName, QString strWel
|
|||
//岩性填充-不填充
|
||||
connect(CallManage::getInstance(), SIGNAL(sig_ClearFillMode(QString, QString, QString, QString)), this, SLOT(s_ClearFillMode(QString, QString, QString, QString)));
|
||||
//岩性填充-填充
|
||||
connect(CallManage::getInstance(), SIGNAL(sig_ChangeFillMode(QString, QString, QString, QString, QString, QString, QColor, QString, QString, float, float)),
|
||||
this, SLOT(s_ChangeFillMode(QString, QString, QString, QString, QString, QString, QColor, QString, QString, float, float)));
|
||||
connect(CallManage::getInstance(), SIGNAL(sig_ChangeFillMode(QString, QString, QString, QString, QString, QString, QColor, QString, QString, float, float, QColor, QColor)),
|
||||
this, SLOT(s_ChangeFillMode(QString, QString, QString, QString, QString, QString, QColor, QString, QString, float, float, QColor, QColor)));
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -192,7 +192,7 @@ void QMyCustomPlot::s_ChangeLeftScale(QString strSlfName, QString strWellName, Q
|
|||
//其他曲线
|
||||
s_ChangeFillMode(m_strSlfName, m_strWellName, m_strTrackName, m_strLineName,
|
||||
m_newFillType, m_newTargetLine, m_newColor, m_newLithosImage, m_newHeadFill,
|
||||
newLeftScale, m_vMax);
|
||||
newLeftScale, m_vMax, m_frontColor, m_backColor);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -217,7 +217,7 @@ void QMyCustomPlot::s_ChangeRightScale(QString strSlfName, QString strWellName,
|
|||
//其他曲线
|
||||
s_ChangeFillMode(m_strSlfName, m_strWellName, m_strTrackName, m_strLineName,
|
||||
m_newFillType, m_newTargetLine, m_newColor, m_newLithosImage, m_newHeadFill,
|
||||
m_vMin, newRightScale);
|
||||
m_vMin, newRightScale, m_frontColor, m_backColor);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -291,7 +291,7 @@ void QMyCustomPlot::s_ClearFillMode(QString strSlfName, QString strWellName, QSt
|
|||
//岩性填充-填充
|
||||
void QMyCustomPlot::s_ChangeFillMode(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName,
|
||||
QString newFillType, QString newTargetLine, QColor newColor, QString newLithosImage, QString newHeadFill,
|
||||
float vMin, float vMax)
|
||||
float vMin, float vMax, QColor frontColor, QColor backColor)
|
||||
{
|
||||
|
||||
if(m_strSlfName == strSlfName &&
|
||||
|
|
@ -307,6 +307,8 @@ void QMyCustomPlot::s_ChangeFillMode(QString strSlfName, QString strWellName, QS
|
|||
m_newHeadFill = newHeadFill;
|
||||
m_vMin = vMin;
|
||||
m_vMax = vMax;
|
||||
m_frontColor = frontColor;
|
||||
m_backColor = backColor;
|
||||
|
||||
//填充
|
||||
if(this->graphCount() > 1)
|
||||
|
|
@ -374,46 +376,178 @@ void QMyCustomPlot::s_ChangeFillMode(QString strSlfName, QString strWellName, QS
|
|||
}
|
||||
else
|
||||
{
|
||||
//其他曲线
|
||||
//其他曲线(左填充)
|
||||
CLogIO *logio=new CLogIO();
|
||||
logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeRead);
|
||||
int index=logio->OpenCurve(newTargetLine.toStdString().c_str());
|
||||
if(index<0)
|
||||
{
|
||||
this->addGraph();
|
||||
|
||||
//读取基线信息
|
||||
int indexBaseCurv = logio->OpenCurve(strLineName.toStdString().c_str());
|
||||
if(indexBaseCurv < 0) {
|
||||
this->addGraph();//空曲线
|
||||
delete logio;
|
||||
}
|
||||
else
|
||||
{
|
||||
Slf_CURVE curveinfo;
|
||||
float *val;
|
||||
float sdep,edep,rlev;
|
||||
//
|
||||
logio->GetCurveInfo(index,&curveinfo);
|
||||
sdep=curveinfo.StartDepth;
|
||||
edep=curveinfo.EndDepth;
|
||||
rlev=curveinfo.DepLevel;
|
||||
//
|
||||
int count=(curveinfo.EndDepth-curveinfo.StartDepth)/curveinfo.DepLevel+1.5;
|
||||
val=new float[count];
|
||||
logio->ReadCurve(index,curveinfo.StartDepth,count,&val[0]);
|
||||
logio->CloseCurve(index);
|
||||
delete logio;
|
||||
|
||||
float newVal = 0.0;
|
||||
for(int i=0; i<count; i++)
|
||||
//其他曲线
|
||||
int index=logio->OpenCurve(newTargetLine.toStdString().c_str());
|
||||
if(index<0)
|
||||
{
|
||||
x.append(-(sdep+ rlev*i));
|
||||
//newVal = (m_iX2-m_iX1)*(val[i]-vMin)/(vMax-vMin) + m_iX1;
|
||||
newVal = val[i];
|
||||
y.append(newVal);
|
||||
this->addGraph();//空曲线
|
||||
delete logio;
|
||||
}
|
||||
else
|
||||
{
|
||||
Slf_CURVE curveinfo;
|
||||
float *val;
|
||||
float sdep,edep,rlev;
|
||||
//
|
||||
logio->GetCurveInfo(index,&curveinfo);
|
||||
sdep=curveinfo.StartDepth;
|
||||
edep=curveinfo.EndDepth;
|
||||
rlev=curveinfo.DepLevel;
|
||||
//
|
||||
int count=(curveinfo.EndDepth-curveinfo.StartDepth)/curveinfo.DepLevel+1.5;
|
||||
val=new float[count];
|
||||
logio->ReadCurve(index,curveinfo.StartDepth,count,&val[0]);
|
||||
logio->CloseCurve(index);
|
||||
//读完基线再关闭
|
||||
// delete logio;
|
||||
|
||||
float newVal = 0.0;
|
||||
for(int i=0; i<count; i++)
|
||||
{
|
||||
float x0=-(sdep+ rlev*i);
|
||||
float y0_old=val[i];
|
||||
float y0 = (m_iX2-m_iX1)*(val[i]-vMin)/(vMax-vMin) + m_iX1;
|
||||
|
||||
//读取基线
|
||||
float BaseY0=0;
|
||||
logio->ReadCurve(indexBaseCurv, 0-x0, 1, &BaseY0);
|
||||
//
|
||||
if(i+1<count)
|
||||
{
|
||||
float x1=-(sdep+ rlev*(i+1));
|
||||
//float y1=val[i+1];
|
||||
float y1 = (m_iX2-m_iX1)*(val[i+1]-vMin)/(vMax-vMin) + m_iX1;
|
||||
//读取基线
|
||||
float BaseY1=0;
|
||||
logio->ReadCurve(indexBaseCurv, 0-x1, 1, &BaseY1);
|
||||
|
||||
if(BaseY0<=y0 && BaseY1<=y1)
|
||||
{
|
||||
//基线在左,采用基线值
|
||||
//y0=BaseY0;
|
||||
y0_old = (BaseY0-m_iX1)/(m_iX2-m_iX1)*(vMax-vMin) + vMin;
|
||||
//
|
||||
x.append(x0);
|
||||
y.append(y0_old);
|
||||
}
|
||||
else if(BaseY0>=y0 && BaseY1>=y1)
|
||||
{
|
||||
//基线在右,直接赋值
|
||||
x.append(x0);
|
||||
y.append(y0_old);
|
||||
}
|
||||
else if(BaseY0<=y0 && BaseY1>=y1)
|
||||
{
|
||||
//基线起点在左,采用基线值
|
||||
//y0=BaseY0;
|
||||
y0_old = (BaseY0-m_iX1)/(m_iX2-m_iX1)*(vMax-vMin) + vMin;
|
||||
//
|
||||
x.append(x0);
|
||||
y.append(y0_old);
|
||||
|
||||
//插值
|
||||
float xNew=x0-rlev*(y0-BaseY0)/(BaseY1-y1);
|
||||
float yNew=(y0-y1)/(x0-x1)*(xNew-x1) + y1;
|
||||
float yNew_Old=(yNew-m_iX1)/(m_iX2-m_iX1)*(vMax-vMin) + vMin;
|
||||
//
|
||||
x.append(xNew);
|
||||
y.append(yNew_Old);
|
||||
}
|
||||
else if(BaseY0>=y0 && BaseY1<=y1)
|
||||
{
|
||||
//基线在右,直接赋值
|
||||
x.append(x0);
|
||||
y.append(y0_old);
|
||||
|
||||
//插值
|
||||
float xNew=x0-rlev*(y0-BaseY0)/(BaseY1-y1);
|
||||
float yNew=(BaseY0-BaseY1)/(x0-x1)*(xNew-x1) + BaseY1;
|
||||
float yNew_Old=(yNew-m_iX1)/(m_iX2-m_iX1)*(vMax-vMin) + vMin;
|
||||
//
|
||||
x.append(xNew);
|
||||
y.append(yNew_Old);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//最后一个点
|
||||
if(BaseY0<y0)
|
||||
{
|
||||
//基线在左,采用基线值
|
||||
//y0=BaseY0;
|
||||
y0_old = (BaseY0-m_iX1)/(m_iX2-m_iX1)*(vMax-vMin) + vMin;
|
||||
}
|
||||
x.append(x0);
|
||||
y.append(y0_old);
|
||||
}
|
||||
|
||||
//newVal = (m_iX2-m_iX1)*(val[i]-vMin)/(vMax-vMin) + m_iX1;
|
||||
//newVal = val[i];
|
||||
//y.append(newVal);
|
||||
}
|
||||
logio->CloseCurve(indexBaseCurv);
|
||||
delete logio;
|
||||
//
|
||||
this->yAxis2->setRange(m_iY1, m_iY2);
|
||||
this->xAxis2->setRange(vMin, vMax);
|
||||
this->addGraph(yAxis2, xAxis2);
|
||||
}
|
||||
this->yAxis2->setRange(m_iY1, m_iY2);
|
||||
this->xAxis2->setRange(vMin, vMax);
|
||||
this->addGraph(yAxis2, xAxis2);
|
||||
}
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// //其他曲线
|
||||
// CLogIO *logio=new CLogIO();
|
||||
// logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeRead);
|
||||
// int index=logio->OpenCurve(newTargetLine.toStdString().c_str());
|
||||
// if(index<0)
|
||||
// {
|
||||
// this->addGraph();
|
||||
|
||||
// delete logio;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Slf_CURVE curveinfo;
|
||||
// float *val;
|
||||
// float sdep,edep,rlev;
|
||||
// //
|
||||
// logio->GetCurveInfo(index,&curveinfo);
|
||||
// sdep=curveinfo.StartDepth;
|
||||
// edep=curveinfo.EndDepth;
|
||||
// rlev=curveinfo.DepLevel;
|
||||
// //
|
||||
// int count=(curveinfo.EndDepth-curveinfo.StartDepth)/curveinfo.DepLevel+1.5;
|
||||
// val=new float[count];
|
||||
// logio->ReadCurve(index,curveinfo.StartDepth,count,&val[0]);
|
||||
// logio->CloseCurve(index);
|
||||
// delete logio;
|
||||
|
||||
// float newVal = 0.0;
|
||||
// for(int i=0; i<count; i++)
|
||||
// {
|
||||
// x.append(-(sdep+ rlev*i));
|
||||
// //newVal = (m_iX2-m_iX1)*(val[i]-vMin)/(vMax-vMin) + m_iX1;
|
||||
// newVal = val[i];
|
||||
// y.append(newVal);
|
||||
// }
|
||||
// this->yAxis2->setRange(m_iY1, m_iY2);
|
||||
// this->xAxis2->setRange(vMin, vMax);
|
||||
// this->addGraph(yAxis2, xAxis2);
|
||||
// }
|
||||
// }
|
||||
|
||||
this->graph(1)->setData(x, y);
|
||||
graph(1)->setLineStyle(graph(0)->lineStyle());//曲线
|
||||
|
|
@ -423,8 +557,25 @@ void QMyCustomPlot::s_ChangeFillMode(QString strSlfName, QString strWellName, QS
|
|||
//
|
||||
if(newFillType == "岩性模式")
|
||||
{
|
||||
graph(0)->setBrush(QBrush(QPixmap(newLithosImage)));
|
||||
//graph(0)->setBrush(QBrush(QPixmap(":/image/file.png")));
|
||||
QColor oldFrontColor(0, 0, 0); // 原始颜色
|
||||
QColor oldBackColor(255, 255, 255); // 原始颜色
|
||||
//
|
||||
QImage image(newLithosImage);
|
||||
for (int y = 0; y < image.height(); ++y) {
|
||||
for (int x = 0; x < image.width(); ++x) {
|
||||
QColor pixelColor = QColor(image.pixel(x, y));
|
||||
if (pixelColor == oldFrontColor) {
|
||||
image.setPixelColor(x, y, m_frontColor); // 使用 setPixelColor 来设置新颜色
|
||||
}
|
||||
if (pixelColor == oldBackColor) {
|
||||
image.setPixelColor(x, y, m_backColor); // 使用 setPixelColor 来设置新颜色
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
graph(0)->setBrush(QBrush(QPixmap::fromImage(image)));
|
||||
//graph(0)->setBrush(QBrush(QPixmap(newLithosImage)));
|
||||
}
|
||||
else if(newFillType == "颜色模式")
|
||||
{
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@ public:
|
|||
QString m_newHeadFill;
|
||||
float m_vMin;
|
||||
float m_vMax;
|
||||
QColor m_frontColor;//岩性前景色
|
||||
QColor m_backColor;//岩性背景色
|
||||
|
||||
QContextMenuEvent *m_event;
|
||||
|
||||
|
|
@ -70,7 +72,7 @@ public slots:
|
|||
//岩性填充-填充
|
||||
void s_ChangeFillMode(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName,
|
||||
QString newFillType, QString newTargetLine, QColor newColor, QString newLithosImage, QString newHeadFill,
|
||||
float vMin, float vMax);
|
||||
float vMin, float vMax, QColor frontColor, QColor backColor);
|
||||
|
||||
void onAddRect();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user