// Connect signals and slots
connect( aPanel, SIGNAL( addObjects() ), SLOT( onAddObjects() ) );
connect( aPanel, SIGNAL( removeObjects() ), SLOT( onRemoveObjects() ) );
- connect( aPanel, SIGNAL( splitZones() ), SLOT( onSplitZones() ) );
- connect( aPanel, SIGNAL( hideZones() ), SLOT( onHideZones() ) );
+ connect( aPanel, SIGNAL( Next( const int ) ), SLOT( onSplitZones() ) );
+ connect( aPanel, SIGNAL( Back( const int ) ), SLOT( onHideZones() ) );
connect( aPanel, SIGNAL( clicked( SUIT_DataObject* ) ), SLOT( onSelected( SUIT_DataObject* ) ) );
connect( aPanel, SIGNAL( setMergeType( int, QString& ) ), SLOT( onSetMergeType( int, QString& ) ) );
connect( aPanel, SIGNAL( moveZones( SUIT_DataObject*, const QList<SUIT_DataObject*>& ) ),
void HYDROGUI_CalculationOp::onBoundarySelected ( const QString & theObjName )
{
- // Set the selected boundary polyline to the calculation case
- Handle(HYDROData_PolylineXY) anObject;
- Handle(AIS_InteractiveContext) aCtx;
- if ( myPreviewViewManager )
- {
- if ( OCCViewer_Viewer* aViewer = myPreviewViewManager->getOCCViewer() )
- {
- aCtx = aViewer->getAISContext();
- }
- }
+ bool anIsToUpdateViewer = false;
+
// Remove the old boundary from the operation viewer
- anObject = myEditedObject->GetBoundaryPolyline();
- if ( !anObject.IsNull() )
+ Handle(HYDROData_PolylineXY) aPrevPolyline =
+ myEditedObject->GetBoundaryPolyline();
+ if ( !aPrevPolyline.IsNull() )
{
- module()->removeObjectShape( HYDROGUI_Module::VMR_PreviewCaseZones, anObject );
+ module()->removeObjectShape( HYDROGUI_Module::VMR_PreviewCaseZones, aPrevPolyline );
+ anIsToUpdateViewer = true;
}
- if ( theObjName.trimmed().isEmpty() )
- {
- // No polyline is selected
- myEditedObject->RemoveBoundaryPolyline();
- }
- else
+ // Set the selected boundary polyline to the calculation case
+ Handle(HYDROData_PolylineXY) aNewPolyline = Handle(HYDROData_PolylineXY)::DownCast(
+ HYDROGUI_Tool::FindObjectByName( module(), theObjName, KIND_POLYLINEXY ) );
+ myEditedObject->SetBoundaryPolyline( aNewPolyline );
+
+ if ( myPreviewViewManager )
{
- Handle(HYDROData_Entity) anEntity =
- HYDROGUI_Tool::FindObjectByName( module(), theObjName, KIND_POLYLINEXY );
- if ( !anEntity.IsNull() )
+ OCCViewer_Viewer* aViewer = myPreviewViewManager->getOCCViewer();
+ if ( aViewer )
{
- anObject = Handle(HYDROData_PolylineXY)::DownCast( anEntity );
- if ( !anObject.IsNull() )
+ if ( !aNewPolyline.IsNull() )
{
- myEditedObject->SetBoundaryPolyline( anObject );
+ Handle(AIS_InteractiveContext) aCtx = aViewer->getAISContext();
if ( !aCtx.IsNull() )
{
- showObject( anEntity, aCtx );
+ showObject( aNewPolyline, aCtx );
+ anIsToUpdateViewer = true;
}
}
+
+ if ( anIsToUpdateViewer )
+ aViewer->update();
}
}
}
if ( myEditedObject->IsMustBeUpdated() )
{
myShowZones = true;
- myEditedObject->SplitGeometryObjects();
+ myEditedObject->Update();
aPanel->setEditedObject( myEditedObject );
}
}
}
+
+ aViewer->update();
}
}
}
if ( OCCViewer_ViewWindow* vw = (OCCViewer_ViewWindow*)myPreviewViewManager->getActiveView() )
vw->onTopView();
}
+
+ aViewer->update();
}
}
aShape = new HYDROGUI_Shape( theCtx, theEntity );
module()->setObjectShape( HYDROGUI_Module::VMR_PreviewCaseZones, theEntity, aShape );
}
- aShape->update();
+ aShape->update( false );
}
}