]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Merge from branch BR_Dev_For_4_0 (from tag mergeto_BR_QT4_Dev_12Feb08) mergefrom_BR_Dev_For_4_0_12Feb08
authorvsr <vsr@opencascade.com>
Tue, 12 Feb 2008 16:15:54 +0000 (16:15 +0000)
committervsr <vsr@opencascade.com>
Tue, 12 Feb 2008 16:15:54 +0000 (16:15 +0000)
18 files changed:
configure.ac
doc/salome/gui/VISU/images/deformedshape.png
src/CONVERTOR/VISU_Convertor_impl.cxx
src/CONVERTOR/VISU_IDMapper.hxx
src/CONVERTOR/VISU_MedConvertor.cxx
src/CONVERTOR/VISU_MedConvertor.hxx
src/CONVERTOR/VISU_Structures.hxx
src/CONVERTOR/VISU_Structures_impl.cxx
src/CONVERTOR/VISU_Structures_impl.hxx
src/OBJECT/VISU_Actor.cxx
src/OBJECT/VISU_GaussPtsAct.cxx
src/OBJECT/VISU_GaussPtsAct.h
src/VISUGUI/VISU_msg_en.ts
src/VISUGUI/VisuGUI_DeformedShapeDlg.cxx
src/VISUGUI/VisuGUI_DeformedShapeDlg.h
src/VISU_I/VISU_Prs3d_i.cc
src/VVTK/VVTK_PickingDlg.cxx
src/VVTK/VVTK_PickingDlg.h

index 4e752299748d71fe996379d53e013b40a1b845f0..b5113abc454d9944fad36dd4a0b2dfd29cf0220c 100644 (file)
@@ -308,7 +308,7 @@ echo ---------------------------------------------
 echo
 
 echo Configure
-variables="cc_ok boost_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok omniORB_ok occ_ok qwt_ok doxygen_ok graphviz_ok Kernel_ok Med_ok"
+variables="cc_ok boost_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok omniORB_ok occ_ok qwt_ok doxygen_ok graphviz_ok Kernel_ok Med_ok SalomeGUI_ok"
 
 for var in $variables
 do
index 9b36a8d62a6b3bb5ddaded9345a61608674785f8..aea062713810177aa42c006703c59dd0357a5ed6 100644 (file)
Binary files a/doc/salome/gui/VISU/images/deformedshape.png and b/doc/salome/gui/VISU/images/deformedshape.png differ
index d0fb297536dfef64a8685e59dbceaa82d6c288a8..024ccf7ccf107a9d0ef006dfec93688dfa8755df 100644 (file)
@@ -398,7 +398,8 @@ namespace
 
        vtkIdType aNbCells = aSource->GetNumberOfCells();
        for(vtkIdType aCell = 0; aCell < aNbCells; aCell++, aCellID++){
-         anElemObj2VTKID[aSubProfile->GetElemObjID(aCell)] = aCellID;
+         vtkIdType anObjID = aSubProfile->GetElemObjID(aCell);
+         anElemObj2VTKID[anObjID] = aCellID;
        }
 
        aSubProfileArr[anInputID++] = aSubProfile;
index 635d2f560dd6af8d2d947f1e6a725c46ed9d874d..767def572a176e0c07b678065a7ec6f14d277e6d 100644 (file)
@@ -229,10 +229,15 @@ namespace VISU
     TGaussPointID 
     GetObjID(vtkIdType theID) const = 0;
 
+    //! Gets VTK ID by its complex Gauss Point ID 
+    virtual 
+    vtkIdType 
+    GetVTKID(const TGaussPointID& theID) const = 0;
+
     //! Gets parent TNamedIDMapper, which contains reference mesh cells
     virtual 
     TNamedIDMapper*
-    GetParent() = 0;
+    GetParent() const = 0;
   };
   typedef MED::SharedPtr<TGaussPtsIDMapper> PGaussPtsIDMapper;
 
index 882a82131083f8d574c3d767a37b0ad203bcb15a..2ea4ef2196a84d56935a90d33489761068076e02 100644 (file)
@@ -1197,14 +1197,33 @@ namespace VISU
   TMEDSubProfile
   ::GetElemObjID(vtkIdType theID) const
   {
-    if(mySubMeshID.empty())
-      if(myIsElemNum)
-        return (*myElemNum)[theID];
-      else
-        return theID;
-    return mySubMeshID[theID];
+    if ( !mySubMeshID.empty() )
+      theID = mySubMeshID[theID];
+
+    if ( myIsElemNum )
+      return (*myElemNum)[theID];
+    else
+      return theID;
   }
   
+
+  //---------------------------------------------------------------
+  vtkIdType
+  TMEDSubProfile
+  ::GetElemVTKID(vtkIdType theID) const
+  {
+    if ( myIsElemNum )
+      for ( size_t anId = 0; anId < (*myElemNum).size(); anId++ ) 
+       if ( (*myElemNum)[ anId ] == theID ) {
+         theID = anId;
+         break;
+       }
+
+    return TSubProfileImpl::GetElemVTKID( theID );
+  }
+
+
+  //----------------------------------------------------------------
   unsigned long int
   TMEDSubProfile
   ::GetMemorySize()
@@ -1238,17 +1257,44 @@ namespace VISU
   TMEDGaussSubMesh
   ::GetObjID(vtkIdType theID) const
   {
-    TCellID aCellID = theID / myGauss->myNbPoints;
-    TLocalPntID aLocalPntID = theID % myGauss->myNbPoints;
-    
-    if(myIsElemNum)
-      aCellID = (*myElemNum)[aCellID];
+    vtkIdType aNbPoints = myGauss->myNbPoints;
+    TCellID aCellID = theID / aNbPoints;
+    TLocalPntID aLocalPntID = theID % aNbPoints;
+
+    if ( myIsElemNum )
+      aCellID = GetElemObjID(aCellID);
     else
       aCellID += myStartID;
 
     return TGaussPointID(aCellID, aLocalPntID);
   }
   
+  
+  //---------------------------------------------------------------
+  vtkIdType
+  TMEDGaussSubMesh
+  ::GetVTKID(const TGaussPointID& theID,
+            vtkIdType theStartID) const
+  {
+    vtkIdType aResult = -1;
+
+    TCellID aCellID = theID.first;
+    TLocalPntID aLocalPntID = theID.second;
+    
+    vtkIdType aNbPoints = myGauss->myNbPoints;
+    if ( aLocalPntID >= aNbPoints )
+      return aResult;
+    
+    if ( myIsElemNum ) {
+      aCellID = GetElemVTKID( aCellID );
+    } else
+      aCellID -= theStartID;
+
+    return aCellID * aNbPoints + aLocalPntID + theStartID;
+  }
+
+
+  //---------------------------------------------------------------
   unsigned long int
   TMEDGaussSubMesh
   ::GetMemorySize()
index 7b2c6b80177c8b5e2b5aa1767f9b622def18b813..4529ecb379caba6dbf8e5b9756edc95473a47df4 100644 (file)
@@ -196,6 +196,11 @@ namespace VISU
     vtkIdType 
     GetElemObjID(vtkIdType theID) const;
     
+    //! Reimplement the TSubProfileImpl::GetElemVTKID
+    virtual 
+    vtkIdType 
+    GetElemVTKID(vtkIdType theID) const;
+
     //! Gets memory size used by the instance (bytes).
     virtual
     unsigned long int
@@ -238,6 +243,11 @@ namespace VISU
     TGaussPointID
     GetObjID(vtkIdType theID) const;
     
+    virtual
+    vtkIdType
+    GetVTKID(const TGaussPointID& theID,
+            vtkIdType theStartID) const;  
+
     //! Gets memory size used by the instance (bytes).
     virtual
     unsigned long int
index 7c2257ff3584df436a1cdf76c18d621df3fea921..06d2fadcc2a4c14d580c614424f6649ffef31c1a 100644 (file)
@@ -104,7 +104,17 @@ namespace VISU
   //---------------------------------------------------------------
   //! Define a basic class which corresponds to MED PROFILE entity
   struct VISU_CONVERTOR_EXPORT TSubProfile: virtual TBaseStructure
-  {};
+  {
+    //! Get object number of mesh cell by its VTK one
+    virtual 
+    vtkIdType 
+    GetElemObjID(vtkIdType theID) const = 0;
+
+    //! Get cell VTK ID for corresponding object ID
+    virtual 
+    vtkIdType 
+    GetElemVTKID(vtkIdType theID) const = 0;
+  };
 
 
   //---------------------------------------------------------------
index 8a922fc05d6373ab458c2cdfae7bb1b47f2aaa51..a00e8e90930efc9e23327189fc558fd6846ee4c1 100644 (file)
 #include <vtkUnstructuredGrid.h>
 #include <vtkPolyData.h>
 #include <vtkCellType.h>
+#include <vtkCell.h>
 
 namespace VISU
 {
+  /*  vtkIdType
+  VISUGeom2NbNodes(EGeometry theGeom)
+  { 
+    switch(theGeom){
+#ifndef VISU_ENABLE_QUADRATIC
+    case VISU::eSEG3: 
+      return 2;
+    case VISU::eTRIA6: 
+      return 3;
+    case VISU::eQUAD8: 
+      return 4;
+    case VISU::eTETRA10: 
+      return 4;
+    case VISU::eHEXA20: 
+      return 8;
+    case VISU::ePENTA15: 
+      return 6;
+    case VISU::ePYRA13: 
+      return 5;
+#endif
+    case VISU::ePOLYGONE: 
+    case VISU::ePOLYEDRE: 
+      return -1;
+    default:
+      return theGeom % 100;
+    }
+  }
+
+  vtkIdType
+  VISUGeom2VTK(EGeometry theGeom)
+  { 
+    switch(theGeom){
+    case VISU::ePOINT1: 
+      return VTK_VERTEX;
+    case VISU::eSEG2: 
+      return VTK_LINE;
+    case VISU::eTRIA3: 
+      return VTK_TRIANGLE;
+    case VISU::eQUAD4: 
+      return VTK_QUAD;
+    case VISU::eTETRA4: 
+      return VTK_TETRA;
+    case VISU::eHEXA8: 
+      return VTK_HEXAHEDRON;
+    case VISU::ePENTA6: 
+      return VTK_WEDGE;
+    case VISU::ePYRA5: 
+      return VTK_PYRAMID;
+
+    case VISU::ePOLYGONE: 
+      return VTK_POLYGON;
+    case VISU::ePOLYEDRE: 
+      return VTK_CONVEX_POINT_SET;
+
+#ifndef VISU_ENABLE_QUADRATIC
+    case VISU::eSEG3: 
+      return VTK_LINE;
+    case VISU::eTRIA6: 
+      return VTK_TRIANGLE;
+    case VISU::eQUAD8: 
+      return VTK_QUAD;
+    case VISU::eTETRA10: 
+      return VTK_TETRA;
+    case VISU::eHEXA20: 
+      return VTK_HEXAHEDRON;
+    case VISU::ePENTA15: 
+      return VTK_WEDGE;
+    case VISU::ePYRA13: 
+      return VTK_PYRAMID;
+
+#else
+
+    case VISU::eSEG3: 
+#if defined(VTK_QUADRATIC_EDGE) && defined(VISU_USE_VTK_QUADRATIC)
+      return VTK_QUADRATIC_EDGE;
+#else
+      return VTK_POLY_LINE;
+#endif
+
+    case VISU::eTRIA6: 
+#if defined(VTK_QUADRATIC_TRIANGLE) && defined(VISU_USE_VTK_QUADRATIC)
+      return VTK_QUADRATIC_TRIANGLE;
+#else
+      return VTK_POLYGON;
+#endif
+
+    case VISU::eQUAD8: 
+#if defined(VTK_QUADRATIC_QUAD) && defined(VISU_USE_VTK_QUADRATIC)
+      return VTK_QUADRATIC_QUAD;
+#else
+      return VTK_POLYGON;
+#endif
+
+    case VISU::eTETRA10: 
+#if defined(VTK_QUADRATIC_TETRA) && defined(VISU_USE_VTK_QUADRATIC)
+      return VTK_QUADRATIC_TETRA;
+#else
+      return VTK_CONVEX_POINT_SET;
+#endif
+
+    case VISU::eHEXA20: 
+#if defined(VTK_QUADRATIC_HEXAHEDRON) && defined(VISU_USE_VTK_QUADRATIC)
+      return VTK_QUADRATIC_HEXAHEDRON;
+#else
+      return VTK_CONVEX_POINT_SET;
+#endif
+
+    case VISU::ePENTA15: 
+#if defined(VTK_QUADRATIC_WEDGE) && defined(VISU_USE_VTK_QUADRATIC)
+      return VTK_QUADRATIC_WEDGE;
+#else
+      return VTK_CONVEX_POINT_SET;
+#endif
+
+    case VISU::ePYRA13: 
+#if defined(VTK_QUADRATIC_PYRAMID) && defined(VISU_USE_VTK_QUADRATIC)
+      return VTK_QUADRATIC_PYRAMID;
+#else
+      return VTK_CONVEX_POINT_SET;
+#endif
+
+#endif //VISU_ENABLE_QUADRATIC
+
+    default:
+      return -1;
+    }
+    }*/
+
+
+  EGeometry
+  VTKGeom2VISU(vtkIdType theGeom)
+  { 
+    switch(theGeom){
+    case VTK_VERTEX: 
+      return VISU::ePOINT1;
+    case VTK_LINE: 
+      return VISU::eSEG2;
+    case VTK_TRIANGLE: 
+      return VISU::eTRIA3;
+    case VTK_QUAD: 
+      return VISU::eQUAD4;
+    case VTK_TETRA: 
+      return VISU::eTETRA4;
+    case VTK_HEXAHEDRON: 
+      return VISU::eHEXA8;
+    case VTK_WEDGE: 
+      return VISU::ePENTA6;
+    case VTK_PYRAMID: 
+      return VISU::ePYRA5;
+
+    case VTK_POLYGON: 
+      return VISU::ePOLYGONE;
+    case VTK_CONVEX_POINT_SET: 
+      return VISU::ePOLYEDRE;
+
+#if defined(VISU_ENABLE_QUADRATIC) && defined(VISU_USE_VTK_QUADRATIC)
+  #if defined(VTK_QUADRATIC_EDGE)
+    case VTK_QUADRATIC_EDGE: 
+      return VISU::eSEG3;
+  #endif
+
+  #if defined(VTK_QUADRATIC_TRIANGLE)
+    case VTK_QUADRATIC_TRIANGLE: 
+      return VISU::eTRIA6;
+  #endif
+
+  #if defined(VTK_QUADRATIC_QUAD)
+    case VTK_QUADRATIC_QUAD: 
+      return VISU::eQUAD8;
+  #endif
+
+  #if defined(VTK_QUADRATIC_TETRA)
+    case VTK_QUADRATIC_TETRA: 
+      return VISU::eTETRA10;
+  #endif
+
+  #if defined(VTK_QUADRATIC_HEXAHEDRON)
+    case VTK_QUADRATIC_HEXAHEDRON: 
+      return VISU::eHEXA20;
+  #endif
+
+  #if defined(VTK_QUADRATIC_WEDGE)
+    case VTK_QUADRATIC_WEDGE: 
+      return VISU::ePENTA15;
+  #endif
+
+  #if defined(VTK_QUADRATIC_PYRAMID)
+    case VTK_QUADRATIC_PYRAMID: 
+      return VISU::ePYRA13;
+  #endif
+
+#endif //VISU_ENABLE_QUADRATIC
+
+    default:
+      return EGeometry(-1);
+    }
+  }
+
   //---------------------------------------------------------------
   /*! Computes number of points by the given number of cells
    *  in assumption of regular hexahedral mesh structure
@@ -289,6 +488,22 @@ namespace VISU
   TSubProfileImpl
   ::GetElemObjID(vtkIdType theID) const
   {
+    if ( !mySubMeshID.empty() )
+      return mySubMeshID[theID];
+    
+    return theID;
+  }
+
+
+  vtkIdType
+  TSubProfileImpl
+  ::GetElemVTKID(vtkIdType theID) const
+  {
+    if ( !mySubMeshID.empty() )
+      for ( size_t anId = 0; anId < mySubMeshID.size(); anId++ ) 
+       if ( mySubMeshID[ anId ] == theID ) 
+         return anId;
+
     return theID;
   }
 
@@ -651,6 +866,37 @@ namespace VISU
     return TGaussPointID(aCellID, aLocalPntID);
   }
 
+  vtkIdType
+  TGaussSubMeshImpl
+  ::GetVTKID(const TGaussPointID& theID) const
+  {
+    vtkIdType aResult = -1;
+
+    TCellID aCellID = theID.first;
+    TLocalPntID aLocalPntID = theID.second;
+    
+    vtkIdType aNbPoints = myGauss->myNbPoints;
+    if ( aLocalPntID >= aNbPoints )
+      return aResult;
+
+    return ( aCellID - myStartID ) * aNbPoints + aLocalPntID;
+  }
+
+  vtkIdType
+  VISU::TGaussSubMeshImpl
+  ::GetElemObjID(vtkIdType theID) const
+  {
+    return mySubProfile->GetElemObjID( theID );
+  }
+  
+  
+  vtkIdType
+  VISU::TGaussSubMeshImpl
+  ::GetElemVTKID(vtkIdType theID) const
+  {
+    return mySubProfile->GetElemVTKID( theID );
+  }
+
   vtkIdType 
   TGaussSubMeshImpl
   ::GetGlobalID(vtkIdType theID) const
@@ -702,6 +948,43 @@ namespace VISU
     return VISU::GetObjID(aFilter->GetOutput(), theID);
   }
 
+  vtkIdType 
+  TGaussMeshImpl
+  ::GetVTKID(const TGaussPointID& theID) const
+  {
+    vtkIdType aResult = -1;
+
+    TCellID aCellID = theID.first;
+
+    vtkIdType aVTKCellId = GetParent()->GetElemVTKID( aCellID );
+    if ( aVTKCellId < 0 ) 
+      return aResult;
+      
+    vtkCell* aCell = GetParent()->GetElemCell( aCellID );
+    if ( !aCell )
+      return aResult;
+
+    EGeometry aVGeom = VISU::VTKGeom2VISU( aCell->GetCellType() );
+    if ( aVGeom < EGeometry(0) ) 
+      return aResult;
+    
+    TGeom2GaussSubMesh::const_iterator anIter = myGeom2GaussSubMesh.find( aVGeom );
+    if ( anIter == myGeom2GaussSubMesh.end() )
+      return aResult;
+      
+    size_t aSubMeshEnd = myGaussSubMeshArr.size();
+    const PAppendFilter& anAppendFilter = GetFilter();
+    const PGaussSubMeshImpl& aGaussSubMesh = anIter->second;
+    for ( size_t aSubMeshId = 0; aSubMeshId < aSubMeshEnd; aSubMeshId++ ) {
+      const PGaussSubMeshImpl& aSubMesh = myGaussSubMeshArr[aSubMeshId];
+      if ( aGaussSubMesh.get() == aSubMesh.get() ) {
+       return aGaussSubMesh->GetVTKID(theID);
+      }
+    }
+
+    return aResult;
+  }
+
   vtkPolyData* 
   TGaussMeshImpl
   ::GetPolyDataOutput()
@@ -726,7 +1009,7 @@ namespace VISU
 
   TNamedIDMapper* 
   TGaussMeshImpl
-  ::GetParent()
+  ::GetParent() const
   {
     return myParent;
   }
@@ -739,10 +1022,17 @@ namespace VISU
   {
     return myGaussPtsIDMapper->GetObjID(theID);
   }
+
+  vtkIdType 
+  TGaussPtsIDFilter
+  ::GetVTKID(const TGaussPointID& theID) const
+  {
+    return myGaussPtsIDMapper->GetVTKID(theID);
+  }
   
   TNamedIDMapper* 
   TGaussPtsIDFilter
-  ::GetParent()
+  ::GetParent() const
   {
     return myGaussPtsIDMapper->GetParent();
   }
index 08461db1f8a4f0075516b0392f19bb072c319590..fe6a7cc59f0194246e4a716e5e22d24411ff2c01 100644 (file)
@@ -252,6 +252,11 @@ namespace VISU
     vtkIdType 
     GetElemObjID(int theVtkI) const;
 
+    //! Get cell VTK ID for corresponding object ID
+    virtual
+    vtkIdType 
+    GetElemVTKID(vtkIdType theID) const;
+
     //! Gets memory size used by the instance (bytes).
     virtual
     unsigned long int
@@ -487,6 +492,19 @@ namespace VISU
     virtual
     TGaussPointID
     GetObjID(vtkIdType theID) const;
+
+    //! To implement the TGaussPtsIDMapper::GetVTKID
+    virtual
+    vtkIdType
+    GetVTKID(const TGaussPointID& theID) const;
+    
+    virtual 
+    vtkIdType 
+    GetElemObjID(vtkIdType theID) const;
+
+    virtual 
+    vtkIdType 
+    GetElemVTKID(vtkIdType theID) const;
     
     virtual
     vtkIdType
@@ -526,6 +544,11 @@ namespace VISU
     TGaussPointID
     GetObjID(vtkIdType theID) const;
 
+    //! Reimplements the TGaussPtsIDMapper::GetVTKID
+    virtual
+    vtkIdType 
+    GetVTKID(const TGaussPointID& theID) const;
+
     //! Reimplement the TGaussPtsIDMapper::GetPolyDataOutput
     virtual
     vtkPolyData* 
@@ -539,7 +562,7 @@ namespace VISU
     //! Reimplement the TGaussPtsIDMapper::GetParent
     virtual 
     TNamedIDMapper*
-    GetParent();
+    GetParent() const;
 
     TNamedIDMapper* myParent; //!< Refer to parent mesh
     TGaussSubMeshArr myGaussSubMeshArr; //!< Keeps sequence of TGaussSubMesh as they were added into TAppendFilterHolder
@@ -559,10 +582,16 @@ namespace VISU
     TGaussPointID 
     GetObjID(vtkIdType theID) const;
 
+    //! Reimplements the TGaussPtsIDMapper::GetVTKID
+    virtual 
+    vtkIdType 
+    GetVTKID(const TGaussPointID& theID) const;
+
+    //! Reimplements the TGaussPtsIDMapper::GetParent
     //! Reimplement the TGaussPtsIDMapper::GetParent
     virtual 
     TNamedIDMapper*
-    GetParent();
+    GetParent() const;
 
     //! Reimplement the TNamedIDMapper::GetUnstructuredGridOutput
     virtual
index de0ddc513fc3fe05330cc63130cb5b719030ddd5..8d448e7f542c76de17e8a406711f05e8fe2996b2 100644 (file)
@@ -131,6 +131,7 @@ VISU_Actor
 ::ShallowCopyPL(VISU_PipeLine* thePipeLine)
 {
   myPipeLine->ShallowCopy(thePipeLine, true);
+  GetMapper()->Update();
 }
 
 //----------------------------------------------------------------------------
index c9d5880d74139be6c4929baee75e436f4f1e1394..045da66fbe5937c94086011600c6eb45ce46b96b 100644 (file)
@@ -85,6 +85,31 @@ static int MYDEBUG2 = 0;
 #endif
 
 
+namespace
+{
+  bool
+  CheckIsSameValue(vtkFloatingPointType theTarget,
+                  vtkFloatingPointType theSource)
+  {
+    static vtkFloatingPointType TOL = 10.0 / VTK_LARGE_FLOAT;
+    return fabs(theTarget - theSource)  < TOL;
+  }
+
+  bool
+  CheckIsSameVector(vtkFloatingPointType* theTarget,
+                   vtkFloatingPointType* theSource,
+                   size_t theLength)
+  {
+    for ( size_t anId = 0; anId < theLength; anId++ ) {
+      if ( !CheckIsSameValue( theTarget[ anId ], theSource[ anId ] ) )
+       return false;
+    }
+
+    return true;
+  }
+  
+}
+
 //============================================================================
 vtkStandardNewMacro(VISU_GaussPtsAct);
 
@@ -96,7 +121,7 @@ VISU_GaussPtsAct
   myDeviceActor(VISU_GaussPtsDeviceActor::New()),
   myWidgetCtrl(NULL),
   myGaussPointsPL(NULL),
-  myLastObjPointID(-1),
+  myLastPreHighlightObjID(-1),
   myTextActor(VISU_FramedTextActor::New()),
   myCursorPyramid(VISU_CursorPyramid::New()),
   myCursorPyramidSelected(VISU_CursorPyramid::New()),
@@ -678,7 +703,7 @@ VISU_GaussPtsAct
 
 
   if(!theIsHighlight)
-    myLastObjPointID = -1;
+    myLastPreHighlightObjID = -1;
 
   Selection_Mode aSelectionMode = theSelectionEvent->mySelectionMode;
 
@@ -706,7 +731,7 @@ VISU_GaussPtsAct
       vtkIdType anObjId = GetNodeObjId( aVtkId );
       myIsPreselected = (anObjId >= 0);
       if(myIsPreselected){
-       anIsChanged = (myLastObjPointID != anObjId);
+       anIsChanged = (myLastPreHighlightObjID != anObjId);
        if(anIsChanged){
          vtkFloatingPointType* aNodeCoord = GetNodeCoord(anObjId);
          vtkDataSet* aDataSet = GetInput();
@@ -729,7 +754,7 @@ VISU_GaussPtsAct
                                  aNodeCoord,
                                  aColor);
          }
-         myLastObjPointID = anObjId;
+         myLastPreHighlightObjID = anObjId;
        }
        myCursorPyramid->SetVisibility(true);
       }
@@ -747,21 +772,20 @@ VISU_GaussPtsAct
 inline
 void
 ChangeZoom(VISU_PickingSettings *thePickingSettings,
-          vtkInteractorStyle* theInteractorStyle,
-          int theInitialHasIndex,
-          int theCurrentHasIndex,
-          const Handle(SALOME_InteractiveObject)& theIO)
+          vtkRenderer* theRenderer,
+          vtkIdType theInitialHasIndex,
+          vtkIdType theCurrentHasIndex)
 {
   if(theInitialHasIndex + theCurrentHasIndex == 1){
-    vtkRenderer *aRenderer = theInteractorStyle->GetCurrentRenderer();
-    vtkCamera *aCamera = aRenderer->GetActiveCamera();
+    vtkCamera *aCamera = theRenderer->GetActiveCamera();
+
     vtkFloatingPointType aZoomFactor = thePickingSettings->GetZoomFactor();
     double aScale = aCamera->GetParallelScale();
-    if (!theInitialHasIndex && theCurrentHasIndex) {
-      aCamera->SetParallelScale(aScale/aZoomFactor);
+    if ( !theInitialHasIndex && theCurrentHasIndex ) {
+      aCamera->SetParallelScale( aScale/aZoomFactor );
     }
     else {
-      aCamera->SetParallelScale(aScale*aZoomFactor);
+      aCamera->SetParallelScale( aScale*aZoomFactor );
     }
   }
   
@@ -776,20 +800,20 @@ VISU_GaussPtsAct
   if ( !GetPickable() )
     return false;
 
-  int anInitialHasIndex = myIsHighlighted && mySelectionMode == GaussPointSelection;
+  //  int anInitialHasIndex = myIsHighlighted && mySelectionMode == GaussPointSelection;
   Handle(SALOME_InteractiveObject) anIO = getIO();
-  myIsHighlighted = false;
+  //  myIsHighlighted = false;
 
   Selection_Mode aSelectionMode = theSelectionEvent->mySelectionMode;
 
   if(!theIsHighlight && aSelectionMode == GaussPointSelection){
     mySelector->RemoveIObject(anIO);
 
-    ChangeZoom(myPickingSettings,
+    /*    ChangeZoom(myPickingSettings,
               theInteractorStyle,
               anInitialHasIndex,
               false,
-              anIO);
+              anIO);*/
 
     return true;
   }
@@ -814,11 +838,11 @@ VISU_GaussPtsAct
     if(myPointPicker->GetActor() != this) {
       mySelector->ClearIObjects();
 
-      ChangeZoom(myPickingSettings,
+      /*      ChangeZoom(myPickingSettings,
                 theInteractorStyle,
                 anInitialHasIndex,
                 false,
-                anIO);
+                anIO);*/
 
       return true;
     }
@@ -827,7 +851,7 @@ VISU_GaussPtsAct
     if( aVtkId >= 0  && mySelector->IsValid( this, aVtkId, true ) && hasIO()) {
       vtkIdType anObjId = GetNodeObjId( aVtkId );
       if(anObjId >= 0){
-       myIsHighlighted = true;
+       //      myIsHighlighted = true;
        // Update the Selector
        if(mySelector->IsSelected(myIO))
          mySelector->AddOrRemoveIndex(myIO,anObjId,theSelectionEvent->myIsShift);
@@ -838,7 +862,7 @@ VISU_GaussPtsAct
          mySelector->AddOrRemoveIndex(myIO,anObjId,theSelectionEvent->myIsShift);
          mySelector->AddIObject(this);
        }
-       //
+       /*
        vtkFloatingPointType* aNodeCoord = GetNodeCoord(anObjId);
        //
        // FlyTo
@@ -853,27 +877,26 @@ VISU_GaussPtsAct
        anInteractor->SetDolly(aDollyWas);
        anInteractor->SetNumberOfFlyFrames(aNumberOfFlyFramesWas);
        
-       anInteractor->InvokeEvent(SVTK::ChangeRotationPoint, aNodeCoord);
+       anInteractor->InvokeEvent(SVTK::ChangeRotationPoint, aNodeCoord);*/
 
        mySelectionMode = aSelectionMode;
 
-       ChangeZoom(myPickingSettings,
+       /*      ChangeZoom(myPickingSettings,
                   theInteractorStyle,
                   anInitialHasIndex,
                   true,
-                  anIO);
+                  anIO);*/
 
        return true;
-       //
       }// if( anObjId >= 0 ) {
     }//if( aVtkId >= 0  && mySelector->IsValid( this, aVtkId, true ) && hasIO()) 
   }//if(!theSelectionEvent->myIsRectangle){
 
-  ChangeZoom(myPickingSettings,
+  /* ChangeZoom(myPickingSettings,
             theInteractorStyle,
             anInitialHasIndex,
             false,
-            anIO);
+            anIO);*/
   
   return false;
 }
@@ -889,34 +912,79 @@ VISU_GaussPtsAct
   if(!mySelector.GetPointer())
     return;
 
+  Selection_Mode aSelectionMode = mySelector->SelectionMode();
+  
+  bool anInitialHasIndex = isHighlighted() && mySelectionMode == GaussPointSelection;
+  
+  TColStd_IndexedMapOfInteger aMapIndex;
+  mySelector->GetIndex( getIO(), aMapIndex );
+  bool aCurrentHasIndex = aMapIndex.Extent() == 1;
+  bool anIsVisible = GetVisibility() && aCurrentHasIndex && theIsHighlight;
+
   myOutlineActor->SetVisibility(false);
-  myTextActor->SetVisibility(false);
-  myCursorPyramidSelected->SetVisibility(false);
   myCursorPyramid->SetVisibility(false);
-  myCellActor->SetVisibility(false);
-  GetScalarBarCtrl()->SetIsMarked(false);
-  GetScalarBarCtrl()->Update();
+
+  myTextActor->SetVisibility(anIsVisible);
+  myCellActor->SetVisibility(anIsVisible);
+  GetScalarBarCtrl()->SetIsMarked(anIsVisible);
+  myCursorPyramidSelected->SetVisibility(anIsVisible);
+  //GetScalarBarCtrl()->Update();
+
+  myIsHighlighted = aCurrentHasIndex;
+
+  // Zoom if necessary
+  ChangeZoom(myPickingSettings,
+            GetRenderer(),
+            anInitialHasIndex,
+            aCurrentHasIndex);
 
   if(!theIsHighlight)
     return;
 
-  bool anIsVisible = GetVisibility();
+  if( aSelectionMode == ActorSelection ) {
+    Superclass::highlight(theIsHighlight);
+    return;
+  }
 
-  Selection_Mode aSelectionMode = mySelector->SelectionMode();
+  if( aSelectionMode != GaussPointSelection )
+    return;
 
-  if(aSelectionMode == ActorSelection)
-    Superclass::highlight(theIsHighlight);
-  else if(aSelectionMode != GaussPointSelection)
+  if ( !aCurrentHasIndex || !myBarVisibility )
     return;
 
-  TColStd_IndexedMapOfInteger aMapIndex;
+  //  TColStd_IndexedMapOfInteger aMapIndex;
   mySelector->GetIndex( getIO(), aMapIndex );
   if(aMapIndex.Extent() != 1 || !myBarVisibility) {
     return;
   }
+
+  vtkRenderer *aRenderer = GetRenderer();
+  vtkCamera* aCamera = aRenderer->GetActiveCamera();
+
+  int anObjId = aMapIndex(1);
+  vtkFloatingPointType* aNodeCoord = GetNodeCoord(anObjId);
+
+  vtkFloatingPointType aFocalPnt[3];
+  aCamera->GetFocalPoint(aFocalPnt);
+
+  if ( CheckIsSameVector( aNodeCoord, aFocalPnt, 3 ) ) 
+    return;
+
+  // FlyTo
+  vtkRenderWindowInteractor* anInteractor = myInteractor;
+  vtkFloatingPointType aDollyWas = anInteractor->GetDolly();
+  int aNumberOfFlyFramesWas = anInteractor->GetNumberOfFlyFrames();
+  
+  anInteractor->SetDolly(0.0);
+  anInteractor->SetNumberOfFlyFrames(myPickingSettings->GetStepNumber());
+  anInteractor->FlyTo(aRenderer, aNodeCoord);
+  aRenderer->ResetCameraClippingRange();
+  anInteractor->SetDolly(aDollyWas);
+  anInteractor->SetNumberOfFlyFrames(aNumberOfFlyFramesWas);
+  anInteractor->InvokeEvent(SVTK::ChangeRotationPoint, aNodeCoord);
   //
   std::ostringstream aStr;
-  int anObjId = aMapIndex(1);
+  //  int anObjId = aMapIndex(1);
   aStr<<"Global ID: "<<anObjId;
   //
   vtkIdType aVtkId = GetNodeVTKID(anObjId);
@@ -930,7 +998,7 @@ VISU_GaussPtsAct
     if(vtkDataArray* aScalarArray = aDataSetAttributes->GetScalars()){
       vtkFloatingPointType aVal = aScalarArray->GetTuple1(aVtkId);
       //
-      GetScalarBarCtrl()->SetIsMarked(true);
+      //      GetScalarBarCtrl()->SetIsMarked(true);
       GetScalarBarCtrl()->SetMarkValue(aVal);
       GetScalarBarCtrl()->Update();
       //
index 7396f591323888e833ce2ff229678ac50693c59e..5cf5086f746597e2c12b61ffc52f4d49f35ed857 100644 (file)
@@ -316,7 +316,7 @@ class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_Actor
 
   vtkSmartPointer<vtkPolyDataMapper> myMapper;
 
-  vtkIdType myLastObjPointID;
+  vtkIdType myLastPreHighlightObjID;
 
   vtkSmartPointer<VISU_FramedTextActor> myTextActor;
 
index b7b69fc6ca64751145b3e7b67386050b1a5fa04c..4b926fc81e16bedfac479c5f33d646551b6689a1 100644 (file)
             <source>ZOOM_FACTOR</source>
             <translation>Zoom at first selected point (ratio) :</translation>
         </message>
+        <message>
+            <source>DATA_POSITION</source>
+            <translation>Position</translation>
+        </message>
+        <message>
+            <source>PARENT_ELEMENT</source>
+            <translation>Parent mesh element ID:</translation>
+        </message>
+        <message>
+            <source>LOCAL_POINT</source>
+            <translation>Local Gauss Point ID:</translation>
+        </message>
     </context>
     <context>
         <name>VVTK_PrimitiveBox</name>
         </message>
         <message>
             <source>MEN_DISPLAY_ONLY</source>
-            <translation>Display Only</translation>
+            <translation>Show Only</translation>
         </message>
         <message>
             <source>MEN_DISPLAY_SELECTION</source>
         </message>
         <message>
             <source>MEN_ERASE_ALL</source>
-            <translation>Erase All</translation>
+            <translation>Hide All</translation>
         </message>
         <message>
             <source>MEN_EXPORT_TABLE</source>
         </message>
         <message>
             <source>LBL_SHOW_UNITS</source>
-            <translation>Display units</translation>
+            <translation>Show units</translation>
         </message>
         <message>
             <source>LBL_UNITS_FORMAT</source>
index 2749474726a2d2c2ba227f359f5a015a170643ba..e9b26850170bf61dd0a6ff18e319a8c0b3f07185 100644 (file)
@@ -64,6 +64,7 @@ VisuGUI_DeformedShapeDlg::VisuGUI_DeformedShapeDlg (SalomeApp_Module* theModule)
   setWindowTitle(tr("DLG_TITLE"));
   setSizeGripEnabled(TRUE);
   myModule = theModule;
+  isApplyed = false;
 
   QVBoxLayout* TopLayout = new QVBoxLayout (this);
   TopLayout->setSpacing(6);
@@ -184,6 +185,30 @@ int VisuGUI_DeformedShapeDlg::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs)
   return anIsOk;
 }
 
+void VisuGUI_DeformedShapeDlg::updatePrsCopy()
+{
+  SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>();
+  VisuGUI* aVisuGUI = dynamic_cast <VisuGUI*>(myModule);
+  if ( myPrsCopy->GetNumberOfActors() == 0 ) {
+    PublishInView(aVisuGUI, myPrsCopy, aViewWindow);
+    aViewWindow->onFitAll();    
+    int aPos = VISU::GetFreePositionOfDefaultScalarBar(aVisuGUI, aViewWindow);
+    VISU::AddScalarBarPosition(aVisuGUI, aViewWindow, myPrsCopy, aPos);
+    } else {
+    try {
+      myPrsCopy->UpdateActors();
+    } catch (std::runtime_error& exc) {
+      myPrsCopy->RemoveActors();
+      
+      INFOS(exc.what());
+      SUIT_MessageBox::warning(VISU::GetDesktop(myModule),
+                              tr("WRN_VISU"),
+                              tr("ERR_CANT_BUILD_PRESENTATION") + ": " + exc.what());
+    }
+    aViewWindow->Repaint();
+  }
+}
+
 void VisuGUI_DeformedShapeDlg::accept()
 {
   VisuGUI_ScalarBarBaseDlg::done( isValid() );
@@ -191,7 +216,7 @@ void VisuGUI_DeformedShapeDlg::accept()
 
 void VisuGUI_DeformedShapeDlg::reject()
 {
-  if ( myPrsCopy->GetNumberOfActors() != 0 )
+  if ( isApplyed )
     VisuGUI_ScalarBarBaseDlg::done( 1 );
   else
     VisuGUI_ScalarBarBaseDlg::reject();
@@ -206,25 +231,8 @@ bool VisuGUI_DeformedShapeDlg::onApply()
 {
   if ( storeToPrsObject( myPrsCopy ) ) 
   {
-    if ( myPrsCopy->GetNumberOfActors() == 0 ) {
-      SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>();
-      VisuGUI* aVisuGUI = dynamic_cast <VisuGUI*>(myModule);
-      PublishInView(aVisuGUI, myPrsCopy, aViewWindow);
-      aViewWindow->onFitAll();
-      int aPos = VISU::GetFreePositionOfDefaultScalarBar(aVisuGUI, aViewWindow);
-      VISU::AddScalarBarPosition(aVisuGUI, aViewWindow, myPrsCopy, aPos);
-    } else {
-      try {
-       myPrsCopy->UpdateActors();
-      } catch (std::runtime_error& exc) {
-       myPrsCopy->RemoveActors();
-       
-       INFOS(exc.what());
-       SUIT_MessageBox::warning
-         (VISU::GetDesktop(myModule), QObject::tr("WRN_VISU"),
-          QObject::tr("ERR_CANT_BUILD_PRESENTATION") + ": " + QObject::tr(exc.what()));
-      }
-    }
+    updatePrsCopy();
+    isApplyed = true;
     return true;
   }
   return false;
@@ -265,6 +273,7 @@ void VisuGUI_DeformedShapeDlg::CreatePrs3d(VisuGUI* theModule)
          
          VisuGUI_DeformedShapeDlg* aDlg = new VisuGUI_DeformedShapeDlg (theModule);
          aDlg->initFromPrsObject(aPrs3d, true);
+         aDlg->UseMagn->setChecked(true);
          VisuGUI_DialogRunner r(aDlg);
          int dlgResult = r.run( false );
 
@@ -294,6 +303,14 @@ void VisuGUI_DeformedShapeDlg::EditPrs3d(VisuGUI* theModule, VISU::Prs3d_i* theP
   if (TPrs3d_i* aPrs3d = dynamic_cast<TPrs3d_i*>(thePrs3d)) {
     VisuGUI_DeformedShapeDlg* aDlg = new VisuGUI_DeformedShapeDlg (theModule);
     aDlg->initFromPrsObject(aPrs3d, true);
+    aDlg->updatePrsCopy();
+
+    //Hide thePrs3d from Viewer
+    SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>(theModule);
+    if (VISU_Actor* anActor = FindActor(aViewWindow, thePrs3d))
+      if (anActor->GetVisibility())
+       anActor->VisibilityOff();
+
     VisuGUI_DialogRunner r(aDlg);
     int dlgResult = r.run( false );
     
@@ -301,17 +318,22 @@ void VisuGUI_DeformedShapeDlg::EditPrs3d(VisuGUI* theModule, VISU::Prs3d_i* theP
       aDlg->storeToPrsObject( aPrs3d );
     
     try {
-      aPrs3d->UpdateActors();
+      thePrs3d->UpdateActors();
     }
     catch (std::runtime_error& exc) {
-      aPrs3d->RemoveActors();
+      thePrs3d->RemoveActors();
       
       INFOS(exc.what());
       SUIT_MessageBox::warning
        (VISU::GetDesktop(theModule), QObject::tr("WRN_VISU"),
         QObject::tr("ERR_CANT_BUILD_PRESENTATION") + ": " + QObject::tr(exc.what()));
     }
-    delete aDlg;
+
+    if (VISU_Actor* anActor = FindActor(aViewWindow, thePrs3d))
+      if (!anActor->GetVisibility())
+       anActor->VisibilityOn();
+    
+    delete aDlg;    
   }
 }
 
index 4fe8d6ccc819f359c448d6fb7584ef0d34630566..099fc006f355547e55f48e4f705032b781059499 100644 (file)
@@ -74,6 +74,8 @@ public:
     static void CreatePrs3d(VisuGUI*  theModule);
     static void EditPrs3d(VisuGUI* theModule, VISU::Prs3d_i* thePrs3d, Handle(SALOME_InteractiveObject)& theIO);
 
+    void updatePrsCopy();
+
 protected:
     virtual QString        GetContextHelpFilePath();
     int                   isValid();
@@ -89,6 +91,7 @@ private:
     VisuGUI_InputPane*     myInputPane;
     SalomeApp_Module*      myModule;
     SALOME::GenericObjPtr<VISU::DeformedShape_i> myPrsCopy;
+    bool                   isApplyed;
 };
 
 #endif // VISUGUI_DEFORMEDSHAPEDLS_H
index 0df4282ead847e5a4e3af8893933bd95e33d481c..baabd4a1381d273380796a3561571c692163e51b 100644 (file)
@@ -48,8 +48,7 @@ static int MYDEBUG = 0;
 
 
 //----------------------------------------------------------------------------
-VISU::Prs3d_i
-::Prs3d_i() :
+VISU::Prs3d_i::Prs3d_i() :
   PrsObject_i(SALOMEDS::Study::_nil()),
   myActorCollection(vtkActorCollection::New()),
   myIsActiveSatate(true)
@@ -96,8 +95,7 @@ namespace VISU
 }
 
 //----------------------------------------------------------------------------
-VISU::Prs3d_i
-::~Prs3d_i()
+VISU::Prs3d_i::~Prs3d_i()
 {
   if(MYDEBUG) MESSAGE("Prs3d_i::~Prs3d_i - this = "<<this);
   ProcessVoidEvent(new TInvokeSignalEvent(myRemoveActorsFromRendererSignal));
@@ -395,17 +393,16 @@ VISU::Prs3d_i
           VISU::Prs3d_i* theRemovable):
       TInvokeSignalEvent(theSignal),
       myRemovable(theRemovable)
-  {}
+    {}
   
-  virtual
-  void
-  Execute()
-  {
-    TInvokeSignalEvent::Execute();
-    myRemovable->Destroy();
-  }
-};
-
+    virtual
+    void
+    Execute()
+    {
+      //TInvokeSignalEvent::Execute();
+      myRemovable->Destroy();
+    }
+  };
 
   ProcessVoidEvent(new TEvent(myRemoveActorsFromRendererSignal, this));
 }
index 6c72bc9aa75477632f9c1241f669616045c4b4e0..5e05ceac14c805cfc3dbd32260c8f07c7c479bb5 100644 (file)
@@ -25,6 +25,7 @@
 
 #include "VISU_GaussPtsAct.h"
 #include "VISU_GaussPtsSettings.h"
+#include "VISU_GaussPointsPL.hxx"
 
 #include "SUIT_MessageBox.h"
 #include "SUIT_ResourceMgr.h"
 
 #include "CAM_Module.h"
 
+#include "SVTK_Selector.h"
 #include "SVTK_MainWindow.h"
 #include "SVTK_RenderWindowInteractor.h"
 
+#include "VTKViewer_Algorithm.h"
+#include "SVTK_Functor.h"
+
 #include <vtkActorCollection.h>
 #include <vtkCallbackCommand.h>
 #include <vtkObjectFactory.h>
@@ -53,6 +58,7 @@
 #include <QPushButton>
 #include <QVBoxLayout>
 #include <QKeyEvent>
+#include <QIntValidator>
 
 #include "QtxAction.h"
 #include "QtxDoubleSpinBox.h"
 
 #include "LightApp_Application.h"
 
-using namespace std;
+namespace
+{
+  struct SelectorHelper
+  {
+  public:
+    SelectorHelper( SVTK_RenderWindowInteractor* theInteractor ):
+      myInteractor( theInteractor )
+    {}
+
+    bool
+    get()
+    {
+      bool aResult = false;
+      myMapIndex.Clear();
+      mySelector = NULL;
+      myPipeLine = NULL;
+      myActor = NULL;
+
+      if ( !myInteractor )
+       return aResult;
+      
+      mySelector = myInteractor->GetSelector();
+      if ( !mySelector )
+       return aResult;
+      
+      const SALOME_ListIO& aListIO = mySelector->StoredIObjects();
+      if ( aListIO.Extent() != 1 ) 
+       return aResult;
+      
+      myIO = aListIO.First();
+      if ( mySelector->HasIndex( myIO ) )
+       mySelector->GetIndex(myIO, myMapIndex);
+       
+      myActor = SVTK::Find<VISU_GaussPtsAct>(myInteractor->getRenderer()->GetActors(),
+                                            SVTK::TIsSameIObject<VISU_GaussPtsAct>( myIO ));
+      if ( !myActor )
+       return aResult;
+      
+      myPipeLine = myActor->GetGaussPointsPL();
+
+      return true;
+    }
+
+    SVTK_RenderWindowInteractor* myInteractor;
+    TColStd_IndexedMapOfInteger myMapIndex;
+    Handle(SALOME_InteractiveObject) myIO;
+    SVTK_Selector* mySelector;
+
+    VISU_GaussPointsPL* myPipeLine;
+    VISU_GaussPtsAct* myActor;
+  };
+
+
+  
+  class GaussPtsIDValidator: public QIntValidator
+  {
+  public:
+    GaussPtsIDValidator( SVTK_RenderWindowInteractor* theInteractor,
+                        QObject * theParent ):
+      QIntValidator( 0, VTK_LARGE_ID, theParent ),
+      myHelper(theInteractor)
+    {}
+
+    virtual 
+    State
+    validate ( QString & theInput, int & thePos ) const
+    {
+      if ( QIntValidator::validate( theInput, thePos ) == QValidator::Invalid)
+       return QValidator::Invalid;
+      
+      if ( !myHelper.get() )
+       return QValidator::Invalid;
+
+      return QValidator::Acceptable;
+    }
+
+  protected:
+    mutable SelectorHelper myHelper;
+  };
+
+
+  class GaussCellIDValidator: public GaussPtsIDValidator
+  {
+  public:
+    GaussCellIDValidator( QLineEdit* theLocalPointLabel,
+                         SVTK_RenderWindowInteractor* theInteractor,
+                         QObject * theParent ):
+      GaussPtsIDValidator( theInteractor, theParent ),
+      myLocalPointLineEdit( theLocalPointLabel )
+    {}
+
+    virtual 
+    State
+    validate ( QString & theInput, int & thePos ) const
+    {
+      if ( GaussPtsIDValidator::validate( theInput, thePos ) == QValidator::Invalid)
+       return QValidator::Invalid;
+
+      VISU::TCellID aCellID = theInput.toInt();
+      VISU::TLocalPntID aLocalPntID = myLocalPointLineEdit->text().toInt();
+      VISU::PGaussPtsIDMapper anIDMapper = myHelper.myPipeLine->GetGaussPtsIDMapper();
+      if ( anIDMapper->GetVTKID( VISU::TGaussPointID( aCellID, aLocalPntID ) ) < 0 )
+       return QValidator::Intermediate;
+
+      return QValidator::Acceptable;
+    }
+
+  private:
+    QLineEdit* myLocalPointLineEdit;
+  };
+
+
+  class GaussLocalPointIDValidator: public GaussPtsIDValidator
+  {
+  public:
+    GaussLocalPointIDValidator( QLineEdit* theParentElementLineEdit,
+                               SVTK_RenderWindowInteractor* theInteractor,
+                               QObject * theParent ):
+      GaussPtsIDValidator( theInteractor, theParent ),
+      myParentElementLineEdit( theParentElementLineEdit )
+    {}
+
+    virtual 
+    State
+    validate ( QString & theInput, int & thePos ) const
+    {
+      if ( GaussPtsIDValidator::validate( theInput, thePos ) == QValidator::Invalid)
+       return QValidator::Invalid;
+
+      VISU::TLocalPntID aLocalPntID = theInput.toInt();
+      VISU::TCellID aCellID = myParentElementLineEdit->text().toInt();
+      VISU::PGaussPtsIDMapper anIDMapper = myHelper.myPipeLine->GetGaussPtsIDMapper();
+      if ( anIDMapper->GetVTKID( VISU::TGaussPointID( aCellID, aLocalPntID ) ) < 0 )
+       return QValidator::Intermediate;
+
+      return QValidator::Acceptable;
+    }
+
+  private:
+    QLineEdit* myParentElementLineEdit;
+  };
+}
+
+
+VVTK_ValidatedLineEdit::VVTK_ValidatedLineEdit( QWidget* parent ):
+  QLineEdit( parent )
+{
+  connect( this, SIGNAL( textChanged( const QString& ) ), this, SLOT( MarkValidated( const QString& ) ) );
+}
+
+void VVTK_ValidatedLineEdit::MarkValidated( const QString& theText )
+{
+  if ( !validator() )
+    return;
+  
+  int aPos;
+  QString aText( theText );
+  QPalette pal = palette();
+  switch ( validator()->validate( aText, aPos ) ) {
+  case QValidator::Invalid:
+  case QValidator::Intermediate:
+    pal.setColor( foregroundRole(), QColor( 255, 0, 0 ));
+    setPalette( pal );
+    break;
+  case QValidator::Acceptable:
+    pal.setColor( foregroundRole(), QColor( 0, 0, 0 ));
+    setPalette( pal );
+    break;
+  }
+}
+
+//---------------------------------------------------------------------------------
 
 VVTK_PickingDlg::VVTK_PickingDlg(QtxAction* theAction,
                                 SVTK_MainWindow* theParent,
@@ -207,20 +384,33 @@ VVTK_PickingDlg::VVTK_PickingDlg(QtxAction* theAction,
   BoxLayout->addWidget( CameraGroup );
 
   // Display parent mesh element
-  QGroupBox* ParentMeshGroup = new QGroupBox( tr( "PARENT_MESH_TITLE" ), aBox );
-  //ParentMeshGroup->setColumnLayout(0, Qt::Vertical );
-  //ParentMeshGroup->layout()->setSpacing( 0 );
-  //ParentMeshGroup->layout()->setMargin( 0 );
+  QGroupBox* PositionGroup = new QGroupBox( tr( "DATA_POSITION" ), aBox );
+  //PositionGroup->setColumnLayout(0, Qt::Vertical );
+  //PositionGroup->layout()->setSpacing( 0 );
+  //PositionGroup->layout()->setMargin( 0 );
+
+  QGridLayout* PositionGroupLayout = new QGridLayout (PositionGroup);
+  PositionGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
+  PositionGroupLayout->setSpacing(6);
+  PositionGroupLayout->setMargin(11);
+
+  QLabel* ParentElementLabel = new QLabel( tr( "PARENT_ELEMENT" ), PositionGroup );
+
+  myParentElementLineEdit = new VVTK_ValidatedLineEdit( PositionGroup );
 
-  QGridLayout* ParentMeshGroupLayout = new QGridLayout (ParentMeshGroup);
-  ParentMeshGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
-  ParentMeshGroupLayout->setSpacing(6);
-  ParentMeshGroupLayout->setMargin(11);
+  QLabel* LocalPointLabel = new QLabel( tr( "LOCAL_POINT" ), PositionGroup );
 
-  myDisplayParentMeshCheckBox = new QCheckBox( tr( "DISPLAY_PARENT_MESH" ), ParentMeshGroup );
-  ParentMeshGroupLayout->addWidget( myDisplayParentMeshCheckBox, 0, 0 );
+  myLocalPointLineEdit = new VVTK_ValidatedLineEdit( PositionGroup );
 
-  BoxLayout->addWidget( ParentMeshGroup );
+  myDisplayParentMeshCheckBox = new QCheckBox( tr( "DISPLAY_PARENT_MESH" ), PositionGroup );
+
+  PositionGroupLayout->addWidget( ParentElementLabel,          0, 0, 1, 3 );
+  PositionGroupLayout->addWidget( myParentElementLineEdit,     0, 3 );
+  PositionGroupLayout->addWidget( LocalPointLabel,             1, 0, 1, 3 );
+  PositionGroupLayout->addWidget( myLocalPointLineEdit,        1, 3 );
+  PositionGroupLayout->addWidget( myDisplayParentMeshCheckBox, 2, 0, 1, 4 );
+
+  BoxLayout->addWidget( PositionGroup );
 
   // Common buttons ===========================================================
   QGroupBox* GroupButtons = new QGroupBox( this );
@@ -252,6 +442,10 @@ VVTK_PickingDlg::VVTK_PickingDlg(QtxAction* theAction,
   connect( buttonApply, SIGNAL( clicked() ), this, SLOT( onClickApply() ) );
   connect( buttonClose, SIGNAL( clicked() ), this, SLOT( onClickClose() ) );
   connect( buttonHelp,  SIGNAL( clicked() ), this, SLOT( onClickHelp() ) );
+
+  connect( myParentElementLineEdit, SIGNAL( textChanged( const QString& ) ), this, SLOT( onSelectionValidate() ) );
+  connect( myLocalPointLineEdit,    SIGNAL( textChanged( const QString& ) ), this, SLOT( onSelectionValidate() ) );
+
 }
 
 VVTK_PickingDlg::~VVTK_PickingDlg()
@@ -341,6 +535,32 @@ void VVTK_PickingDlg::Update()
   onClickApply();
 }
 
+void VVTK_PickingDlg::onSelectionValidate() 
+{
+  myParentElementLineEdit->MarkValidated( myParentElementLineEdit->text() );
+  myLocalPointLineEdit->MarkValidated( myLocalPointLineEdit->text() );
+}
+
+void VVTK_PickingDlg::onSelectionEvent() 
+{
+  SelectorHelper aHelper( myInteractor );
+  if ( !aHelper.get() )
+    return;
+
+  const TColStd_IndexedMapOfInteger& aMapIndex = aHelper.myMapIndex;
+  if ( aMapIndex.Extent() != 1 )
+    return;
+
+  int anObjId = aHelper.myMapIndex(1);
+
+  VISU::TGaussPointID aGaussPointID = aHelper.myPipeLine->GetObjID( anObjId );
+
+  VISU::TCellID aCellID = aGaussPointID.first;
+  myParentElementLineEdit->setText( QString::number( aCellID ) );
+
+  VISU::TLocalPntID aLocalPntID = aGaussPointID.second;
+  myLocalPointLineEdit->setText( QString::number( aLocalPntID ) );
+}
 
 VISU_PickingSettings* 
 VVTK_PickingDlg
@@ -356,9 +576,19 @@ void VVTK_PickingDlg::SetInteractor( SVTK_RenderWindowInteractor* theInteractor
   theInteractor->GetDevice()->AddObserver(vtkCommand::KeyPressEvent, 
                                          myEventCallbackCommand.GetPointer(), 
                                          myPriority);
+  theInteractor->GetDevice()->AddObserver(vtkCommand::EndPickEvent, 
+                                         myEventCallbackCommand.GetPointer(), 
+                                         myPriority);
+  {
+    QValidator* aValidator = new GaussCellIDValidator( myLocalPointLineEdit, theInteractor, myParentElementLineEdit );
+    myParentElementLineEdit->setValidator( aValidator );
+  }
+  {
+    QValidator* aValidator = new GaussLocalPointIDValidator( myParentElementLineEdit, theInteractor, myLocalPointLineEdit );
+    myLocalPointLineEdit->setValidator( aValidator );
+  }
 }
 
-
 void VVTK_PickingDlg::ProcessEvents(vtkObject* vtkNotUsed(theObject), 
                                    unsigned long theEvent,
                                    void* theClientData, 
@@ -370,6 +600,9 @@ void VVTK_PickingDlg::ProcessEvents(vtkObject* vtkNotUsed(theObject),
   case vtkCommand::KeyPressEvent:
     self->KeyPressed();
     break;
+  case vtkCommand::EndPickEvent:
+    self->onSelectionEvent();
+    break;
   }
 }
 
@@ -407,7 +640,24 @@ void VVTK_PickingDlg::onClickApply()
   aColor[2] = aButtonColor.blue() / 255.0;
   myPickingSettings->SetColor( aColor );
 
-  myPickingSettings->InvokeEvent(VISU::UpdatePickingSettingsEvent,NULL);
+  myPickingSettings->InvokeEvent( VISU::UpdatePickingSettingsEvent,NULL );
+
+  SelectorHelper aHelper( myInteractor );
+  if ( !aHelper.get() )
+    return;
+
+  VISU::TCellID aCellID = myParentElementLineEdit->text().toInt();
+  VISU::TLocalPntID aLocalPntID = myLocalPointLineEdit->text().toInt();
+  VISU::PGaussPtsIDMapper anIDMapper = aHelper.myPipeLine->GetGaussPtsIDMapper();
+  vtkIdType anObjId = anIDMapper->GetVTKID( VISU::TGaussPointID( aCellID, aLocalPntID ) );
+  if ( anObjId < 0 )
+    return;
+
+  aHelper.myMapIndex.Clear();
+  aHelper.myMapIndex.Add( anObjId );
+  aHelper.mySelector->AddOrRemoveIndex( aHelper.myIO, aHelper.myMapIndex, false );
+  aHelper.myActor->Highlight( aHelper.myIO );
+  myInteractor->GetDevice()->CreateTimer( VTKI_TIMER_FIRST );
 }
 
 void VVTK_PickingDlg::onClickClose()
index 1026285da8a3609cc0281f9286b5f0523e471253..cc95f596ebf67d5c54b7a366e7654c6f6931b46a 100644 (file)
@@ -29,6 +29,8 @@
 #include <vtkObject.h>
 #include <vtkSmartPointer.h>
 
+#include <QLineEdit>
+
 class vtkActorCollection;
 class vtkCallbackCommand;
 class vtkImageData;
@@ -48,6 +50,7 @@ class VISU_PickingSettings;
 
 class SVTK_MainWindow;
 class SVTK_RenderWindowInteractor;
+class VVTK_ValidatedLineEdit;
 
 //! Picking Dialog.
 /*!
@@ -77,11 +80,13 @@ public:
   void             SetInteractor( SVTK_RenderWindowInteractor* );
 
 protected slots:
+  void             onSelectionEvent();
   void             onClickApply();
   void             onClickClose();
   void             onClickHelp();
 
   //void             onColorButtonPressed();
+  void             onSelectionValidate();
 
 private:
   static void      ProcessEvents(vtkObject* theObject, 
@@ -107,6 +112,11 @@ private:
   vtkSmartPointer<VISU_PickingSettings> 
                     myPickingSettings;
 
+  VVTK_ValidatedLineEdit*      
+                    myParentElementLineEdit;
+  VVTK_ValidatedLineEdit*     
+                    myLocalPointLineEdit;
+
   SVTK_RenderWindowInteractor* 
                     myInteractor;
 
@@ -115,4 +125,14 @@ private:
                     myEventCallbackCommand;
 };
 
+class VVTK_ValidatedLineEdit : public QLineEdit
+{
+  Q_OBJECT;
+public:
+  VVTK_ValidatedLineEdit( QWidget* parent );
+  
+public slots:
+  void MarkValidated( const QString& theText );
+};
+
 #endif