mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-27 18:50:33 +05:00
IPAL53698: Clipping dialog: ambiguos object identification by names
This commit is contained in:
parent
b6bea82aa0
commit
1a1b88b9cf
@ -231,34 +231,37 @@ SMESH::OrientedPlane::~OrientedPlane()
|
|||||||
myPlaneSource->Delete();
|
myPlaneSource->Delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
namespace
|
||||||
Definition of class ActorItem
|
|
||||||
*/
|
|
||||||
class ActorItem : public QListWidgetItem
|
|
||||||
{
|
{
|
||||||
public:
|
/*!
|
||||||
ActorItem( SMESH_Actor* theActor, const QString& theName, QListWidget* theListWidget ) :
|
Definition of class ActorItem
|
||||||
QListWidgetItem( theName, theListWidget ),
|
*/
|
||||||
myActor( theActor ) {}
|
class ActorItem : public QListWidgetItem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ActorItem( SMESH_Actor* theActor, const QString& theName, QListWidget* theListWidget ) :
|
||||||
|
QListWidgetItem( theName, theListWidget ),
|
||||||
|
myActor( theActor ) {}
|
||||||
|
|
||||||
SMESH_Actor* getActor() const { return myActor; }
|
SMESH_Actor* getActor() const { return myActor; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SMESH_Actor* myActor;
|
SMESH_Actor* myActor;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Definition of class TSetVisibility
|
Definition of class TSetVisibility
|
||||||
*/
|
*/
|
||||||
struct TSetVisibility {
|
struct TSetVisibility {
|
||||||
// Set visibility of cutting plane
|
// Set visibility of cutting plane
|
||||||
TSetVisibility(int theIsVisible): myIsVisible(theIsVisible){}
|
TSetVisibility(int theIsVisible): myIsVisible(theIsVisible){}
|
||||||
void operator()(SMESH::TPlaneData& thePlaneData){
|
void operator()(SMESH::TPlaneData& thePlaneData){
|
||||||
bool anIsEmpty = thePlaneData.ActorList.empty();
|
bool anIsEmpty = thePlaneData.ActorList.empty();
|
||||||
thePlaneData.Plane.GetPointer()->myActor->SetVisibility(myIsVisible && !anIsEmpty);
|
thePlaneData.Plane.GetPointer()->myActor->SetVisibility(myIsVisible && !anIsEmpty);
|
||||||
}
|
}
|
||||||
int myIsVisible;
|
int myIsVisible;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/*********************************************************************************
|
/*********************************************************************************
|
||||||
********************* class SMESHGUI_ClippingDlg *********************
|
********************* class SMESHGUI_ClippingDlg *********************
|
||||||
@ -713,46 +716,66 @@ vtkImplicitPlaneWidget* SMESHGUI_ClippingDlg::createPreviewWidget()
|
|||||||
return aPlaneWgt;
|
return aPlaneWgt;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
namespace
|
||||||
Translate two angles of plane to normal
|
|
||||||
*/
|
|
||||||
void rotationToNormal ( double theRotation[2],
|
|
||||||
int theOrientation,
|
|
||||||
double theNormal[3],
|
|
||||||
double theDir[2][3] )
|
|
||||||
{
|
{
|
||||||
static double aCoeff = M_PI/180.0;
|
/*!
|
||||||
|
Translate two angles of plane to normal
|
||||||
|
*/
|
||||||
|
void rotationToNormal ( double theRotation[2],
|
||||||
|
int theOrientation,
|
||||||
|
double theNormal[3],
|
||||||
|
double theDir[2][3] )
|
||||||
|
{
|
||||||
|
static double aCoeff = M_PI/180.0;
|
||||||
|
|
||||||
double anU[2] = { cos( aCoeff * theRotation[0] ), cos( aCoeff * theRotation[1] ) };
|
double anU[2] = { cos( aCoeff * theRotation[0] ), cos( aCoeff * theRotation[1] ) };
|
||||||
double aV[2] = { sqrt( 1.0 - anU[0]*anU[0] ), sqrt( 1.0 - anU[1] * anU[1] ) };
|
double aV[2] = { sqrt( 1.0 - anU[0]*anU[0] ), sqrt( 1.0 - anU[1] * anU[1] ) };
|
||||||
aV[0] = theRotation[0] > 0? aV[0]: -aV[0];
|
aV[0] = theRotation[0] > 0? aV[0]: -aV[0];
|
||||||
aV[1] = theRotation[1] > 0? aV[1]: -aV[1];
|
aV[1] = theRotation[1] > 0? aV[1]: -aV[1];
|
||||||
|
|
||||||
switch ( theOrientation ) {
|
switch ( theOrientation ) {
|
||||||
case 0:
|
case 0:
|
||||||
case 1:
|
case 1:
|
||||||
theDir[0][1] = anU[0];
|
theDir[0][1] = anU[0];
|
||||||
theDir[0][2] = aV[0];
|
theDir[0][2] = aV[0];
|
||||||
theDir[1][0] = anU[1];
|
theDir[1][0] = anU[1];
|
||||||
theDir[1][2] = aV[1];
|
theDir[1][2] = aV[1];
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
theDir[0][2] = anU[0];
|
theDir[0][2] = anU[0];
|
||||||
theDir[0][0] = aV[0];
|
theDir[0][0] = aV[0];
|
||||||
theDir[1][1] = anU[1];
|
theDir[1][1] = anU[1];
|
||||||
theDir[1][0] = aV[1];
|
theDir[1][0] = aV[1];
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
theDir[0][0] = anU[0];
|
theDir[0][0] = anU[0];
|
||||||
theDir[0][1] = aV[0];
|
theDir[0][1] = aV[0];
|
||||||
theDir[1][2] = anU[1];
|
theDir[1][2] = anU[1];
|
||||||
theDir[1][1] = aV[1];
|
theDir[1][1] = aV[1];
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
vtkMath::Cross( theDir[1], theDir[0], theNormal );
|
||||||
|
vtkMath::Normalize( theNormal );
|
||||||
|
vtkMath::Cross( theNormal, theDir[1], theDir[0] );
|
||||||
}
|
}
|
||||||
|
|
||||||
vtkMath::Cross( theDir[1], theDir[0], theNormal );
|
/*!
|
||||||
vtkMath::Normalize( theNormal );
|
* \brief Return a name of a father mesh if any
|
||||||
vtkMath::Cross( theNormal, theDir[1], theDir[0] );
|
*/
|
||||||
|
QString getFatherName( _PTR(SObject)& theSObj )
|
||||||
|
{
|
||||||
|
_PTR(SComponent) objComponent = theSObj->GetFatherComponent();
|
||||||
|
const int theMeshDepth = 1 + objComponent->Depth();
|
||||||
|
if ( theSObj->Depth() <= theMeshDepth )
|
||||||
|
return QString(); // theSObj is a mesh
|
||||||
|
|
||||||
|
_PTR(SObject) sobj = theSObj->GetFather();
|
||||||
|
while ( sobj && sobj->Depth() > theMeshDepth )
|
||||||
|
sobj = sobj->GetFather();
|
||||||
|
|
||||||
|
return sobj ? sobj->GetName().c_str() : "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -1084,6 +1107,10 @@ void SMESHGUI_ClippingDlg::updateActorList()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
QString aName = QString( aSObj->GetName().c_str() );
|
QString aName = QString( aSObj->GetName().c_str() );
|
||||||
|
QString aFatherName = getFatherName( aSObj );
|
||||||
|
if ( !aFatherName.isEmpty() )
|
||||||
|
aName = aFatherName + " / " + aName;
|
||||||
|
aName += QString(" (%1)").arg( aSObj->GetID().c_str() );
|
||||||
QListWidgetItem* anItem = new ActorItem( anActor, aName, ActorList );
|
QListWidgetItem* anItem = new ActorItem( anActor, aName, ActorList );
|
||||||
anItem->setCheckState( anIsChecked ? Qt::Checked : Qt::Unchecked );
|
anItem->setCheckState( anIsChecked ? Qt::Checked : Qt::Unchecked );
|
||||||
updateActorItem( anItem, true, false );
|
updateActorItem( anItem, true, false );
|
||||||
|
Loading…
Reference in New Issue
Block a user