mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-26 01:10:35 +05:00
Fix on - Bug PAL7334 DEVELOPMENT : Control Improvement - implementation of Display Entity functionality
This commit is contained in:
parent
2adad59bbb
commit
2d926edd92
@ -231,6 +231,14 @@
|
||||
<popup-item item-id="213" pos-id="" label-id="Shrink" icon-id="mesh_shrink.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
|
||||
</submenu>
|
||||
<endsubmenu />
|
||||
<submenu label-id="Display Entity" item-id="1135" pos-id="">
|
||||
<popup-item item-id="217" pos-id="" label-id="Edges" icon-id="mesh_line.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
|
||||
<popup-item item-id="218" pos-id="" label-id="Faces" icon-id="mesh_triangle.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
|
||||
<popup-item item-id="219" pos-id="" label-id="Volumes" icon-id="mesh_tetra.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
|
||||
<separator pos-id=""/>
|
||||
<popup-item item-id="220" pos-id="" label-id="All" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
|
||||
</submenu>
|
||||
<endsubmenu />
|
||||
<popup-item item-id="1132" pos-id="" label-id="Colors / Size" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
|
||||
<popup-item item-id="1133" pos-id="" label-id="Transparency" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
|
||||
<popup-item item-id="1134" pos-id="" label-id="Clipping" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
|
||||
@ -274,6 +282,14 @@
|
||||
<popup-item item-id="213" pos-id="" label-id="Shrink" icon-id="mesh_shrink.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
|
||||
</submenu>
|
||||
<endsubmenu />
|
||||
<submenu label-id="Display Entity" item-id="1135" pos-id="">
|
||||
<popup-item item-id="217" pos-id="" label-id="Edges" icon-id="mesh_line.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
|
||||
<popup-item item-id="218" pos-id="" label-id="Faces" icon-id="mesh_triangle.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
|
||||
<popup-item item-id="219" pos-id="" label-id="Volumes" icon-id="mesh_tetra.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
|
||||
<separator pos-id=""/>
|
||||
<popup-item item-id="220" pos-id="" label-id="All" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
|
||||
</submenu>
|
||||
<endsubmenu />
|
||||
<popup-item item-id="1132" pos-id="" label-id="Colors / Size" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
|
||||
<popup-item item-id="1133" pos-id="" label-id="Transparency" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
|
||||
<popup-item item-id="1134" pos-id="" label-id="Clipping" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
|
||||
@ -319,6 +335,14 @@
|
||||
<popup-item item-id="213" pos-id="" label-id="Shrink" icon-id="mesh_shrink.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
|
||||
</submenu>
|
||||
<endsubmenu />
|
||||
<submenu label-id="Display Entity" item-id="1135" pos-id="">
|
||||
<popup-item item-id="217" pos-id="" label-id="Edges" icon-id="mesh_line.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
|
||||
<popup-item item-id="218" pos-id="" label-id="Faces" icon-id="mesh_triangle.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
|
||||
<popup-item item-id="219" pos-id="" label-id="Volumes" icon-id="mesh_tetra.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
|
||||
<separator pos-id=""/>
|
||||
<popup-item item-id="220" pos-id="" label-id="All" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
|
||||
</submenu>
|
||||
<endsubmenu />
|
||||
<popup-item item-id="1132" pos-id="" label-id="Colors / Size" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
|
||||
<popup-item item-id="1133" pos-id="" label-id="Transparency" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
|
||||
<popup-item item-id="1134" pos-id="" label-id="Clipping" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
|
||||
|
@ -439,6 +439,8 @@ SMESH_Actor::SMESH_Actor(){
|
||||
myPtsLabeledDataMapper->SetLabelTextProperty(aPtsTextProp);
|
||||
aPtsTextProp->Delete();
|
||||
|
||||
myEntityMode = eAllEntity;
|
||||
|
||||
myIsPointsLabeled = false;
|
||||
|
||||
myPointLabels = vtkActor2D::New();
|
||||
@ -1021,6 +1023,55 @@ void SMESH_Actor::SetVisibility(int theMode, bool theIsUpdateRepersentation){
|
||||
}
|
||||
|
||||
|
||||
namespace{
|
||||
|
||||
inline bool UpdateEntityMode(unsigned int& theOutputMode,
|
||||
unsigned int theInputMode,
|
||||
unsigned int theMode,
|
||||
int theCondition)
|
||||
{
|
||||
if(!theCondition)
|
||||
theOutputMode &= ~theMode;
|
||||
|
||||
return theOutputMode & theMode && theCondition;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void SMESH_Actor::SetEntityMode(unsigned int theMode){
|
||||
if(!myVisualObj->GetNbEntities(SMESH::EDGE))
|
||||
theMode &= ~eEdges;
|
||||
|
||||
if(!myVisualObj->GetNbEntities(SMESH::FACE))
|
||||
theMode &= ~eFaces;
|
||||
|
||||
if(!myVisualObj->GetNbEntities(SMESH::VOLUME))
|
||||
theMode &= ~eVolumes;
|
||||
|
||||
if(!theMode)
|
||||
return;
|
||||
|
||||
myScalarBarActor->VisibilityOff();
|
||||
|
||||
my1DExtActor->VisibilityOff();
|
||||
my1DActor->VisibilityOff();
|
||||
|
||||
my2DActor->VisibilityOff();
|
||||
my3DActor->VisibilityOff();
|
||||
|
||||
if(theMode & eEdges)
|
||||
my1DActor->VisibilityOn();
|
||||
|
||||
if(theMode & eFaces)
|
||||
my2DActor->VisibilityOn();
|
||||
|
||||
if(theMode & eVolumes)
|
||||
my3DActor->VisibilityOn();
|
||||
|
||||
myEntityMode = theMode;
|
||||
}
|
||||
|
||||
|
||||
void SMESH_Actor::SetRepresentation(int theMode){
|
||||
int aNbEdges = myVisualObj->GetNbEntities(SMESH::EDGE);
|
||||
int aNbFaces = myVisualObj->GetNbEntities(SMESH::FACE);
|
||||
|
@ -121,6 +121,11 @@ class SMESH_Actor : public SALOME_Actor{
|
||||
|
||||
enum EReperesent { ePoint, eEdge, eSurface};
|
||||
virtual void SetRepresentation(int theMode);
|
||||
|
||||
enum EEntityMode { eEdges = 0x01, eFaces = 0x02, eVolumes = 0x04, eAllEntity = 0x07};
|
||||
unsigned int GetEntityMode() const { return myEntityMode;}
|
||||
void SetEntityMode(unsigned int theMode);
|
||||
|
||||
void SetPointRepresentation(bool theIsPointsVisible);
|
||||
bool GetPointRepresentation();
|
||||
|
||||
@ -198,6 +203,7 @@ class SMESH_Actor : public SALOME_Actor{
|
||||
vtkProperty* my1DExtProp;
|
||||
SMESH_DeviceActor* my1DExtActor;
|
||||
|
||||
unsigned int myEntityMode;
|
||||
bool myIsPointsVisible;
|
||||
|
||||
bool myIsShrinkable;
|
||||
|
@ -140,7 +140,9 @@ namespace{
|
||||
|
||||
void ExportMeshToFile(QAD_Desktop * parent, int theCommandID);
|
||||
|
||||
void SetViewMode(int theCommandID);
|
||||
void SetDisplayMode(int theCommandID);
|
||||
|
||||
void SetDisplayEntity(int theCommandID);
|
||||
|
||||
void Control( int theCommandID );
|
||||
|
||||
@ -286,7 +288,48 @@ namespace{
|
||||
}
|
||||
}
|
||||
|
||||
void SetViewMode(int theCommandID){
|
||||
inline void InverseEntityMode(unsigned int& theOutputMode,
|
||||
unsigned int theMode)
|
||||
{
|
||||
bool anIsNotPresent = ~theOutputMode & theMode;
|
||||
if(anIsNotPresent)
|
||||
theOutputMode |= theMode;
|
||||
else
|
||||
theOutputMode &= ~theMode;
|
||||
}
|
||||
|
||||
void SetDisplayEntity(int theCommandID){
|
||||
SALOME_Selection *Sel = SALOME_Selection::Selection(SMESH::GetActiveStudy()->getSelection());
|
||||
if(Sel->IObjectCount() >= 1){
|
||||
SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
|
||||
for(; It.More(); It.Next()){
|
||||
Handle(SALOME_InteractiveObject) IObject = It.Value();
|
||||
if(IObject->hasEntry()){
|
||||
if(SMESH_Actor *anActor = SMESH::FindActorByEntry(IObject->getEntry())){
|
||||
unsigned int aMode = anActor->GetEntityMode();
|
||||
switch(theCommandID){
|
||||
case 217:
|
||||
InverseEntityMode(aMode,SMESH_Actor::eEdges);
|
||||
break;
|
||||
case 218:
|
||||
InverseEntityMode(aMode,SMESH_Actor::eFaces);
|
||||
break;
|
||||
case 219:
|
||||
InverseEntityMode(aMode,SMESH_Actor::eVolumes);
|
||||
break;
|
||||
case 220:
|
||||
aMode = SMESH_Actor::eAllEntity;
|
||||
break;
|
||||
}
|
||||
if(aMode)
|
||||
anActor->SetEntityMode(aMode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SetDisplayMode(int theCommandID){
|
||||
SALOME_Selection *Sel = SALOME_Selection::Selection(SMESH::GetActiveStudy()->getSelection());
|
||||
if(Sel->IObjectCount() >= 1){
|
||||
switch(theCommandID){
|
||||
@ -1031,14 +1074,22 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
|
||||
case 1134: // Clipping
|
||||
case 1133: // Tranparency
|
||||
case 1132: // Colors / Size
|
||||
case 215:
|
||||
case 213:
|
||||
case 212:
|
||||
case 211:
|
||||
{
|
||||
::SetViewMode(theCommandID);
|
||||
break;
|
||||
}
|
||||
|
||||
// Display Mode
|
||||
case 215: // Nodes
|
||||
case 213: // Nodes
|
||||
case 212: // Nodes
|
||||
case 211: // Nodes
|
||||
::SetDisplayMode(theCommandID);
|
||||
break;
|
||||
|
||||
// Display Entity
|
||||
case 217: // Edges
|
||||
case 218: // Faces
|
||||
case 219: // Volumes
|
||||
case 220: // All Entity
|
||||
::SetDisplayEntity(theCommandID);
|
||||
break;
|
||||
|
||||
case 214: // UPDATE
|
||||
{
|
||||
@ -2316,21 +2367,22 @@ bool SMESHGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString
|
||||
if ( !aGeomGroup->_is_nil() ) // group linked on geometry
|
||||
popup->removeItem( 803 ); // EDIT GROUP
|
||||
|
||||
SMESH_Actor* ac = SMESH::FindActorByEntry(IObject->getEntry());
|
||||
SMESH_Actor* anActor = SMESH::FindActorByEntry(IObject->getEntry());
|
||||
// if object has actor
|
||||
if ( ac && studyFrame->getTypeView() == VIEW_VTK ) {
|
||||
if ( anActor && studyFrame->getTypeView() == VIEW_VTK ) {
|
||||
VTKViewer_RenderWindowInteractor* myRenderInter = SMESH::GetCurrentVtkView()->getRWInteractor();
|
||||
if ( myRenderInter->isVisible( IObject ) ) {
|
||||
popup->removeItem( QAD_Display_Popup_ID );
|
||||
popup->setItemChecked( 9010, ac->GetPointsLabeled() ); // Numbering / Display Nodes #
|
||||
popup->setItemChecked( 9011, ac->GetCellsLabeled() ); // Numbering / Display Elements #
|
||||
TVisualObjPtr aVisualObj = ac->GetObject();
|
||||
popup->setItemChecked( 9010, anActor->GetPointsLabeled() ); // Numbering / Display Nodes #
|
||||
popup->setItemChecked( 9011, anActor->GetCellsLabeled() ); // Numbering / Display Elements #
|
||||
TVisualObjPtr aVisualObj = anActor->GetObject();
|
||||
int aNbEdges = aVisualObj->GetNbEntities(SMESH::EDGE);
|
||||
int aNbFaces = aVisualObj->GetNbEntities(SMESH::FACE);
|
||||
int aNbVolumes = aVisualObj->GetNbEntities(SMESH::VOLUME);
|
||||
|
||||
QMenuItem* mi = popup->findItem( 1131 );
|
||||
if ( mi && mi->popup() ) {
|
||||
int prType = ac->GetRepresentation();
|
||||
int prType = anActor->GetRepresentation();
|
||||
// Display Mode / Wireframe
|
||||
if(aNbVolumes == 0 && aNbFaces == 0 && aNbEdges == 0){
|
||||
mi->popup()->removeItem( 211 );
|
||||
@ -2346,15 +2398,47 @@ bool SMESHGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString
|
||||
// Display Mode / Points
|
||||
mi->popup()->setItemChecked( 215, prType == SMESH_Actor::ePoint );
|
||||
// Display Mode / Shrink
|
||||
bool isShrunk = ac->IsShrunk();
|
||||
bool isShrunkable = ac->IsShrunkable();
|
||||
bool isShrunk = anActor->IsShrunk();
|
||||
bool isShrunkable = anActor->IsShrunkable();
|
||||
mi->popup()->setItemChecked( 213, isShrunk );
|
||||
mi->popup()->setItemEnabled( 213, prType != SMESH_Actor::ePoint && isShrunkable);
|
||||
}
|
||||
// Scalar Bar
|
||||
|
||||
// Display Entity
|
||||
mi = popup->findItem( 1135 );
|
||||
if ( mi && mi->popup() ) {
|
||||
QPopupMenu* aPopup = mi->popup();
|
||||
unsigned int aMode = anActor->GetEntityMode();
|
||||
|
||||
if(aNbVolumes == 0)
|
||||
aPopup->removeItem( 219 );
|
||||
else
|
||||
aPopup->setItemChecked( 219, aMode & SMESH_Actor::eVolumes );
|
||||
|
||||
if(aNbFaces == 0)
|
||||
aPopup->removeItem( 218 );
|
||||
else
|
||||
aPopup->setItemChecked( 218, aMode & SMESH_Actor::eFaces );
|
||||
|
||||
|
||||
if(aNbEdges == 0)
|
||||
aPopup->removeItem( 217 );
|
||||
else
|
||||
aPopup->setItemChecked( 217, aMode & SMESH_Actor::eEdges );
|
||||
|
||||
|
||||
bool aIsRemove = (aNbVolumes == 0 || aMode & SMESH_Actor::eVolumes);
|
||||
aIsRemove &= (aNbFaces == 0 || aMode & SMESH_Actor::eFaces);
|
||||
aIsRemove &= (aNbEdges == 0 || aMode & SMESH_Actor::eEdges);
|
||||
|
||||
if(aIsRemove)
|
||||
aPopup->removeItem( 220 );
|
||||
}
|
||||
|
||||
// Controls
|
||||
mi = popup->findItem( 2000 );
|
||||
if ( mi && mi->popup() ) {
|
||||
SMESH_Actor::eControl cMode = ac->GetControlMode();
|
||||
SMESH_Actor::eControl cMode = anActor->GetControlMode();
|
||||
switch ( cMode ) {
|
||||
case SMESH_Actor::eLengthEdges:
|
||||
mi->popup()->setItemChecked( 6001, true ); break;
|
||||
@ -2388,7 +2472,7 @@ bool SMESHGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString
|
||||
mi->popup()->removeItem( 201 );
|
||||
break;
|
||||
}
|
||||
TVisualObjPtr aVisualObj = ac->GetObject();
|
||||
TVisualObjPtr aVisualObj = anActor->GetObject();
|
||||
if(aNbEdges == 0){
|
||||
mi->popup()->removeItem( 6001 );
|
||||
mi->popup()->removeItem( 6003 );
|
||||
|
Loading…
Reference in New Issue
Block a user