]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
GPUSPHGUI: show a custom control by setting a functor
authoreap <eap@opencascade.com>
Thu, 15 Feb 2018 12:47:48 +0000 (15:47 +0300)
committereap <eap@opencascade.com>
Thu, 15 Feb 2018 12:47:48 +0000 (15:47 +0300)
src/OBJECT/SMESH_Actor.cxx
src/OBJECT/SMESH_Actor.h
src/OBJECT/SMESH_ActorDef.h

index b011a74129785265cc0a49e728e7bf55af3570a8..32e0b1deea45dfc6f53fd98d7132a79e3c1fed22 100644 (file)
@@ -801,12 +801,20 @@ bool SMESH_ActorDef::GetFacesOrientation3DVectors()
 }
 
 
+void SMESH_ActorDef::SetControl(SMESH::Controls::FunctorPtr theFunctor)
+{
+  myFunctor = theFunctor;
+  if ( !theFunctor )
+    SetControlMode( eNone, true );
+  else
+    SetControlMode( eCustomControl, true );
+}
+
 void SMESH_ActorDef::SetControlMode(eControl theMode)
 {
   SetControlMode(theMode,true);
 }
 
-
 void SMESH_ActorDef::SetControlMode( eControl theMode, bool theCheckEntityMode )
 {
   vtkLookupTable* lookupTable = static_cast<vtkLookupTable*>(myScalarBarActor->GetLookupTable());
@@ -1003,6 +1011,19 @@ void SMESH_ActorDef::SetControlMode( eControl theMode, bool theCheckEntityMode )
       myControlActor = myNodeActor;
       break;
     }
+    case eCustomControl:
+    {
+      if ( !myFunctor )
+        return;
+      switch ( myFunctor->GetType() ) {
+      case SMDSAbs_Node          : myControlActor = myNodeActor; break;
+      case SMDSAbs_Edge          : myControlActor = my1DActor;   break;
+      case SMDSAbs_Face          : myControlActor = my2DActor;   break;
+      case SMDSAbs_Volume        : myControlActor = my3DActor;   break;
+      default                    : return;
+      }
+      break;
+    }
     default:
       return;
     }
index e8818e4d50b344f94edbb1feef52b8383d1c4e75..7ad9d2f886909e799fde5ab6e3644be8aa24457a 100644 (file)
@@ -146,8 +146,10 @@ class SMESHOBJECT_EXPORT SMESH_Actor: public SALOME_Actor
                 eMinimumAngle, eWarping, eSkew, eAspectRatio3D, eMultiConnection2D, eVolume3D,
                 eMaxElementLength2D, eMaxElementLength3D, eBareBorderFace, eBareBorderVolume,
                 eOverConstrainedFace, eOverConstrainedVolume, eCoincidentNodes,
-                eCoincidentElems1D, eCoincidentElems2D, eCoincidentElems3D, eNodeConnectivityNb };
+                eCoincidentElems1D, eCoincidentElems2D, eCoincidentElems3D, eNodeConnectivityNb,
+                eCustomControl };
   virtual void SetControlMode(eControl theMode) = 0;
+  virtual void SetControl(SMESH::Controls::FunctorPtr) = 0;
   virtual eControl GetControlMode() = 0;
   virtual SMESH::Controls::FunctorPtr GetFunctor() = 0;
   virtual int GetNumberControlEntities() = 0;
index 4366a98a6c87264dd18a4af04def9e5dfe2df2db..a43c80e6525427fb748eac969343ff2662cba47e 100644 (file)
@@ -208,6 +208,7 @@ class SMESH_ActorDef : public SMESH_Actor
   virtual bool GetFacesOrientation3DVectors();
 
   virtual void SetControlMode(eControl theMode);
+  virtual void SetControl(SMESH::Controls::FunctorPtr theFunctor);
   virtual int GetNumberControlEntities();
   virtual eControl GetControlMode(){ return myControlMode;}
   virtual SMESH::Controls::FunctorPtr GetFunctor() { return myFunctor; }