mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-11-15 10:08:34 +05:00
0020082: EDF 869 GEOM : Edges Orientation indicator/reverse
This commit is contained in:
parent
0f691b4cc1
commit
a89c4cb333
@ -68,6 +68,9 @@ public:
|
|||||||
QString getShapeEntry() const { return myShapeEntry; }
|
QString getShapeEntry() const { return myShapeEntry; }
|
||||||
void setShapeEntry( const QString& theEntry );
|
void setShapeEntry( const QString& theEntry );
|
||||||
|
|
||||||
|
QString getMainShapeEntry() const { return myMainShapeEntry; }
|
||||||
|
void setMainShapeEntry( const QString& theEntry ) { myMainShapeEntry = theEntry; }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void finished( int );
|
void finished( int );
|
||||||
|
|
||||||
@ -126,6 +129,7 @@ private:
|
|||||||
bool myIsCreate;
|
bool myIsCreate;
|
||||||
QtxDialog* myDlg;
|
QtxDialog* myDlg;
|
||||||
QString myShapeEntry;
|
QString myShapeEntry;
|
||||||
|
QString myMainShapeEntry;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SMESHGUI_HypothesisDlg : public QtxDialog
|
class SMESHGUI_HypothesisDlg : public QtxDialog
|
||||||
|
@ -1069,18 +1069,45 @@ void SMESHGUI_MeshOp::createHypothesis(const int theDim,
|
|||||||
removeCustomFilters(); // Issue 0020170
|
removeCustomFilters(); // Issue 0020170
|
||||||
|
|
||||||
// Get Entry of the Geom object
|
// Get Entry of the Geom object
|
||||||
|
QString aGeomEntry = "";
|
||||||
|
QString aMeshEntry = "";
|
||||||
QString anObjEntry = "";
|
QString anObjEntry = "";
|
||||||
anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
|
aGeomEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
|
||||||
if ( anObjEntry == "" ) {
|
aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh );
|
||||||
anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj );
|
anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj );
|
||||||
if ( anObjEntry != "" ) {
|
|
||||||
_PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.toLatin1().data() );
|
if ( aMeshEntry != "" ) { // Get Geom object from Mesh
|
||||||
GEOM::GEOM_Object_var aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( pObj );
|
_PTR(SObject) pObj = studyDS()->FindObjectID( aMeshEntry.toLatin1().data() );
|
||||||
anObjEntry = ( aGeomVar->_is_nil() ) ? "" : anObjEntry = aGeomVar->GetStudyEntry();
|
GEOM::GEOM_Object_var aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( pObj );
|
||||||
}
|
aMeshEntry = ( aGeomVar->_is_nil() ) ? "" : aMeshEntry = aGeomVar->GetStudyEntry();
|
||||||
}
|
}
|
||||||
|
|
||||||
aCreator->setShapeEntry( anObjEntry );
|
if ( aMeshEntry == "" && aGeomEntry == "" ) {
|
||||||
|
_PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.toLatin1().data() );
|
||||||
|
GEOM::GEOM_Object_var aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( pObj );
|
||||||
|
aGeomEntry = aGeomVar->GetStudyEntry();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( anObjEntry != "" && aGeomEntry != "" && aMeshEntry == "" ) { // take geometry from submesh
|
||||||
|
_PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.toLatin1().data() );
|
||||||
|
if ( pObj ) {
|
||||||
|
// if current object is sub-mesh
|
||||||
|
SMESH::SMESH_subMesh_var aSubMeshVar =
|
||||||
|
SMESH::SMESH_subMesh::_narrow( _CAST( SObject,pObj )->GetObject() );
|
||||||
|
if ( !aSubMeshVar->_is_nil() ) {
|
||||||
|
SMESH::SMESH_Mesh_var aMeshVar = aSubMeshVar->GetFather();
|
||||||
|
if ( !aMeshVar->_is_nil() ) {
|
||||||
|
_PTR(SObject) aMeshSO = SMESH::FindSObject( aMeshVar );
|
||||||
|
GEOM::GEOM_Object_var aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( aMeshSO );
|
||||||
|
aMeshEntry = aGeomVar->GetStudyEntry();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
aCreator->setShapeEntry( aGeomEntry );
|
||||||
|
if ( aMeshEntry != "" )
|
||||||
|
aCreator->setMainShapeEntry( aMeshEntry );
|
||||||
myDlg->setEnabled( false );
|
myDlg->setEnabled( false );
|
||||||
aCreator->create(initParamHyp, aHypName, myDlg, this, SLOT( onHypoCreated( int ) ) );
|
aCreator->create(initParamHyp, aHypName, myDlg, this, SLOT( onHypoCreated( int ) ) );
|
||||||
dialog = true;
|
dialog = true;
|
||||||
@ -1163,18 +1190,45 @@ void SMESHGUI_MeshOp::onEditHyp( const int theHypType, const int theIndex )
|
|||||||
aCreator->setInitParamsHypothesis( initParamHyp );
|
aCreator->setInitParamsHypothesis( initParamHyp );
|
||||||
|
|
||||||
// Get Entry of the Geom object
|
// Get Entry of the Geom object
|
||||||
|
QString aGeomEntry = "";
|
||||||
|
QString aMeshEntry = "";
|
||||||
QString anObjEntry = "";
|
QString anObjEntry = "";
|
||||||
anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
|
aGeomEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
|
||||||
if ( anObjEntry == "" ) {
|
aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh );
|
||||||
anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj );
|
anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj );
|
||||||
if ( anObjEntry != "" ) {
|
|
||||||
_PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.toLatin1().data() );
|
if ( aMeshEntry != "" ) { // Get Geom object from Mesh
|
||||||
GEOM::GEOM_Object_var aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( pObj );
|
_PTR(SObject) pObj = studyDS()->FindObjectID( aMeshEntry.toLatin1().data() );
|
||||||
anObjEntry = aGeomVar->GetStudyEntry();
|
GEOM::GEOM_Object_var aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( pObj );
|
||||||
|
aMeshEntry = ( aGeomVar->_is_nil() ) ? "" : aMeshEntry = aGeomVar->GetStudyEntry();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( aMeshEntry == "" && aGeomEntry == "" ) {
|
||||||
|
_PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.toLatin1().data() );
|
||||||
|
GEOM::GEOM_Object_var aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( pObj );
|
||||||
|
aGeomEntry = aGeomVar->GetStudyEntry();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( anObjEntry != "" && aGeomEntry != "" && aMeshEntry == "" ) { // take geometry from submesh
|
||||||
|
_PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.toLatin1().data() );
|
||||||
|
if ( pObj ) {
|
||||||
|
// if current object is sub-mesh
|
||||||
|
SMESH::SMESH_subMesh_var aSubMeshVar =
|
||||||
|
SMESH::SMESH_subMesh::_narrow( _CAST( SObject,pObj )->GetObject() );
|
||||||
|
if ( !aSubMeshVar->_is_nil() ) {
|
||||||
|
SMESH::SMESH_Mesh_var aMeshVar = aSubMeshVar->GetFather();
|
||||||
|
if ( !aMeshVar->_is_nil() ) {
|
||||||
|
_PTR(SObject) aMeshSO = SMESH::FindSObject( aMeshVar );
|
||||||
|
GEOM::GEOM_Object_var aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( aMeshSO );
|
||||||
|
aMeshEntry = aGeomVar->GetStudyEntry();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
aCreator->setShapeEntry( anObjEntry );
|
aCreator->setShapeEntry( aGeomEntry );
|
||||||
|
if ( aMeshEntry != "" )
|
||||||
|
aCreator->setMainShapeEntry( aMeshEntry );
|
||||||
removeCustomFilters(); // Issue 0020170
|
removeCustomFilters(); // Issue 0020170
|
||||||
myDlg->setEnabled( false );
|
myDlg->setEnabled( false );
|
||||||
aCreator->edit( aHyp.in(), aHypItem.second, dlg(), this, SLOT( onHypoEdited( int ) ) );
|
aCreator->edit( aHyp.in(), aHypItem.second, dlg(), this, SLOT( onHypoEdited( int ) ) );
|
||||||
|
@ -197,14 +197,16 @@ QFrame* StdMeshersGUI_NbSegmentsCreator::buildFrame()
|
|||||||
row++;
|
row++;
|
||||||
|
|
||||||
// 8) reverce edge parameters
|
// 8) reverce edge parameters
|
||||||
myReversedEdgesBox = new QGroupBox(tr( "SMESH_REVERCE_EDGES" ), fr);
|
myReversedEdgesBox = new QGroupBox(tr( "SMESH_REVERSED_EDGES" ), fr);
|
||||||
QHBoxLayout* edgeLay = new QHBoxLayout( myReversedEdgesBox );
|
QHBoxLayout* edgeLay = new QHBoxLayout( myReversedEdgesBox );
|
||||||
|
|
||||||
myDirectionWidget = new StdMeshersGUI_SubShapeSelectorWdg();
|
myDirectionWidget = new StdMeshersGUI_SubShapeSelectorWdg();
|
||||||
QString anEntry = getShapeEntry();
|
QString aGeomEntry = getShapeEntry();
|
||||||
if ( anEntry == "" )
|
QString aMainEntry = getMainShapeEntry();
|
||||||
anEntry = h->GetObjectEntry();
|
if ( aGeomEntry == "" )
|
||||||
myDirectionWidget->SetMainShapeEntry( anEntry );
|
aGeomEntry = h->GetObjectEntry();
|
||||||
|
myDirectionWidget->SetGeomShapeEntry( aGeomEntry );
|
||||||
|
myDirectionWidget->SetMainShapeEntry( aMainEntry );
|
||||||
myDirectionWidget->SetListOfIDs( h->GetReversedEdges() );
|
myDirectionWidget->SetListOfIDs( h->GetReversedEdges() );
|
||||||
edgeLay->addWidget( myDirectionWidget );
|
edgeLay->addWidget( myDirectionWidget );
|
||||||
|
|
||||||
|
@ -455,8 +455,7 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const
|
|||||||
h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
|
h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
|
||||||
if (w) {
|
if (w) {
|
||||||
h->SetReversedEdges( w->GetListOfIDs() );
|
h->SetReversedEdges( w->GetListOfIDs() );
|
||||||
const char * entry = w->GetMainShapeEntry();
|
h->SetObjectEntry( w->GetMainShapeEntry() );
|
||||||
h->SetObjectEntry( entry );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( hypType()=="FixedPoints1D" )
|
else if( hypType()=="FixedPoints1D" )
|
||||||
@ -477,8 +476,7 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const
|
|||||||
}
|
}
|
||||||
if (w2) {
|
if (w2) {
|
||||||
h->SetReversedEdges( w2->GetListOfIDs() );
|
h->SetReversedEdges( w2->GetListOfIDs() );
|
||||||
const char * entry = w2->GetMainShapeEntry();
|
h->SetObjectEntry( w2->GetMainShapeEntry() );
|
||||||
h->SetObjectEntry( entry );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( hypType()=="MaxElementArea" )
|
else if( hypType()=="MaxElementArea" )
|
||||||
@ -606,8 +604,8 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const
|
|||||||
StdMeshersGUI_SubShapeSelectorWdg* w =
|
StdMeshersGUI_SubShapeSelectorWdg* w =
|
||||||
widget< StdMeshersGUI_SubShapeSelectorWdg >( 0 );
|
widget< StdMeshersGUI_SubShapeSelectorWdg >( 0 );
|
||||||
if (w) {
|
if (w) {
|
||||||
if( w->GetListOfIDs()->length()>0 ) {
|
if( int id = w->GetListOfIDs()[0] ) {
|
||||||
h->SetTriaVertex( w->GetListOfIDs()[0] );
|
h->SetTriaVertex( id );
|
||||||
}
|
}
|
||||||
const char * entry = w->GetMainShapeEntry();
|
const char * entry = w->GetMainShapeEntry();
|
||||||
h->SetObjectEntry( entry );
|
h->SetObjectEntry( entry );
|
||||||
@ -736,10 +734,13 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
|
|||||||
|
|
||||||
StdMeshersGUI_SubShapeSelectorWdg* aDirectionWidget =
|
StdMeshersGUI_SubShapeSelectorWdg* aDirectionWidget =
|
||||||
new StdMeshersGUI_SubShapeSelectorWdg();
|
new StdMeshersGUI_SubShapeSelectorWdg();
|
||||||
QString anEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
|
QString aGeomEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
|
||||||
if ( anEntry == "" )
|
QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
|
||||||
anEntry = h->GetObjectEntry();
|
if ( aGeomEntry == "" )
|
||||||
aDirectionWidget->SetMainShapeEntry( anEntry );
|
aGeomEntry = h->GetObjectEntry();
|
||||||
|
|
||||||
|
aDirectionWidget->SetGeomShapeEntry( aGeomEntry );
|
||||||
|
aDirectionWidget->SetMainShapeEntry( aMainEntry );
|
||||||
aDirectionWidget->SetListOfIDs( h->GetReversedEdges() );
|
aDirectionWidget->SetListOfIDs( h->GetReversedEdges() );
|
||||||
aDirectionWidget->showPreview( true );
|
aDirectionWidget->showPreview( true );
|
||||||
customWidgets()->append ( aDirectionWidget );
|
customWidgets()->append ( aDirectionWidget );
|
||||||
@ -769,9 +770,11 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
|
|||||||
StdMeshersGUI_SubShapeSelectorWdg* aDirectionWidget =
|
StdMeshersGUI_SubShapeSelectorWdg* aDirectionWidget =
|
||||||
new StdMeshersGUI_SubShapeSelectorWdg();
|
new StdMeshersGUI_SubShapeSelectorWdg();
|
||||||
QString anEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
|
QString anEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
|
||||||
|
QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
|
||||||
if ( anEntry == "" )
|
if ( anEntry == "" )
|
||||||
anEntry = h->GetObjectEntry();
|
anEntry = h->GetObjectEntry();
|
||||||
aDirectionWidget->SetMainShapeEntry( anEntry );
|
aDirectionWidget->SetGeomShapeEntry( anEntry );
|
||||||
|
aDirectionWidget->SetMainShapeEntry( aMainEntry );
|
||||||
aDirectionWidget->SetListOfIDs( h->GetReversedEdges() );
|
aDirectionWidget->SetListOfIDs( h->GetReversedEdges() );
|
||||||
aDirectionWidget->showPreview( true );
|
aDirectionWidget->showPreview( true );
|
||||||
customWidgets()->append ( aDirectionWidget );
|
customWidgets()->append ( aDirectionWidget );
|
||||||
@ -823,11 +826,12 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
|
|||||||
StdMeshersGUI_SubShapeSelectorWdg* aDirectionWidget =
|
StdMeshersGUI_SubShapeSelectorWdg* aDirectionWidget =
|
||||||
new StdMeshersGUI_SubShapeSelectorWdg();
|
new StdMeshersGUI_SubShapeSelectorWdg();
|
||||||
QString anEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
|
QString anEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
|
||||||
|
QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
|
||||||
if ( anEntry == "" )
|
if ( anEntry == "" )
|
||||||
anEntry = h->GetObjectEntry();
|
anEntry = h->GetObjectEntry();
|
||||||
aDirectionWidget->SetMainShapeEntry( anEntry );
|
aDirectionWidget->SetGeomShapeEntry( anEntry );
|
||||||
|
aDirectionWidget->SetMainShapeEntry( aMainEntry );
|
||||||
aDirectionWidget->SetListOfIDs( h->GetReversedEdges() );
|
aDirectionWidget->SetListOfIDs( h->GetReversedEdges() );
|
||||||
aDirectionWidget->SetMainShapeEntry( h->GetObjectEntry() );
|
|
||||||
aDirectionWidget->showPreview( true );
|
aDirectionWidget->showPreview( true );
|
||||||
customWidgets()->append ( aDirectionWidget );
|
customWidgets()->append ( aDirectionWidget );
|
||||||
}
|
}
|
||||||
@ -984,9 +988,11 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
|
|||||||
aDirectionWidget->SetMaxSize(1);
|
aDirectionWidget->SetMaxSize(1);
|
||||||
aDirectionWidget->SetSubShType(TopAbs_VERTEX);
|
aDirectionWidget->SetSubShType(TopAbs_VERTEX);
|
||||||
QString anEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
|
QString anEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
|
||||||
|
QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
|
||||||
if ( anEntry == "" )
|
if ( anEntry == "" )
|
||||||
anEntry = h->GetObjectEntry();
|
anEntry = h->GetObjectEntry();
|
||||||
aDirectionWidget->SetMainShapeEntry( anEntry );
|
aDirectionWidget->SetGeomShapeEntry( anEntry );
|
||||||
|
aDirectionWidget->SetMainShapeEntry( aMainEntry );
|
||||||
SMESH::long_array_var aVec = new SMESH::long_array;
|
SMESH::long_array_var aVec = new SMESH::long_array;
|
||||||
int vertID = h->GetTriaVertex();
|
int vertID = h->GetTriaVertex();
|
||||||
if(vertID>0) {
|
if(vertID>0) {
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
// Author : Open CASCADE S.A.S. (dmv)
|
// Author : Open CASCADE S.A.S. (dmv)
|
||||||
// SMESH includes
|
// SMESH includes
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "StdMeshersGUI_SubShapeSelectorWdg.h"
|
#include "StdMeshersGUI_SubShapeSelectorWdg.h"
|
||||||
|
|
||||||
// SMESH Includes
|
// SMESH Includes
|
||||||
@ -141,6 +142,7 @@ StdMeshersGUI_SubShapeSelectorWdg::~StdMeshersGUI_SubShapeSelectorWdg()
|
|||||||
void StdMeshersGUI_SubShapeSelectorWdg::init()
|
void StdMeshersGUI_SubShapeSelectorWdg::init()
|
||||||
{
|
{
|
||||||
myParamValue = "";
|
myParamValue = "";
|
||||||
|
myIsNotCorrected = true; // to dont call the GetCorrectedValue method twice
|
||||||
myListOfIDs.clear();
|
myListOfIDs.clear();
|
||||||
mySelectedIDs.clear();
|
mySelectedIDs.clear();
|
||||||
|
|
||||||
@ -334,13 +336,14 @@ void StdMeshersGUI_SubShapeSelectorWdg::onListSelectionChanged()
|
|||||||
// function : setGeomShape
|
// function : setGeomShape
|
||||||
// purpose : Called to set geometry
|
// purpose : Called to set geometry
|
||||||
//================================================================================
|
//================================================================================
|
||||||
void StdMeshersGUI_SubShapeSelectorWdg::SetMainShapeEntry( const QString& theEntry )
|
void StdMeshersGUI_SubShapeSelectorWdg::SetGeomShapeEntry( const QString& theEntry )
|
||||||
{
|
{
|
||||||
if ( theEntry != "") {
|
if ( theEntry != "") {
|
||||||
myParamValue = theEntry;
|
myParamValue = theEntry;
|
||||||
myEntry = theEntry;
|
myEntry = theEntry;
|
||||||
myMainShape = GetTopoDSByEntry( theEntry );
|
myGeomShape = GetTopoDSByEntry( theEntry );
|
||||||
updateState();
|
updateState();
|
||||||
|
myIsNotCorrected = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -351,7 +354,7 @@ void StdMeshersGUI_SubShapeSelectorWdg::SetMainShapeEntry( const QString& theEnt
|
|||||||
void StdMeshersGUI_SubShapeSelectorWdg::updateState()
|
void StdMeshersGUI_SubShapeSelectorWdg::updateState()
|
||||||
{
|
{
|
||||||
bool state = false;
|
bool state = false;
|
||||||
if ( !myMainShape.IsNull() )
|
if ( !myGeomShape.IsNull() )
|
||||||
state = true;
|
state = true;
|
||||||
|
|
||||||
myListWidget->setEnabled( state );
|
myListWidget->setEnabled( state );
|
||||||
@ -361,8 +364,7 @@ void StdMeshersGUI_SubShapeSelectorWdg::updateState()
|
|||||||
if (state) {
|
if (state) {
|
||||||
myPreviewActor = new SMESH_PreviewActorsCollection();
|
myPreviewActor = new SMESH_PreviewActorsCollection();
|
||||||
myPreviewActor->SetSelector( mySelector );
|
myPreviewActor->SetSelector( mySelector );
|
||||||
//myPreviewActor->Init( myMainShape, TopAbs_EDGE, myEntry );
|
myPreviewActor->Init( myGeomShape, mySubShType, myEntry );
|
||||||
myPreviewActor->Init( myMainShape, mySubShType, myEntry );
|
|
||||||
myPreviewActor->SetShown( false );
|
myPreviewActor->SetShown( false );
|
||||||
myIsShown = false;
|
myIsShown = false;
|
||||||
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) {
|
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) {
|
||||||
@ -414,6 +416,10 @@ TopoDS_Shape StdMeshersGUI_SubShapeSelectorWdg::GetTopoDSByEntry( const QString&
|
|||||||
SMESH::long_array_var StdMeshersGUI_SubShapeSelectorWdg::GetListOfIDs()
|
SMESH::long_array_var StdMeshersGUI_SubShapeSelectorWdg::GetListOfIDs()
|
||||||
{
|
{
|
||||||
SMESH::long_array_var anArray = new SMESH::long_array;
|
SMESH::long_array_var anArray = new SMESH::long_array;
|
||||||
|
|
||||||
|
if ( myMainEntry != "" && myIsNotCorrected )
|
||||||
|
myListOfIDs = GetCorrectedListOfIDs( true );
|
||||||
|
|
||||||
int size = myListOfIDs.size();
|
int size = myListOfIDs.size();
|
||||||
anArray->length( size );
|
anArray->length( size );
|
||||||
if ( size ) {
|
if ( size ) {
|
||||||
@ -435,6 +441,65 @@ void StdMeshersGUI_SubShapeSelectorWdg::SetListOfIDs( SMESH::long_array_var theI
|
|||||||
int size = theIds->length();
|
int size = theIds->length();
|
||||||
for ( int i = 0; i < size; i++ )
|
for ( int i = 0; i < size; i++ )
|
||||||
mySelectedIDs.append( theIds[ i ] );
|
mySelectedIDs.append( theIds[ i ] );
|
||||||
|
|
||||||
|
mySelectedIDs = GetCorrectedListOfIDs( false );
|
||||||
onAdd();
|
onAdd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : SetMainShapeEntry
|
||||||
|
// purpose : Called to set the Main Object Entry
|
||||||
|
//=================================================================================
|
||||||
|
void StdMeshersGUI_SubShapeSelectorWdg::SetMainShapeEntry( const QString& theEntry )
|
||||||
|
{
|
||||||
|
myMainEntry = theEntry;
|
||||||
|
myMainShape = GetTopoDSByEntry( theEntry );
|
||||||
|
myIsNotCorrected = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : GetMainShapeEntry
|
||||||
|
// purpose : Called to get the Main Object Entry
|
||||||
|
//=================================================================================
|
||||||
|
const char* StdMeshersGUI_SubShapeSelectorWdg::GetMainShapeEntry()
|
||||||
|
{
|
||||||
|
if ( myMainEntry == "")
|
||||||
|
return myEntry.toLatin1().data();
|
||||||
|
|
||||||
|
return myMainEntry.toLatin1().data();
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : GetCorrectedListOfIds
|
||||||
|
// purpose : Called to convert the list of IDs from subshape IDs to main shape IDs
|
||||||
|
//=================================================================================
|
||||||
|
QList<int> StdMeshersGUI_SubShapeSelectorWdg::GetCorrectedListOfIDs( bool fromSubshapeToMainshape )
|
||||||
|
{
|
||||||
|
if ( myMainShape.IsNull() || myGeomShape.IsNull() )
|
||||||
|
return myListOfIDs;
|
||||||
|
|
||||||
|
QList<int> aList;
|
||||||
|
TopTools_IndexedMapOfShape aGeomMap;
|
||||||
|
TopTools_IndexedMapOfShape aMainMap;
|
||||||
|
TopExp::MapShapes(myGeomShape, aGeomMap);
|
||||||
|
TopExp::MapShapes(myMainShape, aMainMap);
|
||||||
|
|
||||||
|
if ( fromSubshapeToMainshape ) { // convert indexes from subshape to mainshape
|
||||||
|
int size = myListOfIDs.size();
|
||||||
|
for (int i = 0; i < size; i++) {
|
||||||
|
TopoDS_Shape aSubShape = aGeomMap.FindKey( myListOfIDs.at(i) );
|
||||||
|
int index = aMainMap.FindIndex( aSubShape );
|
||||||
|
aList.append( index );
|
||||||
|
}
|
||||||
|
myIsNotCorrected = false;
|
||||||
|
} else { // convert indexes from main shape to subshape
|
||||||
|
int size = mySelectedIDs.size();
|
||||||
|
for (int i = 0; i < size; i++) {
|
||||||
|
TopoDS_Shape aSubShape = aMainMap.FindKey( mySelectedIDs.at(i) );
|
||||||
|
int index = aGeomMap.FindIndex( aSubShape );
|
||||||
|
aList.append( index );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return aList;
|
||||||
|
}
|
||||||
|
@ -59,11 +59,17 @@ public:
|
|||||||
SMESH::long_array_var GetListOfIDs();
|
SMESH::long_array_var GetListOfIDs();
|
||||||
void SetListOfIDs( SMESH::long_array_var );
|
void SetListOfIDs( SMESH::long_array_var );
|
||||||
|
|
||||||
void SetMainShapeEntry( const QString& theEntry );
|
void SetGeomShapeEntry( const QString& theEntry );
|
||||||
const char* GetMainShapeEntry() { return myEntry.toLatin1().data();}
|
const char* GetGeomShapeEntry() { return myEntry.toLatin1().data();}
|
||||||
|
|
||||||
|
void SetMainShapeEntry( const QString& theEntry );
|
||||||
|
const char* GetMainShapeEntry();
|
||||||
|
|
||||||
|
TopoDS_Shape GetGeomShape() { return myGeomShape; }
|
||||||
TopoDS_Shape GetMainShape() { return myMainShape; }
|
TopoDS_Shape GetMainShape() { return myMainShape; }
|
||||||
|
|
||||||
|
QList<int> GetCorrectedListOfIDs( bool fromSubshapeToMainshape = true );
|
||||||
|
|
||||||
static GEOM::GEOM_Object_var GetGeomObjectByEntry( const QString& );
|
static GEOM::GEOM_Object_var GetGeomObjectByEntry( const QString& );
|
||||||
static TopoDS_Shape GetTopoDSByEntry( const QString& );
|
static TopoDS_Shape GetTopoDSByEntry( const QString& );
|
||||||
|
|
||||||
@ -91,8 +97,10 @@ private:
|
|||||||
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
||||||
SVTK_Selector* mySelector;
|
SVTK_Selector* mySelector;
|
||||||
SMESH::SMESH_Mesh_var myMesh;
|
SMESH::SMESH_Mesh_var myMesh;
|
||||||
|
TopoDS_Shape myGeomShape;
|
||||||
TopoDS_Shape myMainShape;
|
TopoDS_Shape myMainShape;
|
||||||
QString myEntry;
|
QString myEntry;
|
||||||
|
QString myMainEntry;
|
||||||
vtkRenderer* myRenderer;
|
vtkRenderer* myRenderer;
|
||||||
|
|
||||||
QListWidget* myListWidget;
|
QListWidget* myListWidget;
|
||||||
@ -103,6 +111,7 @@ private:
|
|||||||
|
|
||||||
QString myParamValue;
|
QString myParamValue;
|
||||||
bool myIsShown;
|
bool myIsShown;
|
||||||
|
bool myIsNotCorrected;
|
||||||
|
|
||||||
// for manage possible size of myListOfIDs
|
// for manage possible size of myListOfIDs
|
||||||
int myMaxSize;
|
int myMaxSize;
|
||||||
|
Loading…
Reference in New Issue
Block a user