]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
synchonization of highlight between two views
authorpkv <pkv@opencascade.com>
Tue, 4 Oct 2005 14:05:10 +0000 (14:05 +0000)
committerpkv <pkv@opencascade.com>
Tue, 4 Oct 2005 14:05:10 +0000 (14:05 +0000)
src/OBJECT/VISU_GaussPtsAct.cxx
src/OBJECT/VISU_GaussPtsAct.h
src/PIPELINE/SALOME_ExtractGeometry.cxx
src/PIPELINE/SALOME_ExtractGeometry.h
src/PIPELINE/VISU_PipeLine.cxx

index f8583ce573573c22b578214276e3936c77a38c44..668696cf6eb77c00892e452db01497abee60c620 100644 (file)
@@ -81,7 +81,9 @@ static int MYDEBUG = 0;
 static int MYDEBUG1 = 0;
 static int MYDEBUG2 = 0;
 #endif
-
+//modified by NIZNHY-PKV Tue Oct  4 16:00:12 2005f
+static float s_Radius=0;
+//modified by NIZNHY-PKV Tue Oct  4 16:00:15 2005t
 //----------------------------------------------------------------
 vtkStandardNewMacro( VISU_OutsideCursorSettings );
 vtkStandardNewMacro( VISU_PickingSettings );
@@ -661,6 +663,7 @@ VISU_GaussPtsAct
     }
     //
     vtkIdType aVtkId = myPointPicker->GetPointId();
+    printf(" * Highlight() aVtkId=%d\n", aVtkId);
     if( aVtkId >= 0  && theSelector->IsValid( this, aVtkId, true ) && hasIO())  {
       vtkIdType anObjId = GetNodeObjId( aVtkId );
       if(anObjId >= 0){
@@ -696,6 +699,9 @@ VISU_GaussPtsAct
        if(vtkDataArray* aScalarArray = aCellData->GetScalars()){
          float aVal = aScalarArray->GetTuple1(aVtkId);
          float aRadius = myGaussPointsPL->GetPointSize(aVtkId, aScalarArray);
+         //modified by NIZNHY-PKV Tue Oct  4 16:00:45 2005f
+         s_Radius=aRadius;
+         //modified by NIZNHY-PKV Tue Oct  4 16:00:47 2005t
          mySphereSourceSelected->SetRadius(aRadius);
          //
          if(theSelector->HasIndex(myIO)){
@@ -853,7 +859,46 @@ VISU_GaussPtsAct
   //mySphereActor->SetVisibility(aSphereVisibility);
   return bRet;
 }
-
+//==================================================================
+// function : highlight
+// purpose  :
+//==================================================================
+void VISU_GaussPtsAct::highlight(bool theHighlight,
+                                SVTK_Selector* theSelector)
+{
+  Superclass::highlight(theHighlight, theSelector);
+  //
+  TColStd_IndexedMapOfInteger aMapIndex;
+  theSelector->GetIndex( getIO(), aMapIndex );
+  int aNbOfParts = aMapIndex.Extent();
+  if (!aNbOfParts){
+    mySphereActorSelected->SetVisibility(0);
+  }
+  else if (aNbOfParts==1){
+    int anObjId = aMapIndex(1);
+    vtkIdType aVtkId;
+    float* aNodeCoord = GetNodeCoord(anObjId);
+    printf(" *highlight() anObjId=%d  { %f, %f, %f }\n", 
+           anObjId, aNodeCoord[0], aNodeCoord[1], aNodeCoord[2]);
+    mySphereSourceSelected->SetCenter(aNodeCoord); 
+    //mySphereSourceSelected->SetRadius(s_Radius);
+    //
+    
+    aVtkId=myGaussPointsPL->GetElemVTKID(anObjId);
+    printf(" aVtkId=%d\n", aVtkId);
+    vtkDataSet* aDataSet = GetInput();
+    vtkCellData* aCellData = aDataSet->GetCellData();
+    if(vtkDataArray* aScalarArray = aCellData->GetScalars()){
+      float aVal = aScalarArray->GetTuple1(aVtkId);
+      float aRadius = myGaussPointsPL->GetPointSize(aVtkId, aScalarArray);
+      mySphereSourceSelected->SetRadius(aRadius);
+      //
+      GetScalarBarCtrl()->SetMarkValue(aVal);
+    }
+    
+    mySphereActorSelected->SetVisibility(1);
+  }
+}
 //----------------------------------------------------------------
 void
 VISU_GaussPtsAct
index 8456a26f246ff47c3ad99c564e95a9814e76e4a1..330f9b031e82425ea5d855bc2e0045a8a175ed66 100644 (file)
@@ -257,8 +257,13 @@ class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_Actor
   void
   SetPickingSettings(VISU_PickingSettings* thePickingSettings);
 
+  void UpdatePickingSettings();
+
+  virtual
   void
-  UpdatePickingSettings();
+  highlight(bool theHighlight, 
+           SVTK_Selector* theSelector);
 
  protected:
   //----------------------------------------------------------------------------
index 5f7d30ec10a4a3ea044e41c9b968ee90a873e208..896fcea72c66d5299a8324e6db8d8b9251871f09 100755 (executable)
@@ -99,7 +99,58 @@ SALOME_ExtractGeometry
 {
   return myStoreMapping;
 }
+//modified by NIZNHY-PKV Tue Oct  4 16:52:22 2005f
+//----------------------------------------------------------------------------
+vtkIdType
+SALOME_ExtractGeometry
+::GetElemVTKId(int theObjID)
+{
+  if (myElemVTK2ObjIds.empty())
+    return theObjID;
+
+  int i, aNb;
+  vtkIdType anObjId, aVTKId=-1;
+  //
+  aNb=myElemVTK2ObjIds.size();
+  for (i=0; i<aNb; ++i){
+#if defined __GNUC_2__
+    anObjId=myElemVTK2ObjIds[i];
+#else
+    anObjId=myElemVTK2ObjIds.at(i);
+#endif
+    if (anObjId==theObjID){
+      aVTKId=i;
+      return aVTKId;
+    }
+  }
+  return aVTKId;
+}
 
+vtkIdType
+SALOME_ExtractGeometry
+::GetNodeVTKId(int theObjID)
+{
+  if (myNodeVTK2ObjIds.empty())
+    return theObjID;
+
+  int i, aNb;
+  vtkIdType anObjId, aVTKId=-1;
+  //
+  aNb=myNodeVTK2ObjIds.size();
+  for (i=0; i<aNb; ++i){
+#if defined __GNUC_2__
+    anObjId=myNodeVTK2ObjIds[i];
+#else
+    anObjId=myNodeVTK2ObjIds.at(i);
+#endif
+    if (anObjId==theObjID){
+      aVTKId=i;
+      return aVTKId;
+    }
+  }
+  return aVTKId;
+}
+//modified by NIZNHY-PKV Tue Oct  4 16:52:24 2005t
 
 //----------------------------------------------------------------------------
 vtkIdType
index 2b6fdbe1c368106ee6afe3938eff9b31dc296ea3..2cb9fb32e186ca5c49ad111b4e10b3fc96a1dda9 100755 (executable)
@@ -52,7 +52,10 @@ public:
 
   virtual vtkIdType GetNodeObjId(int theID);
   virtual vtkIdType GetElemObjId(int theID);
-
+  //pkvf
+  virtual vtkIdType GetNodeVTKId(int theID);
+  virtual vtkIdType GetElemVTKId(int theID);
+  //pkvt
 protected:
   SALOME_ExtractGeometry();
   ~SALOME_ExtractGeometry();
index 1b06ceef072f3aa10f0079130513baa27302b3fb..3b88c987e9f1c665c0fff68a799700a94ab722b7 100644 (file)
@@ -429,7 +429,10 @@ vtkIdType
 VISU_PipeLine
 ::GetElemVTKID(vtkIdType theID)
 {
-  return myIDMapper->GetElemVTKID(theID);
+  vtkIdType anID = myExtractGeometry->GetElemVTKId(theID);
+  return myIDMapper->GetElemVTKID(anID);
+  
+  //return myIDMapper->GetElemVTKID(theID);
 }
 
 vtkCell*