解释结论代码优化,整理到 TransparentGroupResult 中读取中文字符GBK转UTF8
This commit is contained in:
parent
24bfc1e7dd
commit
a9e5632219
|
|
@ -1182,3 +1182,26 @@ int GetLineWidth(QPainter * painter,int flWidth)
|
|||
else if(abs(temp)<=1) temp=1;
|
||||
return (int)temp;
|
||||
}
|
||||
|
||||
QString GBKToUTF8(const QByteArray& gbkData) {
|
||||
QTextCodec* gbkCodec = QTextCodec::codecForName("GBK");
|
||||
if (!gbkCodec) {
|
||||
return QString();
|
||||
}
|
||||
|
||||
// 将GBK编码的字节转换为Unicode QString
|
||||
QString unicodeStr = gbkCodec->toUnicode(gbkData);
|
||||
return unicodeStr;
|
||||
}
|
||||
|
||||
// UTF-8 转 GBK
|
||||
QByteArray UTF8ToGBK(const QString& utf8Str) {
|
||||
QTextCodec* gbkCodec = QTextCodec::codecForName("GBK");
|
||||
if (!gbkCodec) {
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
// 将Unicode QString转换为GBK编码的字节
|
||||
return gbkCodec->fromUnicode(utf8Str);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -237,6 +237,9 @@ QString GetLithSymbolDir(QString cs=QDir::separator());
|
|||
QString GetGujingSymbolDir(QString cs=QDir::separator());
|
||||
int GetLineWidth(QPainter * painter,int flWidth);
|
||||
|
||||
QString GBKToUTF8(const QByteArray& gbkData);
|
||||
QByteArray UTF8ToGBK(const QString& utf8Str);
|
||||
|
||||
struct WellHead
|
||||
{
|
||||
WellHead()
|
||||
|
|
|
|||
|
|
@ -50,6 +50,79 @@ void TransparentGroupResult::addResultToPlot(double left_Low, double right_Hight
|
|||
m_mapDraggable_Result[strUuid] = dragRect;
|
||||
}
|
||||
|
||||
QString TransparentGroupResult::getIconName(const QMap<QString, QString>& zoneOrder, const QString& result_str, int nidx, double dMDepth)
|
||||
{
|
||||
QString result = "";
|
||||
QString iconshotname = "";
|
||||
if (result_str.length() == 1)
|
||||
{
|
||||
if (nidx > 0)
|
||||
return result;
|
||||
|
||||
if (result_str.length() > 0 && dMDepth)
|
||||
iconshotname = zoneOrder.key(result_str.at(0));
|
||||
else
|
||||
iconshotname = zoneOrder.key(result_str);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dMDepth != 0) {
|
||||
if (result_str.length() > nidx)
|
||||
iconshotname = zoneOrder.key(result_str.at(nidx));
|
||||
|
||||
}
|
||||
}
|
||||
if (iconshotname != "") {
|
||||
result = ::GetOilSymbolDir() + iconshotname + ".svg";
|
||||
QDir fexit;
|
||||
if (!fexit.exists(result))
|
||||
result = ::GetOilSymbolDir() + iconshotname + ".png";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void TransparentGroupResult::addAllResultToPlot(LAYER_DATA* pResult)
|
||||
{
|
||||
QMap<QString, QString> zoneOrder = GetZoneOrder();//初始化ZoneOrder 层序号根据层位名来,配置文件在conf\\RESULT.txt
|
||||
|
||||
//
|
||||
QDir fexit;
|
||||
QString result_str = QString::number(pResult->Result);
|
||||
|
||||
QVector<float> vecDepth;
|
||||
vecDepth << pResult->MDepth1 << pResult->MDepth1;
|
||||
vecDepth << pResult->MDepth2 << pResult->MDepth3 << pResult->MDepth4 << pResult->MDepth5;
|
||||
vecDepth << pResult->MDepth6 << pResult->MDepth7 << pResult->MDepth8 << pResult->MDepth9 << pResult->MDepth10;
|
||||
|
||||
QString strUuid = "";
|
||||
for (int i = 0; i < vecDepth.size()-1; i++)
|
||||
{
|
||||
QString result = getIconName(zoneOrder, result_str, i, vecDepth.at(i));
|
||||
|
||||
if (result != "")
|
||||
{
|
||||
double dEnd = vecDepth.at(i + 1);
|
||||
double dStart = vecDepth.at(i);
|
||||
if (i == 0)
|
||||
{
|
||||
dStart= pResult->StartDepth;
|
||||
}
|
||||
if (dEnd != 0)
|
||||
{
|
||||
//第一个加Zone解释层号
|
||||
this->addResultToPlot(-dEnd, -dStart, result, strUuid);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->addResultToPlot(-pResult->EndDepth, -dStart, result, strUuid);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//设置最小宽度
|
||||
void TransparentGroupResult::setMinWidth(double minWidth)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -23,6 +23,10 @@ public:
|
|||
|
||||
void addResultToPlot(double left_Low, double right_Hight, QString myResult, QString &strUuid);
|
||||
|
||||
QString getIconName(const QMap<QString, QString>& zoneOrder, const QString& result_str, int nidx, double dMDepth);
|
||||
|
||||
void addAllResultToPlot(LAYER_DATA* pResult);
|
||||
|
||||
//设置最小宽度
|
||||
void setMinWidth(double minWidth);
|
||||
//设置标题
|
||||
|
|
|
|||
|
|
@ -3583,7 +3583,6 @@ void FormDraw::initResult(QMyCustomPlot *widget, QString strSlfName, QString str
|
|||
|
||||
}
|
||||
|
||||
|
||||
bool FormDraw::LoadFromSLF_Result(QMyCustomPlot *widget, QString strSlfName, QString strLineName)
|
||||
{
|
||||
static bool isrun=false;
|
||||
|
|
@ -3618,316 +3617,10 @@ bool FormDraw::LoadFromSLF_Result(QMyCustomPlot *widget, QString strSlfName, QSt
|
|||
|
||||
if(m_Result->StartDepth==m_Result->EndDepth) continue;
|
||||
|
||||
//以下字段为临时添加,后面需要和pai数据组集成
|
||||
//tmp code
|
||||
QString resultNo;//解释层号
|
||||
QString result;//油气结论
|
||||
double thick;//有效厚度
|
||||
double tt;//累计厚度
|
||||
QString result1;//油气结论2
|
||||
QString result2;//油气结论3
|
||||
QString result3;//油气结论3
|
||||
QString result4;//油气结论3
|
||||
QString result5;//油气结论3
|
||||
QString result6;//油气结论2
|
||||
QString result7;//油气结论3
|
||||
QString result8;//油气结论3
|
||||
QString result9;//油气结论3
|
||||
QString result10;//油气结论3
|
||||
float m_MDepth1;
|
||||
float m_MDepth2;
|
||||
float m_MDepth3;
|
||||
float m_MDepth4;
|
||||
float m_MDepth5;
|
||||
float m_MDepth6;
|
||||
float m_MDepth7;
|
||||
float m_MDepth8;
|
||||
float m_MDepth9;
|
||||
float m_MDepth10;
|
||||
QString strZone = QString::number(atoi(m_Result->Zone));
|
||||
QString Description1;
|
||||
QString Description2;
|
||||
QString Description3;
|
||||
QString Description4;
|
||||
QString Description5;
|
||||
QString Description6;
|
||||
QString Description7;
|
||||
QString Description8;
|
||||
QString Description9;
|
||||
QString Description10;
|
||||
int m_GEOName;
|
||||
QString m_DEST;
|
||||
float m_SDEP,m_EDEP;
|
||||
float m_SDEP1,m_EDEP1;
|
||||
float m_SDEP2,m_EDEP2;
|
||||
float m_SDEP3,m_EDEP3;
|
||||
float m_SDEP4,m_EDEP4;
|
||||
float m_SDEP5,m_EDEP5;
|
||||
float m_SDEP6,m_EDEP6;
|
||||
float m_SDEP7,m_EDEP7;
|
||||
float m_SDEP8,m_EDEP8;
|
||||
float m_SDEP9,m_EDEP9;
|
||||
float m_SDEP10,m_EDEP10;
|
||||
//0代表直接绘制 1代表平铺 2代表拉伸 默认值是2
|
||||
|
||||
QMap<QString,QString> zoneOrder = GetZoneOrder();//初始化ZoneOrder 层序号根据层位名来,配置文件在conf\\RESULT.txt
|
||||
|
||||
//
|
||||
QDir fexit;
|
||||
QString result_str=QString::number(m_Result->Result);
|
||||
QString iconshotname;
|
||||
if(result_str.length()>0&&m_Result->MDepth1)
|
||||
iconshotname=zoneOrder.key(result_str.at(0));
|
||||
else
|
||||
iconshotname=zoneOrder.key(result_str);
|
||||
|
||||
if(iconshotname!=""){
|
||||
result=::GetOilSymbolDir()+iconshotname+".svg";
|
||||
if(!fexit.exists(result))
|
||||
{
|
||||
result=::GetOilSymbolDir()+iconshotname+".png";
|
||||
}
|
||||
}
|
||||
if(m_Result->MDepth1!=0) {
|
||||
if(result_str.length()>1) iconshotname=zoneOrder.key(QString::number(m_Result->Result).at(1));
|
||||
if(iconshotname!=""){
|
||||
result1=::GetOilSymbolDir()+iconshotname+".svg";
|
||||
if(!fexit.exists(result1))
|
||||
result1=::GetOilSymbolDir()+iconshotname+".png";
|
||||
}
|
||||
}
|
||||
|
||||
if(m_Result->MDepth2!=0) {
|
||||
if(result_str.length()>2) iconshotname=zoneOrder.key(result_str.at(2));
|
||||
if(iconshotname!=""){
|
||||
result2=::GetOilSymbolDir()+iconshotname+".svg";
|
||||
if(!fexit.exists(result2))
|
||||
result2=::GetOilSymbolDir()+iconshotname+".png";
|
||||
}
|
||||
}
|
||||
if(m_Result->MDepth3!=0) {
|
||||
if(result_str.length()>3) iconshotname=zoneOrder.key(result_str.at(3));
|
||||
if(iconshotname!=""){
|
||||
result3=::GetOilSymbolDir()+iconshotname+".svg";
|
||||
if(!fexit.exists(result3))
|
||||
result3=::GetOilSymbolDir()+iconshotname+".png";
|
||||
}
|
||||
}
|
||||
if(m_Result->MDepth4!=0) {
|
||||
if(result_str.length()>4) iconshotname=zoneOrder.key(result_str.at(4));
|
||||
if(iconshotname!=""){
|
||||
result4=::GetOilSymbolDir()+iconshotname+".svg";
|
||||
if(!fexit.exists(result4))
|
||||
result4=::GetOilSymbolDir()+iconshotname+".png";
|
||||
}
|
||||
}
|
||||
if(m_Result->MDepth5!=0) {
|
||||
if(result_str.length()>5) iconshotname=zoneOrder.key(result_str.at(5));
|
||||
if(iconshotname!=""){
|
||||
result5=::GetOilSymbolDir()+iconshotname+".svg";
|
||||
if(!fexit.exists(result5))
|
||||
result5=::GetOilSymbolDir()+iconshotname+".png";
|
||||
}
|
||||
}
|
||||
if(m_Result->MDepth6!=0) {
|
||||
if(result_str.length()>6) iconshotname=zoneOrder.key(result_str.at(6));
|
||||
if(iconshotname!=""){
|
||||
result6=::GetOilSymbolDir()+iconshotname+".svg";
|
||||
if(!fexit.exists(result6))
|
||||
result6=::GetOilSymbolDir()+iconshotname+".png";
|
||||
}
|
||||
}
|
||||
if(m_Result->MDepth7!=0) {
|
||||
if(result_str.length()>7) iconshotname=zoneOrder.key(result_str.at(7));
|
||||
if(iconshotname!=""){
|
||||
result7=::GetOilSymbolDir()+iconshotname+".svg";
|
||||
if(!fexit.exists(result7))
|
||||
result7=::GetOilSymbolDir()+iconshotname+".png";
|
||||
}
|
||||
}
|
||||
if(m_Result->MDepth8!=0) {
|
||||
if(result_str.length()>8) iconshotname=zoneOrder.key(result_str.at(8));
|
||||
if(iconshotname!=""){
|
||||
result8=::GetOilSymbolDir()+iconshotname+".svg";
|
||||
if(!fexit.exists(result8))
|
||||
result8=::GetOilSymbolDir()+iconshotname+".png";
|
||||
}
|
||||
}
|
||||
if(m_Result->MDepth9!=0) {
|
||||
if(result_str.length()>9) iconshotname=zoneOrder.key(result_str.at(9));
|
||||
if(iconshotname!=""){
|
||||
result9=::GetOilSymbolDir()+iconshotname+".svg";
|
||||
if(!fexit.exists(result9))
|
||||
result9=::GetOilSymbolDir()+iconshotname+".png";
|
||||
}
|
||||
}
|
||||
if(m_Result->MDepth10!=0) {
|
||||
if(result_str.length()>10) iconshotname=zoneOrder.key(result_str.at(10));
|
||||
if(iconshotname!=""){
|
||||
result10=::GetOilSymbolDir()+iconshotname+".svg";
|
||||
if(!fexit.exists(result10))
|
||||
result10=::GetOilSymbolDir()+iconshotname+".png";
|
||||
}
|
||||
}
|
||||
QString strZone = QString::number(atoi(m_Result->Zone));
|
||||
// 设置解释结论终止深度
|
||||
TransparentGroupResult* pGroup = widget->addResultGroup(-m_Result->EndDepth, -m_Result->StartDepth, strGroupUuid, strZone);
|
||||
QString strUuid = "";
|
||||
if (result != "")
|
||||
{
|
||||
if (m_Result->MDepth1 != 0)
|
||||
{
|
||||
//第一个加Zone解释层号
|
||||
pGroup->addResultToPlot(-m_Result->MDepth1, -m_Result->StartDepth, result, strUuid);
|
||||
}
|
||||
else
|
||||
{
|
||||
pGroup->addResultToPlot(-m_Result->EndDepth, -m_Result->StartDepth, result, strUuid);
|
||||
}
|
||||
}
|
||||
if (result1 != "")
|
||||
{
|
||||
if (m_Result->MDepth2 != 0)
|
||||
{
|
||||
pGroup->addResultToPlot(-m_Result->MDepth2, -m_Result->MDepth1, result1, strUuid);
|
||||
}
|
||||
else {
|
||||
pGroup->addResultToPlot(-m_Result->EndDepth, -m_Result->MDepth1, result1, strUuid);
|
||||
}
|
||||
}
|
||||
|
||||
if (result2 != "")
|
||||
{
|
||||
if (m_Result->MDepth3 != 0)
|
||||
{
|
||||
pGroup->addResultToPlot(-m_Result->MDepth3, -m_Result->MDepth2, result2, strUuid);
|
||||
}
|
||||
else {
|
||||
pGroup->addResultToPlot(-m_Result->EndDepth, -m_Result->MDepth2, result2, strUuid);
|
||||
}
|
||||
}
|
||||
continue;
|
||||
//
|
||||
strUuid = "";
|
||||
if(result != "")
|
||||
{
|
||||
if(m_Result->MDepth1!=0)
|
||||
{
|
||||
//第一个加Zone解释层号
|
||||
widget->addResultToPlot(-m_Result->MDepth1, -m_Result->StartDepth, result, strUuid, strZone);
|
||||
}
|
||||
else
|
||||
{
|
||||
widget->addResultToPlot(-m_Result->EndDepth, -m_Result->StartDepth, result, strUuid, strZone);
|
||||
}
|
||||
}
|
||||
//return true;
|
||||
if(result1 != "")
|
||||
{
|
||||
if(m_Result->MDepth2!=0)
|
||||
{
|
||||
widget->addResultToPlot(-m_Result->MDepth2, -m_Result->MDepth1, result1, strUuid);
|
||||
}
|
||||
else {
|
||||
widget->addResultToPlot(-m_Result->EndDepth, -m_Result->MDepth1, result1, strUuid);
|
||||
}
|
||||
}
|
||||
|
||||
if(result2 != "")
|
||||
{
|
||||
if(m_Result->MDepth3!=0)
|
||||
{
|
||||
widget->addResultToPlot(-m_Result->MDepth3, -m_Result->MDepth2, result2, strUuid);
|
||||
}
|
||||
else {
|
||||
widget->addResultToPlot(-m_Result->EndDepth, -m_Result->MDepth2, result2, strUuid);
|
||||
}
|
||||
}
|
||||
|
||||
if(result3 != "")
|
||||
{
|
||||
if(m_Result->MDepth4!=0)
|
||||
{
|
||||
widget->addResultToPlot(-m_Result->MDepth4, -m_Result->MDepth3, result3, strUuid);
|
||||
}
|
||||
else {
|
||||
widget->addResultToPlot(-m_Result->EndDepth, -m_Result->MDepth3, result3, strUuid);
|
||||
}
|
||||
}
|
||||
|
||||
if(result4 != "")
|
||||
{
|
||||
if(m_Result->MDepth5!=0)
|
||||
{
|
||||
widget->addResultToPlot(-m_Result->MDepth5, -m_Result->MDepth4, result4, strUuid);
|
||||
}
|
||||
else {
|
||||
widget->addResultToPlot(-m_Result->EndDepth, -m_Result->MDepth4, result4, strUuid);
|
||||
}
|
||||
}
|
||||
|
||||
if(result5 != "")
|
||||
{
|
||||
if(m_Result->MDepth6!=0)
|
||||
{
|
||||
widget->addResultToPlot(-m_Result->MDepth6, -m_Result->MDepth5, result5, strUuid);
|
||||
}
|
||||
else{
|
||||
widget->addResultToPlot(-m_Result->EndDepth, -m_Result->MDepth5, result5, strUuid);
|
||||
}
|
||||
}
|
||||
|
||||
if(result6 != "")
|
||||
{
|
||||
if(m_Result->MDepth6!=0)
|
||||
{
|
||||
widget->addResultToPlot(-m_Result->MDepth7, -m_Result->MDepth6, result6, strUuid);
|
||||
}
|
||||
else {
|
||||
widget->addResultToPlot(-m_Result->EndDepth, -m_Result->MDepth6, result6, strUuid);
|
||||
}
|
||||
}
|
||||
|
||||
if(result7 != "")
|
||||
{
|
||||
if(m_Result->MDepth8!=0)
|
||||
{
|
||||
widget->addResultToPlot(-m_Result->MDepth8, -m_Result->MDepth7, result7, strUuid);
|
||||
}
|
||||
else {
|
||||
widget->addResultToPlot(-m_Result->EndDepth, -m_Result->MDepth7, result7, strUuid);
|
||||
}
|
||||
}
|
||||
|
||||
if(result8 != "")
|
||||
{
|
||||
if(m_Result->MDepth9!=0)
|
||||
{
|
||||
widget->addResultToPlot(-m_Result->MDepth9, -m_Result->MDepth8, result8, strUuid);
|
||||
}
|
||||
else {
|
||||
widget->addResultToPlot(-m_Result->EndDepth, -m_Result->MDepth8, result8, strUuid);
|
||||
}
|
||||
}
|
||||
|
||||
if(result9 != "")
|
||||
{
|
||||
if(m_Result->MDepth10!=0)
|
||||
{
|
||||
widget->addResultToPlot(-m_Result->MDepth10, -m_Result->MDepth9, result9, strUuid);
|
||||
}
|
||||
else{
|
||||
widget->addResultToPlot(-m_Result->EndDepth, -m_Result->MDepth9, result9, strUuid);
|
||||
}
|
||||
}
|
||||
|
||||
if(result10 != "")
|
||||
{
|
||||
if(m_Result->MDepth10!=0)
|
||||
{
|
||||
widget->addResultToPlot(-m_Result->EndDepth, -m_Result->MDepth10, result10, strUuid);
|
||||
}
|
||||
}
|
||||
|
||||
pGroup->addAllResultToPlot(m_Result);
|
||||
}
|
||||
logio->CloseTable(iIndex);
|
||||
delete pstr;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user