<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=""/>
<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=""/>
<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=""/>
myPtsLabeledDataMapper->SetLabelTextProperty(aPtsTextProp);
aPtsTextProp->Delete();
+ myEntityMode = eAllEntity;
+
myIsPointsLabeled = false;
myPointLabels = vtkActor2D::New();
}
+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);
void ExportMeshToFile(QAD_Desktop * parent, int theCommandID);
- void SetViewMode(int theCommandID);
+ void SetDisplayMode(int theCommandID);
+
+ void SetDisplayEntity(int theCommandID);
void Control( int theCommandID );
}
}
- 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){
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
{
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 );
// 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;
mi->popup()->removeItem( 201 );
break;
}
- TVisualObjPtr aVisualObj = ac->GetObject();
+ TVisualObjPtr aVisualObj = anActor->GetObject();
if(aNbEdges == 0){
mi->popup()->removeItem( 6001 );
mi->popup()->removeItem( 6003 );