aPanel->setObjectName( anObjectName );
aPanel->setEditedObject( myEditedObject );
-// aPanel->setSelectedGeomObjects( aSelectedObjects );
createPreview();
}
{
updateGeomObjectsList( aPanel );
}
+ createPreview();
}
void HYDROGUI_CalculationOp::onRemoveObjects()
anObject = Handle(HYDROData_Object)::DownCast( anEntity );
if ( !anObject.IsNull() )
{
+ module()->removeObjectShape( HYDROGUI_Module::VMR_PreviewCaseZones, anObject );
myEditedObject->RemoveGeometryObject( anObject );
}
}
if ( !aPanel )
return false;
- //QString anObjectName = aPanel->getObjectName().simplified();
- //if ( anObjectName.isEmpty() )
- //{
- // theErrorMsg = tr( "INCORRECT_OBJECT_NAME" );
- // return false;
- //}
-
- //// check that there are no other objects with the same name in the document
- //if( !myIsEdit || ( !myEditedObject.IsNull() && myEditedObject->GetName() != anObjectName ) )
- //{
- // Handle(HYDROData_Entity) anObject = HYDROGUI_Tool::FindObjectByName( module(), anObjectName );
- // if ( !anObject.IsNull() )
- // {
- // theErrorMsg = tr( "OBJECT_EXISTS_IN_DOCUMENT" ).arg( anObjectName );
- // return false;
- // }
- //}
-
- //Handle(HYDROData_Document) aDocument = doc();
-
- //Handle(HYDROData_CalculationCase) aCalculObj = myIsEdit ? myEditedObject :
- // Handle(HYDROData_CalculationCase)::DownCast( aDocument->CreateObject( KIND_CALCULATION ) );
- //if ( aCalculObj.IsNull() )
- // return false;
-
- //aCalculObj->SetName( anObjectName );
-
- //QStringList aRefObjectNames = aPanel->getSelectedGeomObjects();
- //HYDROData_SequenceOfObjects aGeomObjects =
- // HYDROGUI_Tool::FindObjectsByNames( module(), aRefObjectNames );
-
theUpdateFlags = UF_Model;
return true;
void HYDROGUI_CalculationOp::onSplitZones()
{
- //myRegionsList.clear();
-
HYDROGUI_CalculationDlg* aPanel =
::qobject_cast<HYDROGUI_CalculationDlg*>( inputPanel() );
if ( !aPanel )
QApplication::setOverrideCursor( Qt::WaitCursor );
- //QStringList aGeomObjectNames = aPanel->getSelectedGeomObjects();
- //HYDROData_SequenceOfObjects aGeomObjects =
- // HYDROGUI_Tool::FindObjectsByNames( module(), aGeomObjectNames );
-
- //QStringList aResSplittedZones;
-
- //HYDROData_SplitToZonesTool::SplitDataList aSplittedZones =
- // HYDROData_SplitToZonesTool::SplitToZones( aGeomObjects );
-
- //QStringList aUsedNames;
-
- //HYDROData_SplitToZonesTool::SplitDataListIterator anIter( aSplittedZones );
- //while( anIter.hasNext() )
- //{
- // Region aRegion;
- // aRegion.SplitData = anIter.next();
-
- // aRegion.FillingColor = HYDROGUI_Tool::GenerateFillingColor( module(), aRegion.SplitData.ObjectNames );
- // aRegion.BorderColor = QColor( HYDROData_ImmersibleZone::DefaultBorderColor() );
-
- // aRegion.RegionName = HYDROGUI_Tool::GenerateObjectName( module(), "Region", aUsedNames );
-
- // aUsedNames.append( aRegion.RegionName );
-
- // aResSplittedZones.append( aRegion.RegionName );
-
- // myRegionsList.append( aRegion );
- //}
- //
-
myEditedObject->SplitGeometryObjects();
aPanel->setEditedObject( myEditedObject );
createPreview();
void HYDROGUI_CalculationOp::createPreview()
{
LightApp_Application* anApp = module()->getApp();
+ HYDROData_SequenceOfObjects aSeq = myEditedObject->GetGeometryObjects();
+ module()->removeViewShapes( HYDROGUI_Module::VMR_PreviewCaseZones );
if ( !myActiveViewManager )
{
- if ( myRegionsList.isEmpty() )
+ if ( aSeq.IsEmpty() )
return;
myActiveViewManager = anApp->activeViewManager();
Handle(AIS_InteractiveContext) aCtx = aViewer->getAISContext();
if ( !aCtx.IsNull() )
{
- RegionsList::iterator anIter = myRegionsList.begin();
- for ( ; anIter != myRegionsList.end(); ++anIter )
+ HYDROData_SequenceOfObjects::Iterator anIter( aSeq );
+ Handle(HYDROData_Object) anObject;
+ Handle(HYDROData_Entity) anEntity;
+ HYDROGUI_Shape* aShape;
+ for ( ; anIter.More(); anIter.Next() )
{
- Region& aRegion = *anIter;
- if ( aRegion.Shape )
+ anEntity = anIter.Value();
+ if ( !anEntity.IsNull() )
{
- aRegion.Shape->erase( false );
- delete aRegion.Shape;
+ anObject = Handle(HYDROData_Object)::DownCast( anEntity );
+ if ( !anObject.IsNull() )
+ {
+ aShape = module()->getObjectShape( HYDROGUI_Module::VMR_PreviewCaseZones, anObject );
+ if ( !aShape )
+ {
+ aShape = new HYDROGUI_Shape( aCtx, anObject );
+ }
+ aShape->update();
+ module()->setObjectShape( HYDROGUI_Module::VMR_PreviewCaseZones, anObject, aShape );
+ }
}
-
- aRegion.Shape = new HYDROGUI_Shape( aCtx, NULL );
-
- aRegion.Shape->setFillingColor( aRegion.FillingColor, false, false );
- aRegion.Shape->setBorderColor( aRegion.BorderColor, false, false );
- aRegion.Shape->setFace( aRegion.SplitData.Face(), true, false );
}
//Process the draw events for viewer
void HYDROGUI_CalculationOp::closePreview()
{
- RegionsList::iterator anIter= myRegionsList.begin();
- for ( ; anIter != myRegionsList.end(); ++anIter )
- {
- Region& aRegion = *anIter;
- if ( aRegion.Shape )
- {
- aRegion.Shape->erase( false );
- delete aRegion.Shape;
- aRegion.Shape = NULL;
- }
- }
-
if( myPreviewViewManager )
{
disconnect( myPreviewViewManager, SIGNAL( lastViewClosed( SUIT_ViewManager* ) ),