X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROGUI%2FHYDROGUI_CalculationOp.cxx;h=134c3bd0b2996beb4d13914db545b34c115e382b;hb=58bb6b7459bebeeb089c9ed486c4683a8bae7288;hp=797e5fcad695d79413accb4b8fe59362eb35b966;hpb=a0f46af000e5038df100106897aa04901ad59e49;p=modules%2Fhydro.git diff --git a/src/HYDROGUI/HYDROGUI_CalculationOp.cxx b/src/HYDROGUI/HYDROGUI_CalculationOp.cxx index 797e5fca..134c3bd0 100644 --- a/src/HYDROGUI/HYDROGUI_CalculationOp.cxx +++ b/src/HYDROGUI/HYDROGUI_CalculationOp.cxx @@ -98,6 +98,13 @@ void HYDROGUI_CalculationOp::startOperation() QStringList anEntryList; HYDROData_SequenceOfObjects aSeq = HYDROGUI_Tool::GetGeometryObjects( module() ); getNamesAndEntries( aSeq, aList, anEntryList ); + + QStringList List1; + QStringList EList1; + + //add intersection polylines + AddInterPolylinesToList(aList, anEntryList); + aPanel->setAllGeomObjects( aList, anEntryList ); // Get all polylines @@ -147,7 +154,10 @@ void HYDROGUI_CalculationOp::startOperation() aPanel->setBoundary( aPolylineName ); } - aSeq = myEditedObject->GetGeometryObjects(); + aSeq = myEditedObject->GetGeometryObjects(); + HYDROData_SequenceOfObjects anInterPolyList = myEditedObject->GetInterPolyObjects(); + aSeq.Append(anInterPolyList); + getNamesAndEntries( aSeq, aList, anEntryList ); aPanel->includeGeomObjects( aList ); @@ -171,6 +181,26 @@ void HYDROGUI_CalculationOp::startOperation() createPreview( false ); } +void HYDROGUI_CalculationOp::AddInterPolylinesToList(QStringList& theList, QStringList& theEntryList) +{ + HYDROData_Iterator anIter( doc(), KIND_POLYLINEXY ); + Handle(HYDROData_PolylineXY) aPolylineObj; + QString aPolylineName; + for ( ; anIter.More(); anIter.Next() ) + { + aPolylineObj = Handle(HYDROData_PolylineXY)::DownCast( anIter.Current() ); + if ( !aPolylineObj.IsNull()) + { + aPolylineName = aPolylineObj->GetName(); + if ( !aPolylineName.isEmpty() && !theList.contains(aPolylineName) ) + { + theList.append( aPolylineName ); + theEntryList.append(HYDROGUI_DataObject::dataObjectEntry( aPolylineObj )); + } + } + } +} + void HYDROGUI_CalculationOp::getNamesAndEntries( const HYDROData_SequenceOfObjects& theSeq, QStringList& theNames, QStringList& theEntries ) const { @@ -510,6 +540,17 @@ void HYDROGUI_CalculationOp::onAddObjects() anAddedList.append( anObject->GetName() ); } + for (int i = 0; i < aSelectedList.length(); i++) + { + Handle(HYDROData_PolylineXY) aPoly = Handle(HYDROData_PolylineXY)::DownCast( + HYDROGUI_Tool::FindObjectByName( module(), aSelectedList.at( i ) ) ); + if ( aPoly.IsNull() ) + continue; + + if ( myEditedObject->AddInterPoly( aPoly ) ) + anAddedList.append( aPoly->GetName() ); + } + if ( !anAddedList.isEmpty() ) { aPanel->includeGeomObjects( anAddedList ); @@ -540,6 +581,17 @@ void HYDROGUI_CalculationOp::onRemoveObjects() myEditedObject->RemoveGeometryObject( anObject ); } + for (int i = 0; i < aSelectedList.length(); i++) + { + Handle(HYDROData_PolylineXY) aPoly = Handle(HYDROData_PolylineXY)::DownCast( + HYDROGUI_Tool::FindObjectByName( module(), aSelectedList.at(i) ) ); + if ( aPoly.IsNull() ) + continue; + + setObjectVisibility( aPoly, false ); + myEditedObject->RemoveInterPolyObject ( aPoly ); + } + module()->update( UF_OCCViewer ); aPanel->excludeGeomObjects( aSelectedList ); } @@ -1156,7 +1208,9 @@ void HYDROGUI_CalculationOp::createPreview( const bool theLandCoverMap ) else if ( !theLandCoverMap && myShowGeomObjects ) { HYDROData_SequenceOfObjects aSeqGO = myEditedObject->GetGeometryObjects(); + HYDROData_SequenceOfObjects aSeqP = myEditedObject->GetInterPolyObjects(); aSeq.Append( aSeqGO ); + aSeq.Append( aSeqP ); } Handle(HYDROData_Entity) anEntity; @@ -1184,7 +1238,8 @@ void HYDROGUI_CalculationOp::createPreview( const bool theLandCoverMap ) } // Get a boundary polyline if any - aSeq.Append( myEditedObject->GetBoundaryPolyline() ); + if (Handle(HYDROData_PolylineXY) aBPoly = myEditedObject->GetBoundaryPolyline()) + aSeq.Append( aBPoly ); module()->removeViewShapes( HYDROGUI_Module::VMR_PreviewCaseZones ); @@ -1221,16 +1276,19 @@ void HYDROGUI_CalculationOp::createPreview( const bool theLandCoverMap ) HYDROData_SequenceOfObjects::Iterator anIter( aSeq ); for ( ; anIter.More(); anIter.Next() ) { - setObjectVisibility( anIter.Value(), true ); + const Handle(HYDROData_Entity)& ent = anIter.Value(); + if (!ent.IsNull()) + setObjectVisibility( ent, true ); } //Process the draw events for viewer QApplication::processEvents( QEventLoop::ExcludeUserInputEvents ); - if ( OCCViewer_ViewWindow* vw = (OCCViewer_ViewWindow*)myPreviewViewManager->getActiveView() ) - vw->onTopView(); } module()->update( UF_OCCViewer | UF_FitAll ); + + if ( OCCViewer_ViewWindow* vw = (OCCViewer_ViewWindow*)myPreviewViewManager->getActiveView() ) + vw->onTopView(); } }