Compare commits
No commits in common. "2c6ff9b050af9c16edfe3711193e8da8b52b30b7" and "2ade61190b26795b269dc51377c5ca8bf88d0151" have entirely different histories.
2c6ff9b050
...
2ade61190b
430
app/fdsa4_test/test0531.cpp
Normal file
430
app/fdsa4_test/test0531.cpp
Normal file
|
|
@ -0,0 +1,430 @@
|
||||||
|
#include "memrdwt.h"
|
||||||
|
#include "math.h"
|
||||||
|
#include "basefun.h"
|
||||||
|
#include "DepthProgress.h"
|
||||||
|
#include <qvector.h>
|
||||||
|
//#include"cloudalgorithmaccess.h"
|
||||||
|
#include <QTextCodec>
|
||||||
|
#include <QCoreApplication>
|
||||||
|
#include <QtNetwork/QNetworkProxyFactory>
|
||||||
|
#include <QLibrary>
|
||||||
|
#include <QtNetwork/QTcpSocket>
|
||||||
|
#include "pythonhandler.h"
|
||||||
|
|
||||||
|
// #undef slots
|
||||||
|
// #if defined(_DEBUG)
|
||||||
|
// #define IS_DEBUG
|
||||||
|
// #undef _DEBUG//防止加载python312_d.lib 先取消掉_DEBUG
|
||||||
|
// #endif
|
||||||
|
// #include <Python.h>
|
||||||
|
// #include <numpy/arrayobject.h>
|
||||||
|
// #if defined(IS_DEBUG)
|
||||||
|
// #define _DEBUG
|
||||||
|
// #endif
|
||||||
|
// #define slots
|
||||||
|
#include <QDebug>
|
||||||
|
/****************************************************数据定义****************************************************************
|
||||||
|
******************************begin****************************/
|
||||||
|
extern "C"{
|
||||||
|
_declspec (dllexport) struct INC_STRU INC={6,
|
||||||
|
"FWGN_W:波名1,raw;;\
|
||||||
|
NWGN_W:波名2,raw;;\
|
||||||
|
RWGN_W:波名3,raw;;\
|
||||||
|
GR:伽马,API;;\
|
||||||
|
NWGN_C:曲线名2,raw;;\
|
||||||
|
RWGN_C:曲线名3,raw;;\
|
||||||
|
"
|
||||||
|
};//输入曲线定义 6:输入6条数据, "数据英文:数据中文,数据单位;;"
|
||||||
|
_declspec (dllexport) struct INP_STRU INP; ///使用GetINValue(RGN_C, 6, 1);函数需要定义该变量
|
||||||
|
|
||||||
|
_declspec (dllexport) struct OUTC_STRU OUTC={2,
|
||||||
|
"ATT:波名1,raw;;\
|
||||||
|
THCAV:曲线名1,raw;;\
|
||||||
|
"
|
||||||
|
};//输出曲线定义 2:输出2条数据, "数据英文:数据中文,数据单位;;"(注:先写波形数据,再写曲线数据)
|
||||||
|
//_declspec (dllexport) struct OUTP_STRU OUTP;
|
||||||
|
|
||||||
|
_declspec (dllexport) struct HD_STRU HD={0.0,9999.0,0.0,0.0,0.0,0.0,0.0,"test0531.INP","test0531.TLP"};//改成自己的工程名
|
||||||
|
|
||||||
|
__declspec (dllexport) struct CONC_STRU CONC={4,
|
||||||
|
"CTH:参数名1,mm;;;;10.5;\
|
||||||
|
CT:参数名2,%;;;;1;\
|
||||||
|
IT:参数名3,mm;;;;9.7;\
|
||||||
|
MT:参数名4,%;;;;1;"
|
||||||
|
};//常量参数定义 4:4个参数, "数据英文:数据中文,单位;;;;参数默认值;"
|
||||||
|
_declspec (dllexport) struct CON_STRU CON={10.5, 1, 9.7, 1};//再次设置默认值(需要与前面相同)
|
||||||
|
|
||||||
|
_declspec (dllexport) struct ErrorInf errorinf;
|
||||||
|
|
||||||
|
//定义输出数据类型(注:需要与前面输出定义一一对应)
|
||||||
|
__declspec (dllexport) struct LogType LogType={WAVE_OBJECT, CURVE_OBJECT};//{WAVE_OBJECT, CURVE_OBJECT}
|
||||||
|
|
||||||
|
__declspec( dllexport ) CMemRdWt MemRdWt;
|
||||||
|
_declspec (dllexport) int test0531();//改成自己的工程名
|
||||||
|
}
|
||||||
|
/****************************************************end****************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
struct Process_Struct{
|
||||||
|
int Process();
|
||||||
|
};
|
||||||
|
|
||||||
|
//DLL入口函数
|
||||||
|
int test0531()//改成自己的工程名
|
||||||
|
{
|
||||||
|
Process_Struct Process;
|
||||||
|
return Process.Process();
|
||||||
|
}
|
||||||
|
|
||||||
|
//固井结构体(注:此处为表格输出示例)
|
||||||
|
typedef struct ss_struct
|
||||||
|
{
|
||||||
|
int GNO;
|
||||||
|
float GSDEP,GEDEP;
|
||||||
|
int GRESULT;
|
||||||
|
} GUJING;
|
||||||
|
//结论结构体
|
||||||
|
typedef struct s2_struct
|
||||||
|
{
|
||||||
|
int NO;
|
||||||
|
float SDEP,EDEP;
|
||||||
|
QString R;
|
||||||
|
} JIELUN;
|
||||||
|
|
||||||
|
void callPython(float FGN_C, float NGN_C, float RGN_C, float* FGN_W, float* NGN_W, float* Att0all, int nlen)
|
||||||
|
{
|
||||||
|
QVariantList args;
|
||||||
|
// args << 0.77;
|
||||||
|
// args << 2.93;
|
||||||
|
// args << 50;
|
||||||
|
// PythonHandler::getInstance()->executeScript("UCS_test_0330", "get_UCS_Horsrud_correlation_shale", args, NULL, nlen);
|
||||||
|
// return;
|
||||||
|
|
||||||
|
QVariantList arg1;
|
||||||
|
QVariantList arg2;
|
||||||
|
// 填充列表
|
||||||
|
for (int i = 0; i < nlen; ++i) {
|
||||||
|
arg1 << (double)FGN_W[i];
|
||||||
|
arg2 << (double)NGN_W[i];
|
||||||
|
}
|
||||||
|
args.append(QVariant::fromValue(arg1)); // 直接将 innerList1 作为元素添加
|
||||||
|
args.append(QVariant::fromValue(arg2)); // 使用 << 操作符
|
||||||
|
args << (double)FGN_C << (double)NGN_C << (double)RGN_C;
|
||||||
|
PythonHandler::getInstance()->executeScript("fdsa4_test", "process_arrays", args, Att0all, nlen);
|
||||||
|
|
||||||
|
// static PyObject * pmodule = NULL;
|
||||||
|
// static PyObject * pmodule2 = NULL;
|
||||||
|
// if (!pmodule) // 防止重复加载报错cannot load module more than once per process
|
||||||
|
// {
|
||||||
|
// Py_Initialize();
|
||||||
|
// if(!Py_IsInitialized())
|
||||||
|
// {
|
||||||
|
// qDebug() << "init err";
|
||||||
|
// }
|
||||||
|
// PyRun_SimpleString("import os");
|
||||||
|
// PyRun_SimpleString("import sys");
|
||||||
|
// // PyRun_SimpleString("sys.path.append('./app/fdsa4_test')");// 设置运行路径
|
||||||
|
// PyRun_SimpleString("sys.path.append('D:/jiayl0909/logPlus/build/Bin/app/fdsa4_test')");// 设置运行路径
|
||||||
|
// PyRun_SimpleString("sys.path.append(os.path.dirname(os.path.dirname(os.getcwd())))");
|
||||||
|
// PyRun_SimpleString("print(os.getcwd())");
|
||||||
|
// PyRun_SimpleString("print(os.path.dirname(os.path.dirname(os.getcwd())))");
|
||||||
|
// PyRun_SimpleString("print(sys.path)");
|
||||||
|
|
||||||
|
// // pmodule2 = PyImport_ImportModule("math_algorithm");
|
||||||
|
// pmodule = PyImport_ImportModule("math_algorithm");
|
||||||
|
|
||||||
|
// }
|
||||||
|
// if(PyErr_Occurred()){
|
||||||
|
// PyObject*pType,*pValue,*pTraceback;
|
||||||
|
// PyErr_Fetch(&pType,&pValue,&pTraceback);PyErr_NormalizeException(&pType,&pValue,&pTraceback);
|
||||||
|
// PyObject* pstr=PyObject_Str(pValue);
|
||||||
|
// const char* pstrErrorMessage =PyUnicode_AsUTF8(pstr);
|
||||||
|
// printf("Error message:%s\n",pstrErrorMessage);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if(!pmodule)
|
||||||
|
// {
|
||||||
|
// qDebug() << "can not open the file";
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // return;
|
||||||
|
// PyObject* pFunc2 = PyObject_GetAttrString(pmodule, "process_arrays");
|
||||||
|
|
||||||
|
// // 创建两个Python列表(数组)
|
||||||
|
// PyObject* pArgs = PyTuple_New(5);//五个参数
|
||||||
|
// PyObject* pList1 = PyList_New(0);
|
||||||
|
// PyObject* pList2 = PyList_New(0);
|
||||||
|
|
||||||
|
// // 填充列表
|
||||||
|
// for (int i = 0; i < nlen; ++i) {
|
||||||
|
// PyList_Append(pList1, PyFloat_FromDouble(FGN_W[i])); // 可以调用GetINValue(AC,1,1);添加曲线数据
|
||||||
|
// PyList_Append(pList2, PyFloat_FromDouble(NGN_W[i]));
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // 将列表放入参数元组中
|
||||||
|
// PyTuple_SetItem(pArgs, 0, pList1);
|
||||||
|
// PyTuple_SetItem(pArgs, 1, pList2);
|
||||||
|
// PyTuple_SetItem(pArgs, 2, PyFloat_FromDouble(FGN_C));
|
||||||
|
// PyTuple_SetItem(pArgs, 3, PyFloat_FromDouble(NGN_C));
|
||||||
|
// PyTuple_SetItem(pArgs, 4, PyFloat_FromDouble(RGN_C));
|
||||||
|
|
||||||
|
// // 调用函数
|
||||||
|
// PyObject* pValue = PyObject_CallObject(pFunc2, pArgs);
|
||||||
|
// if (pValue != NULL) {
|
||||||
|
// // // 处理结果或打印结果(例如,转换为C++数据类型)
|
||||||
|
// // for (Py_ssize_t i = 0; i < PyList_Size(pValue); ++i) {
|
||||||
|
// // PyObject* item = PyList_GetItem(pValue, i);
|
||||||
|
// // printf("%ld ", PyLong_AsLong(item)); // 对于Python 3,使用 PyLong_AsLong
|
||||||
|
// // }
|
||||||
|
// // printf("\n");
|
||||||
|
// // 处理返回的元组,这里有两个数组元素
|
||||||
|
// PyObject* array1 = PyTuple_GetItem(pValue, 0);
|
||||||
|
// double dR = PyFloat_AsDouble(PyTuple_GetItem(pValue, 1)); // 获取double
|
||||||
|
|
||||||
|
// // // 将numpy数组转换为C++数组(例如使用numpy的API)
|
||||||
|
// // PyArrayObject* arr1 = (PyArrayObject*)PyArray_FromAny(array1, NULL, 0, 0, NPY_ARRAY_CARRAY, NULL);
|
||||||
|
// PyArrayObject* arr1 = (PyArrayObject*)array1;
|
||||||
|
// double* data1 = (double*)PyArray_DATA(arr1);
|
||||||
|
|
||||||
|
// int len = PyArray_DIM(arr1, 0); // 获取数组长度
|
||||||
|
// if (len>nlen)
|
||||||
|
// len = nlen;
|
||||||
|
// for (int i = 0; i < len; i++) {
|
||||||
|
// Att0all[i] = data1[i];
|
||||||
|
// }
|
||||||
|
// Py_DECREF(arr1);
|
||||||
|
// } else {
|
||||||
|
// PyErr_Print();
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // 清理资源
|
||||||
|
// Py_DECREF(pValue);
|
||||||
|
// Py_DECREF(pArgs);
|
||||||
|
|
||||||
|
// // while(Py_REFCNT(pmodule)>0)
|
||||||
|
// // Py_DECREF(pmodule);
|
||||||
|
// // Py_Finalize();
|
||||||
|
}
|
||||||
|
|
||||||
|
//核心处理逻辑
|
||||||
|
int Process_Struct::Process()
|
||||||
|
{
|
||||||
|
if(HD.Sdep >= HD.EndDep)
|
||||||
|
{
|
||||||
|
// AfxMessageBox("当前处理井段深度有误!\n已停止计算");
|
||||||
|
AfxMessageBox("The current depth of the processing interval is incorrect!\n Calculation has been stopped");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************写数据前的准备操作*******************************************************
|
||||||
|
******************************begin****************************/
|
||||||
|
//(1)初始化参数、输入
|
||||||
|
MemRdWt.Const();
|
||||||
|
MemRdWt.In();
|
||||||
|
|
||||||
|
//(2)波形类型的输出数据初始化检查
|
||||||
|
char outname[2][16];
|
||||||
|
int OUTindex = 0, WaveIndex = 0;
|
||||||
|
MemRdWt.GetOutCurveName(OUTindex, outname[OUTindex]);//获取输出数据名称,参数1是序列值(从0开始)(注:波形/曲线均使用GetOutCurveName函数)
|
||||||
|
|
||||||
|
int index1 = MemRdWt.OpenWave(outname[OUTindex]);//检查是否存在outname[OUTindex]波形
|
||||||
|
if(index1 < 0) //返回索引小于0说明没有该波形,需要创建
|
||||||
|
{
|
||||||
|
//创建方式:
|
||||||
|
Slf_WAVE myWave;
|
||||||
|
strcpy(myWave.Name, outname[OUTindex]);
|
||||||
|
strcpy(myWave.AliasName, outname[OUTindex]);
|
||||||
|
strcpy(myWave.DepthUnit, "m");
|
||||||
|
myWave.CodeLen = 4;
|
||||||
|
myWave.RepCode = 4;
|
||||||
|
myWave.DefVal = 0;
|
||||||
|
myWave.StartDepth = HD.Sdep;
|
||||||
|
myWave.EndDepth = HD.Edep;
|
||||||
|
myWave.DepLevel = HD.Rlev;
|
||||||
|
strcpy(myWave.DepthUnit, "m");
|
||||||
|
myWave.StartTime = 0; //起始记录时间
|
||||||
|
myWave.TimeLevel = 5; //时间采样间隔
|
||||||
|
myWave.ArrayNum = 1; //阵列数
|
||||||
|
myWave.TimeSamples = 36; //时间采样总数
|
||||||
|
strcpy(myWave.TimeUnit, "ns"); //时间单位
|
||||||
|
|
||||||
|
index1 = MemRdWt.OpenWave((Slf_WAVE *)&myWave); //创建波形(注:此时返回索引应>1,代表创建成功)
|
||||||
|
}
|
||||||
|
if(index1 < 0)
|
||||||
|
{
|
||||||
|
// AfxMessageBox("阵列数据创建失败!\n已停止计算");
|
||||||
|
AfxMessageBox("Array data creation failed!\nCalculation stopped");
|
||||||
|
return 0;
|
||||||
|
}else{
|
||||||
|
WaveIndex = index1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//(3)曲线类型的输出数据初始化检查
|
||||||
|
OUTindex = 1;//按extern "C"中定义的输出数据顺序设置
|
||||||
|
MemRdWt.GetOutCurveName(OUTindex, outname[OUTindex]);//获取输出数据名称,参数1是序列值(从0开始)
|
||||||
|
index1 = MemRdWt.OpenCurve(outname[1]);//index1 = MemRdWt.OpenCurve("EEE");//检查数据是否存在//outname[OUTindex]
|
||||||
|
if(index1 < 0) //返回索引小于0说明没有这条曲线,需要创建
|
||||||
|
{
|
||||||
|
//创建方式:
|
||||||
|
Slf_CURVE myCurve; //定义曲线对象
|
||||||
|
strcpy(myCurve.Name, outname[1]); //设置名称
|
||||||
|
strcpy(myCurve.AliasName, outname[1]); //设置别名
|
||||||
|
strcpy(myCurve.Unit, "m"); //设置数据单位
|
||||||
|
myCurve.CodeLen = 4; //设置字节长度(注:4float)
|
||||||
|
myCurve.RepCode = 4; //设置数据类型(注:4float)
|
||||||
|
myCurve.DefVal = 0; //设置默认值
|
||||||
|
myCurve.StartDepth = HD.Sdep; //设置起始深度
|
||||||
|
myCurve.EndDepth = HD.Edep; //设置结束深度
|
||||||
|
myCurve.DepLevel = HD.Rlev; //设置采样间隔
|
||||||
|
strcpy(myCurve.DepthUnit, "m"); //设置深度单位
|
||||||
|
|
||||||
|
index1 = MemRdWt.OpenCurve((Slf_CURVE *)&myCurve); //创建曲线(注:此时返回索引应>1,代表创建成功)
|
||||||
|
|
||||||
|
}
|
||||||
|
if(index1 < 0)
|
||||||
|
{
|
||||||
|
// AfxMessageBox("波形数据创建失败!\n已停止计算");
|
||||||
|
AfxMessageBox("Array data creation failed!\nCalculation stopped");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
/*********************************************************end************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//(4)平台进度条设置
|
||||||
|
DepthProgress mmProgress;
|
||||||
|
mmProgress.CreatProgress(HD.Stdep, HD.EndDep, "程序处理中...");
|
||||||
|
|
||||||
|
//(5)深度循环
|
||||||
|
while(HD.Dep <= HD.EndDep)//逐深度处理
|
||||||
|
{
|
||||||
|
mmProgress.SetDepth(HD.Dep);//设置平台进度条
|
||||||
|
|
||||||
|
/********************************************************获取常量参数示例***************************************************
|
||||||
|
******************************begin****************************/
|
||||||
|
|
||||||
|
//GetPosValue函数的参数3为序列值,要和extern "C"的CONC内容对应上(从1开始)
|
||||||
|
float CTH, CT, IT, MT;
|
||||||
|
GetPosValue(CTH, CON, 1, 1);
|
||||||
|
GetPosValue(CT, CON, 2, 1);
|
||||||
|
GetPosValue(IT, CON, 3, 1);
|
||||||
|
GetPosValue(MT, CON, 4, 1);
|
||||||
|
/***************************************************************end*************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
/********************************************************读数据示例***************************************************************
|
||||||
|
*****************************begin****************************/
|
||||||
|
|
||||||
|
//(1)读wave数据
|
||||||
|
char inname[3][36];
|
||||||
|
int index[4] = {-1};
|
||||||
|
//获取输入数据对应的波列名称,,参数1是序列值(从0开始)
|
||||||
|
MemRdWt.GetInCurveName(0, inname[0]);
|
||||||
|
MemRdWt.GetInCurveName(1, inname[1]);
|
||||||
|
MemRdWt.GetInCurveName(2, inname[2]);
|
||||||
|
//获取波列数据对应的index,再读数据
|
||||||
|
index[0] = MemRdWt.OpenWave(inname[0]);
|
||||||
|
index[1] = MemRdWt.OpenWave(inname[1]);
|
||||||
|
index[2] = MemRdWt.OpenWave(inname[2]);
|
||||||
|
if(index[0] < 0 || index[1] < 0 || index[2] < 0){
|
||||||
|
// AfxMessageBox("波列数据获取失败\n已停止计算");
|
||||||
|
AfxMessageBox("Waveform data acquisition failed\nCalculation stopped");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
float FGN_W[60], NGN_W[60], RGN_W[60]; //必须根据wave数据的大小声明!
|
||||||
|
int a = 0;
|
||||||
|
int b = 0; int c = 0;
|
||||||
|
c = MemRdWt.ReadWaveToFloatBuf(index[2], HD.Dep, 1, RGN_W);
|
||||||
|
b = MemRdWt.ReadWaveToFloatBuf(index[1], HD.Dep, 1, NGN_W);
|
||||||
|
a = MemRdWt.ReadWaveToFloatBuf(index[0], HD.Dep, 1, FGN_W);//读取wave数据,从HD.Dep深度开始,读1个深度位置的wave数据至FGN_W中
|
||||||
|
|
||||||
|
//(2)读曲线数据
|
||||||
|
//GetINValue函数的参数2为序列值,要和extern "C"的INC内容的顺序对应上
|
||||||
|
float FGN_C, NGN_C, RGN_C;
|
||||||
|
GetINValue(FGN_C, 4, 1);
|
||||||
|
GetINValue(NGN_C, 5, 1);
|
||||||
|
GetINValue(RGN_C, 6, 1);
|
||||||
|
/********************************************************end*************************************************************/
|
||||||
|
|
||||||
|
/*******************************************处理程序示例(注:改成自己的算法)******************************************
|
||||||
|
*****************************begin****************************/
|
||||||
|
float Att0all[36];
|
||||||
|
float THCAV = 0.0;
|
||||||
|
bool bPython = true;
|
||||||
|
if (bPython)
|
||||||
|
{
|
||||||
|
callPython(FGN_C, NGN_C, RGN_C, FGN_W, NGN_W, Att0all, 36);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for(int i = 0; i < 36; i++)
|
||||||
|
Att0all[i] = FGN_W[i] + NGN_W[i];
|
||||||
|
THCAV = FGN_C + NGN_C + RGN_C;
|
||||||
|
}
|
||||||
|
/********************************************************end********************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************向平台写数据示例**********************************************
|
||||||
|
*****************************begin****************************/
|
||||||
|
|
||||||
|
//(1)写wave数据
|
||||||
|
MemRdWt.WriteWave(WaveIndex, HD.Dep, 1, &Att0all);
|
||||||
|
|
||||||
|
//(2)写curve数据
|
||||||
|
int THCAV_index = MemRdWt.OpenCurve(outname[1]);//outname[1]
|
||||||
|
if(THCAV_index > 0)
|
||||||
|
MemRdWt.WriteCurve(THCAV_index, HD.Dep, 1, &THCAV);
|
||||||
|
/*******************************************************end**********************************************************/
|
||||||
|
MemRdWt.In(); //继续深度循环
|
||||||
|
}
|
||||||
|
|
||||||
|
/*************************************************向平台写表格示例*************************************************************
|
||||||
|
*****************************begin****************************/
|
||||||
|
|
||||||
|
//(1)固井结论表格
|
||||||
|
int itable1 = MemRdWt.OpenOG_RESULT("固井质量");//例如表格取名为“固井质量”
|
||||||
|
MemRdWt.SetTableRecordCount(itable1, 0); //清空原有表格数据
|
||||||
|
|
||||||
|
GUJING *CCNN2 = new GUJING[5];
|
||||||
|
for(int i = 0; i < 5; i++)
|
||||||
|
{
|
||||||
|
CCNN2[i].GNO = i + 1;
|
||||||
|
CCNN2[i].GSDEP = 2000 + i * 10;
|
||||||
|
CCNN2[i].GEDEP = 2000 + (i + 1) * 10;
|
||||||
|
CCNN2[i].GRESULT = 1;
|
||||||
|
|
||||||
|
int temp = MemRdWt.WriteTable(itable1, i + 1, &CCNN2[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
//(2)其他表格
|
||||||
|
struct Slf_RST{
|
||||||
|
int Order;
|
||||||
|
float Depth;
|
||||||
|
float CorrDepth;
|
||||||
|
};
|
||||||
|
struct Slf_RST m_Result;
|
||||||
|
itable1 = MemRdWt.OpenTable("ABCD");
|
||||||
|
if (itable1 < 0)
|
||||||
|
{
|
||||||
|
itable1 = MemRdWt.Open_Set_Table("ABCD",0,3,
|
||||||
|
"NO,DEPTH,DDEP",
|
||||||
|
"4,4,4",//字段长度
|
||||||
|
"1,4,4",//字段类型
|
||||||
|
"0,0,0");//字段备注,1-枚举
|
||||||
|
}
|
||||||
|
MemRdWt.SetTableRecordCount(itable1,3); //设置表格有3行数据
|
||||||
|
for(int j = 0; j < 3; j++)
|
||||||
|
{
|
||||||
|
memset(&m_Result, 0, sizeof(Slf_RST));
|
||||||
|
m_Result.Order = j + 1;
|
||||||
|
m_Result.Depth = 10;
|
||||||
|
m_Result.CorrDepth = 20 + j;
|
||||||
|
MemRdWt.WriteTable(itable1, j + 1, &m_Result);
|
||||||
|
|
||||||
|
}
|
||||||
|
MemRdWt.CloseTable(itable1);
|
||||||
|
/******************************************************end*************************************************************/
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
@ -238,10 +238,10 @@ void RGB_to_HSL (float r, float g, float b, float *h, float *s, float *l)
|
||||||
float vm;
|
float vm;
|
||||||
float r2, g2, b2;
|
float r2, g2, b2;
|
||||||
|
|
||||||
v = qMax(r,g);
|
v = max(r,g);
|
||||||
v = qMax(v,b);
|
v = max(v,b);
|
||||||
m = qMin(r,g);
|
m = min(r,g);
|
||||||
m = qMin(m,b);
|
m = min(m,b);
|
||||||
|
|
||||||
if ((*l = (m + v) / 2.0f) <= 0.0f) return;
|
if ((*l = (m + v) / 2.0f) <= 0.0f) return;
|
||||||
if ((*s = vm = v - m) > 0.0f) {
|
if ((*s = vm = v - m) > 0.0f) {
|
||||||
|
|
@ -393,7 +393,7 @@ COLORREF CGradient::InterpolateHSLShortest(COLORREF first, COLORREF second, floa
|
||||||
return RGB((BYTE)(r*255.0f), (BYTE)(g*255.0f), (BYTE)(b*255.0f));
|
return RGB((BYTE)(r*255.0f), (BYTE)(g*255.0f), (BYTE)(b*255.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
int CGradient::GetColorArray(COLORREF colorArr[])
|
void CGradient::GetColorArray(COLORREF colorArr[])
|
||||||
{
|
{
|
||||||
float pos;
|
float pos;
|
||||||
|
|
||||||
|
|
@ -410,7 +410,7 @@ int CGradient::GetColorArray(COLORREF colorArr[])
|
||||||
//COLORREF lastpegcolour = pegs[pegs.GetUpperBound()].colour;
|
//COLORREF lastpegcolour = pegs[pegs.GetUpperBound()].colour;
|
||||||
int curpeg;
|
int curpeg;
|
||||||
|
|
||||||
int index = 0; float pos2; COLORREF colour;
|
int index; float pos2; COLORREF colour;
|
||||||
for (index=0,pos=0.0; index<256; index++,pos+=0.003906)
|
for (index=0,pos=0.0; index<256; index++,pos+=0.003906)
|
||||||
{
|
{
|
||||||
if(m_Quantization != -1)
|
if(m_Quantization != -1)
|
||||||
|
|
@ -435,11 +435,11 @@ int CGradient::GetColorArray(COLORREF colorArr[])
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return index;
|
|
||||||
}
|
}
|
||||||
else //pegs.size == 0
|
else //pegs.size == 0
|
||||||
{
|
{
|
||||||
int index = 0; float pos2; COLORREF colour;
|
int index; float pos2; COLORREF colour;
|
||||||
for (index=0,pos=0.0; index<256; index++,pos+=0.003906)
|
for (index=0,pos=0.0; index<256; index++,pos+=0.003906)
|
||||||
{
|
{
|
||||||
if (m_Quantization != -1)
|
if (m_Quantization != -1)
|
||||||
|
|
@ -449,9 +449,8 @@ int CGradient::GetColorArray(COLORREF colorArr[])
|
||||||
colour = Interpolate(m_StartPeg.colour, m_EndPeg.colour, pos2, 0, 1);
|
colour = Interpolate(m_StartPeg.colour, m_EndPeg.colour, pos2, 0, 1);
|
||||||
colorArr[index] = colour;
|
colorArr[index] = colour;
|
||||||
}
|
}
|
||||||
return index;
|
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
int CGradient::IndexFromPos2(float pos)
|
int CGradient::IndexFromPos2(float pos)
|
||||||
{
|
{
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
#define Gradient_H
|
#define Gradient_H
|
||||||
|
|
||||||
#include <QGraphicsWidget>
|
#include <QGraphicsWidget>
|
||||||
|
#include "CStringType.h"
|
||||||
|
|
||||||
//typedef struct myRGBTRIPLE {
|
//typedef struct myRGBTRIPLE {
|
||||||
// BYTE rgbtBlue;
|
// BYTE rgbtBlue;
|
||||||
|
|
@ -10,10 +11,6 @@
|
||||||
// BYTE rgbtRed;
|
// BYTE rgbtRed;
|
||||||
//} RGBTRIPLE;
|
//} RGBTRIPLE;
|
||||||
|
|
||||||
typedef unsigned long DWORD;
|
|
||||||
typedef unsigned char BYTE;
|
|
||||||
typedef unsigned short WORD;
|
|
||||||
|
|
||||||
typedef DWORD COLORREF;
|
typedef DWORD COLORREF;
|
||||||
typedef DWORD *LPCOLORREF;
|
typedef DWORD *LPCOLORREF;
|
||||||
|
|
||||||
|
|
@ -80,7 +77,7 @@ public:
|
||||||
QString m_FileFlag;
|
QString m_FileFlag;
|
||||||
public:
|
public:
|
||||||
//void MakeEntries(RGBTRIPLE *lpPal, int iEntryCount);
|
//void MakeEntries(RGBTRIPLE *lpPal, int iEntryCount);
|
||||||
int GetColorArray(COLORREF colorArr[]);
|
void GetColorArray(COLORREF colorArr[]);
|
||||||
InterpolateFn GetInterpolationProc();
|
InterpolateFn GetInterpolationProc();
|
||||||
int IndexFromPos2(float pos);
|
int IndexFromPos2(float pos);
|
||||||
int IndexFromPos(float pos);
|
int IndexFromPos(float pos);
|
||||||
|
|
@ -2421,19 +2421,13 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant
|
||||||
CommonPropertyChanged(pProperty, variant);
|
CommonPropertyChanged(pProperty, variant);
|
||||||
changedDcaProperty(m_propertyData[pProperty], variant);
|
changedDcaProperty(m_propertyData[pProperty], variant);
|
||||||
}
|
}
|
||||||
else if (m_strCurrentProperty == DrawImage_Property)//图像
|
|
||||||
{
|
|
||||||
// 先处理通用属性
|
|
||||||
CommonPropertyChanged(pProperty, variant);
|
|
||||||
changedDrawImageProperty(m_propertyData[pProperty], variant);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PropertyWidget::SlotPropertyChanged(QtProperty *property, const int &val, bool islinestyle)
|
void PropertyWidget::SlotPropertyChanged(QtProperty *property, const int &val, bool islinestyle)
|
||||||
{
|
{
|
||||||
QString str = m_propertyData[property];
|
QString str = m_propertyData[property];
|
||||||
if (m_strCurrentProperty == Wave_Property
|
if (m_strCurrentProperty == Wave_Property)
|
||||||
|| m_strCurrentProperty == DrawImage_Property)
|
|
||||||
{
|
{
|
||||||
m_formInfo->setInfoProperty(str, val);
|
m_formInfo->setInfoProperty(str, val);
|
||||||
|
|
||||||
|
|
@ -2733,7 +2727,7 @@ void PropertyWidget::_CreateEnumPropertyItem(QString strGroup, QString strProper
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QtProperty* PropertyWidget::_CreateColorSchemePropertyItem(QString strGroup, QString strPropertyCaption, QVariant vtPropertyValue, int nclr)
|
void PropertyWidget::_CreateColorSchemePropertyItem(QString strGroup, QString strPropertyCaption, QVariant vtPropertyValue)
|
||||||
{
|
{
|
||||||
QtProperty *pGroupItem = NULL;
|
QtProperty *pGroupItem = NULL;
|
||||||
{
|
{
|
||||||
|
|
@ -2751,34 +2745,7 @@ QtProperty* PropertyWidget::_CreateColorSchemePropertyItem(QString strGroup, QSt
|
||||||
}
|
}
|
||||||
|
|
||||||
QtProperty *colorSchemeProperty = m_pColorSchemeManager->addProperty(strPropertyCaption);
|
QtProperty *colorSchemeProperty = m_pColorSchemeManager->addProperty(strPropertyCaption);
|
||||||
|
m_pColorSchemeManager->setLinear(colorSchemeProperty);
|
||||||
// QVector <QString> qvFiles;
|
|
||||||
// int n = getColorConfig(qvFiles);
|
|
||||||
// if (n > 0)
|
|
||||||
// {
|
|
||||||
// CGradient m_GraInfo;
|
|
||||||
// QList<QtSchemeColor> listSColor;
|
|
||||||
// for (int i = 0; i < qvFiles.size(); i++)
|
|
||||||
// {
|
|
||||||
// m_GraInfo.Serialize(qvFiles[i]);
|
|
||||||
//
|
|
||||||
// //获取颜色数组
|
|
||||||
// int iColorNum = 256;
|
|
||||||
// COLORREF pColorArr[256];
|
|
||||||
// int nret = m_GraInfo.GetColorArray(pColorArr);
|
|
||||||
//
|
|
||||||
// QtSchemeColor sc;
|
|
||||||
// sc.schemeName = qvFiles.at(i);
|
|
||||||
// for (int k = 0; k < nret; k++)
|
|
||||||
// {
|
|
||||||
// sc.colorList.push_back(QtColorItem(QColor(pColorArr[k])));
|
|
||||||
// }
|
|
||||||
// listSColor << sc;
|
|
||||||
// }
|
|
||||||
// m_pColorSchemeManager->setLinear(colorSchemeProperty, listSColor);
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
m_pColorSchemeManager->setLinear(colorSchemeProperty, nclr);
|
|
||||||
if (colorSchemeProperty)
|
if (colorSchemeProperty)
|
||||||
{
|
{
|
||||||
m_propertyData[colorSchemeProperty] = strPropertyCaption;
|
m_propertyData[colorSchemeProperty] = strPropertyCaption;
|
||||||
|
|
@ -2789,7 +2756,6 @@ QtProperty* PropertyWidget::_CreateColorSchemePropertyItem(QString strGroup, QSt
|
||||||
// m_mapProperty[colorSchemeProperty] = pMetaProperty;
|
// m_mapProperty[colorSchemeProperty] = pMetaProperty;
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
return colorSchemeProperty;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PropertyWidget::initWidgetProperty(QString strUuid, int iScale)
|
void PropertyWidget::initWidgetProperty(QString strUuid, int iScale)
|
||||||
|
|
@ -3353,10 +3319,6 @@ void PropertyWidget::initProperty(FormInfo *formInfo)
|
||||||
//
|
//
|
||||||
this->initDcaProperty(formInfo);
|
this->initDcaProperty(formInfo);
|
||||||
}
|
}
|
||||||
else if (formInfo->m_strType == "DrawImageObject")
|
|
||||||
{
|
|
||||||
this->initDrawImageProperty(formInfo);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PropertyWidget::initWaveProperty(FormInfo *formInfo, int nType)
|
void PropertyWidget::initWaveProperty(FormInfo *formInfo, int nType)
|
||||||
|
|
@ -3436,7 +3398,7 @@ void PropertyWidget::initWaveProperty(FormInfo *formInfo, int nType)
|
||||||
|
|
||||||
if (nType == 2)
|
if (nType == 2)
|
||||||
{
|
{
|
||||||
_CreateColorSchemePropertyItem("调色板参数设置", "色板", formInfo->m_nSchemeIndex, 0);
|
_CreateColorSchemePropertyItem("调色板参数设置", "色板", formInfo->m_nSchemeIndex);
|
||||||
_CreateVariantPropertyItem("调色板参数设置", "变密度颜色级数", formInfo->m_nColorNum, QVariant::Int);
|
_CreateVariantPropertyItem("调色板参数设置", "变密度颜色级数", formInfo->m_nColorNum, QVariant::Int);
|
||||||
}
|
}
|
||||||
// _CreateVariantPropertyItem("调色板参数设置", "图例置顶", false, QVariant::Bool);
|
// _CreateVariantPropertyItem("调色板参数设置", "图例置顶", false, QVariant::Bool);
|
||||||
|
|
@ -5975,84 +5937,43 @@ void PropertyWidget::changedMCalsProperty(QString strProperty, QVariant varVal)
|
||||||
|
|
||||||
void PropertyWidget::initDrawImageProperty(FormInfo *formInfo)
|
void PropertyWidget::initDrawImageProperty(FormInfo *formInfo)
|
||||||
{
|
{
|
||||||
//初始化,清空
|
|
||||||
InitCurrentViewInfo();
|
|
||||||
|
|
||||||
m_formInfo = formInfo;
|
|
||||||
|
|
||||||
m_strUuid = formInfo->m_strUuid;
|
|
||||||
m_strTrackUuid = formInfo->m_strTrackUuid;
|
|
||||||
//
|
|
||||||
m_strSlfName = formInfo->m_strSlfName;
|
|
||||||
m_strWellName = formInfo->m_strWellName;
|
|
||||||
m_strTrackName = formInfo->m_strTrackName;
|
|
||||||
m_strLineName = formInfo->m_strLineName;
|
|
||||||
|
|
||||||
_CreateVariantPropertyItem("数据", "名称", formInfo->m_strAliasName, QVariant::String);
|
_CreateVariantPropertyItem("数据", "名称", formInfo->m_strAliasName, QVariant::String);
|
||||||
_CreateVariantPropertyItem("数据", "选择曲线", formInfo->m_strSlfName, QVariant::String);
|
_CreateVariantPropertyItem("数据", "选择曲线", formInfo->m_strSlfName, QVariant::String);
|
||||||
_CreateVariantPropertyItem("数据", "显示单位", "(°)", QVariant::String);
|
_CreateVariantPropertyItem("数据", "显示单位", formInfo->m_strUnit, QVariant::String);
|
||||||
_CreateVariantPropertyItem("数据", "最小值", formInfo->m_ImgMinVal, QVariant::String);
|
_CreateVariantPropertyItem("数据", "最小值", formInfo->m_strUnit, QVariant::String);
|
||||||
_CreateVariantPropertyItem("数据", "最大值", formInfo->m_ImgMaxVal, QVariant::String);
|
_CreateVariantPropertyItem("数据", "最大值", formInfo->m_strUnit, QVariant::String);
|
||||||
|
|
||||||
//_CreateVariantPropertyItem("通常", "例区高度(cm)", formInfo->m_strUnit, QVariant::String);
|
_CreateVariantPropertyItem("通常", "例区高度(cm)", formInfo->m_strUnit, QVariant::String);
|
||||||
|
|
||||||
_CreateVariantPropertyItem("字体", "曲线名称", formInfo->m_curveNameFont, QVariant::Font);
|
_CreateVariantPropertyItem("字体", "曲线名称", formInfo->m_strAliasNameFont, QVariant::Font);
|
||||||
_CreateVariantPropertyItem("字体", "曲线单位", formInfo->m_strUnitFont, QVariant::Font);
|
_CreateVariantPropertyItem("字体", "曲线单位", formInfo->m_strUnitFont, QVariant::Font);
|
||||||
_CreateVariantPropertyItem("字体", "颜色", formInfo->m_lineColor, QVariant::Color);
|
_CreateVariantPropertyItem("字体", "颜色", formInfo->m_pl_fontScale, QVariant::Font);
|
||||||
|
|
||||||
_CreateVariantPropertyItem("三维", "三维显示", formInfo->m_bShow3D, QVariant::Bool);
|
_CreateVariantPropertyItem("三维", "三维显示", formInfo->m_pl_fontScale, QVariant::Font);
|
||||||
_CreateVariantPropertyItem("三维", "俯视角度", formInfo->m_nOverlook, QVariant::Int);
|
_CreateVariantPropertyItem("三维", "俯视角度", formInfo->m_pl_fontScale, QVariant::Font);
|
||||||
_CreateVariantPropertyItem("三维", "微调旋转角度", formInfo->m_nRotAng, QVariant::Int);
|
_CreateVariantPropertyItem("三维", "微调旋转角度", formInfo->m_pl_fontScale, QVariant::Font);
|
||||||
_CreateVariantPropertyItem("三维", "显示方位", formInfo->m_nAzimuth, QVariant::Int);
|
_CreateVariantPropertyItem("三维", "显示方位", formInfo->m_pl_fontScale, QVariant::Font);
|
||||||
|
|
||||||
QStringList listType;
|
QStringList listType;
|
||||||
listType.append("线性");
|
listType.append("线性");
|
||||||
listType.append("对数");
|
listType.append("对数");
|
||||||
_CreateEnumPropertyItem("显示设置", "坐标类型", formInfo->m_nCoord, listType);
|
_CreateEnumPropertyItem("显示设置", "坐标类型", formInfo->m_pl_fontScale, listType);
|
||||||
_CreateColorSchemePropertyItem("显示设置", "配色方案", formInfo->m_nSchemeIndex, 1);
|
QStringList listType2;
|
||||||
// _CreateVariantPropertyItem("显示设置", "背景值", formInfo->m_pl_fontScale, QVariant::Font);
|
listType2.append("线性");
|
||||||
// _CreateVariantPropertyItem("显示设置", "滤波方式", formInfo->m_pl_fontScale, QVariant::Font);
|
listType2.append("对数");
|
||||||
// _CreateVariantPropertyItem("显示设置", "NxN(N取奇数)", formInfo->m_pl_fontScale, QVariant::Font);
|
_CreateEnumPropertyItem("显示设置", "配色方案", formInfo->m_pl_fontScale, listType2);
|
||||||
|
_CreateVariantPropertyItem("显示设置", "背景值", formInfo->m_pl_fontScale, QVariant::Font);
|
||||||
|
_CreateVariantPropertyItem("显示设置", "滤波方式", formInfo->m_pl_fontScale, QVariant::Font);
|
||||||
|
_CreateVariantPropertyItem("显示设置", "NxN(N取奇数)", formInfo->m_pl_fontScale, QVariant::Font);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
m_strCurrentProperty = DrawImage_Property;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PropertyWidget::changedDrawImageProperty(QString strProperty, QVariant varVal)
|
void PropertyWidget::changedDrawImageProperty(QString strProperty, QVariant varVal)
|
||||||
{
|
{
|
||||||
bool bDraw = false;
|
|
||||||
QStringList slist;
|
|
||||||
slist << "最小值" << "最大值" << "曲线名称" << "曲线单位" << "颜色"
|
|
||||||
<< "三维显示" << "俯视角度" << "微调旋转角度" << "显示方位"
|
|
||||||
<< "坐标类型" << "配色方案" << "背景值" << "滤波方式" << "NxN(N取奇数)";
|
|
||||||
for (int i = 0; i < slist.length(); i++)
|
|
||||||
{
|
|
||||||
if (slist.at(i) == strProperty)
|
|
||||||
{
|
|
||||||
bDraw = m_formInfo->setInfoProperty(strProperty, varVal);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ("颜色" == strProperty)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!slist.contains(strProperty))
|
|
||||||
bDraw = true;
|
|
||||||
|
|
||||||
if (bDraw)
|
|
||||||
{
|
|
||||||
QVariantList listCond;
|
|
||||||
listCond << m_strUuid;
|
|
||||||
listCond << m_strSlfName;
|
|
||||||
listCond << m_strWellName;
|
|
||||||
listCond << m_strTrackName;
|
|
||||||
listCond << m_strLineName;
|
|
||||||
listCond << strProperty;
|
|
||||||
listCond << varVal;
|
|
||||||
emit CallManage::getInstance()->sig_changeDrawProperty(listCond);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PropertyWidget::initDcaProperty(FormInfo *formInfo)
|
void PropertyWidget::initDcaProperty(FormInfo *formInfo)
|
||||||
|
|
|
||||||
|
|
@ -85,8 +85,6 @@
|
||||||
|
|
||||||
#define MCals_Property "MCals_Property" //多臂井径
|
#define MCals_Property "MCals_Property" //多臂井径
|
||||||
|
|
||||||
#define DrawImage_Property "DrawImage_Property" //图像
|
|
||||||
|
|
||||||
#pragma execution_character_set("utf-8")
|
#pragma execution_character_set("utf-8")
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -175,7 +173,7 @@ public:
|
||||||
void _CreateVariantPropertyItem(QString strGroup, QString strPropertyCaption, QVariant vtPropertyValue, int propertyType, double dMin, double dMax);
|
void _CreateVariantPropertyItem(QString strGroup, QString strPropertyCaption, QVariant vtPropertyValue, int propertyType, double dMin, double dMax);
|
||||||
void _CreateEnumPropertyItem(QString strGroup, QString strPropertyCaption, QVariant vtPropertyValue, QStringList listValue);
|
void _CreateEnumPropertyItem(QString strGroup, QString strPropertyCaption, QVariant vtPropertyValue, QStringList listValue);
|
||||||
|
|
||||||
QtProperty* _CreateColorSchemePropertyItem(QString strGroup, QString strPropertyCaption, QVariant vtPropertyValue, int nclr);
|
void _CreateColorSchemePropertyItem(QString strGroup, QString strPropertyCaption, QVariant vtPropertyValue);
|
||||||
|
|
||||||
void InitCurrentViewInfo(bool bAll = true); //初始化属性,清空
|
void InitCurrentViewInfo(bool bAll = true); //初始化属性,清空
|
||||||
void initWidgetProperty(QString strUuid, int iScale); //可视解释整体属性
|
void initWidgetProperty(QString strUuid, int iScale); //可视解释整体属性
|
||||||
|
|
@ -298,7 +296,6 @@ public:
|
||||||
void initMCalsProperty(FormInfo *formInfo);
|
void initMCalsProperty(FormInfo *formInfo);
|
||||||
void changedMCalsProperty(QString strProName, QVariant val);
|
void changedMCalsProperty(QString strProName, QVariant val);
|
||||||
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void SlotPropertyChanged(QtProperty *property, const QVariant &variant);
|
void SlotPropertyChanged(QtProperty *property, const QVariant &variant);
|
||||||
void SlotPropertyChanged(QtProperty *property, const int &val, bool islinestyle);
|
void SlotPropertyChanged(QtProperty *property, const int &val, bool islinestyle);
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
#include "TransparentDraggableRect.h"
|
#include "TransparentDraggableRect.h"
|
||||||
#include "TransparentGroupResult.h"
|
#include "TransparentGroupResult.h"
|
||||||
#include <QtMath>
|
#include <QtMath>
|
||||||
|
#include "Gradient.h"
|
||||||
#include "PickFrac.h"
|
#include "PickFrac.h"
|
||||||
#include "formline.h"
|
#include "formline.h"
|
||||||
#include "PropertyWidget.h"
|
#include "PropertyWidget.h"
|
||||||
|
|
@ -3338,7 +3339,7 @@ void FormDraw::s_AddLine_Property(QString strUuid, QString strSlfName, QString s
|
||||||
|
|
||||||
AppendConsole(PAI_INFO, "FormDraw s_AddLine_Property end");
|
AppendConsole(PAI_INFO, "FormDraw s_AddLine_Property end");
|
||||||
}
|
}
|
||||||
//#include "CylinderImagePlot.h"
|
|
||||||
void FormDraw::s_addWave(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strWaveName)
|
void FormDraw::s_addWave(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strWaveName)
|
||||||
{
|
{
|
||||||
//井名&道名不一致
|
//井名&道名不一致
|
||||||
|
|
@ -3383,18 +3384,6 @@ void FormDraw::s_addWave(QString strUuid, QString strSlfName, QString strWellNam
|
||||||
curv->m_bX2Y = false;
|
curv->m_bX2Y = false;
|
||||||
|
|
||||||
curv->initWave(strSlfName, strWaveName);
|
curv->initWave(strSlfName, strWaveName);
|
||||||
|
|
||||||
// 圆柱渲染器
|
|
||||||
// CylindricalImageMap* cylinderMap = new CylindricalImageMap(curv->xAxis, curv->yAxis);
|
|
||||||
// cylinderMap->setData(curv->m_colorMap->data());
|
|
||||||
// cylinderMap->setCylinderRadius(2.0);
|
|
||||||
// cylinderMap->setSourceColorMap(curv->m_colorMap); // 共享梯度
|
|
||||||
// cylinderMap->setAzimuth(45);
|
|
||||||
// cylinderMap->setElevation(30);
|
|
||||||
// // 隐藏原始的矩形色图
|
|
||||||
// curv->m_colorMap->setVisible(false);
|
|
||||||
//cylinderMap->rescaleAxes();
|
|
||||||
|
|
||||||
_nSamples = curv->getScaleV();
|
_nSamples = curv->getScaleV();
|
||||||
}
|
}
|
||||||
curv->replot();
|
curv->replot();
|
||||||
|
|
@ -4034,18 +4023,12 @@ void FormDraw::s_addDrawImage(QString strUuid, QString strSlfName, QString strWe
|
||||||
QMyCustomPlot *curv = new QMyCustomPlot(this, strSlfName, strWellName, strTrackName, strLineName);
|
QMyCustomPlot *curv = new QMyCustomPlot(this, strSlfName, strWellName, strTrackName, strLineName);
|
||||||
//绑定m_formTrack,方便关联formInfo
|
//绑定m_formTrack,方便关联formInfo
|
||||||
curv->m_formTrack = m_formTrack;
|
curv->m_formTrack = m_formTrack;
|
||||||
curv->setDepthY(m_iY1, m_iY2);
|
|
||||||
if (nW <= 0)
|
|
||||||
nW = g_iOneWidth;
|
|
||||||
curv->initGeometry(m_strUuid, m_iScale, nW);
|
|
||||||
curv->m_bX2Y = false;
|
|
||||||
curv->show();
|
curv->show();
|
||||||
|
|
||||||
//图像 成像
|
//图像 成像
|
||||||
QString strWaveName = "";
|
QString strWaveName = "";
|
||||||
int _nSamples = 0;
|
int _nSamples = 0;
|
||||||
curv->initImage(strSlfName, strWaveName);
|
DrawImageNew_NoFilter(curv, strSlfName, strWaveName, _nSamples);
|
||||||
//DrawImageNew_NoFilter(curv, strSlfName, strWaveName, _nSamples);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
connect(curv, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(s_mouseWheel(QWheelEvent*)));
|
connect(curv, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(s_mouseWheel(QWheelEvent*)));
|
||||||
|
|
@ -4059,7 +4042,7 @@ void FormDraw::s_addDrawImage(QString strUuid, QString strSlfName, QString strWe
|
||||||
double width=2;
|
double width=2;
|
||||||
QString strScaleType = "";
|
QString strScaleType = "";
|
||||||
//道-对象
|
//道-对象
|
||||||
m_formTrack->Add(strSlfName, m_strWellName, m_strTrackName, strLineName, strAliasName, strUnit, newlineColor, width, _nSamples, 0, strScaleType, "DrawImageObject");
|
m_formTrack->Add(strSlfName, m_strWellName, m_strTrackName, strWaveName, strAliasName, strUnit, newlineColor, width, _nSamples, 0, strScaleType, "DrawImageObject");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -5083,6 +5066,202 @@ void FormDraw::initWave_3D(QMyCustomPlot *widget, QString strSlfName, QString st
|
||||||
colorMap->rescaleDataRange();
|
colorMap->rescaleDataRange();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 搜索所有配色方案名
|
||||||
|
int FormDraw::getColorConfig(QVector <QString> &qFiles)
|
||||||
|
{
|
||||||
|
char str[256],*buffer;
|
||||||
|
int i,nRet=0;
|
||||||
|
QString qstr;
|
||||||
|
QByteArray ba;
|
||||||
|
|
||||||
|
//GetBinDir(str);
|
||||||
|
qstr = QCoreApplication::applicationDirPath();//QString(QLatin1String(str)); //char*=>QString
|
||||||
|
qstr+="\\color\\colorConfig.list";
|
||||||
|
qFiles.clear();
|
||||||
|
QFile f(qstr);
|
||||||
|
if(!f.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||||
|
{
|
||||||
|
//cout << "Open failed." << endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
QTextStream txtInput(&f);
|
||||||
|
qstr = txtInput.readLine();
|
||||||
|
//QString==>char *
|
||||||
|
ba = qstr.toLatin1(); // must
|
||||||
|
buffer=ba.data();
|
||||||
|
sscanf(buffer,"%d",&nRet);
|
||||||
|
for (i=0;i<nRet;i++)
|
||||||
|
{
|
||||||
|
qstr = txtInput.readLine();
|
||||||
|
qFiles.append(qstr);
|
||||||
|
}
|
||||||
|
f.close();
|
||||||
|
|
||||||
|
return nRet;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FormDraw::DrawImageNew_NoFilter(QMyCustomPlot *widget, QString strSlfName, QString &strWaveName, int &_nSamples)
|
||||||
|
{
|
||||||
|
if(strSlfName.isEmpty()) return;
|
||||||
|
if(strWaveName=="" || strWaveName=="AC") strWaveName="DYNIMAGE";
|
||||||
|
//
|
||||||
|
CLogIO *logio=new CLogIO();
|
||||||
|
logio->Open(strSlfName.toStdString().c_str(), CSlfIO::modeRead);
|
||||||
|
//
|
||||||
|
int index=logio->OpenWave(strWaveName.toStdString().c_str());
|
||||||
|
if(index<0) {
|
||||||
|
delete logio;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Slf_WAVE _wave;
|
||||||
|
logio->GetWaveInfo(index, &_wave);
|
||||||
|
float _SDep,_EDep,_Rlev;
|
||||||
|
_SDep = _wave.StartDepth;
|
||||||
|
_EDep = _wave.EndDepth;
|
||||||
|
// _SDep = 0.0 - m_iY2;
|
||||||
|
// _EDep = 0.0 - m_iY1;
|
||||||
|
_Rlev = _wave.DepLevel;
|
||||||
|
int m_Record=(float)(fabs((_EDep-_SDep)/_Rlev+0.5));
|
||||||
|
|
||||||
|
_nSamples = _wave.TimeSamples;
|
||||||
|
|
||||||
|
char *value=new char[(_nSamples+1)*m_Record*_wave.CodeLen+1];
|
||||||
|
logio->ReadWave(index,_SDep,m_Record,(void *)value);
|
||||||
|
logio->CloseWave(index);
|
||||||
|
delete logio;
|
||||||
|
|
||||||
|
bool bFistValue=false;
|
||||||
|
float vmax = -9999;//(float)_nSamples;
|
||||||
|
float vmin = -9999;
|
||||||
|
//
|
||||||
|
double** wavedata;
|
||||||
|
wavedata = new double*[_nSamples];
|
||||||
|
for(int kk = 0;kk<_nSamples;kk++){
|
||||||
|
wavedata[kk] = new double[m_Record];
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i=0; i<m_Record; i++)
|
||||||
|
{
|
||||||
|
for(int kk = 0;kk<_nSamples;kk++)
|
||||||
|
{
|
||||||
|
double val = GetData(_wave.RepCode,(char *)&value[(kk)*_wave.CodeLen+i*_nSamples*_wave.CodeLen]);
|
||||||
|
wavedata[kk][i] = val;
|
||||||
|
if(val==-9999)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(bFistValue==false)
|
||||||
|
{
|
||||||
|
//最大值,最小值默认采用第一个有效值
|
||||||
|
bFistValue=true;
|
||||||
|
vmax = vmin = val;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
if(vmax<val)vmax=val;
|
||||||
|
if(vmin>val)vmin=val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
delete[] value;
|
||||||
|
|
||||||
|
widget->setScaleX(vmin, vmax);
|
||||||
|
widget->setDepthY(m_iY1, m_iY2);
|
||||||
|
widget->initGeometry(m_strUuid, m_iScale, g_iOneWidth);
|
||||||
|
widget->axisRect()->setupFullAxesBox();
|
||||||
|
//
|
||||||
|
widget->xAxis->ticker()->setTickCount(10);//x个主刻度
|
||||||
|
widget->yAxis->ticker()->setTickCount(60);//y个主刻度
|
||||||
|
|
||||||
|
//对调XY轴,在最前面设置
|
||||||
|
QCPAxis *yAxis = widget->yAxis;
|
||||||
|
QCPAxis *xAxis = widget->xAxis;
|
||||||
|
widget->xAxis = yAxis;
|
||||||
|
widget->yAxis = xAxis;
|
||||||
|
|
||||||
|
//-------------------
|
||||||
|
// set up the QCPColorMap:
|
||||||
|
QCPColorMap *colorMap = new QCPColorMap(widget->xAxis, widget->yAxis);
|
||||||
|
int nx = m_Record;
|
||||||
|
int ny = _nSamples;
|
||||||
|
colorMap->data()->setSize(nx, ny); // 我们希望彩色地图有nx*ny的数据点
|
||||||
|
//colorMap->data()->setRange(QCPRange(m_iY1, m_iY2), QCPRange(vmin, vmax)); // 并在键(x)和值(y)维上跨越坐标范围-4..4
|
||||||
|
colorMap->data()->setRange(QCPRange(0-_EDep, 0-_SDep), QCPRange(vmin, vmax));
|
||||||
|
// :现在,我们通过访问颜色贴图的QCPColorMapData实例来分配一些数据:
|
||||||
|
double x, y, z;
|
||||||
|
for (int xIndex=0; xIndex<nx; ++xIndex)
|
||||||
|
{
|
||||||
|
for (int yIndex=0; yIndex<ny; ++yIndex)
|
||||||
|
{
|
||||||
|
if(wavedata[yIndex][xIndex]==-9999)
|
||||||
|
{
|
||||||
|
colorMap->data()->setCell(nx-xIndex-1, yIndex, vmin);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//colorMap->data()->setCell(xIndex, yIndex, wavedata[yIndex][xIndex]);
|
||||||
|
colorMap->data()->setCell(nx-xIndex-1, yIndex, wavedata[yIndex][xIndex]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加色标:
|
||||||
|
QCPColorScale *colorScale = new QCPColorScale(widget);
|
||||||
|
colorMap->setColorScale(colorScale); // 将颜色图与色标关联
|
||||||
|
// 将颜色贴图的“颜色渐变”设置为其中一个预设
|
||||||
|
//colorMap->setGradient(QCPColorGradient::gpPolar);//gpJet);
|
||||||
|
// 我们还可以创建一个QCPColorGradient实例并向其中添加自己的颜色
|
||||||
|
// 渐变,请参阅QCPColorGradient的文档以获取可能的效果.
|
||||||
|
// int nIndex=11;
|
||||||
|
// QVector<MyColorItem> colorList;
|
||||||
|
// bool inpolation = true;
|
||||||
|
// int iColorNum = getSystemColor(nIndex, colorList, inpolation);
|
||||||
|
// //
|
||||||
|
// QCPColorGradient gradient;
|
||||||
|
// for(int i=0; i<iColorNum; i++)
|
||||||
|
// {
|
||||||
|
// double dbTmpIndex=(double)(i+1)/iColorNum;
|
||||||
|
// gradient.setColorStopAt(dbTmpIndex, colorList[i].color); // x% 位置的颜色
|
||||||
|
// }
|
||||||
|
// colorMap->setGradient(gradient);
|
||||||
|
|
||||||
|
QVector <QString> m_qvFiles;
|
||||||
|
int n=getColorConfig(m_qvFiles);
|
||||||
|
if(n<=0)return;
|
||||||
|
|
||||||
|
//获取配色方案
|
||||||
|
int nIndex=0;
|
||||||
|
CGradient m_GraInfo;
|
||||||
|
m_GraInfo.Serialize(m_qvFiles[nIndex]);
|
||||||
|
|
||||||
|
//获取颜色数组
|
||||||
|
int iColorNum = 256;
|
||||||
|
COLORREF pColorArr[256];
|
||||||
|
m_GraInfo.GetColorArray(pColorArr);
|
||||||
|
|
||||||
|
//
|
||||||
|
QCPColorGradient gradient;
|
||||||
|
for(int i=0; i<iColorNum; i++)
|
||||||
|
{
|
||||||
|
double dbTmpIndex=(double)(i+1)/iColorNum;
|
||||||
|
QColor color(pColorArr[i]);
|
||||||
|
gradient.setColorStopAt(dbTmpIndex, color); // x% 位置的颜色
|
||||||
|
}
|
||||||
|
colorMap->setGradient(gradient);
|
||||||
|
// 重新缩放数据维度(颜色),以使所有数据点都位于颜色渐变显示的范围内:
|
||||||
|
colorMap->rescaleDataRange();
|
||||||
|
|
||||||
|
//----调色板--------
|
||||||
|
// widget->plotLayout()->addElement(0, 1, colorScale); // 将其添加到主轴矩形的右侧
|
||||||
|
// colorScale->setType(QCPAxis::atRight); // 刻度应为垂直条,刻度线/坐标轴标签右侧(实际上,右侧已经是默认值)
|
||||||
|
// colorScale->axis()->setLabel("Magnetic Field Strength");
|
||||||
|
// //确保轴rect和色标同步其底边距和顶边距(以便它们对齐):
|
||||||
|
// QCPMarginGroup *marginGroup = new QCPMarginGroup(widget);
|
||||||
|
// widget->axisRect()->setMarginGroup(QCP::msBottom|QCP::msTop, marginGroup);
|
||||||
|
// colorScale->setMarginGroup(QCP::msBottom|QCP::msTop, marginGroup);
|
||||||
|
|
||||||
|
// 重新缩放键(x)和值(y)轴,以便可以看到整个颜色图:
|
||||||
|
//widget->rescaleAxes();
|
||||||
|
}
|
||||||
|
|
||||||
//蝌蚪图
|
//蝌蚪图
|
||||||
void FormDraw::initKedou(QMyCustomPlot *widget, QString strSlfName, QString strLineName, QString strAliasName, QColor newlineColor, QJsonObject listOtherProperty)
|
void FormDraw::initKedou(QMyCustomPlot *widget, QString strSlfName, QString strLineName, QString strAliasName, QColor newlineColor, QJsonObject listOtherProperty)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -150,6 +150,10 @@ public:
|
||||||
//波列
|
//波列
|
||||||
void initWave_3D(QMyCustomPlot *widget, QString strSlfName, QString strWaveName, int &_nSamples);
|
void initWave_3D(QMyCustomPlot *widget, QString strSlfName, QString strWaveName, int &_nSamples);
|
||||||
|
|
||||||
|
//图像-3d成图
|
||||||
|
int getColorConfig(QVector <QString> &qFiles);
|
||||||
|
void DrawImageNew_NoFilter(QMyCustomPlot *widget, QString strSlfName, QString &strWaveName, int &_nSamples);
|
||||||
|
|
||||||
//蝌蚪图
|
//蝌蚪图
|
||||||
void initKedou(QMyCustomPlot *widget, QString strSlfName, QString strLineName, QString strAliasName = "蝌蚪图", QColor newlineColor=QColor(0,0,0), QJsonObject listOtherProperty={});
|
void initKedou(QMyCustomPlot *widget, QString strSlfName, QString strLineName, QString strAliasName = "蝌蚪图", QColor newlineColor=QColor(0,0,0), QJsonObject listOtherProperty={});
|
||||||
//杆状图
|
//杆状图
|
||||||
|
|
|
||||||
|
|
@ -1421,20 +1421,10 @@ void FormInfo::paintEvent(QPaintEvent* event)
|
||||||
//painter.drawText(rect.left(), rect.top(), rect.width(), rect.height()/3, Qt::AlignCenter, strAliasNameTmp);
|
//painter.drawText(rect.left(), rect.top(), rect.width(), rect.height()/3, Qt::AlignCenter, strAliasNameTmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(m_strType=="waveObject" || m_strType == "DrawImageObject")
|
|
||||||
{
|
|
||||||
int nUseTag = -1;
|
|
||||||
if (m_strType == "DrawImageObject")
|
|
||||||
{
|
|
||||||
painter.drawText(rect.left(), rect.top(), rect.width(), 30, Qt::AlignCenter, strShowTxt);
|
|
||||||
nUseTag = 1;
|
|
||||||
strShowTxt = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
if(m_strType=="waveObject")
|
if(m_strType=="waveObject")
|
||||||
{
|
{
|
||||||
painter.drawText(rect.left(), rect.top(), rect.width(), 30, Qt::AlignCenter, m_strLineName);
|
painter.drawText(rect.left(), rect.top(), rect.width(), 30, Qt::AlignCenter, m_strLineName);
|
||||||
|
|
||||||
if (m_nDrawType == 0 || m_nDrawType == 1)
|
if (m_nDrawType == 0 || m_nDrawType == 1)
|
||||||
{
|
{
|
||||||
int nbot = rect.bottom()- rect.height() / 3.0;
|
int nbot = rect.bottom()- rect.height() / 3.0;
|
||||||
|
|
@ -1467,12 +1457,11 @@ void FormInfo::paintEvent(QPaintEvent* event)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
nUseTag = 0;
|
QtColorTableData::getInstance()->SetCurrentSchemeIndex(m_nSchemeIndex);
|
||||||
}
|
//ColorTableIndex = ind;
|
||||||
}
|
|
||||||
if (nUseTag >= 0)
|
QtColorTableData::getInstance()->ChangeColorNum(m_nColorNum);
|
||||||
{
|
QList<QRgb> rgbList = QtColorTableData::getInstance()->GetRgb();
|
||||||
QList<QRgb> rgbList = QtColorTableData::getInstance()->GetRgb_UseTag(nUseTag, m_nSchemeIndex, m_nColorNum);
|
|
||||||
int iColorNum = rgbList.size();
|
int iColorNum = rgbList.size();
|
||||||
|
|
||||||
//头部绘制调色板
|
//头部绘制调色板
|
||||||
|
|
@ -1492,6 +1481,7 @@ void FormInfo::paintEvent(QPaintEvent* event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(m_strLineName=="RESULT")
|
if(m_strLineName=="RESULT")
|
||||||
{
|
{
|
||||||
//解释结论,不绘制左右范围
|
//解释结论,不绘制左右范围
|
||||||
|
|
@ -2542,10 +2532,12 @@ bool FormInfo::setInfoProperty(QString strProName, QVariant val, QString strGp)
|
||||||
else if ("色板" == strProName)
|
else if ("色板" == strProName)
|
||||||
{
|
{
|
||||||
this->m_nSchemeIndex = val.toInt();
|
this->m_nSchemeIndex = val.toInt();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
else if ("变密度颜色级数" == strProName)
|
else if ("变密度颜色级数" == strProName)
|
||||||
{
|
{
|
||||||
this->m_nColorNum = val.toInt();
|
this->m_nColorNum = val.toInt();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
else if ("垂向绘制" == strProName)
|
else if ("垂向绘制" == strProName)
|
||||||
{
|
{
|
||||||
|
|
@ -2581,50 +2573,6 @@ bool FormInfo::setInfoProperty(QString strProName, QVariant val, QString strGp)
|
||||||
{
|
{
|
||||||
this->m_bConBackAndForth = val.toBool();
|
this->m_bConBackAndForth = val.toBool();
|
||||||
}
|
}
|
||||||
else if ("最小值" == strProName)
|
|
||||||
{
|
|
||||||
this->m_ImgMinVal = val.toInt();
|
|
||||||
}
|
|
||||||
else if ("最大值" == strProName)
|
|
||||||
{
|
|
||||||
this->m_ImgMaxVal = val.toInt();
|
|
||||||
}
|
|
||||||
else if ("三维显示" == strProName)
|
|
||||||
{
|
|
||||||
this->m_bShow3D = val.toBool();
|
|
||||||
}
|
|
||||||
else if ("俯视角度" == strProName)
|
|
||||||
{
|
|
||||||
this->m_nOverlook = val.toInt();
|
|
||||||
}
|
|
||||||
else if ("微调旋转角度" == strProName)
|
|
||||||
{
|
|
||||||
this->m_nRotAng = val.toInt();
|
|
||||||
}
|
|
||||||
else if ("显示方位" == strProName)
|
|
||||||
{
|
|
||||||
this->m_nAzimuth = val.toInt();
|
|
||||||
}
|
|
||||||
else if ("坐标类型" == strProName)
|
|
||||||
{
|
|
||||||
this->m_nCoord = val.toInt();
|
|
||||||
}
|
|
||||||
else if ("配色方案" == strProName)
|
|
||||||
{
|
|
||||||
this->m_nSchemeIndex = val.toInt();
|
|
||||||
}
|
|
||||||
// else if ("背景值" == strProName)
|
|
||||||
// {
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// else if ("滤波方式" == strProName)
|
|
||||||
// {
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// else if ("NxN(N取奇数)" == strProName)
|
|
||||||
// {
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
|
|
||||||
this->update();
|
this->update();
|
||||||
return bDraw;
|
return bDraw;
|
||||||
|
|
|
||||||
|
|
@ -431,15 +431,6 @@ public:
|
||||||
int m_nVLineWidth =1; //纵格线宽度
|
int m_nVLineWidth =1; //纵格线宽度
|
||||||
QColor m_VLineColor = QColor(0,0,0);//纵格线颜色
|
QColor m_VLineColor = QColor(0,0,0);//纵格线颜色
|
||||||
|
|
||||||
// 图像
|
|
||||||
float m_ImgMinVal = 0; // 最小值
|
|
||||||
float m_ImgMaxVal = 128; // 最大值
|
|
||||||
bool m_bShow3D = false; // 三维显示
|
|
||||||
int m_nOverlook = 20; // 俯视角度
|
|
||||||
int m_nRotAng = 3; // 微调旋转角度
|
|
||||||
int m_nAzimuth = 0; // 显示方位
|
|
||||||
int m_nCoord = 0; // 坐标类型
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void setLineWidth(double dWidth);
|
void setLineWidth(double dWidth);
|
||||||
double getLineWidth();
|
double getLineWidth();
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<QtMoc Include="TransparentDraggableLine_Master.h" />
|
|
||||||
<QtMoc Include="wellheader.h" />
|
<QtMoc Include="wellheader.h" />
|
||||||
<QtMoc Include="selectwelldialog.h" />
|
<QtMoc Include="selectwelldialog.h" />
|
||||||
<QtMoc Include="TransparentDraggableCorePhysics.h" />
|
<QtMoc Include="TransparentDraggableCorePhysics.h" />
|
||||||
|
|
@ -20,6 +19,7 @@
|
||||||
<QtMoc Include="TransparentGroupResult.h" />
|
<QtMoc Include="TransparentGroupResult.h" />
|
||||||
<QtMoc Include="transparentdraggableRightList.h" />
|
<QtMoc Include="transparentdraggableRightList.h" />
|
||||||
<QtMoc Include="transparentdraggableSelectRect.h" />
|
<QtMoc Include="transparentdraggableSelectRect.h" />
|
||||||
|
<QtMoc Include="..\CallManage\CallManage.h" />
|
||||||
<QtMoc Include="..\common\dropdownbutton.h" />
|
<QtMoc Include="..\common\dropdownbutton.h" />
|
||||||
<ClInclude Include="..\common\common.h" />
|
<ClInclude Include="..\common\common.h" />
|
||||||
<ClInclude Include="..\common\geometryutils.h" />
|
<ClInclude Include="..\common\geometryutils.h" />
|
||||||
|
|
@ -41,11 +41,9 @@
|
||||||
<ClInclude Include="3rd_tiff\libtiff\libtiff\tif_predict.h" />
|
<ClInclude Include="3rd_tiff\libtiff\libtiff\tif_predict.h" />
|
||||||
<ClInclude Include="3rd_tiff\libtiff\libtiff\uvcode.h" />
|
<ClInclude Include="3rd_tiff\libtiff\libtiff\uvcode.h" />
|
||||||
<ClInclude Include="backgrounddelegate.h" />
|
<ClInclude Include="backgrounddelegate.h" />
|
||||||
<QtMoc Include="CallManage.h" />
|
|
||||||
<ClInclude Include="CStringType.h" />
|
<ClInclude Include="CStringType.h" />
|
||||||
<ClInclude Include="CurveLine.h" />
|
<ClInclude Include="CurveLine.h" />
|
||||||
<ClInclude Include="customellipse.h" />
|
<ClInclude Include="customellipse.h" />
|
||||||
<QtMoc Include="CylinderImagePlot.h" />
|
|
||||||
<ClInclude Include="DepPairs.h" />
|
<ClInclude Include="DepPairs.h" />
|
||||||
<ClInclude Include="DrawTvd.h" />
|
<ClInclude Include="DrawTvd.h" />
|
||||||
<QtMoc Include="formhead.h" />
|
<QtMoc Include="formhead.h" />
|
||||||
|
|
@ -53,6 +51,7 @@
|
||||||
<QtMoc Include="fracsel.h" />
|
<QtMoc Include="fracsel.h" />
|
||||||
<QtMoc Include="FormBase.h" />
|
<QtMoc Include="FormBase.h" />
|
||||||
<ClInclude Include="GeoIndicatorGenerator.h" />
|
<ClInclude Include="GeoIndicatorGenerator.h" />
|
||||||
|
<ClInclude Include="Gradient.h" />
|
||||||
<QtMoc Include="mainwindowsplitter.h" />
|
<QtMoc Include="mainwindowsplitter.h" />
|
||||||
<ClInclude Include="ItemBorderDelegate.h" />
|
<ClInclude Include="ItemBorderDelegate.h" />
|
||||||
<ClInclude Include="ObjectArchive.h" />
|
<ClInclude Include="ObjectArchive.h" />
|
||||||
|
|
@ -105,6 +104,7 @@
|
||||||
<QtMoc Include="ConsoleOutputWidget.h" />
|
<QtMoc Include="ConsoleOutputWidget.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\CallManage\CallManage.cpp" />
|
||||||
<ClCompile Include="..\common\dropdownbutton.cpp" />
|
<ClCompile Include="..\common\dropdownbutton.cpp" />
|
||||||
<ClCompile Include="..\common\geometryutils.cpp" />
|
<ClCompile Include="..\common\geometryutils.cpp" />
|
||||||
<ClCompile Include="3rd_qcustomplot\smoothcurve.cpp" />
|
<ClCompile Include="3rd_qcustomplot\smoothcurve.cpp" />
|
||||||
|
|
@ -152,13 +152,11 @@
|
||||||
<ClCompile Include="3rd_tiff\libtiff\port\lfind.c" />
|
<ClCompile Include="3rd_tiff\libtiff\port\lfind.c" />
|
||||||
<ClCompile Include="3rd_tiff\libtiff\port\snprintf.c" />
|
<ClCompile Include="3rd_tiff\libtiff\port\snprintf.c" />
|
||||||
<ClCompile Include="backgrounddelegate.cpp" />
|
<ClCompile Include="backgrounddelegate.cpp" />
|
||||||
<ClCompile Include="CallManage.cpp" />
|
|
||||||
<ClCompile Include="ConsoleOutputWidget.cpp" />
|
<ClCompile Include="ConsoleOutputWidget.cpp" />
|
||||||
<ClCompile Include="CStringType.cpp" />
|
<ClCompile Include="CStringType.cpp" />
|
||||||
<ClCompile Include="CurveLine.cpp" />
|
<ClCompile Include="CurveLine.cpp" />
|
||||||
<ClCompile Include="customtabbar.cpp" />
|
<ClCompile Include="customtabbar.cpp" />
|
||||||
<ClCompile Include="customtabwidget.cpp" />
|
<ClCompile Include="customtabwidget.cpp" />
|
||||||
<ClCompile Include="CylinderImagePlot.cpp" />
|
|
||||||
<ClCompile Include="DepPairs.cpp" />
|
<ClCompile Include="DepPairs.cpp" />
|
||||||
<ClCompile Include="DrawNrad.cpp" />
|
<ClCompile Include="DrawNrad.cpp" />
|
||||||
<ClCompile Include="DrawTvd.cpp" />
|
<ClCompile Include="DrawTvd.cpp" />
|
||||||
|
|
@ -176,6 +174,7 @@
|
||||||
<ClCompile Include="formwell.cpp" />
|
<ClCompile Include="formwell.cpp" />
|
||||||
<ClCompile Include="fracsel.cpp" />
|
<ClCompile Include="fracsel.cpp" />
|
||||||
<ClCompile Include="GeoIndicatorGenerator.cpp" />
|
<ClCompile Include="GeoIndicatorGenerator.cpp" />
|
||||||
|
<ClCompile Include="Gradient.cpp" />
|
||||||
<ClCompile Include="InDefTableDlg.cpp" />
|
<ClCompile Include="InDefTableDlg.cpp" />
|
||||||
<ClCompile Include="InterfaceWidget.cpp" />
|
<ClCompile Include="InterfaceWidget.cpp" />
|
||||||
<ClCompile Include="main.cpp" />
|
<ClCompile Include="main.cpp" />
|
||||||
|
|
@ -207,7 +206,6 @@
|
||||||
<ClCompile Include="TransparentDraggableJiegutext.cpp" />
|
<ClCompile Include="TransparentDraggableJiegutext.cpp" />
|
||||||
<ClCompile Include="TransparentDraggableLayer.cpp" />
|
<ClCompile Include="TransparentDraggableLayer.cpp" />
|
||||||
<ClCompile Include="TransparentDraggableLine.cpp" />
|
<ClCompile Include="TransparentDraggableLine.cpp" />
|
||||||
<ClCompile Include="TransparentDraggableLine_Master.cpp" />
|
|
||||||
<ClCompile Include="TransparentDraggableMFac.cpp" />
|
<ClCompile Include="TransparentDraggableMFac.cpp" />
|
||||||
<ClCompile Include="TransparentDraggablePhase.cpp" />
|
<ClCompile Include="TransparentDraggablePhase.cpp" />
|
||||||
<ClCompile Include="TransparentDraggableRect.cpp" />
|
<ClCompile Include="TransparentDraggableRect.cpp" />
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,9 @@
|
||||||
<Filter Include="3rd_qcustomplot\v2_1">
|
<Filter Include="3rd_qcustomplot\v2_1">
|
||||||
<UniqueIdentifier>{1f2b53b3-aa5f-43c7-8ab9-93f4396930b7}</UniqueIdentifier>
|
<UniqueIdentifier>{1f2b53b3-aa5f-43c7-8ab9-93f4396930b7}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<Filter Include="CallManage">
|
||||||
|
<UniqueIdentifier>{01484347-5324-4654-80c8-0972752803c6}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
<Filter Include="common">
|
<Filter Include="common">
|
||||||
<UniqueIdentifier>{90fce5ea-3cd6-47d8-9400-aea11137b079}</UniqueIdentifier>
|
<UniqueIdentifier>{90fce5ea-3cd6-47d8-9400-aea11137b079}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
|
@ -62,6 +65,9 @@
|
||||||
<ClInclude Include="GeoIndicatorGenerator.h">
|
<ClInclude Include="GeoIndicatorGenerator.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="Gradient.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="ObjectArchive.h">
|
<ClInclude Include="ObjectArchive.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
|
@ -268,6 +274,9 @@
|
||||||
<QtMoc Include="3rd_qcustomplot\v2_1\qcustomplot.h">
|
<QtMoc Include="3rd_qcustomplot\v2_1\qcustomplot.h">
|
||||||
<Filter>3rd_qcustomplot\v2_1</Filter>
|
<Filter>3rd_qcustomplot\v2_1</Filter>
|
||||||
</QtMoc>
|
</QtMoc>
|
||||||
|
<QtMoc Include="..\CallManage\CallManage.h">
|
||||||
|
<Filter>CallManage</Filter>
|
||||||
|
</QtMoc>
|
||||||
<QtMoc Include="formhead.h">
|
<QtMoc Include="formhead.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</QtMoc>
|
</QtMoc>
|
||||||
|
|
@ -310,15 +319,6 @@
|
||||||
<QtMoc Include="FormBase.h">
|
<QtMoc Include="FormBase.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</QtMoc>
|
</QtMoc>
|
||||||
<QtMoc Include="TransparentDraggableLine_Master.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</QtMoc>
|
|
||||||
<QtMoc Include="CallManage.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</QtMoc>
|
|
||||||
<QtMoc Include="CylinderImagePlot.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</QtMoc>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="backgrounddelegate.cpp">
|
<ClCompile Include="backgrounddelegate.cpp">
|
||||||
|
|
@ -378,6 +378,9 @@
|
||||||
<ClCompile Include="GeoIndicatorGenerator.cpp">
|
<ClCompile Include="GeoIndicatorGenerator.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="Gradient.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="InDefTableDlg.cpp">
|
<ClCompile Include="InDefTableDlg.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|
@ -489,6 +492,9 @@
|
||||||
<ClCompile Include="3rd_qcustomplot\smoothcurve.cpp">
|
<ClCompile Include="3rd_qcustomplot\smoothcurve.cpp">
|
||||||
<Filter>3rd_qcustomplot</Filter>
|
<Filter>3rd_qcustomplot</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\CallManage\CallManage.cpp">
|
||||||
|
<Filter>CallManage</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="..\common\geometryutils.cpp">
|
<ClCompile Include="..\common\geometryutils.cpp">
|
||||||
<Filter>common</Filter>
|
<Filter>common</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|
@ -660,15 +666,6 @@
|
||||||
<ClCompile Include="FormBase.cpp">
|
<ClCompile Include="FormBase.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="TransparentDraggableLine_Master.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="CallManage.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="CylinderImagePlot.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<QtRcc Include="logplus.qrc">
|
<QtRcc Include="logplus.qrc">
|
||||||
|
|
|
||||||
|
|
@ -4154,6 +4154,17 @@ void MainWindowCurve::s_DrawImage()
|
||||||
|
|
||||||
//新建井+道+曲线(首条)
|
//新建井+道+曲线(首条)
|
||||||
NewWellAndTrack(sret.at(0), sret.at(1), "DYNIMAGE", "DrawImageObject");
|
NewWellAndTrack(sret.at(0), sret.at(1), "DYNIMAGE", "DrawImageObject");
|
||||||
|
|
||||||
|
// QStringList sret = this->insertCol(nW);
|
||||||
|
// if (sret.length() <= 0)
|
||||||
|
// return;
|
||||||
|
|
||||||
|
// QString strWellName = sret.at(0);
|
||||||
|
// //直接从选中的井获取,data记录slf路径
|
||||||
|
// QString strSlfName = sret.at(1);
|
||||||
|
|
||||||
|
// //新建道
|
||||||
|
// emit CallManage::getInstance()->sig_NewTrack(m_strUuid, strWellName, strSlfName, "DYNIMAGE", "DrawImageObject", nW);
|
||||||
}
|
}
|
||||||
|
|
||||||
//地质层位道
|
//地质层位道
|
||||||
|
|
|
||||||
|
|
@ -406,21 +406,21 @@ void QMyCustomPlot::initWave(QString strSlfName, QString strWaveName)
|
||||||
widget->m_fmin = vmin;
|
widget->m_fmin = vmin;
|
||||||
widget->m_fmax = vmax;
|
widget->m_fmax = vmax;
|
||||||
//
|
//
|
||||||
// if (!widget->m_bX2Y)
|
if (!widget->m_bX2Y)
|
||||||
// {
|
{
|
||||||
widget->setScaleX(0, 264);
|
widget->setScaleX(0, 264);
|
||||||
// widget->xAxis->setVisible(false);
|
widget->xAxis->setVisible(false);
|
||||||
// widget->xAxis2->setVisible(false);
|
widget->xAxis2->setVisible(false);
|
||||||
// widget->yAxis->setVisible(false);
|
widget->yAxis->setVisible(false);
|
||||||
// widget->yAxis2->setVisible(false);
|
widget->yAxis2->setVisible(false);
|
||||||
|
|
||||||
// //对调XY轴,在最前面设置
|
//对调XY轴,在最前面设置
|
||||||
// QCPAxis *yAxis = widget->yAxis;
|
QCPAxis *yAxis = widget->yAxis;
|
||||||
// QCPAxis *xAxis = widget->xAxis;
|
QCPAxis *xAxis = widget->xAxis;
|
||||||
// widget->xAxis = yAxis;
|
widget->xAxis = yAxis;
|
||||||
// widget->yAxis = xAxis;
|
widget->yAxis = xAxis;
|
||||||
// widget->m_bX2Y = true;
|
widget->m_bX2Y = true;
|
||||||
// }
|
}
|
||||||
|
|
||||||
//-------------------
|
//-------------------
|
||||||
// set up the QCPColorMap:
|
// set up the QCPColorMap:
|
||||||
|
|
@ -633,151 +633,6 @@ void QMyCustomPlot::initCurve(QString strSlfName, QString strLineName)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QMyCustomPlot::initImage(QString strSlfName, QString strWaveName)
|
|
||||||
{
|
|
||||||
if (strSlfName.isEmpty()) return;
|
|
||||||
if (strWaveName == "" || strWaveName == "AC") strWaveName = "DYNIMAGE";
|
|
||||||
|
|
||||||
CLogIO *logio = new CLogIO();
|
|
||||||
logio->Open(strSlfName.toStdString().c_str(), CSlfIO::modeRead);
|
|
||||||
//
|
|
||||||
int index = logio->OpenWave(strWaveName.toStdString().c_str());
|
|
||||||
if (index < 0) {
|
|
||||||
delete logio;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_nUseColor = 1;
|
|
||||||
QMyCustomPlot* widget = this;
|
|
||||||
Slf_WAVE _wave;
|
|
||||||
logio->GetWaveInfo(index, &_wave);
|
|
||||||
float _SDep, _EDep, _Rlev;
|
|
||||||
_SDep = _wave.StartDepth;
|
|
||||||
_EDep = _wave.EndDepth;
|
|
||||||
m_SDep = _SDep;
|
|
||||||
m_EDep = _EDep;
|
|
||||||
// _SDep = 0.0 - m_iY2;
|
|
||||||
// _EDep = 0.0 - m_iY1;
|
|
||||||
_Rlev = _wave.DepLevel;
|
|
||||||
int m_Record = (float)(fabs((_EDep - _SDep) / _Rlev + 0.5));
|
|
||||||
|
|
||||||
int _nSamples = _wave.TimeSamples;
|
|
||||||
m_nSamples = _nSamples;
|
|
||||||
if (m_fScaleV <= 0.0f)
|
|
||||||
m_fScaleV = _nSamples;
|
|
||||||
char *value = new char[(_nSamples + 1)*m_Record*_wave.CodeLen + 1];
|
|
||||||
logio->ReadWave(index, _SDep, m_Record, (void *)value);
|
|
||||||
logio->CloseWave(index);
|
|
||||||
delete logio;
|
|
||||||
|
|
||||||
bool bFistValue = false;
|
|
||||||
float vmax = -9999;//(float)_nSamples;
|
|
||||||
float vmin = -9999;
|
|
||||||
|
|
||||||
float detp = _SDep;
|
|
||||||
float edepc = _EDep;
|
|
||||||
if (m_nWaveJg < 10)
|
|
||||||
m_nWaveJg = 10;
|
|
||||||
float m_r = _Rlev * m_nWaveJg;
|
|
||||||
float m_MoveDep = 0.0f;
|
|
||||||
|
|
||||||
float yscale = 1;
|
|
||||||
if (m_nWaveHei > 1)
|
|
||||||
{
|
|
||||||
float DifBase = 1;
|
|
||||||
if (m_nDrawType == 2 || m_nDrawType == 6 || m_nDrawType == 10) {
|
|
||||||
DifBase = (m_MaxRange - m_Base) / m_nColorNum;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
DifBase = (m_MaxRange - m_Base) / 1;
|
|
||||||
}
|
|
||||||
if (fabs(DifBase) <= 1e-6) DifBase = 1;
|
|
||||||
|
|
||||||
yscale = m_nWaveHei + DifBase;
|
|
||||||
yscale = yscale / DifBase;
|
|
||||||
}
|
|
||||||
|
|
||||||
//QVector< QVector <double>> vecWave;
|
|
||||||
m_vecWaveData.clear();
|
|
||||||
for (float dep1 = detp - 10 * m_r; dep1 < edepc + m_MoveDep + 10 * m_r; dep1 += m_r)
|
|
||||||
{
|
|
||||||
int iIndex = Slf_Int(dep1 + m_MoveDep, _SDep, _Rlev);
|
|
||||||
if (iIndex < 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (iIndex >= m_Record)
|
|
||||||
break;
|
|
||||||
|
|
||||||
QVector <double> ve(_nSamples);
|
|
||||||
for (int kk = 0; kk < _nSamples; kk++)
|
|
||||||
{
|
|
||||||
double val = GetData(_wave.RepCode, (char *)&value[iIndex * _nSamples*_wave.CodeLen + kk * _wave.CodeLen]);
|
|
||||||
ve[kk] = val;// 256 * (val - m_LeftVal) / (m_RightVal - m_LeftVal);
|
|
||||||
//ve[kk] = (int)((val - m_Base)*yscale);
|
|
||||||
if (val == -9999)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bFistValue == false)
|
|
||||||
{
|
|
||||||
//最大值,最小值默认采用第一个有效值
|
|
||||||
bFistValue = true;
|
|
||||||
vmax = vmin = val;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
if (vmax < val)vmax = val;
|
|
||||||
if (vmin > val)vmin = val;
|
|
||||||
}
|
|
||||||
m_vecWaveData << ve;
|
|
||||||
}
|
|
||||||
|
|
||||||
delete[] value;
|
|
||||||
|
|
||||||
widget->m_fmin = vmin;
|
|
||||||
widget->m_fmax = vmax;
|
|
||||||
//
|
|
||||||
if (!widget->m_bX2Y)
|
|
||||||
{
|
|
||||||
widget->setScaleX(0, 264);
|
|
||||||
widget->xAxis->setVisible(false);
|
|
||||||
widget->xAxis2->setVisible(false);
|
|
||||||
widget->yAxis->setVisible(false);
|
|
||||||
widget->yAxis2->setVisible(false);
|
|
||||||
|
|
||||||
//对调XY轴,在最前面设置
|
|
||||||
QCPAxis *yAxis = widget->yAxis;
|
|
||||||
QCPAxis *xAxis = widget->xAxis;
|
|
||||||
widget->xAxis = yAxis;
|
|
||||||
widget->yAxis = xAxis;
|
|
||||||
widget->m_bX2Y = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------
|
|
||||||
// set up the QCPColorMap:
|
|
||||||
if (widget->m_colorMap == NULL)
|
|
||||||
{
|
|
||||||
QCPColorMap *colorMap = new QCPColorMap(widget->xAxis, widget->yAxis);
|
|
||||||
widget->m_colorMap = colorMap;
|
|
||||||
// 添加色标:
|
|
||||||
QCPColorScale *colorScale = new QCPColorScale(widget);
|
|
||||||
colorMap->setColorScale(colorScale); // 将颜色图与色标关联
|
|
||||||
|
|
||||||
// :现在,我们通过访问颜色贴图的QCPColorMapData实例来分配一些数据:
|
|
||||||
this->updateImageWave();
|
|
||||||
|
|
||||||
// 重新缩放数据维度(颜色),以使所有数据点都位于颜色渐变显示的范围内:
|
|
||||||
//colorMap->rescaleDataRange();
|
|
||||||
|
|
||||||
this->setSchemeIndex(m_nSchemeIndex, m_nColorNum);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this->updateImageWave();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void QMyCustomPlot::initColorTable()
|
void QMyCustomPlot::initColorTable()
|
||||||
{
|
{
|
||||||
this->setSchemeIndex(m_nSchemeIndex, m_nColorNum);
|
this->setSchemeIndex(m_nSchemeIndex, m_nColorNum);
|
||||||
|
|
@ -794,8 +649,8 @@ void QMyCustomPlot::setSchemeIndex(int nidx, int colorNum)
|
||||||
QtColorTableData::getInstance()->SetCurrentSchemeIndex(nidx);
|
QtColorTableData::getInstance()->SetCurrentSchemeIndex(nidx);
|
||||||
//ColorTableIndex = ind;
|
//ColorTableIndex = ind;
|
||||||
|
|
||||||
//QtColorTableData::getInstance()->ChangeColorNum(colorNum);
|
QtColorTableData::getInstance()->ChangeColorNum(colorNum);
|
||||||
QList<QRgb> rgbList = QtColorTableData::getInstance()->GetRgb_UseTag(m_nUseColor, nidx, colorNum);
|
QList<QRgb> rgbList = QtColorTableData::getInstance()->GetRgb();
|
||||||
|
|
||||||
int iColorNum = rgbList.size();
|
int iColorNum = rgbList.size();
|
||||||
QCPColorGradient gradient;
|
QCPColorGradient gradient;
|
||||||
|
|
@ -812,18 +667,18 @@ void QMyCustomPlot::setSchemeIndex(int nidx, int colorNum)
|
||||||
|
|
||||||
QCPColorMap * QMyCustomPlot::updateWave()
|
QCPColorMap * QMyCustomPlot::updateWave()
|
||||||
{
|
{
|
||||||
int ny = m_vecWaveData.size();
|
int nx = m_vecWaveData.size();
|
||||||
int nx = m_nSamples;
|
int ny = m_nSamples;
|
||||||
|
|
||||||
m_colorMap->data()->setSize(nx, ny); // 我们希望彩色地图有nx*ny的数据点
|
m_colorMap->data()->setSize(nx, ny); // 我们希望彩色地图有nx*ny的数据点
|
||||||
float f = 0.99;// 264 / 269.0f;
|
float f = 0.99;// 264 / 269.0f;
|
||||||
m_colorMap->data()->setRange(QCPRange(this->m_iX1, this->m_iX2*f), QCPRange(0 - m_EDep, 0 - m_SDep));
|
m_colorMap->data()->setRange(QCPRange(0 - m_EDep, 0 - m_SDep), QCPRange(this->m_iX1, this->m_iX2*f));
|
||||||
|
|
||||||
for (int yIndex = 0; yIndex < ny; ++yIndex)
|
|
||||||
{
|
|
||||||
for (int xIndex = 0; xIndex < nx; ++xIndex)
|
for (int xIndex = 0; xIndex < nx; ++xIndex)
|
||||||
{
|
{
|
||||||
double dz = m_vecWaveData[yIndex][xIndex];
|
for (int yIndex = 0; yIndex < ny; ++yIndex)
|
||||||
|
{
|
||||||
|
double dz = m_vecWaveData[xIndex][yIndex];
|
||||||
if (m_nMode == 0)
|
if (m_nMode == 0)
|
||||||
{
|
{
|
||||||
if (dz == -9999)
|
if (dz == -9999)
|
||||||
|
|
@ -849,51 +704,10 @@ QCPColorMap * QMyCustomPlot::updateWave()
|
||||||
dz = m_fmin;
|
dz = m_fmin;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_colorMap->data()->setCell(xIndex, ny - yIndex - 1, dz);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//m_colorMap->setDataRange(QCPRange(m_fmin, m_fmax));
|
|
||||||
return m_colorMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
QCPColorMap * QMyCustomPlot::updateImageWave()
|
|
||||||
{
|
|
||||||
int nx = m_vecWaveData.size();
|
|
||||||
int ny = m_nSamples;
|
|
||||||
|
|
||||||
m_colorMap->data()->setSize(nx, ny); // 我们希望彩色地图有nx*ny的数据点
|
|
||||||
float f = 0.99;// 264 / 269.0f;
|
|
||||||
m_colorMap->data()->setRange(QCPRange(0 - m_EDep, 0 - m_SDep), QCPRange(this->m_iX1, this->m_iX2*f));
|
|
||||||
|
|
||||||
int nbs = 1024;
|
|
||||||
|
|
||||||
float fLeftVal = 0;
|
|
||||||
float fRightVal = 128;
|
|
||||||
FormInfo* pInfo = m_formTrack->getFormInfoByParameters(m_strUuid, m_strWellName, m_strTrackName, m_strLineName);
|
|
||||||
if (pInfo)
|
|
||||||
{
|
|
||||||
fLeftVal = pInfo->m_ImgMinVal;
|
|
||||||
fRightVal = pInfo->m_ImgMaxVal;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int xIndex = 0; xIndex < nx; ++xIndex)
|
|
||||||
{
|
|
||||||
for (int yIndex = 0; yIndex < ny; ++yIndex)
|
|
||||||
{
|
|
||||||
double dz = m_vecWaveData[xIndex][yIndex];
|
|
||||||
if (dz == -9999)
|
|
||||||
{
|
|
||||||
dz = m_fmin;
|
|
||||||
}
|
|
||||||
dz = dz * nbs/ (fRightVal - fLeftVal);
|
|
||||||
if (dz > m_fmax)
|
|
||||||
{
|
|
||||||
dz = m_fmax;
|
|
||||||
}
|
|
||||||
m_colorMap->data()->setCell(nx - xIndex - 1, yIndex, dz);
|
m_colorMap->data()->setCell(nx - xIndex - 1, yIndex, dz);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_colorMap->setDataRange(QCPRange(m_fmin, m_fmax));
|
//m_colorMap->setDataRange(QCPRange(m_fmin, m_fmax));
|
||||||
return m_colorMap;
|
return m_colorMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -5670,7 +5484,7 @@ void QMyCustomPlot::s_changeDrawProperty(QVariantList vlist)
|
||||||
{
|
{
|
||||||
m_iX1 = varVal.toFloat();
|
m_iX1 = varVal.toFloat();
|
||||||
float f = 264 / m_fScaleV;
|
float f = 264 / m_fScaleV;
|
||||||
m_colorMap->data()->setKeyRange(QCPRange(m_iX1, m_iX2*f));
|
m_colorMap->data()->setValueRange(QCPRange(m_iX1, m_iX2*f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ("右刻度" == strProperty)
|
else if ("右刻度" == strProperty)
|
||||||
|
|
@ -5679,7 +5493,7 @@ void QMyCustomPlot::s_changeDrawProperty(QVariantList vlist)
|
||||||
{
|
{
|
||||||
m_fScaleV = varVal.toFloat();
|
m_fScaleV = varVal.toFloat();
|
||||||
float f = 264 / m_fScaleV;
|
float f = 264 / m_fScaleV;
|
||||||
m_colorMap->data()->setKeyRange(QCPRange(m_iX1, m_iX2*f));
|
m_colorMap->data()->setValueRange(QCPRange(m_iX1, m_iX2*f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ("最大振幅" == strProperty)
|
else if ("最大振幅" == strProperty)
|
||||||
|
|
@ -5687,8 +5501,7 @@ void QMyCustomPlot::s_changeDrawProperty(QVariantList vlist)
|
||||||
m_MaxRange = varVal.toDouble();
|
m_MaxRange = varVal.toDouble();
|
||||||
this->changePropertyWaveUpdate();
|
this->changePropertyWaveUpdate();
|
||||||
}
|
}
|
||||||
else if ("色板" == strProperty
|
else if ("色板" == strProperty)
|
||||||
|| "配色方案" == strProperty)
|
|
||||||
{
|
{
|
||||||
this->setSchemeIndex(varVal.toInt(), m_nColorNum);
|
this->setSchemeIndex(varVal.toInt(), m_nColorNum);
|
||||||
}
|
}
|
||||||
|
|
@ -5754,11 +5567,6 @@ void QMyCustomPlot::s_changeDrawProperty(QVariantList vlist)
|
||||||
{
|
{
|
||||||
this->changeCurveValSetting();
|
this->changeCurveValSetting();
|
||||||
}
|
}
|
||||||
else if ("最小值" == strProperty
|
|
||||||
|| "最大值" == strProperty)
|
|
||||||
{
|
|
||||||
this->updateImageWave();
|
|
||||||
}
|
|
||||||
|
|
||||||
this->replot();
|
this->replot();
|
||||||
}
|
}
|
||||||
|
|
@ -11366,11 +11174,6 @@ void QMyCustomPlot::changeCurveValSetting()
|
||||||
updateCurveTwoBackAndForth();
|
updateCurveTwoBackAndForth();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QMyCustomPlot::setUseColor(int nUse)
|
|
||||||
{
|
|
||||||
m_nUseColor = nUse;
|
|
||||||
}
|
|
||||||
|
|
||||||
//道宽改变后,避免井壁取心等组件变形,需要重新刷新
|
//道宽改变后,避免井壁取心等组件变形,需要重新刷新
|
||||||
void QMyCustomPlot::resetPosition()
|
void QMyCustomPlot::resetPosition()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -94,13 +94,9 @@ public:
|
||||||
// 曲线绘制
|
// 曲线绘制
|
||||||
void initCurve(QString strSlfName, QString strLineName);
|
void initCurve(QString strSlfName, QString strLineName);
|
||||||
|
|
||||||
void initImage(QString strSlfName, QString strWaveName);
|
|
||||||
|
|
||||||
void initColorTable();
|
void initColorTable();
|
||||||
void setSchemeIndex(int nidx, int colorNum);
|
void setSchemeIndex(int nidx, int colorNum);
|
||||||
|
|
||||||
QCPColorMap * updateWave();
|
QCPColorMap * updateWave();
|
||||||
QCPColorMap * updateImageWave();
|
|
||||||
|
|
||||||
float getScaleV();
|
float getScaleV();
|
||||||
|
|
||||||
|
|
@ -156,7 +152,6 @@ public:
|
||||||
// 曲线数值设置
|
// 曲线数值设置
|
||||||
void changeCurveValSetting();
|
void changeCurveValSetting();
|
||||||
|
|
||||||
void setUseColor(int nUse);
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -235,7 +230,6 @@ public:
|
||||||
float m_MaxRange = 1023.0f;
|
float m_MaxRange = 1023.0f;
|
||||||
int m_nWaveJg = 1;
|
int m_nWaveJg = 1;
|
||||||
int m_nWaveHei = 1;
|
int m_nWaveHei = 1;
|
||||||
int m_nUseColor = 0; // 色板颜色标志
|
|
||||||
|
|
||||||
// 深度 第三个轴
|
// 深度 第三个轴
|
||||||
QCPAxis *m_yAxis2 = nullptr;
|
QCPAxis *m_yAxis2 = nullptr;
|
||||||
|
|
|
||||||
|
|
@ -86,12 +86,9 @@ QWidget *QtColorSchemeComboBoxFactory::createEditor(QtColorSchemeComboBoxPropert
|
||||||
//QtColorSchemeComboBox * m_pColorSchemeBox = new QtColorSchemeComboBox();
|
//QtColorSchemeComboBox * m_pColorSchemeBox = new QtColorSchemeComboBox();
|
||||||
//return m_pColorSchemeBox;
|
//return m_pColorSchemeBox;
|
||||||
QtColorSchemeComboBox * pColorSchemeCombox = d_ptr->createEditor(property,parent);
|
QtColorSchemeComboBox * pColorSchemeCombox = d_ptr->createEditor(property,parent);
|
||||||
// QtColorTableData colorMap("Color Scheme",true);
|
QtColorTableData colorMap("Color Scheme",true);
|
||||||
// colorMap.SetCurrentSchemeIndex(manager->value(property));
|
colorMap.SetCurrentSchemeIndex(manager->value(property));
|
||||||
int useclr= manager->useColorTag(property);
|
pColorSchemeCombox->setSchemeColor(colorMap.GetSchemeList());
|
||||||
QList<QtSchemeColor> colorList = QtColorTableData::getInstance()->GetSchemeList(useclr);
|
|
||||||
//QList<QtSchemeColor> schemeColor = manager->schemeColor(property);
|
|
||||||
pColorSchemeCombox->setSchemeColor(colorList);
|
|
||||||
pColorSchemeCombox->setCurrentIndex(manager->value(property));
|
pColorSchemeCombox->setCurrentIndex(manager->value(property));
|
||||||
|
|
||||||
//QComboBox *editor = d_ptr->createEditor(property, parent);
|
//QComboBox *editor = d_ptr->createEditor(property, parent);
|
||||||
|
|
@ -261,11 +258,6 @@ QMap<int, QIcon> QtColorSchemeComboBoxPropertyManager::enumIcons(const QtPropert
|
||||||
return getData<QMap<int, QIcon> >(d_ptr->m_values, &QtColorSchemeComboBoxPropertyManagerPrivate::Data::enumIcons, property, QMap<int, QIcon>());
|
return getData<QMap<int, QIcon> >(d_ptr->m_values, &QtColorSchemeComboBoxPropertyManagerPrivate::Data::enumIcons, property, QMap<int, QIcon>());
|
||||||
}
|
}
|
||||||
|
|
||||||
int QtColorSchemeComboBoxPropertyManager::useColorTag(const QtProperty *property) const
|
|
||||||
{
|
|
||||||
return getData<int>(d_ptr->m_values, &QtColorSchemeComboBoxPropertyManagerPrivate::Data::nUseColorTag, property, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\reimp
|
\reimp
|
||||||
*/
|
*/
|
||||||
|
|
@ -398,49 +390,13 @@ void QtColorSchemeComboBoxPropertyManager::setEnumIcons(QtProperty *property, co
|
||||||
|
|
||||||
emit propertyChanged(property);
|
emit propertyChanged(property);
|
||||||
}
|
}
|
||||||
|
void QtColorSchemeComboBoxPropertyManager::setLinear(QtProperty *property)
|
||||||
void QtColorSchemeComboBoxPropertyManager::setUseColorTag(QtProperty *property, int useColorTag)
|
|
||||||
{
|
|
||||||
const QtColorSchemeComboBoxPropertyManagerPrivate::PropertyValueMap::iterator it = d_ptr->m_values.find(property);
|
|
||||||
if (it == d_ptr->m_values.end())
|
|
||||||
return;
|
|
||||||
|
|
||||||
QtColorSchemeComboBoxPropertyManagerPrivate::Data& data = it.value();
|
|
||||||
data.nUseColorTag = useColorTag;
|
|
||||||
}
|
|
||||||
|
|
||||||
QPixmap QtColorSchemeComboBoxPropertyManager::getColorLabelPixmap(const QVector<QtColorItem> &colorList, int colorNumber)
|
|
||||||
{
|
|
||||||
int w = 64, h = 32;
|
|
||||||
QPixmap pixmap(w, h);
|
|
||||||
QBrush brush(QColor(255, 0, 0));
|
|
||||||
pixmap.fill(QColor(255, 0, 0));
|
|
||||||
|
|
||||||
//QVector<QtColorItem> newColorList=paiInpolation(colorList,colorNumber);
|
|
||||||
|
|
||||||
|
|
||||||
QPainter painter;
|
|
||||||
painter.begin(&pixmap);
|
|
||||||
float colorStep = colorNumber * 1. / w;
|
|
||||||
QPen Pen;
|
|
||||||
for (int x = 0; x < w; x++)
|
|
||||||
{
|
|
||||||
// 色标位置
|
|
||||||
int clrIndex = (int)((x)* colorStep);
|
|
||||||
if (colorList.size() <= x) break;
|
|
||||||
Pen.setColor(QColor(colorList[clrIndex].color));
|
|
||||||
painter.setPen(Pen);
|
|
||||||
painter.drawLine(x, 0, x, h - 1);
|
|
||||||
}
|
|
||||||
painter.end();
|
|
||||||
return pixmap;
|
|
||||||
}
|
|
||||||
void QtColorSchemeComboBoxPropertyManager::setLinear(QtProperty *property, int nclr)
|
|
||||||
{
|
{
|
||||||
QStringList enumNames;
|
QStringList enumNames;
|
||||||
QMap<int, QIcon> enumIcons;
|
QMap<int, QIcon> enumIcons;
|
||||||
//QtColorTableData colorMap("Color Scheme",true);
|
|
||||||
QList<QtSchemeColor> colorList = QtColorTableData::getInstance()->GetSchemeList(nclr);
|
QtColorTableData colorMap("Color Scheme",true);
|
||||||
|
QList<QtSchemeColor> colorList = colorMap.GetSchemeList();
|
||||||
|
|
||||||
int nCount = colorList.size();
|
int nCount = colorList.size();
|
||||||
//样式值
|
//样式值
|
||||||
|
|
@ -452,41 +408,22 @@ void QtColorSchemeComboBoxPropertyManager::setLinear(QtProperty *property, int n
|
||||||
|
|
||||||
for(int i = 0 ; i < nCount; i++)
|
for(int i = 0 ; i < nCount; i++)
|
||||||
{
|
{
|
||||||
enumNames.push_back(colorList.at(i).schemeName);
|
enumNames.push_back(QString::number(i));
|
||||||
//colorMap.
|
//colorMap.
|
||||||
QPixmap pix = getColorLabelPixmap(colorList.at(i).colorList, colorList.at(i).colorList.count());
|
// QPixmap pix(rectSize);
|
||||||
// pix.fill(Qt::white);
|
// pix.fill(Qt::white);
|
||||||
// QBrush brush(Qt::black);
|
// QBrush brush(Qt::black);
|
||||||
// QPen pen(brush,2, linears.at(i));
|
// QPen pen(brush,2, linears.at(i));
|
||||||
// QPainter painter(&pix);
|
// QPainter painter(&pix);
|
||||||
// painter.setPen(pen);
|
// painter.setPen(pen);
|
||||||
// painter.drawLine(2,7,500,7);
|
// painter.drawLine(2,7,500,7);
|
||||||
enumIcons[i] = QIcon(pix);
|
//enumIcons[i] = QIcon(pix);
|
||||||
}
|
}
|
||||||
|
|
||||||
setEnumNames(property, enumNames);
|
setEnumNames(property, enumNames);
|
||||||
setEnumIcons(property, enumIcons);
|
//setEnumIcons(property, enumIcons);
|
||||||
setUseColorTag(property, nclr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtColorSchemeComboBoxPropertyManager::setLinear(QtProperty *property, QList<QtSchemeColor> colorList)
|
|
||||||
{
|
|
||||||
QStringList enumNames;
|
|
||||||
QMap<int, QIcon> enumIcons;
|
|
||||||
|
|
||||||
int nCount = colorList.size();
|
|
||||||
|
|
||||||
for (int i = 0; i < nCount; i++)
|
|
||||||
{
|
|
||||||
enumNames.push_back(colorList.at(i).schemeName);
|
|
||||||
QPixmap pix = getColorLabelPixmap(colorList.at(i).colorList, colorList.at(i).colorList.count());
|
|
||||||
enumIcons[i] = QIcon(pix);
|
|
||||||
}
|
|
||||||
|
|
||||||
setEnumNames(property, enumNames);
|
|
||||||
setEnumIcons(property, enumIcons);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\reimp
|
\reimp
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -23,15 +23,13 @@ public:
|
||||||
int value(const QtProperty *property) const;
|
int value(const QtProperty *property) const;
|
||||||
QStringList enumNames(const QtProperty *property) const;
|
QStringList enumNames(const QtProperty *property) const;
|
||||||
QMap<int, QIcon> enumIcons(const QtProperty *property) const;
|
QMap<int, QIcon> enumIcons(const QtProperty *property) const;
|
||||||
int useColorTag(const QtProperty *property) const;
|
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void setValue(QtProperty *property, int val, bool islinestyle);
|
void setValue(QtProperty *property, int val, bool islinestyle);
|
||||||
void setEnumNames(QtProperty *property, const QStringList &names);
|
void setEnumNames(QtProperty *property, const QStringList &names);
|
||||||
void setEnumIcons(QtProperty *property, const QMap<int, QIcon> &icons);
|
void setEnumIcons(QtProperty *property, const QMap<int, QIcon> &icons);
|
||||||
void setUseColorTag(QtProperty *property, int useColorTag);
|
void setLinear(QtProperty *property);
|
||||||
void setLinear(QtProperty *property, int nclr = 0);
|
|
||||||
void setLinear(QtProperty *property, QList<QtSchemeColor> colorList);
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void valueChanged(QtProperty *property, int val,bool islineStyle);
|
void valueChanged(QtProperty *property, int val,bool islineStyle);
|
||||||
void enumNamesChanged(QtProperty *property, const QStringList &names);
|
void enumNamesChanged(QtProperty *property, const QStringList &names);
|
||||||
|
|
@ -42,8 +40,6 @@ protected:
|
||||||
bool IsColorScheme(const QtProperty *property) const;
|
bool IsColorScheme(const QtProperty *property) const;
|
||||||
virtual void initializeProperty(QtProperty *property);
|
virtual void initializeProperty(QtProperty *property);
|
||||||
virtual void uninitializeProperty(QtProperty *property);
|
virtual void uninitializeProperty(QtProperty *property);
|
||||||
|
|
||||||
QPixmap getColorLabelPixmap(const QVector<QtColorItem> &colorList, int colorNumber);
|
|
||||||
private:
|
private:
|
||||||
QScopedPointer<QtColorSchemeComboBoxPropertyManagerPrivate> d_ptr;
|
QScopedPointer<QtColorSchemeComboBoxPropertyManagerPrivate> d_ptr;
|
||||||
Q_DECLARE_PRIVATE(QtColorSchemeComboBoxPropertyManager)
|
Q_DECLARE_PRIVATE(QtColorSchemeComboBoxPropertyManager)
|
||||||
|
|
@ -65,7 +61,7 @@ public:
|
||||||
int val;
|
int val;
|
||||||
QStringList enumNames;
|
QStringList enumNames;
|
||||||
QMap<int, QIcon> enumIcons;
|
QMap<int, QIcon> enumIcons;
|
||||||
int nUseColorTag;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef QMap<const QtProperty *, Data> PropertyValueMap;
|
typedef QMap<const QtProperty *, Data> PropertyValueMap;
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,7 @@
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QTextStream>
|
|
||||||
#include "qtColorSchemeComboBox.h"
|
#include "qtColorSchemeComboBox.h"
|
||||||
#include "Gradient.h"
|
|
||||||
|
|
||||||
QtColorSchemeComboBox::QtColorSchemeComboBox(QWidget *parent):QtComboBox(parent), m_isShowText(true)
|
QtColorSchemeComboBox::QtColorSchemeComboBox(QWidget *parent):QtComboBox(parent), m_isShowText(true)
|
||||||
{
|
{
|
||||||
m_colorSchemeList.clear();
|
m_colorSchemeList.clear();
|
||||||
|
|
@ -375,8 +372,6 @@ bool QtColorTableData::LoadScheme(bool IsReLoad)
|
||||||
m_systemSchemeList.push_back(schemeItem);
|
m_systemSchemeList.push_back(schemeItem);
|
||||||
}
|
}
|
||||||
m_systemShcemeNum=k;
|
m_systemShcemeNum=k;
|
||||||
|
|
||||||
LoadColorConfig();
|
|
||||||
}
|
}
|
||||||
// 读取定制的颜色方案
|
// 读取定制的颜色方案
|
||||||
ReadSettings();
|
ReadSettings();
|
||||||
|
|
@ -421,79 +416,6 @@ bool QtColorTableData::LoadScheme(bool IsReLoad)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int QtColorTableData::getColorConfig(QVector <QString> &qFiles)
|
|
||||||
{
|
|
||||||
char str[256], *buffer;
|
|
||||||
int i, nRet = 0;
|
|
||||||
QString qstr;
|
|
||||||
QByteArray ba;
|
|
||||||
|
|
||||||
//GetBinDir(str);
|
|
||||||
qstr = QCoreApplication::applicationDirPath();//QString(QLatin1String(str)); //char*=>QString
|
|
||||||
qstr += "\\color\\colorConfig.list";
|
|
||||||
qFiles.clear();
|
|
||||||
QFile f(qstr);
|
|
||||||
if (!f.open(QIODevice::ReadOnly | QIODevice::Text))
|
|
||||||
{
|
|
||||||
//cout << "Open failed." << endl;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
QTextStream txtInput(&f);
|
|
||||||
qstr = txtInput.readLine();
|
|
||||||
//QString==>char *
|
|
||||||
ba = qstr.toLatin1(); // must
|
|
||||||
buffer = ba.data();
|
|
||||||
sscanf(buffer, "%d", &nRet);
|
|
||||||
for (i = 0; i < nRet; i++)
|
|
||||||
{
|
|
||||||
qstr = txtInput.readLine();
|
|
||||||
qFiles.append(qstr);
|
|
||||||
}
|
|
||||||
f.close();
|
|
||||||
|
|
||||||
return nRet;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool QtColorTableData::LoadColorConfig()
|
|
||||||
{
|
|
||||||
// FreeColorScheme();
|
|
||||||
|
|
||||||
QVector <QString> qvFiles;
|
|
||||||
getColorConfig(qvFiles);
|
|
||||||
|
|
||||||
CGradient m_GraInfo;
|
|
||||||
int nRet = qvFiles.size();
|
|
||||||
for (int i = 0; i < nRet; i++)
|
|
||||||
{
|
|
||||||
m_GraInfo.Serialize(qvFiles[i]);
|
|
||||||
|
|
||||||
//获取颜色数组
|
|
||||||
int iColorNum = 256;
|
|
||||||
COLORREF pColorArr[256];
|
|
||||||
int nret = m_GraInfo.GetColorArray(pColorArr);
|
|
||||||
|
|
||||||
QVector<QtColorItem> colorList;
|
|
||||||
for (int k = 0; k < nret; k++)
|
|
||||||
{
|
|
||||||
colorList.push_back(QtColorItem(QColor(pColorArr[k])));
|
|
||||||
}
|
|
||||||
|
|
||||||
QString str = qvFiles.at(i);
|
|
||||||
QStringList slist = str.split("_");
|
|
||||||
// 构建颜色方案表
|
|
||||||
QtSchemeColor schemeItem;
|
|
||||||
schemeItem.schemeName = slist.length() > 0 ? slist.at(0) : str;
|
|
||||||
schemeItem.colorList = colorList;
|
|
||||||
schemeItem.isDirty = false;
|
|
||||||
schemeItem.isCustom = false;
|
|
||||||
schemeItem.currentIndex = 0;
|
|
||||||
m_colorCfgList.push_back(schemeItem);
|
|
||||||
|
|
||||||
}
|
|
||||||
return nRet;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool QtColorTableData::ChangeColorNum(int colorNum)
|
bool QtColorTableData::ChangeColorNum(int colorNum)
|
||||||
{
|
{
|
||||||
QtSchemeColor* scheme=CurrentScheme();
|
QtSchemeColor* scheme=CurrentScheme();
|
||||||
|
|
@ -536,36 +458,6 @@ QList<QRgb> QtColorTableData::GetRgb(int colornum) const
|
||||||
return rgbList;
|
return rgbList;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QRgb> QtColorTableData::GetRgb_UseTag(int nuse, int schemIndex, int colornum) const
|
|
||||||
{
|
|
||||||
const QtSchemeColor* scheme= nullptr;
|
|
||||||
if(nuse == 0)
|
|
||||||
scheme = &m_colorSchemeList[schemIndex];
|
|
||||||
else
|
|
||||||
scheme = &m_colorCfgList[schemIndex];
|
|
||||||
|
|
||||||
QList<QRgb> rgbList;
|
|
||||||
if(colornum<=0)
|
|
||||||
colornum=scheme->colorList.count();
|
|
||||||
else if(colornum>SECTIONVIEW_NUM)
|
|
||||||
colornum=SECTIONVIEW_NUM;
|
|
||||||
|
|
||||||
QVector<QtColorItem> newColorList;
|
|
||||||
|
|
||||||
if(colornum!=scheme->colorList.count())
|
|
||||||
newColorList=paiInpolation(scheme->colorList,colornum);
|
|
||||||
else
|
|
||||||
newColorList=scheme->colorList;
|
|
||||||
|
|
||||||
for(int i=0;i<newColorList.count();i++)
|
|
||||||
{
|
|
||||||
QtColorItem item=newColorList[i];
|
|
||||||
rgbList.push_back(qRgb(item.color.red(),item.color.green(),item.color.blue()));
|
|
||||||
}
|
|
||||||
|
|
||||||
return rgbList;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QtColorTableData::ChangeDataRange(QtSchemeColor *scheme)
|
void QtColorTableData::ChangeDataRange(QtSchemeColor *scheme)
|
||||||
{
|
{
|
||||||
int colorNum=scheme->colorList.count();
|
int colorNum=scheme->colorList.count();
|
||||||
|
|
|
||||||
|
|
@ -152,18 +152,13 @@ public:
|
||||||
*/
|
*/
|
||||||
bool LoadScheme(bool IsReLoad=false);
|
bool LoadScheme(bool IsReLoad=false);
|
||||||
|
|
||||||
int getColorConfig(QVector <QString> &qFiles);
|
|
||||||
bool LoadColorConfig();
|
|
||||||
/*
|
/*
|
||||||
* @brief 获取颜色方案列表
|
* @brief 获取颜色方案列表
|
||||||
* @warning 下一部准备实现不同模块的系统保留和自定义方案
|
* @warning 下一部准备实现不同模块的系统保留和自定义方案
|
||||||
*/
|
*/
|
||||||
QList<QtSchemeColor > &GetSchemeList(int nuclr)
|
QList<QtSchemeColor > &GetSchemeList()
|
||||||
{
|
{
|
||||||
if (nuclr == 0)
|
|
||||||
return m_colorSchemeList;
|
return m_colorSchemeList;
|
||||||
else
|
|
||||||
return m_colorCfgList;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -176,9 +171,6 @@ public:
|
||||||
*/
|
*/
|
||||||
QList<QRgb> GetRgb(int colornum=0) const;
|
QList<QRgb> GetRgb(int colornum=0) const;
|
||||||
|
|
||||||
|
|
||||||
QList<QRgb> GetRgb_UseTag(int nuse, int schemIndex, int colornum=0) const;
|
|
||||||
|
|
||||||
void ChangeDataRange(QtSchemeColor *scheme);
|
void ChangeDataRange(QtSchemeColor *scheme);
|
||||||
|
|
||||||
void ReadSettings();
|
void ReadSettings();
|
||||||
|
|
@ -205,7 +197,6 @@ private:
|
||||||
bool m_isSettingSysColor;
|
bool m_isSettingSysColor;
|
||||||
// 当前所有的颜色方案,包括系统方案,自定义方案
|
// 当前所有的颜色方案,包括系统方案,自定义方案
|
||||||
QList<QtSchemeColor> m_colorSchemeList;
|
QList<QtSchemeColor> m_colorSchemeList;
|
||||||
QList<QtSchemeColor> m_colorCfgList;
|
|
||||||
|
|
||||||
// 备份的颜色方案
|
// 备份的颜色方案
|
||||||
QList<QtSchemeColor> m_systemSchemeList;
|
QList<QtSchemeColor> m_systemSchemeList;
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,6 @@ SOURCES += $$PWD/qtpropertybrowser.cpp \
|
||||||
$$PWD/qtgroupboxpropertybrowser.cpp \
|
$$PWD/qtgroupboxpropertybrowser.cpp \
|
||||||
$$PWD/qtpropertybrowserutils.cpp \
|
$$PWD/qtpropertybrowserutils.cpp \
|
||||||
ColorSchemeComboBox.cpp \
|
ColorSchemeComboBox.cpp \
|
||||||
Gradient.cpp \
|
|
||||||
qtColorSchemeComboBox.cpp \
|
qtColorSchemeComboBox.cpp \
|
||||||
qtComboBox.cpp
|
qtComboBox.cpp
|
||||||
|
|
||||||
|
|
@ -55,7 +54,6 @@ HEADERS += $$PWD/qtpropertybrowser.h \
|
||||||
$$PWD/qtgroupboxpropertybrowser.h \
|
$$PWD/qtgroupboxpropertybrowser.h \
|
||||||
$$PWD/qtpropertybrowserutils_p.h \
|
$$PWD/qtpropertybrowserutils_p.h \
|
||||||
ColorSchemeComboBox.h \
|
ColorSchemeComboBox.h \
|
||||||
Gradient.h \
|
|
||||||
qtColorSchemeComboBox.h \
|
qtColorSchemeComboBox.h \
|
||||||
qtComboBox.h
|
qtComboBox.h
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user