Merge branch 'main' of http://git.hivekion.com:3000/jiayulong/logplus
This commit is contained in:
commit
b5f6f2fec2
|
|
@ -2429,11 +2429,101 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant
|
|||
m_item->setData(Qt::UserRole+5, strSlfName);
|
||||
m_item->setData(Qt::UserRole+6, strWellName);
|
||||
|
||||
//qDebug() << "公式->改变 " << newFormulaText <<" "<<strSlfName <<" "<<strWellName;
|
||||
// QString newText = "";
|
||||
//先判断公式有效性
|
||||
QString TableName,FieldName;
|
||||
int DecNum,m_ValType=0;
|
||||
QString RecNo;
|
||||
bool isOk=false;
|
||||
//float value;
|
||||
ParseFormualInfos(newFormulaText,TableName,FieldName,RecNo,DecNum,isOk);
|
||||
if (!isOk)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// m_formHead->m_bRefresh=false;
|
||||
// m_item->setText(newText);
|
||||
//使用公式,组织数据
|
||||
//qDebug() << "公式->改变 " << newFormulaText <<" "<<strSlfName <<" "<<strWellName;
|
||||
QString computeCellResult = "";
|
||||
if(!strSlfName.isEmpty() &&
|
||||
!newFormulaText.isEmpty() &&
|
||||
newFormulaText.indexOf("=TABLE")>-1)
|
||||
{
|
||||
CMemRdWt mem;
|
||||
if(mem.Open(strSlfName.toStdString().c_str(), CLogIO::modeRead)) {
|
||||
computeCellResult = ComputeCell(mem, newFormulaText);
|
||||
mem.Close();
|
||||
}
|
||||
}
|
||||
//文字显示
|
||||
m_formHead->m_bRefresh=false;
|
||||
m_item->setText(computeCellResult);
|
||||
}
|
||||
else if("公式操作类型" == m_propertyData[pProperty])
|
||||
{
|
||||
int temp = variant.value<int>();
|
||||
m_item->setData(Qt::UserRole+7, temp); // 公式操作类型
|
||||
m_FormulaType = (FormualType)temp;
|
||||
|
||||
//公式
|
||||
QString newFormulaText = "";
|
||||
QVariant vtFormula = m_item->data(Qt::UserRole+4);
|
||||
if (vtFormula.isValid()) {
|
||||
newFormulaText = vtFormula.toString();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_strFormulaText = "";
|
||||
}
|
||||
|
||||
//slf名、井次名
|
||||
QString strSlfName = "";
|
||||
QVariant vtSlfName = m_item->data(Qt::UserRole+5);
|
||||
if (vtSlfName.isValid()) {
|
||||
strSlfName = vtSlfName.toString();
|
||||
}
|
||||
else
|
||||
{
|
||||
strSlfName = "";
|
||||
}
|
||||
//
|
||||
QString strWellName = "";
|
||||
QVariant vtWellName = m_item->data(Qt::UserRole+6);
|
||||
if (vtWellName.isValid()) {
|
||||
strWellName = vtWellName.toString();
|
||||
}
|
||||
else
|
||||
{
|
||||
strWellName = "";
|
||||
}
|
||||
|
||||
//先判断公式有效性
|
||||
QString TableName,FieldName;
|
||||
int DecNum,m_ValType=0;
|
||||
QString RecNo;
|
||||
bool isOk=false;
|
||||
//float value;
|
||||
ParseFormualInfos(newFormulaText,TableName,FieldName,RecNo,DecNum,isOk);
|
||||
if (!isOk)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//使用公式,组织数据
|
||||
//qDebug() << "公式操作类型->改变 " << newFormulaText <<" "<<strSlfName <<" "<<strWellName;
|
||||
QString computeCellResult = "";
|
||||
if(!strSlfName.isEmpty() &&
|
||||
!newFormulaText.isEmpty() &&
|
||||
newFormulaText.indexOf("=TABLE")>-1)
|
||||
{
|
||||
CMemRdWt mem;
|
||||
if(mem.Open(strSlfName.toStdString().c_str(), CLogIO::modeRead)) {
|
||||
computeCellResult = ComputeCell(mem, newFormulaText);
|
||||
mem.Close();
|
||||
}
|
||||
}
|
||||
//文字显示
|
||||
m_formHead->m_bRefresh=false;
|
||||
m_item->setText(computeCellResult);
|
||||
}
|
||||
}
|
||||
else if(m_strCurrentProperty == PL_OBJECT_PROPERTY) // 频率统计图
|
||||
|
|
@ -3251,6 +3341,21 @@ void PropertyWidget::initHeadProperty(FormHead *formHead, QTableWidget *tableWid
|
|||
m_strFormulaText = "";
|
||||
}
|
||||
|
||||
//公式操作类型
|
||||
QVariant vtFormula_type = m_item->data(Qt::UserRole+7);
|
||||
if (vtFormula_type.isValid()) {
|
||||
m_FormulaType = (FormualType)vtFormula_type.toInt();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_FormulaType = PropertyWidget::Compute;
|
||||
}
|
||||
|
||||
QStringList enumNames;
|
||||
enumNames << tr("计算") << tr("连接")<<tr("换行连接")<<tr("换行连接显行线")<<tr("空格连接")
|
||||
<<tr("计算结果为零不显示")<<tr("计算结果去除尾0")<<tr("非数字单元格空")<<tr("尾公式换行连接划线")<<tr("字母数字混合串");
|
||||
|
||||
|
||||
_CreateVariantPropertyItem("单元格", "图例", imagePath, VariantManager::filePathTypeId()); //"./image/胜利符号库/岩性符号/砂岩.png"
|
||||
_CreateVariantPropertyItem("单元格", "图例宽(cm)", m_colWidth_Img, QVariant::Double, 0, 100);
|
||||
_CreateVariantPropertyItem("单元格", "图例高(cm)", m_rowHeight_Img, QVariant::Double, 0, 100);
|
||||
|
|
@ -3265,9 +3370,13 @@ void PropertyWidget::initHeadProperty(FormHead *formHead, QTableWidget *tableWid
|
|||
_CreateVariantPropertyItem("表格", "行高(cm)", m_rowHeight, QVariant::Double, 0, 100);
|
||||
_CreateVariantPropertyItem("表格", "列宽(cm)", m_colWidth, QVariant::Double, 0, 100);
|
||||
|
||||
//读取图头公式
|
||||
//
|
||||
_CreateEnumPropertyItem("单元格", "公式操作类型", m_FormulaType, enumNames);
|
||||
|
||||
//读取图头公式(放在最后,不然下方的项容易重复多次出现)
|
||||
ReadWellRoundDataToFormula();
|
||||
_CreateFormulaPropertyItem("单元格", "公式", m_strFormulaText);
|
||||
|
||||
}
|
||||
|
||||
void PropertyWidget::initTableProperty(FormInfo *formInfo)
|
||||
|
|
@ -6723,4 +6832,672 @@ void PropertyWidget::ReadWellRoundDataToFormula()
|
|||
}
|
||||
}
|
||||
|
||||
//解析公式字段
|
||||
QStringList PropertyWidget::ParseCellFormula(QString formulaStr, QStringList &symbolList,QStringList &reatinList)
|
||||
{
|
||||
QStringList formualList;
|
||||
QString splitName="=TABLE";
|
||||
|
||||
if (formulaStr.isEmpty())
|
||||
{
|
||||
return formualList;
|
||||
}
|
||||
QStringList tempFormulaList=formulaStr.split(splitName,QString::SkipEmptyParts);
|
||||
|
||||
QString symbol;
|
||||
int left=-1;
|
||||
foreach (QString rowItem, tempFormulaList) {
|
||||
symbol=rowItem.right(1);
|
||||
if(symbol == QString(")"))
|
||||
{
|
||||
symbol="";
|
||||
}
|
||||
symbolList <<symbol;
|
||||
if(!symbol.isEmpty())
|
||||
{
|
||||
rowItem=rowItem.remove(rowItem.length()-1,1);
|
||||
}
|
||||
left=rowItem.lastIndexOf(".")+1;
|
||||
reatinList<<rowItem.mid(left,1);
|
||||
formualList <<(splitName+rowItem);
|
||||
}
|
||||
return formualList;
|
||||
}
|
||||
|
||||
QString PropertyWidget::ComputeCell(CMemRdWt &mem, QString formulaStr)
|
||||
{
|
||||
QString cs,value,ratin,symbol,sCompute,sSplitBr="\n",sSplitSpace=" ";
|
||||
QString sp;
|
||||
QStringList formulaList,valueList,
|
||||
symbolList,ratinList;
|
||||
int valCount;
|
||||
double dValue,dCompute;
|
||||
int dec=0;
|
||||
bool isOK=false,isConcat=false;
|
||||
if(formulaStr != "")
|
||||
{
|
||||
formulaList=ParseCellFormula(formulaStr,symbolList,ratinList);
|
||||
//
|
||||
valueList=ReadFormulaValues(mem,formulaList);
|
||||
valCount=valueList.size();
|
||||
if(ratinList.size()) dec=ratinList[0].toInt();
|
||||
if (valCount == 1)
|
||||
{
|
||||
value= valueList.value(0);
|
||||
ratin=ratinList.value(0);
|
||||
dValue=CanConvertToDouble(value,ratin.toInt(),isOK);
|
||||
if(!isOK && !isConcat)
|
||||
{
|
||||
sCompute=value;
|
||||
isConcat=true;
|
||||
}else
|
||||
{
|
||||
dCompute=dValue;
|
||||
sCompute=value;
|
||||
}
|
||||
}else if(valCount >=2)
|
||||
{
|
||||
isOK=false;
|
||||
int k=0;
|
||||
for (int i=0;i<valCount;i++)
|
||||
{
|
||||
value=valueList.value(i);
|
||||
ratin=ratinList.value(i);
|
||||
if(value!="") k=i+1;
|
||||
// "非数字单元格空"
|
||||
if (GetFormualType() == PropertyWidget::Compute||
|
||||
GetFormualType() == PropertyWidget::ComputeSpace||
|
||||
GetFormualType() == PropertyWidget::ComputeCLearZero
|
||||
)
|
||||
{
|
||||
if (isOK)
|
||||
{
|
||||
dValue=CanConvertToDouble(value,ratin.toInt(),isOK);
|
||||
symbol=symbolList.value(i-1);
|
||||
dCompute= ComputeValue(dCompute,dValue,symbol);
|
||||
}else
|
||||
{
|
||||
dCompute=CanConvertToDouble(value,ratin.toInt(),isOK);
|
||||
if (isConcat)
|
||||
{
|
||||
sCompute +=value;
|
||||
}else
|
||||
{
|
||||
isOK=true;
|
||||
}
|
||||
}
|
||||
}else
|
||||
{
|
||||
isConcat=true;
|
||||
switch(GetFormualType())
|
||||
{
|
||||
case PropertyWidget::Connect:
|
||||
sCompute +=value;
|
||||
break;
|
||||
case PropertyWidget::ConnectSpace:
|
||||
sCompute +=value+sSplitSpace;
|
||||
sp=sSplitSpace;
|
||||
break;
|
||||
case PropertyWidget::ConnectEnter:
|
||||
case PropertyWidget::ConnectEnterRowLine:
|
||||
sCompute +=value+sSplitBr;
|
||||
sp=sSplitBr;
|
||||
break;
|
||||
case PropertyWidget::ComputeNODIGEqueSPACE:
|
||||
{
|
||||
if(i){
|
||||
if(isdigit(*sCompute.toStdString().c_str())) {
|
||||
sCompute=value;
|
||||
}
|
||||
else sCompute="";
|
||||
}
|
||||
else sCompute=value;
|
||||
break;
|
||||
}
|
||||
case PropertyWidget::TailConnectEnterRowLine:
|
||||
if(i==valCount-1)sCompute +=sSplitBr;
|
||||
sCompute +=value;
|
||||
sp=sSplitBr;
|
||||
}
|
||||
|
||||
}
|
||||
} //begin compute
|
||||
switch(GetFormualType())
|
||||
{
|
||||
case PropertyWidget::ConnectSpace:
|
||||
sCompute=sCompute.trimmed();
|
||||
break;
|
||||
case PropertyWidget::ConnectEnter:
|
||||
case PropertyWidget::ConnectEnterRowLine:
|
||||
sCompute=sCompute.left(sCompute.size()-sSplitBr.size());
|
||||
break;
|
||||
}
|
||||
if(!k) {
|
||||
sCompute="";
|
||||
}
|
||||
else if(!sp.isEmpty()){
|
||||
QStringList css=sCompute.split(sp);
|
||||
int si=css.size();
|
||||
for (int j=k;j<si;j++)
|
||||
{
|
||||
css.removeAt(k);
|
||||
}
|
||||
sCompute=css.join(sp);
|
||||
}
|
||||
}// end count >2
|
||||
}// end Cell
|
||||
cs=sCompute;
|
||||
|
||||
if (!isConcat)
|
||||
{
|
||||
cs=QString::number(dCompute,'f',ratin.toInt());
|
||||
bool isOk=false;
|
||||
double tryDouble=cs.toDouble(&isOk);
|
||||
if (isOk)
|
||||
{
|
||||
// if(tryDouble==0) cs="";
|
||||
// QRegExp reg("(\\.0*|0+)$");
|
||||
// cs=cs.replace(reg,"");
|
||||
}
|
||||
}
|
||||
else {
|
||||
int len=cs.length();
|
||||
if(len&&(cs.at(len-1)==sSplitBr.at(0)||cs.at(len-1)==sSplitSpace.at(0)))
|
||||
{
|
||||
cs=cs.remove(len-1,1);
|
||||
}
|
||||
}
|
||||
if(GetFormualType() == PropertyWidget::ComputeSpace) {
|
||||
if(cs.size()&&cs.at(0).isDigit()&&cs.toFloat()==0.0) cs="";
|
||||
}
|
||||
else if(GetFormualType() == PropertyWidget::ComputeCLearZero) {
|
||||
cs=toString(cs);
|
||||
if(cs.size()&&cs.at(0).isDigit()&&cs.toFloat()==0.0) cs="";
|
||||
}
|
||||
if(dec&&GetFormualType() == PropertyWidget::LetterAndNumber) cs=setdec(cs,dec,1);
|
||||
// pCell->SetText(cs);
|
||||
return cs;
|
||||
}
|
||||
|
||||
double PropertyWidget::ComputeValue(double d1,double d2,const QString &symbolTag)
|
||||
{
|
||||
double value;
|
||||
if (symbolTag == QString("+"))
|
||||
{
|
||||
value=d1 + d2;
|
||||
}
|
||||
|
||||
if(symbolTag == QString("-"))
|
||||
{
|
||||
value=d1 - d2;
|
||||
}
|
||||
|
||||
if(symbolTag == QString("*"))
|
||||
{
|
||||
value=d1 * d2;
|
||||
}
|
||||
|
||||
if(symbolTag == QString("/"))
|
||||
{
|
||||
value=d1 / d2;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
double PropertyWidget::CanConvertToDouble(const QString &value,int ratin,bool &canOk)
|
||||
{
|
||||
double dValue;
|
||||
QString convertValue;
|
||||
bool isOk;
|
||||
|
||||
dValue=value.toDouble(&isOk);
|
||||
if(isOk)
|
||||
{
|
||||
convertValue=QString::number(dValue,'f',ratin);
|
||||
dValue=convertValue.toDouble();
|
||||
}
|
||||
canOk=isOk;
|
||||
return dValue;
|
||||
}
|
||||
|
||||
QStringList PropertyWidget::ReadFormulaValues(CMemRdWt &mem,const QStringList &formulaList)
|
||||
{
|
||||
int count=formulaList.size();
|
||||
QString formual,slfTableValue;
|
||||
QStringList values;
|
||||
for (int i=0;i<count;i++)
|
||||
{
|
||||
formual=formulaList.value(i);
|
||||
if (formual.isEmpty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
slfTableValue=ReadSlfTableValue(mem,formual);
|
||||
values << slfTableValue;
|
||||
}
|
||||
return values;
|
||||
}
|
||||
|
||||
QString ReadLogWellMapFieldValue(
|
||||
CMemRdWt &mem,
|
||||
const QString &tbName,
|
||||
int colIndex,
|
||||
int recordNo
|
||||
)
|
||||
{
|
||||
char name[100];
|
||||
QStringList fieldList;
|
||||
QString fieldValue;
|
||||
strcpy(name,tbName.toStdString().c_str());
|
||||
int iIndex=mem.OpenTable(name);
|
||||
if (iIndex >=0)
|
||||
{
|
||||
//读取数据
|
||||
char buf[513];
|
||||
memset(buf,0,513);
|
||||
mem.GetTableFieldData(iIndex,colIndex-1,buf,recordNo);
|
||||
if(strlen(buf)>512)
|
||||
{
|
||||
buf[512]=0;
|
||||
}
|
||||
fieldValue=toString(buf);
|
||||
}
|
||||
mem.CloseTable(iIndex);
|
||||
return fieldValue;
|
||||
}
|
||||
|
||||
QString ReadWellMessageData3( CMemRdWt &logio ,int colIndex,int RecNo)
|
||||
{
|
||||
QList<QStringList> tableData;
|
||||
QString readResult;
|
||||
QStringList rowData;
|
||||
Slf_FILE_MESSAGE msg;
|
||||
logio.GetFileMessage(msg);
|
||||
// logio.Close();
|
||||
|
||||
|
||||
QList<QStringList> valueList;
|
||||
//////////////////////////////////////1////////////////////////////////////
|
||||
QStringList partRow;
|
||||
partRow <<QString("泥浆密度9")<<QString::number(msg.Mud_Density[8]);
|
||||
for (int i=0;i<4;i++)
|
||||
partRow<<QString("泥浆粘度%1").arg(i+1)<<QString::number(msg.Mud_Viscosity[i]);
|
||||
|
||||
valueList << partRow;
|
||||
|
||||
partRow.clear();
|
||||
//////////////////////////////////////2////////////////////////////////////
|
||||
for (int i=4;i<9;i++)
|
||||
partRow<<QString("泥浆粘度%1").arg(i+1)<<QString::number(msg.Mud_Viscosity[i]);
|
||||
valueList << partRow;
|
||||
partRow.clear();
|
||||
///////////////////////////////////////3///////////////////////////////////
|
||||
partRow <<QString("泥浆粘度10")<<QString::number(msg.Mud_Viscosity[9]);
|
||||
for (int i=0;i<4;i++)
|
||||
partRow<<QString("泥浆电阻%1").arg(i+1)<<QString::number(msg.Mud_Resistivity[i]);
|
||||
valueList << partRow;
|
||||
partRow.clear();
|
||||
////////////////////////////////////////4//////////////////////////////////
|
||||
for (int i=4;i<9;i++)
|
||||
partRow<<QString("泥浆电阻%1").arg(i+1)<<QString::number(msg.Mud_Resistivity[i]);
|
||||
valueList << partRow;
|
||||
partRow.clear();
|
||||
//////////////////////////////////////////5////////////////////////////////
|
||||
partRow <<QString("泥浆电阻10")<<QString::number(msg.Mud_Resistivity[9]);
|
||||
for (int i=0;i<4;i++)
|
||||
partRow<<QString("短套外径%1").arg(i+1)<<QString::number(msg.Bushing_Outside_Diameter[i]);
|
||||
valueList << partRow;
|
||||
partRow.clear();
|
||||
/////////////////////////////////////////6/////////////////////////////////
|
||||
for (int i=4;i<9;i++)
|
||||
partRow<<QString("短套外径%1").arg(i+1)<<QString::number(msg.Bushing_Outside_Diameter[i]);
|
||||
valueList << partRow;
|
||||
partRow.clear();
|
||||
///////////////////////////////////////////7///////////////////////////////
|
||||
partRow<<QString("短套外径10")<<QString::number(msg.Bushing_Outside_Diameter[9])
|
||||
<<QString("泥浆性能")<<QString::fromLocal8Bit(msg.Mud_Property)
|
||||
<<QString("仪器性能")<<QString::fromLocal8Bit(msg.YqType)
|
||||
<<QString("测时井深")<<QString::number(msg.LoggingDepth)
|
||||
<<QString("磁偏角")<<QString::number(msg.azca);
|
||||
valueList << partRow;
|
||||
partRow.clear();
|
||||
/////////////////////////////////////////////8/////////////////////////////
|
||||
partRow<<QString("起始垂深")<<QString::number(msg.TVD)
|
||||
<<QString("测点X偏移")<<QString::number(msg.X0)
|
||||
<<QString("测点Y偏移")<<QString::number(msg.Y0)
|
||||
<<QString("测点Z偏移")<<QString::number(msg.Z0)
|
||||
<<QString("泥浆温度")<<QString::number(msg.Mud_Temp);
|
||||
valueList << partRow;
|
||||
partRow.clear();
|
||||
////////////////////////////////////////////9//////////////////////////////
|
||||
partRow<<QString("备注")<<QString::fromLocal8Bit(msg.Intor)
|
||||
<<QString("IntDepths")<<QString::fromLocal8Bit(msg.IntDepths)
|
||||
<<QString("解释员")<<QString::fromLocal8Bit(msg.audit)
|
||||
<<QString("软件")<<QString::fromLocal8Bit(msg.Prog)
|
||||
<<QString("WaterLoss")<<QString::number(msg.WaterLoss);
|
||||
valueList << partRow;
|
||||
partRow.clear();
|
||||
///////////////////////////////////////////10///////////////////////////////
|
||||
partRow<<QString("测井小队")<<QString::fromLocal8Bit(msg.Item)
|
||||
<<QString("Reserved")<<QString::fromLocal8Bit(msg.Reserved);
|
||||
for (int i=3;i<6;i++)
|
||||
partRow<<QString("套管内径%1(毫米)").arg(i+1)<<QString::number(msg.Bushing_Inside_Diameter[i]);
|
||||
valueList << partRow;
|
||||
partRow.clear();
|
||||
//////////////////////////////////////////////11////////////////////////////
|
||||
for (int i=4;i<9;i++)
|
||||
partRow<<QString("套管内径%1(毫米)").arg(i+1)<<QString::number(msg.Bushing_Inside_Diameter[i]);
|
||||
valueList << partRow;
|
||||
partRow.clear();
|
||||
///////////////////////////////////////////////12///////////////////////////
|
||||
partRow<<QString("套管内径10(毫米)")<<QString::number(msg.Bushing_Inside_Diameter[9]);
|
||||
for (int i=3;i<7;i++)
|
||||
partRow<<QString("套管深度%1(米)").arg(i+1)<<QString::number(msg.Bushing_Detpth[i]);
|
||||
valueList << partRow;
|
||||
partRow.clear();
|
||||
////////////////////////////////////////////////13//////////////////////////
|
||||
for (int i=7;i<10;i++)
|
||||
partRow<<QString("套管深度%1(米)").arg(i+1)<<QString::number(msg.Bushing_Detpth[i]);
|
||||
for (int i=4;i<6;i++)
|
||||
partRow<<QString("钻头直径%1(毫米)").arg(i+1)<<QString::number(msg.Bit_Diameter[i]);
|
||||
valueList << partRow;
|
||||
partRow.clear();
|
||||
/////////////////////////////////////////////////14/////////////////////////
|
||||
for (int i=6;i<10;i++)
|
||||
partRow<<QString("钻头直径%1(毫米)").arg(i+1)<<QString::number(msg.Bit_Diameter[i]);
|
||||
|
||||
partRow<<QString("钻头深度5(米)")<<QString::number(msg.Bit_Depth[4]);
|
||||
valueList << partRow;
|
||||
partRow.clear();
|
||||
////////////////////////////////////////////////////15//////////////////////
|
||||
for (int i=5;i<10;i++)
|
||||
partRow<<QString("钻头深度%1(米)").arg(i+1)<<QString::number(msg.Bit_Depth[i]);
|
||||
valueList << partRow;
|
||||
partRow.clear();
|
||||
|
||||
|
||||
|
||||
rowData <<QString("井名")<<QString::fromLocal8Bit( msg.WellName)<<QString("井别")<<QString::fromLocal8Bit(msg.JB)
|
||||
<<QString("地区")<<QString::fromLocal8Bit(msg.AreaName)<<QString("补心")<<ConvertDataByFloat(msg.Kelly)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
<<QString("公司名称")<<QString::fromLocal8Bit( msg.OilCompanyName)<<QString("绘图井名")<<QString::fromLocal8Bit(msg.WellAliasName)
|
||||
<<QString("井类型")<<QString::fromLocal8Bit(msg.WellType)<<QString("大地X坐标")<<QString::number(msg.Xcoor)
|
||||
<<QString("大地Y坐标")<<QString::number(msg.Ycoor);
|
||||
|
||||
tableData <<rowData;
|
||||
rowData.clear();
|
||||
QString vv=ConvertDataByFloat(msg.Bushing_Detpth[0]);
|
||||
rowData <<QString("套管内径1(毫米)")<<ConvertDataByFloat( msg.Bushing_Inside_Diameter[0])<<QString("套管深度1(米)")<<ConvertDataByFloat(msg.Bushing_Detpth[0])
|
||||
<<QString("钻头直径1(毫米)")<<ConvertDataByFloat(msg.Bit_Diameter[0])<<QString("钻头深度1(米)")<<ConvertDataByFloat(msg.Bit_Depth[0])
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
<<QString("海拔高度")<<QString::number( msg.Altitude)<<QString("起始深度")<<QString::number(msg.StartDepth)
|
||||
<<QString("终止深度")<<QString::number(msg.EndDepth)<<QString("开钻时间")<<QString::number(msg.StartDrillDate)
|
||||
<<QString("完钻时间")<<QString::number(msg.EndDrillDate);
|
||||
tableData <<rowData;
|
||||
rowData.clear();
|
||||
rowData <<QString("套管内径2(毫米)")<<ConvertDataByFloat( msg.Bushing_Inside_Diameter[1])<<QString("套管深度2(米)")<<ConvertDataByFloat(msg.Bushing_Detpth[1])
|
||||
<<QString("钻头直径2(毫米)")<<ConvertDataByFloat(msg.Bit_Diameter[1])<<QString("钻头深度2(米)")<<ConvertDataByFloat(msg.Bit_Depth[1])
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
<<QString("测井时间")<<QString::number( msg.LoggingDate)<<QString("测井公司")<<QString::fromLocal8Bit(msg.LogCompanyName)
|
||||
<<QString("测井队")<<QString::fromLocal8Bit(msg.LoggingTeam)<<QString("操作员")<<QString::fromLocal8Bit(msg.Operator)
|
||||
<<QString("测井系列")<<QString::fromLocal8Bit(msg.LoggingSerial);
|
||||
tableData <<rowData;
|
||||
rowData.clear();
|
||||
rowData <<QString("套管内径3(毫米)")<<ConvertDataByFloat( msg.Bushing_Inside_Diameter[2])
|
||||
<<QString("套管深度3(米)")<<ConvertDataByFloat(msg.Bushing_Detpth[2])
|
||||
<<QString("钻头直径3(毫米)")<<ConvertDataByFloat(msg.Bit_Diameter[2])
|
||||
<<QString("钻头深度3(米)")<<ConvertDataByFloat(msg.Bit_Depth[2])
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
<<QString("井底温度")<<QString::number( msg.Well_Bottom_Temperature)
|
||||
<<QString("泥浆密度1")<<QString::number(msg.Mud_Density[0])
|
||||
<<QString("泥浆密度2")<<QString::number(msg.Mud_Density[1])
|
||||
<<QString("泥浆密度3")<<QString::number(msg.Mud_Density[2])
|
||||
<<QString("泥浆密度4")<<QString::number(msg.Mud_Density[3]);
|
||||
tableData <<rowData;
|
||||
rowData.clear();
|
||||
rowData <<QString("")<<QString("")
|
||||
<<QString("")<<QString("")
|
||||
<<QString("钻头直径4(毫米)")<<ConvertDataByFloat(msg.Bit_Diameter[3])
|
||||
<<QString("钻头深度4(米)")<<ConvertDataByFloat(msg.Bit_Depth[3])
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
<<QString("泥浆密度5")<<QString::number( msg.Mud_Density[4])
|
||||
<<QString("泥浆密度6")<<QString::number(msg.Mud_Density[5])
|
||||
<<QString("泥浆密度7")<<QString::number(msg.Mud_Density[6])
|
||||
<<QString("泥浆密度8")<<QString::number(msg.Mud_Density[7])
|
||||
<<QString("泥浆密度9")<<QString::number(msg.Mud_Density[8]);
|
||||
tableData <<rowData;
|
||||
rowData.clear();
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
QStringList rowList;
|
||||
for (int i=0;i<15;i++)
|
||||
{
|
||||
rowData <<QString("")<<QString("")<<QString("")<<QString("")
|
||||
<<QString("")<<QString("")<<QString("")<<QString("");
|
||||
if (valueList.size()>i)
|
||||
{
|
||||
rowList=valueList.at(i);
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
for (int j=0;j<rowList.size();j++)
|
||||
{
|
||||
rowData<<rowList.at(j);
|
||||
}
|
||||
}
|
||||
|
||||
tableData <<rowData;
|
||||
rowData.clear();
|
||||
}
|
||||
tableData[6-1][6-1]="米";
|
||||
if (tableData.size() >=RecNo)
|
||||
{
|
||||
readResult=tableData[RecNo-1][colIndex-1];
|
||||
}
|
||||
//readResult=tableData[RecNo][colIndex];
|
||||
|
||||
return readResult;
|
||||
}
|
||||
|
||||
QString PropertyWidget::ReadSlfTableValue(CMemRdWt &mem, const QString &formula)
|
||||
{
|
||||
QString cs="";
|
||||
//if(mem.mFile) {
|
||||
//if (!SLFFileName.isEmpty())
|
||||
{
|
||||
QString TableName,FieldName;
|
||||
int decNum,m_ValType=0;
|
||||
bool isOk=false;
|
||||
QString RecNo;
|
||||
double value;
|
||||
ParseFormualInfos(formula,TableName,FieldName,RecNo,decNum,isOk);
|
||||
|
||||
if (!isOk)
|
||||
{
|
||||
return cs;
|
||||
}
|
||||
if (TableName == QString("QString"))
|
||||
{
|
||||
// if(FieldName.compare("SUM",Qt::CaseInsensitive)==0||FieldName.compare("AGE",Qt::CaseInsensitive)==0||FieldName.compare("FST",Qt::CaseInsensitive)==0||FieldName.compare("END",Qt::CaseInsensitive)==0)
|
||||
// {
|
||||
// if(m_FormulaPos<1) return "0";
|
||||
// int ncol=-1,nrow=-1;
|
||||
// for (int i=0;i<m_nRowNumber;i++)
|
||||
// {
|
||||
// for (int j=0;j<m_nColumnNumber;j++)
|
||||
// {
|
||||
// if(pCell==GetCell(i,j)){
|
||||
// ncol=j;
|
||||
// nrow=i;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if(ncol>=0)
|
||||
// {
|
||||
// double val=0;
|
||||
// for (int i=m_FormulaPos-1;i<nrow;i++)
|
||||
// {
|
||||
// CCell *pCell1=GetCell(i,ncol);
|
||||
// val+=pCell1->text.toDouble();
|
||||
// }
|
||||
// if(FieldName.compare("AGE",Qt::CaseInsensitive)==0) {
|
||||
// if((nrow-m_FormulaPos+1)>0) val=val/(nrow-m_FormulaPos+1);
|
||||
// }
|
||||
// cs=QString::number(val);
|
||||
// }
|
||||
// else cs="0";
|
||||
// }
|
||||
// else cs=FieldName;
|
||||
}else if (TableName == QString("测井信息表"))
|
||||
{
|
||||
QRegExp regNum("\\d+");
|
||||
int begin=regNum.indexIn(FieldName);
|
||||
int end=regNum.lastIndexIn(FieldName);
|
||||
int colIndex= FieldName.mid(begin,end-begin+1).toInt();
|
||||
int rec=RecNo.toInt();
|
||||
if(rec<1) rec=1;
|
||||
cs=ReadLogWellMapFieldValue(mem,TableName,colIndex,rec);
|
||||
|
||||
}else if(TableName=="CARD")
|
||||
{
|
||||
|
||||
//int i;
|
||||
int iIndex=mem.OpenStream(FieldName.toStdString().c_str());
|
||||
if (iIndex>-1){
|
||||
int numrec=mem.GetStreamLength(iIndex);
|
||||
if(numrec>0) {
|
||||
int len=mem.GetStreamLength(iIndex);
|
||||
char *buf=new char[len+1];
|
||||
DWORD lpb=0;
|
||||
mem.ReadStream(iIndex,len,&lpb,buf);
|
||||
buf[len]=0;
|
||||
cs=buf;
|
||||
delete buf;
|
||||
}
|
||||
mem.CloseStream(iIndex);
|
||||
}
|
||||
|
||||
m_ValType=1;
|
||||
|
||||
}
|
||||
else if(TableName=="Well_Message")
|
||||
{
|
||||
char buf[1000];
|
||||
//QStringList MsgFields;
|
||||
QRegExp regNum("\\d+");
|
||||
int begin=regNum.indexIn(FieldName);
|
||||
int end=regNum.lastIndexIn(FieldName);
|
||||
int colIndex= FieldName.mid(begin,end-begin+1).toInt();
|
||||
int rec=RecNo.toInt();
|
||||
if(rec<1) rec=1;
|
||||
cs=ReadWellMessageData3(mem,colIndex,rec);
|
||||
m_ValType=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
char buf[1000];
|
||||
int rec=1;
|
||||
if(RecNo.compare("SUM",Qt::CaseInsensitive)==0||RecNo.compare("AGE",Qt::CaseInsensitive)==0) {
|
||||
float yy=0;
|
||||
double total=0;
|
||||
int index=mem.OpenTable((char *)TableName.toStdString().c_str());
|
||||
if(index>-1) rec=mem.GetTableRecordCount(index);
|
||||
else return "0";
|
||||
for(int i=0;i<rec;i++){
|
||||
m_ValType=mem.GetTableFieldData(
|
||||
index,
|
||||
(char *)FieldName.toStdString().c_str(),
|
||||
buf,
|
||||
i+1
|
||||
);
|
||||
sscanf(buf,"%f",&yy);
|
||||
total+=yy;
|
||||
}
|
||||
if(RecNo.compare("SUM",Qt::CaseInsensitive)==0) cs=QString::number(total);
|
||||
else cs=QString::number(total/rec);
|
||||
}
|
||||
else if(RecNo.compare("FREC",Qt::CaseInsensitive)==0||RecNo.compare("FST",Qt::CaseInsensitive)==0) {
|
||||
rec=1;
|
||||
m_ValType=mem.GetTableFieldData(
|
||||
(char *)TableName.toStdString().c_str(),
|
||||
(char *)FieldName.toStdString().c_str(),
|
||||
buf,
|
||||
rec
|
||||
);
|
||||
cs=buf;
|
||||
}
|
||||
else if(RecNo.compare("EREC",Qt::CaseInsensitive)==0||RecNo.compare("END",Qt::CaseInsensitive)==0) {
|
||||
int index=mem.OpenTable((char *)TableName.toStdString().c_str());
|
||||
if(index>-1) rec=mem.GetTableRecordCount(index);
|
||||
m_ValType=mem.GetTableFieldData(
|
||||
index,
|
||||
(char *)FieldName.toStdString().c_str(),
|
||||
buf,
|
||||
rec
|
||||
);
|
||||
cs=buf;
|
||||
}
|
||||
else {
|
||||
rec=RecNo.toInt();
|
||||
if(rec<1) rec=1;
|
||||
float yy=0;
|
||||
m_ValType=mem.GetTableFieldData(
|
||||
(char *)TableName.toStdString().c_str(),
|
||||
(char *)FieldName.toStdString().c_str(),
|
||||
buf,
|
||||
yy,
|
||||
rec
|
||||
);
|
||||
if(m_ValType==6) {
|
||||
cs=buf;
|
||||
}
|
||||
else cs=QString::number(yy,'f',8);
|
||||
}
|
||||
}
|
||||
value=cs.toDouble(&isOk);
|
||||
if (isOk)
|
||||
{
|
||||
cs=QString::number(value+0.0001,'f',decNum);
|
||||
}
|
||||
}
|
||||
return cs;
|
||||
}
|
||||
|
||||
PropertyWidget::FormualType PropertyWidget::GetFormualType()
|
||||
{
|
||||
if (m_FormulaType == 0)
|
||||
{
|
||||
m_FormulaType=PropertyWidget::Compute;
|
||||
}
|
||||
return m_FormulaType;
|
||||
}
|
||||
|
||||
void PropertyWidget::ParseFormualInfos(const QString &formual,
|
||||
QString &TableName, QString &FieldName,
|
||||
QString &RecordNo, int &DecNum, bool &isSuccess)
|
||||
{
|
||||
isSuccess=false;
|
||||
QString Formula=formual;
|
||||
int i0=Formula.indexOf("(");
|
||||
if(i0<0) return ;
|
||||
Formula=Formula.mid(i0+1);
|
||||
int i1=Formula.indexOf(":");//TableName
|
||||
if(i1<0) return ;
|
||||
TableName=Formula.left(i1);
|
||||
Formula=Formula.mid(i1+1);
|
||||
int i2=Formula.indexOf(":");//FieldName
|
||||
if(i2<0) i2=0;
|
||||
FieldName=Formula.left(i2);
|
||||
Formula=Formula.mid(i2+1);
|
||||
int i3=Formula.indexOf(".");//Rec No
|
||||
if(i3<0) i3=0;
|
||||
QString Rec=Formula.left(i3);
|
||||
Formula=Formula.mid(i3+1);
|
||||
int i4=Formula.indexOf(")");//dec number
|
||||
if(i4<0) i4=0;
|
||||
QString Dec=Formula.left(i4);
|
||||
RecordNo=Rec;//.toInt();
|
||||
if(RecordNo.isEmpty()) RecordNo="1";
|
||||
//保留小数位数
|
||||
DecNum=Dec.toInt();
|
||||
isSuccess=true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,7 +106,27 @@ public:
|
|||
PropertyWidget(const QString &title, QWidget *parent = 0, Qt::WindowFlags flags = 0);
|
||||
~PropertyWidget();
|
||||
|
||||
private:
|
||||
public:
|
||||
typedef enum _FormualType
|
||||
{
|
||||
// 计算
|
||||
Compute=0,
|
||||
// 连接
|
||||
Connect,
|
||||
// 换行连接
|
||||
ConnectEnter,
|
||||
// 换行连接显行线
|
||||
ConnectEnterRowLine,
|
||||
// 空格连接
|
||||
ConnectSpace,
|
||||
ComputeSpace,
|
||||
ComputeCLearZero,
|
||||
ComputeNODIGEqueSPACE,
|
||||
TailConnectEnterRowLine,
|
||||
LetterAndNumber
|
||||
} FormualType;
|
||||
|
||||
private:
|
||||
QtTreePropertyBrowser *m_pPropertyBrowser;
|
||||
QtVariantPropertyManager *m_pVariantManager;
|
||||
QtColorSchemeComboBoxPropertyManager * m_pColorSchemeManager;
|
||||
|
|
@ -146,8 +166,12 @@ public:
|
|||
//图头, 图例宽高
|
||||
double m_colWidth_Img = 1;
|
||||
double m_rowHeight_Img = 1;
|
||||
|
||||
//公式
|
||||
QString m_strFormulaText = "";
|
||||
// 公式操作符类型
|
||||
FormualType m_FormulaType;
|
||||
|
||||
//图头, 行高、列宽
|
||||
double m_colWidth = 1;
|
||||
double m_rowHeight = 1;
|
||||
|
|
@ -186,10 +210,24 @@ public:
|
|||
void _CreateEnumPropertyItem(QString strGroup, QString strPropertyCaption, QVariant vtPropertyValue, QStringList listValue);
|
||||
|
||||
QtProperty* _CreateColorSchemePropertyItem(QString strGroup, QString strPropertyCaption, QVariant vtPropertyValue, int nclr);
|
||||
|
||||
QtProperty* _CreateFormulaPropertyItem(QString strGroup, QString strPropertyCaption, QVariant vtPropertyValue);
|
||||
//读取图头公式
|
||||
void ReadWellRoundDataToFormula();
|
||||
//获取表格的公式计算结果
|
||||
QString ComputeCell(CMemRdWt &mem, QString formulaStr);
|
||||
double ComputeValue(double d1,double d2,const QString &symbolTag);
|
||||
//解析公式字段
|
||||
QStringList ParseCellFormula(QString formulaStr, QStringList &symbolList, QStringList &reatinList);
|
||||
double CanConvertToDouble(const QString &value,int ratin,bool &canOk);
|
||||
QStringList ReadFormulaValues(CMemRdWt &mem,const QStringList &formulaList);
|
||||
QString ReadSlfTableValue(CMemRdWt &mem, const QString &formula);
|
||||
PropertyWidget::FormualType GetFormualType();
|
||||
void ParseFormualInfos(const QString &formual,
|
||||
QString &TableName, QString &FieldName,
|
||||
QString &RecordNo, int &DecNum, bool &isSuccess);
|
||||
|
||||
//
|
||||
void InitCurrentViewInfo(bool bAll = true); //初始化属性,清空
|
||||
void initWidgetProperty(QString strUuid, int iScale); //可视解释整体属性
|
||||
//井
|
||||
|
|
|
|||
|
|
@ -4349,6 +4349,8 @@ void MainWindowCurve::_slotExport(QPrinter &printer, int IsBmp, QString pngName,
|
|||
PropertyService()->initWidgetProperty(m_strUuid, m_iScale);
|
||||
//取消所有选中单元格
|
||||
emit CallManage::getInstance()->sig_Raise(m_strUuid, "", "", "", "", 0, "");
|
||||
//取消其他表格的选中状态(图头、成果表)
|
||||
emit CallManage::getInstance()->sig_UnSelectTableItem("");
|
||||
|
||||
//默认选中-竖屏
|
||||
m_hvDraw->setChecked(true);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user