@ -1247,6 +1247,9 @@ void QMyCustomPlot::contextMenuEvent(QContextMenuEvent *event)
menu . addAction ( QIcon ( : : GetImagePath ( ) + " icon/Split.png " ) , " 分割为层内层 " , this , & QMyCustomPlot : : segmentationInnerLayer ) ;
menu . addAction ( QIcon ( : : GetImagePath ( ) + " icon/Split.png " ) , " 分割为独立层 " , this , & QMyCustomPlot : : segmentationIndependentLayer ) ;
menu . addAction ( QIcon ( : : GetImagePath ( ) + " icon/Split.png " ) , " 拆分复合层成独立层 " , this , & QMyCustomPlot : : splitIndependentLayer ) ;
QMap < double , TransparentGroupResult * > mapsort = this - > getSelectGroupResult ( ) ;
if ( mapsort . size ( ) > 1 )
menu . addAction ( QIcon ( : : GetImagePath ( ) + " icon/decreasey.png " ) , " 合并 " , this , & QMyCustomPlot : : megResultLayer ) ;
}
menu . exec ( event - > globalPos ( ) ) ;
@ -3682,6 +3685,18 @@ void QMyCustomPlot::addItems_Gujing()
//取消选中
void QMyCustomPlot : : ClearSelectItems ( )
{
if ( m_strLineName = = " RESULT " )
{
QMap < double , TransparentGroupResult * > mapsort = this - > getSelectGroupResult ( ) ;
QList < TransparentGroupResult * > listGroup = mapsort . values ( ) ;
for ( int i = 0 ; i < listGroup . size ( ) ; i + + )
{
TransparentGroupResult * pGroup = listGroup . at ( i ) ;
if ( pGroup = = NULL )
continue ;
pGroup - > setSelectRect ( false ) ;
}
}
//属性清空
PropertyService ( ) - > InitCurrentViewInfo ( ) ;
}
@ -6888,6 +6903,7 @@ void QMyCustomPlot::DeleteItemGroup()
continue ;
pGroup - > removeAllResult ( ) ;
}
SaveToSLF_Result ( ) ;
}
}
@ -6915,6 +6931,284 @@ void QMyCustomPlot::updateGroupZone()
nZid + + ;
}
this - > replot ( ) ;
SaveToSLF_Result ( ) ;
}
bool QMyCustomPlot : : SaveToSLF_Result ( )
{
static int isrun = false ;
if ( isrun ) return false ;
QString ss = m_strSlfName ;
if ( ss = = " " ) return false ;
isrun = true ;
CMemRdWt * logio = new CMemRdWt ( ) ;
if ( ss = = " " | | ! logio - > Open ( ss . toStdString ( ) . c_str ( ) , CSlfIO : : modeReadWrite ) )
{
delete logio ;
QMessageBox : : information ( NULL , " 提示 " , " SLF文件打开失败, 请检查! ! " , QMessageBox : : Yes ) ;
isrun = false ;
return false ;
}
int resultGroupSize = m_mapDragGroup . size ( ) ;
bool isfirst = false ;
int iIndex = logio - > OpenTable ( m_strLineName . toStdString ( ) . c_str ( ) ) ;
if ( iIndex < 0 )
{
if ( ! resultGroupSize ) {
delete logio ;
isrun = false ;
return false ;
}
iIndex = logio - > Open_Set_Table ( m_strLineName . toStdString ( ) . c_str ( ) , 0 , 35 ,
" NO,SDEP,EDEP,ZONE,RESULTNO,THICK,TT,MDEPTH1,MDEPTH2,MDEPTH3,MDEPTH4,MDEPTH5,MDEPTH6,MDEPTH7,MDEPTH8,MDEPTH9,MDEPTH10,OIL,POOROIL,OILWATER,WATEROIL,GAS,POORGAS,GASWATER,WATERGAS,DEST1,DEST2,DEST3,DEST4,DEST5,DEST6,DEST7,DEST8,DEST9,DEST10,SDEP1,EDEP1,SDEP2,EDEP2,SDEP3,EDEP3,SDEP4,EDEP4,SDEP5,EDEP5,SDEP6,EDEP6,SDEP7,EDEP7,SDEP8,EDEP8,SDEP9,EDEP9,SDEP10,EDEP10 " ,
" 4,4,4,8,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,48,48,48,48,48,48,48,48,48,48,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 " , //字段长度
" 1,4,4,6,1,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,6,6,6,6,6,6,6,6,6,6,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 " , //字段类型
" 0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 " ) ; //字段备注
isfirst = true ;
}
logio - > SetTableRecordCount ( iIndex , resultGroupSize ) ; //-nn);
if ( ! resultGroupSize ) {
delete logio ;
//if (isfirst)AddTableToWellRound();
isrun = false ;
return false ;
}
QMap < QString , QString > zoneOrder = GetZoneOrder ( ) ;
LAYER_DATA m_Result ;
QMap < double , TransparentGroupResult * > mapSortGroup ;
QMap < QString , QObject * > : : iterator it = m_mapDragGroup . begin ( ) ;
for ( ; it ! = m_mapDragGroup . end ( ) ; + + it )
{
TransparentGroupResult * pGroup = qobject_cast < TransparentGroupResult * > ( it . value ( ) ) ;
if ( pGroup = = nullptr )
continue ;
mapSortGroup . insert ( pGroup - > getRange ( ) . upper , pGroup ) ;
}
QList < TransparentGroupResult * > listGroup = mapSortGroup . values ( ) ;
for ( int i = 0 ; i < listGroup . size ( ) ; i + + )
{
TransparentGroupResult * pGroup = listGroup . at ( i ) ;
if ( pGroup = = NULL )
continue ;
memset ( & m_Result , 0 , sizeof ( LAYER_DATA ) ) ;
m_Result . StartDepth = - pGroup - > getRange ( ) . upper ;
m_Result . EndDepth = - pGroup - > getRange ( ) . lower ;
m_Result . Result = pGroup - > getNResult ( ) ;
const QVector < QString > & vec = pGroup - > getVecResult ( ) ;
const QMap < QString , QObject * > & mapResult = pGroup - > getMapDraggable_Result ( ) ;
QVector < double > vecDepth ;
QVector < int > vecResult ;
//vecDepth << 0.0;
//vecResult << 0;
//QString strRet = "";
for ( int k = 0 ; k < vec . size ( ) ; k + + )
{
TransparentDraggableResult * pret = qobject_cast < TransparentDraggableResult * > ( mapResult . value ( vec . at ( k ) ) ) ;
if ( pret = = NULL )
continue ;
QCPRange rg = pret - > getRange ( ) ;
vecDepth < < - rg . upper ;
QFileInfo finfo ( pret - > getResult ( ) ) ;
QString s = zoneOrder . value ( finfo . baseName ( ) ) ;
//QString str = QString("%1").arg(s.toInt(), 2, 10, QChar('0'));
//strRet += str;
vecResult < < s . toInt ( ) ;
}
QByteArray btzone = UTF8ToGBK ( pGroup - > getTitle ( ) ) ;
strcpy ( m_Result . Zone , btzone . data ( ) ) ;
QByteArray btrmk = UTF8ToGBK ( pGroup - > getRemark ( ) ) ;
strcpy ( m_Result . Description10 , btrmk . data ( ) ) ;
//strcpy(m_Result.szResult, strRet.toStdString().c_str());
m_Result . Result = 0 ;
int n = vecDepth . size ( ) ;
if ( n > 0 )
{
m_Result . Result = 10 * m_Result . Result + vecResult . at ( 0 ) ;
}
if ( n > 1 )
{
m_Result . MDepth1 = vecDepth . at ( 1 ) ;
m_Result . Result = 10 * m_Result . Result + vecResult . at ( 1 ) ;
}
if ( n > 2 )
{
m_Result . MDepth2 = vecDepth . at ( 2 ) ;
m_Result . Result = 10 * m_Result . Result + vecResult . at ( 2 ) ;
}
if ( n > 3 )
{
m_Result . MDepth3 = vecDepth . at ( 3 ) ;
m_Result . Result = 10 * m_Result . Result + vecResult . at ( 3 ) ;
}
if ( n > 4 )
{
m_Result . MDepth4 = vecDepth . at ( 4 ) ;
m_Result . Result = 10 * m_Result . Result + vecResult . at ( 4 ) ;
}
if ( n > 5 )
{
m_Result . MDepth5 = vecDepth . at ( 5 ) ;
m_Result . Result = 10 * m_Result . Result + vecResult . at ( 5 ) ;
}
if ( n > 6 )
{
m_Result . MDepth6 = vecDepth . at ( 6 ) ;
m_Result . Result = 10 * m_Result . Result + vecResult . at ( 6 ) ;
}
if ( n > 7 )
{
m_Result . MDepth7 = vecDepth . at ( 7 ) ;
m_Result . Result = 10 * m_Result . Result + vecResult . at ( 7 ) ;
}
if ( n > 8 )
{
m_Result . MDepth8 = vecDepth . at ( 8 ) ;
m_Result . Result = 10 * m_Result . Result + vecResult . at ( 8 ) ;
}
if ( n > 9 )
{
m_Result . MDepth9 = vecDepth . at ( 9 ) ;
m_Result . Result = 10 * m_Result . Result + vecResult . at ( 9 ) ;
}
if ( n > 10 )
{
m_Result . MDepth10 = vecDepth . at ( 10 ) ;
m_Result . Result = 10 * m_Result . Result + vecResult . at ( 10 ) ;
}
logio - > WriteTable ( iIndex , i + 1 , & m_Result ) ;
}
/*
foreach ( WelllogItem * iter , items )
{
if ( ! iter ) continue ;
memset ( & m_Result , 0 , sizeof ( LAYER_DATA ) ) ;
m_Result . StartDepth = iter - > GetTopDepth ( ) ;
m_Result . EndDepth = iter - > GetBottomDepth ( ) ;
if ( m_Result . EndDepth - m_Result . StartDepth < = 0 ) {
continue ;
}
OGResultItem * pResult = dynamic_cast < OGResultItem * > ( iter ) ;
m_Result . Order = j ;
m_Result . Result = 0 ;
m_Result . MDepth1 = pResult - > m_MDepth1 ;
m_Result . MDepth2 = pResult - > m_MDepth2 ;
m_Result . MDepth3 = pResult - > m_MDepth3 ;
m_Result . MDepth4 = pResult - > m_MDepth4 ;
m_Result . MDepth5 = pResult - > m_MDepth5 ;
m_Result . MDepth6 = pResult - > m_MDepth6 ;
m_Result . MDepth7 = pResult - > m_MDepth7 ;
m_Result . MDepth8 = pResult - > m_MDepth8 ;
m_Result . MDepth9 = pResult - > m_MDepth9 ;
m_Result . MDepth10 = pResult - > m_MDepth10 ;
QString innerresult = pResult - > GetIntResult ( ) ;
if ( innerresult ! = " " ) m_Result . Result = innerresult . toInt ( ) ;
if ( m_Result . Result < 0 ) m_Result . Result = 0 ;
innerresult = pResult - > GetIntResult1 ( ) ;
if ( innerresult ! = " " & & m_Result . MDepth1 )
{
m_Result . Result = 10 * m_Result . Result + innerresult . toInt ( ) ;
}
innerresult = pResult - > GetIntResult2 ( ) ;
if ( innerresult ! = " " & & m_Result . MDepth2 )
{
m_Result . Result = 10 * m_Result . Result + innerresult . toInt ( ) ;
}
innerresult = pResult - > GetIntResult3 ( ) ;
if ( innerresult ! = " " & & m_Result . MDepth3 ) {
m_Result . Result = m_Result . Result * 10 + innerresult . toInt ( ) ;
}
innerresult = pResult - > GetIntResult4 ( ) ;
if ( innerresult ! = " " & & m_Result . MDepth4 ) {
m_Result . Result = m_Result . Result * 10 + innerresult . toInt ( ) ;
}
innerresult = pResult - > GetIntResult5 ( ) ;
if ( innerresult ! = " " & & m_Result . MDepth5 ) {
m_Result . Result = m_Result . Result * 10 + innerresult . toInt ( ) ;
}
innerresult = pResult - > GetIntResult6 ( ) ;
if ( innerresult ! = " " & & m_Result . MDepth6 ) {
m_Result . Result = m_Result . Result * 10 + innerresult . toInt ( ) ;
}
innerresult = pResult - > GetIntResult7 ( ) ;
if ( innerresult ! = " " & & m_Result . MDepth7 ) {
m_Result . Result = m_Result . Result * 10 + innerresult . toInt ( ) ;
}
innerresult = pResult - > GetIntResult8 ( ) ;
if ( innerresult ! = " " & & m_Result . MDepth8 ) {
m_Result . Result = m_Result . Result * 10 + innerresult . toInt ( ) ;
}
innerresult = pResult - > GetIntResult9 ( ) ;
if ( innerresult ! = " " & & m_Result . MDepth9 ) {
m_Result . Result = m_Result . Result * 10 + innerresult . toInt ( ) ;
}
innerresult = pResult - > GetIntResult10 ( ) ;
if ( innerresult ! = " " & & m_Result . MDepth10 ) {
m_Result . Result = m_Result . Result * 10 + innerresult . toInt ( ) ;
}
strcpy ( m_Result . Zone , pResult - > Zone . toStdString ( ) . c_str ( ) ) ;
ComputeTT ( m_Result ,
pResult - > result ,
pResult - > result1 ,
pResult - > result2 ,
pResult - > result3 ,
pResult - > result4 ,
pResult - > result5 ,
pResult - > result6 ,
pResult - > result7 ,
pResult - > result8 ,
pResult - > result9 ,
pResult - > result10
) ;
strcpy ( m_Result . Description1 , pResult - > Description1 . toStdString ( ) . c_str ( ) ) ;
strcpy ( m_Result . Description2 , pResult - > Description2 . toStdString ( ) . c_str ( ) ) ;
strcpy ( m_Result . Description3 , pResult - > Description3 . toStdString ( ) . c_str ( ) ) ;
strcpy ( m_Result . Description4 , pResult - > Description4 . toStdString ( ) . c_str ( ) ) ;
strcpy ( m_Result . Description5 , pResult - > Description5 . toStdString ( ) . c_str ( ) ) ;
strcpy ( m_Result . Description6 , pResult - > Description6 . toStdString ( ) . c_str ( ) ) ;
strcpy ( m_Result . Description7 , pResult - > Description7 . toStdString ( ) . c_str ( ) ) ;
strcpy ( m_Result . Description8 , pResult - > Description8 . toStdString ( ) . c_str ( ) ) ;
strcpy ( m_Result . Description9 , pResult - > Description9 . toStdString ( ) . c_str ( ) ) ;
strcpy ( m_Result . Description10 , pResult - > Description10 . toStdString ( ) . c_str ( ) ) ;
m_Result . Sdep1 = pResult - > m_SDEP1 ;
m_Result . Edep1 = pResult - > m_EDEP1 ;
m_Result . Sdep2 = pResult - > m_SDEP2 ;
m_Result . Edep2 = pResult - > m_EDEP2 ;
m_Result . Sdep3 = pResult - > m_SDEP3 ;
m_Result . Edep3 = pResult - > m_EDEP3 ;
m_Result . Sdep4 = pResult - > m_SDEP4 ;
m_Result . Edep4 = pResult - > m_EDEP4 ;
m_Result . Sdep5 = pResult - > m_SDEP5 ;
m_Result . Edep5 = pResult - > m_EDEP5 ;
m_Result . Sdep6 = pResult - > m_SDEP6 ;
m_Result . Edep6 = pResult - > m_EDEP6 ;
m_Result . Sdep7 = pResult - > m_SDEP7 ;
m_Result . Edep7 = pResult - > m_EDEP7 ;
m_Result . Sdep8 = pResult - > m_SDEP8 ;
m_Result . Edep8 = pResult - > m_EDEP8 ;
m_Result . Sdep9 = pResult - > m_SDEP9 ;
m_Result . Edep9 = pResult - > m_EDEP9 ;
m_Result . Sdep10 = pResult - > m_SDEP10 ;
m_Result . Edep10 = pResult - > m_EDEP10 ;
logio - > WriteTable ( iIndex , j + 1 , & m_Result ) ;
j + + ;
}
*/
logio - > CloseTable ( iIndex ) ;
delete logio ;
isrun = false ;
return true ;
}
TransparentGroupResult * QMyCustomPlot : : getCurGroupResult ( double x_val )
@ -6936,6 +7230,21 @@ TransparentGroupResult* QMyCustomPlot::getCurGroupResult(double x_val)
return pClickGroup ;
}
QMap < double , TransparentGroupResult * > QMyCustomPlot : : getSelectGroupResult ( )
{
QMap < double , TransparentGroupResult * > mapsort ;
QObjectList objList = m_mapDragGroup . values ( ) ;
for ( int i = 0 ; i < objList . size ( ) ; i + + )
{
TransparentGroupResult * pGroup = qobject_cast < TransparentGroupResult * > ( objList . at ( i ) ) ;
if ( pGroup = = nullptr | | ! pGroup - > getSelect ( ) )
continue ;
QCPRange rg = pGroup - > getRange ( ) ;
mapsort . insert ( - rg . upper , pGroup ) ;
}
return mapsort ;
}
void QMyCustomPlot : : segmentationInnerLayer ( )
{
//获取鼠标点位置
@ -6948,6 +7257,8 @@ void QMyCustomPlot::segmentationInnerLayer()
return ;
pClickGroup - > segmentationInnerLayer ( x_val ) ;
SaveToSLF_Result ( ) ;
}
void QMyCustomPlot : : segmentationIndependentLayer ( )
@ -7039,7 +7350,7 @@ void QMyCustomPlot::segmentationIndependentLayer()
}
pClickGroup - > removeAllResult ( ) ;
this - > replot ( ) ;
SaveToSLF_Result ( ) ;
}
void QMyCustomPlot : : splitIndependentLayer ( )
@ -7058,6 +7369,68 @@ void QMyCustomPlot::splitIndependentLayer()
// 删除原来的复合层
pClickGroup - > removeAllResult ( ) ;
this - > replot ( ) ;
SaveToSLF_Result ( ) ;
}
void QMyCustomPlot : : megResultLayer ( )
{
if ( QMessageBox : : information ( NULL , QObject : : tr ( " 提示 " ) , QObject : : tr ( " 合并为复合层? " ) , tr ( " 是 " ) , tr ( " 否 " ) ) ! = 0 ) return ;
// 筛选出选中的Group, 并且排序
QMap < double , TransparentGroupResult * > mapsort = this - > getSelectGroupResult ( ) ;
if ( mapsort . size ( ) < = 0 )
return ;
// 取出Group下面的DraggableResult, 并且调整 lower, 删除原来选中的Group
double dupper ;
double dlower ;
QVector < QPair < QCPRange , QString > > gr ;
QList < TransparentGroupResult * > listGroup = mapsort . values ( ) ;
for ( int i = 0 ; i < listGroup . size ( ) ; i + + )
{
TransparentGroupResult * pGroup = listGroup . at ( i ) ;
if ( pGroup = = NULL )
continue ;
if ( i = = 0 )
{
dupper = pGroup - > getRange ( ) . upper ;
}
if ( i = = listGroup . size ( ) - 1 )
{
dlower = pGroup - > getRange ( ) . lower ;
}
const QVector < QString > & vec = pGroup - > getVecResult ( ) ;
const QMap < QString , QObject * > & mapResult = pGroup - > getMapDraggable_Result ( ) ;
for ( int k = 0 ; k < vec . size ( ) ; k + + )
{
TransparentDraggableResult * pret = qobject_cast < TransparentDraggableResult * > ( mapResult . value ( vec . at ( k ) ) ) ;
if ( pret = = NULL )
continue ;
QCPRange rg = pret - > getRange ( ) ;
if ( i + 1 < listGroup . size ( ) )
{
TransparentGroupResult * pLowGroup = listGroup . at ( i + 1 ) ;
if ( pGroup )
rg . lower = pLowGroup - > getRange ( ) . upper ;
}
gr < < qMakePair ( rg , pret - > getResult ( ) ) ;
}
pGroup - > removeAllResult ( ) ;
}
// 生成新的Group
QString strUuid = " " ;
TransparentGroupResult * pNewG = this - > addResultGroup ( dlower , dupper , strUuid ) ;
strUuid = " " ;
for ( int i = 0 ; i < gr . size ( ) ; i + + )
{
const QPair < QCPRange , QString > & r = gr . at ( i ) ;
pNewG - > addResultToPlot ( r . first . lower , r . first . upper , r . second , strUuid ) ;
}
this - > replot ( ) ;
SaveToSLF_Result ( ) ;
}
bool QMyCustomPlot : : getIsEditor ( )