Crash after pre-viewing mesh translation

This commit is contained in:
eap 2018-11-14 16:41:52 +03:00 committed by vsr
parent 4be45a651b
commit 5ec2574399
12 changed files with 19 additions and 20 deletions

View File

@ -1339,7 +1339,7 @@ void SMESHGUI_BaseComputeOp::onShowBadMesh()
prop->SetPointSize( aPointSize * 3 ); prop->SetPointSize( aPointSize * 3 );
prop->SetColor( 250, 0, 250 ); prop->SetColor( 250, 0, 250 );
myBadMeshDisplayer->GetActor()->SetProperty( prop ); myBadMeshDisplayer->GetActor()->SetProperty( prop );
myBadMeshDisplayer->SetData( aMeshData._retn() ); myBadMeshDisplayer->SetData( aMeshData.in() );
prop->Delete(); prop->Delete();
} }
} }
@ -1979,11 +1979,10 @@ void SMESHGUI_PrecomputeOp::onPreview()
SMESH::MeshPreviewStruct_var previewData = SMESH::MeshPreviewStruct_var previewData =
gen->Precompute(myMesh, myMainShape, (SMESH::Dimension)dim, aShapesId); gen->Precompute(myMesh, myMainShape, (SMESH::Dimension)dim, aShapesId);
SMESH::MeshPreviewStruct* previewRes = previewData._retn(); if ( & previewData.in() && previewData->nodesXYZ.length() > 0 )
if ( previewRes && previewRes->nodesXYZ.length() > 0 )
{ {
computeFailed = false; computeFailed = false;
myPreviewDisplayer->SetData( previewRes ); myPreviewDisplayer->SetData( previewData );
// append shape indices with computed mesh entities // append shape indices with computed mesh entities
for ( int i = 0, n = aShapesId->length(); i < n; i++ ) for ( int i = 0, n = aShapesId->length(); i < n; i++ )
myMapShapeId[ aShapesId[ i ] ] = 0; myMapShapeId[ aShapesId[ i ] ] = 0;

View File

@ -265,7 +265,7 @@ bool SMESHGUI_ConvToQuadOp::onApply()
prop->Delete(); prop->Delete();
SMESH::MeshPreviewStruct_var previewData = aEditor->GetPreviewData(); SMESH::MeshPreviewStruct_var previewData = aEditor->GetPreviewData();
myBadElemsPreview->SetData( previewData._retn() ); myBadElemsPreview->SetData( previewData.in() );
myBadElemsPreview->SetVisibility(true); myBadElemsPreview->SetVisibility(true);
SUIT_MessageBox* mb = new SUIT_MessageBox(SUIT_MessageBox::Warning, SUIT_MessageBox* mb = new SUIT_MessageBox(SUIT_MessageBox::Warning,

View File

@ -1112,7 +1112,7 @@ void SMESHGUI_ExtrusionAlongPathDlg::onDisplaySimulation( bool toDisplayPreview
if( retVal == SMESH::SMESH_MeshEditor::EXTR_OK ) if( retVal == SMESH::SMESH_MeshEditor::EXTR_OK )
{ {
SMESH::MeshPreviewStruct_var aMeshPreviewStruct = meshEditor->GetPreviewData(); SMESH::MeshPreviewStruct_var aMeshPreviewStruct = meshEditor->GetPreviewData();
mySimulation->SetData( aMeshPreviewStruct._retn() ); mySimulation->SetData( aMeshPreviewStruct.in() );
} }
else { else {
hidePreview(); hidePreview();

View File

@ -1573,7 +1573,7 @@ void SMESHGUI_ExtrusionDlg::onDisplaySimulation( bool toDisplayPreview )
makeGroups ); makeGroups );
} }
SMESH::MeshPreviewStruct_var aMeshPreviewStruct = meshEditor->GetPreviewData(); SMESH::MeshPreviewStruct_var aMeshPreviewStruct = meshEditor->GetPreviewData();
mySimulation->SetData(aMeshPreviewStruct._retn()); mySimulation->SetData(aMeshPreviewStruct);
} catch (...) { } catch (...) {
hidePreview(); hidePreview();

View File

@ -536,7 +536,7 @@ void SMESHGUI_FindElemByPointOp::redisplayPreview()
myPreview->nodesXYZ[0].z = myDlg->myZ->GetValue(); myPreview->nodesXYZ[0].z = myDlg->myZ->GetValue();
if (!mySimulation) if (!mySimulation)
mySimulation = new SMESHGUI_MeshEditPreview(SMESH::GetViewWindow( mySMESHGUI )); mySimulation = new SMESHGUI_MeshEditPreview(SMESH::GetViewWindow( mySMESHGUI ));
mySimulation->SetData( myPreview._retn()); mySimulation->SetData( myPreview.in());
} }
//================================================================================ //================================================================================

View File

@ -811,9 +811,9 @@ void SMESHGUI_MakeNodeAtPointOp::redisplayPreview()
if (!mySimulation) if (!mySimulation)
mySimulation = new SMESHGUI_MeshEditPreview(SMESH::GetViewWindow( mySMESHGUI )); mySimulation = new SMESHGUI_MeshEditPreview(SMESH::GetViewWindow( mySMESHGUI ));
// display data // display data
if ( aMeshPreviewStruct.operator->() ) if ( & aMeshPreviewStruct.in() )
{ {
mySimulation->SetData(aMeshPreviewStruct._retn()); mySimulation->SetData( aMeshPreviewStruct.in() );
} }
else else
{ {

View File

@ -167,10 +167,10 @@ vtkIdType getCellType( const SMDSAbs_ElementType theType,
*/ */
//================================================================================ //================================================================================
void SMESHGUI_MeshEditPreview::SetData (const SMESH::MeshPreviewStruct_var previewData) void SMESHGUI_MeshEditPreview::SetData (const SMESH::MeshPreviewStruct& previewData)
{ {
// Create points // Create points
const SMESH::nodes_array& aNodesXYZ = previewData->nodesXYZ; const SMESH::nodes_array& aNodesXYZ = previewData.nodesXYZ;
vtkPoints* aPoints = vtkPoints::New(); vtkPoints* aPoints = vtkPoints::New();
aPoints->SetNumberOfPoints(aNodesXYZ.length()); aPoints->SetNumberOfPoints(aNodesXYZ.length());
@ -182,8 +182,8 @@ void SMESHGUI_MeshEditPreview::SetData (const SMESH::MeshPreviewStruct_var previ
aPoints->Delete(); aPoints->Delete();
// Create cells // Create cells
const SMESH::long_array& anElemConnectivity = previewData->elementConnectivities; const SMESH::long_array& anElemConnectivity = previewData.elementConnectivities;
const SMESH::types_array& anElemTypes = previewData->elementTypes; const SMESH::types_array& anElemTypes = previewData.elementTypes;
vtkIdType aCellsSize = anElemConnectivity.length() + anElemTypes.length(); vtkIdType aCellsSize = anElemConnectivity.length() + anElemTypes.length();
vtkIdType aNbCells = anElemTypes.length(); vtkIdType aNbCells = anElemTypes.length();

View File

@ -57,7 +57,7 @@ public:
SMESHGUI_MeshEditPreview( SVTK_ViewWindow* ); SMESHGUI_MeshEditPreview( SVTK_ViewWindow* );
~SMESHGUI_MeshEditPreview(); ~SMESHGUI_MeshEditPreview();
void SetData( const SMESH::MeshPreviewStruct_var ); void SetData( const SMESH::MeshPreviewStruct& );
void SetVisibility( bool ); void SetVisibility( bool );
void SetColor( double, double, double ); void SetColor( double, double, double );

View File

@ -1242,7 +1242,7 @@ void SMESHGUI_UnionOfTrianglesDlg::onDisplaySimulation( bool toDisplayPreview )
mySimulation->GetActor()->SetProperty( aProp ); mySimulation->GetActor()->SetProperty( aProp );
aProp->Delete(); aProp->Delete();
mySimulation->SetData( aMeshPreviewStruct._retn() ); mySimulation->SetData( aMeshPreviewStruct.in() );
} catch ( ... ) { } catch ( ... ) {
hidePreview(); hidePreview();
} }

View File

@ -248,7 +248,7 @@ void SMESHGUI_MultiPreviewDlg::setSimulationPreview( QList<SMESH::MeshPreviewStr
mySimulationList.clear(); mySimulationList.clear();
for ( int i = 0; i < theMeshPreviewStruct.count(); i++ ) { for ( int i = 0; i < theMeshPreviewStruct.count(); i++ ) {
mySimulationList << new SMESHGUI_MeshEditPreview( SMESH::GetViewWindow( mySMESHGUI ) ); mySimulationList << new SMESHGUI_MeshEditPreview( SMESH::GetViewWindow( mySMESHGUI ) );
mySimulationList[i]->SetData( theMeshPreviewStruct[i].operator->() ); mySimulationList[i]->SetData( theMeshPreviewStruct[i].in() );
} }
} }

View File

@ -933,9 +933,9 @@ void SMESHGUI_ReorientFacesOp::redisplayPreview()
// } // }
// // display data // // display data
// if ( aMeshPreviewStruct.operator->() ) // if ( & aMeshPreviewStruct.in() )
// { // {
// myVectorPreview->SetData(aMeshPreviewStruct._retn()); // myVectorPreview->SetData(aMeshPreviewStruct.in());
// } // }
// else // else
// { // {

View File

@ -796,7 +796,7 @@ void SMESHGUI_RevolutionDlg::onDisplaySimulation(bool toDisplayPreview)
anAxis, anAngle, aNbSteps, aTolerance, makeGroups ); anAxis, anAngle, aNbSteps, aTolerance, makeGroups );
SMESH::MeshPreviewStruct_var aMeshPreviewStruct = meshEditor->GetPreviewData(); SMESH::MeshPreviewStruct_var aMeshPreviewStruct = meshEditor->GetPreviewData();
mySimulation->SetData( aMeshPreviewStruct._retn() ); mySimulation->SetData( aMeshPreviewStruct.in() );
} }
catch (...) {} catch (...) {}
} }