]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Migration of DIAGRAM to 1.7.3
authorsln <sln@opencascade.com>
Tue, 11 Sep 2012 12:28:12 +0000 (12:28 +0000)
committersln <sln@opencascade.com>
Tue, 11 Sep 2012 12:28:12 +0000 (12:28 +0000)
18 files changed:
src/CAM/CAM_Application.cxx
src/CAM/Makefile.am
src/LightApp/LightApp_Application.cxx
src/LightApp/LightApp_Application.h
src/LightApp/LightApp_Module.cxx
src/LightApp/LightApp_Module.h
src/LightApp/resources/LightApp_msg_en.ts
src/LightApp/resources/LightApp_msg_fr.ts
src/Qtx/QtxMultiAction.cxx
src/Qtx/QtxSplash.cxx
src/Qtx/QtxWorkstack.cxx
src/SUIT/SUIT_DataObject.cxx
src/SVTK/SALOME_Actor.cxx
src/SVTK/SALOME_Actor.h
src/SVTK/SVTK_Actor.cxx
src/SVTK/SVTK_Renderer.cxx
src/SVTK/SVTK_Renderer.h
src/VTKViewer/VTKViewer_GeometryFilter.cxx

index 73d7ef7877482af3ebf359325295632bff7a3575..d70e80840ad4e6b057d85fd8aa83bd9b78518ad9 100755 (executable)
@@ -31,6 +31,8 @@
 #include <QApplication>
 #include <QRegExp>
 
+#include <stdio.h>
+
 #ifdef WIN32
 #include <windows.h>
 #else
index 3b80df3f8f7c93409d5a9ea74f50af1d1c3add77..44283644abe28f4a3ee78be0fef7aff2efcd0f2f 100755 (executable)
@@ -49,7 +49,7 @@ nodist_libCAM_la_SOURCES = $(MOC_FILES)
 
 nodist_salomeres_DATA = \
        CAM_msg_en.qm \
-       CAM_msg_en.qm
+       CAM_msg_fr.qm
 
 libCAM_la_CPPFLAGS = $(QT_INCLUDES) -I$(srcdir)/../SUIT -I$(srcdir)/../STD -I$(srcdir)/../Qtx
 libCAM_la_LDFLAGS  = $(QT_MT_LIBS)
index 02c07a4ee3b9337bda03cd15590950bc14cbe709..689a8433692c9c4dac300e00e02775247faf27c2 100644 (file)
@@ -585,7 +585,6 @@ void LightApp_Application::createActions()
   // New window
   int windowMenu = createMenu( tr( "MEN_DESK_WINDOW" ), -1, MenuWindowId, 100 );
   int newWinMenu = createMenu( tr( "MEN_DESK_NEWWINDOW" ), windowMenu, -1, 0 );
-  int restoreWinMenu = createMenu( tr( "MEN_DESK_RESTORE" ), windowMenu, -1, 0 );
 
   createAction( CloseId, tr( "TOT_CLOSE" ), QIcon(), tr( "MEN_DESK_CLOSE" ), tr( "PRP_CLOSE" ),
                 Qt::SHIFT+Qt::Key_C, desk, false, this, SLOT( onCloseWindow() ) );
@@ -618,17 +617,6 @@ void LightApp_Application::createActions()
   createActionForViewer( NewGraphicsViewId, newWinMenu, QString::number( 5 ), Qt::ALT+Qt::Key_R );
 #endif
 
-  createAction( RestoreDefaultId, tr( "TOT_RESTORE_DEFAULT" ), QIcon(), 
-                tr( "MEN_DESK_RESTORE_DEFAULT" ), tr( "PRP_RESTORE_DEFAULT" ),
-                0, desk, false, this, SLOT( onRestoreDefault() ) );
-
-  createAction( RestoreFromPrefsId, tr( "TOT_RESTORE_FROM_PREFERENCES" ), QIcon(), 
-                tr( "MEN_DESK_RESTORE_FROM_PREFERENCES" ), tr( "PRP_RESTORE_FROM_PREFERENCES" ),
-                0, desk, false, this, SLOT( onRestoreFromPreferences() ) );
-  
-  createMenu( RestoreDefaultId, restoreWinMenu, -1 );
-  createMenu( RestoreFromPrefsId, restoreWinMenu, -1 );
-
   createAction( RenameId, tr( "TOT_RENAME" ), QIcon(), tr( "MEN_DESK_RENAME" ), tr( "PRP_RENAME" ),
                Qt::SHIFT+Qt::Key_R, desk, false, this, SLOT( onRenameWindow() ) );
   createMenu( RenameId, windowMenu, -1 );
@@ -865,14 +853,6 @@ void LightApp_Application::updateCommandsStatus()
   if( a )
     a->setEnabled( activeStudy() );
 #endif
-
-  a = action( RestoreDefaultId );
-  if( a )
-    a->setEnabled( activeStudy() );
-
-  a = action( RestoreFromPrefsId );
-  if( a )
-    a->setEnabled( activeStudy() );
 }
 
 /*!
@@ -2125,14 +2105,27 @@ void LightApp_Application::createPreferences( LightApp_Preferences* pref )
   }
 
   // Default Module Preferences
-  int moduleGroup = pref->addPreference( tr( "PREF_DEFAULT_MODULE" ), genTab );
-  int moduleNameCombo = pref->addPreference( tr( "PREF_DEF_MODULE_NAME" ), moduleGroup, LightApp_Preferences::Selector, "Activate", "def_module" );
-  aValuesList.clear();
-  anIndicesList.clear();
-  aValuesList   << tr("PREF_DEF_MODULE_NONE") << tr("PREF_DEF_MODULE_CATHARE") << tr("PREF_DEF_MODULE_DIAGRAM");
-  anIndicesList << 0                        << 1                         << 2                       ;
-  pref->setItemProperty( "strings", aValuesList,   moduleNameCombo );
-  pref->setItemProperty( "indexes", anIndicesList, moduleNameCombo );
+  QStringList aModuleNames;
+  modules( aModuleNames, false ); 
+  if ( aModuleNames.count() > 1 )
+  {
+    int moduleGroup = pref->addPreference( tr( "PREF_DEFAULT_MODULE" ), genTab );
+    int moduleNameCombo = pref->addPreference( tr( "PREF_DEF_MODULE_NAME" ), moduleGroup, LightApp_Preferences::Selector, "Activate", "def_module" );
+    aValuesList.clear();
+    anIndicesList.clear();
+    aValuesList.append( tr("PREF_DEF_MODULE_NONE") );
+    anIndicesList.append( 0 );
+    QStringList::iterator it = aModuleNames.begin();
+    for ( int ind = 1; it != aModuleNames.end(); ++it, ++ind )
+    {
+      const QString& modName = *it;
+      aValuesList.append( modName );
+      anIndicesList.append( ind );
+    }
+    
+    pref->setItemProperty( "strings", aValuesList,   moduleNameCombo );
+    pref->setItemProperty( "indexes", anIndicesList, moduleNameCombo );
+  }
 
   // theme values
   Style_Model* aSModel = 0;
@@ -2722,13 +2715,13 @@ void LightApp_Application::updateViewManagers()
 /*!
   Loads windows geometry
 */
-void LightApp_Application::loadDockWindowsState( const bool theIsForced )
+void LightApp_Application::loadDockWindowsState()
 {
   if ( !desktop() )
     return;
 
   bool store = resourceMgr()->booleanValue( "Study", "store_positions", true );
-  if ( !theIsForced && !store )
+  if( !store )
     return;
 
   QString modName;
@@ -3071,76 +3064,6 @@ void LightApp_Application::onGroupAllWindow()
     wgStack->stack();
 }
 
-/*!
-  Restore default state of application windows
-*/
-void LightApp_Application::onRestoreDefault()
-{
-  if ( !activeStudy() || !desktop() )
-    return;
-
-  QMap<int, int> winMap;
-  bool restored = false;
-
-  if ( activeModule() && activeModule()->inherits( "LightApp_Module" ) )
-  {
-   ((LightApp_Module*)activeModule())->windows( winMap );
-    restored = ((LightApp_Module*)activeModule())->defaultWindowsState();
-  }
-  
-  if ( !restored )
-  {
-    if( winMap.isEmpty() )
-      defaultWindows( winMap );
-
-    QMap<int, int>::const_iterator winMapIt = winMap.constBegin();
-    for ( ; winMapIt != winMap.constEnd(); ++winMapIt )
-    {
-      QWidget* win = dockWindow( winMapIt.key() );
-      QDockWidget* dock = ::qobject_cast<QDockWidget*>( win );
-      if ( !dock )
-        dock = windowDock( win );
-
-      if ( dock  )
-      {
-        if ( !dock->isVisible() )
-          dock->setVisible( true );
-
-        if ( dock->isFloating() )
-          dock->setFloating( false );
-          
-        desktop()->addDockWidget( (Qt::DockWidgetArea)winMapIt.value(), dock );
-      }
-    }
-
-    QList<QToolBar*> tbList = qFindChildren<QToolBar*>( desktop() );
-    for ( QList<QToolBar*>::iterator tit = tbList.begin(); tit != tbList.end(); ++tit )
-    {
-      QToolBar* tb = *tit;
-
-      QObject* po = Qtx::findParent( tb, "QMainWindow" );
-      if ( po != desktop() )
-        continue;
-
-      if ( !tb->isVisible() )
-        tb->setVisible( true );
-
-      desktop()->addToolBar( Qt::TopToolBarArea, tb );
-    }
-  }
-}
-
-/*!
-  Restore application windows state from preferences file
-*/
-void LightApp_Application::onRestoreFromPreferences()
-{
-  if ( !activeStudy() || !desktop() )
-    return;
-
-  loadDockWindowsState( true );
-}
-
 /*!
   \return if the library of module exists
   \param moduleTitle - title of module
index 3815ec437f7c19795e74241289f982f311972525..3fe5d6ced2b3e51fec03fb9964b5260edc466dd7 100644 (file)
@@ -76,7 +76,6 @@ public:
 
   enum { RenameId = CAM_Application::UserID,
         CloseId, CloseAllId, GroupAllId,
-         RestoreDefaultId, RestoreFromPrefsId,
         PreferencesId, MRUId, ModulesListId,
          NewGLViewId, NewPlot2dId, NewOCCViewId, NewVTKViewId, NewQxGraphViewId,
          NewGraphicsViewId, UserID };
@@ -218,15 +217,13 @@ private slots:
   void                                onCloseWindow();
   void                                onCloseAllWindow();
   void                                onGroupAllWindow();
-  void                                onRestoreDefault();
-  void                                onRestoreFromPreferences();
 
 protected:
   void                                updateWindows();
   void                                updateViewManagers();
   void                                updateModuleActions();
 
-  void                                loadDockWindowsState( const bool theIsForced = false );
+  void                                loadDockWindowsState();
   void                                saveDockWindowsState();
 
   virtual void                        studyOpened( SUIT_Study* );
index c9ce919288d75b9bd1720751c7cf9d7d2d1ce744..332e4a70ace82ecee7d0d4b2e13484c962724d74 100644 (file)
@@ -124,12 +124,6 @@ void LightApp_Module::windows( QMap<int, int>& ) const
 {
 }
 
-/*!NOT IMPLEMENTED*/
-bool LightApp_Module::defaultWindowsState()
-{
-  return false;
-}
-
 /*!NOT IMPLEMENTED*/
 void LightApp_Module::viewManagers( QStringList& ) const
 {
index b9754724354ae542529ad6861cb838fcc82e6550..95206ec468176a51f54e1176dfa13d8f00760974 100644 (file)
@@ -93,9 +93,6 @@ public:
   virtual QString                     updateDesktopTitle( const QString& );
   // Custom update desktop title
 
-  virtual bool                        defaultWindowsState();
-  // Custom restore the default windows state
-
 public slots:
   virtual bool                        activateModule( SUIT_Study* );
   virtual bool                        deactivateModule( SUIT_Study* );
index 6cdfcf1942e39e1f5764b204233612210d179b9e..29985e9eab619ce3f2682d0cdd2c6c39fa17bf28 100644 (file)
@@ -533,34 +533,6 @@ CEA/DEN, CEDRAT, EDF R&amp;D, LEG, PRINCIPIA R&amp;D, BUREAU VERITAS</translatio
         <source>PRP_GROUP_ALL</source>
         <translation>Group all windows</translation>
     </message>
-    <message>
-        <source>MEN_DESK_RESTORE</source>
-        <translation>Restore windows &amp;state</translation>
-    </message>
-    <message>
-        <source>TOT_RESTORE_DEFAULT</source>
-        <translation>By Default</translation>
-    </message>
-    <message>
-        <source>MEN_DESK_RESTORE_DEFAULT</source>
-        <translation>&amp;By Default</translation>
-    </message>
-    <message>
-        <source>PRP_RESTORE_DEFAULT</source>
-        <translation>Restore windows state by default</translation>
-    </message>
-    <message>
-        <source>TOT_RESTORE_FROM_PREFERENCES</source>
-        <translation>From Preferences</translation>
-    </message>
-    <message>
-        <source>MEN_DESK_RESTORE_FROM_PREFERENCES</source>
-        <translation>&amp;From Preferences</translation>
-    </message>
-    <message>
-        <source>PRP_RESTORE_FROM_PREFERENCES</source>
-        <translation>Restore windows state from preferences file</translation>
-    </message>
     <message>
         <source>ERR_DOC_NOT_EXISTS</source>
         <translation>Can not open %1.
index e167be16e99fa377ec17c709725ae3ceab18c2b9..b88a546b772ea7edc3f37437a2b0db926d34d725 100755 (executable)
@@ -533,34 +533,6 @@ CEA/DEN, CEDRAT, EDF R&amp;D, LEG, PRINCIPIA R&amp;D, BUREAU VERITAS</translatio
         <source>PRP_GROUP_ALL</source>
         <translation type="unfinished">Grouper toutes les fenêtres</translation>
     </message>
-    <message>
-        <source>MEN_DESK_RESTORE</source>
-        <translation>Redimensionner les fenêtres</translation>
-    </message>
-    <message>
-        <source>TOT_RESTORE_DEFAULT</source>
-        <translation>Par défaut</translation>
-    </message>
-    <message>
-        <source>MEN_DESK_RESTORE_DEFAULT</source>
-        <translation>&amp;Défaut</translation>
-    </message>
-    <message>
-        <source>PRP_RESTORE_DEFAULT</source>
-        <translation>Redimensionner les fenêtres par défaut.</translation>
-    </message>
-    <message>
-        <source>TOT_RESTORE_FROM_PREFERENCES</source>
-        <translation>Selon les préférences</translation>
-    </message>
-    <message>
-        <source>MEN_DESK_RESTORE_FROM_PREFERENCES</source>
-        <translation>&amp;Préférences</translation>
-    </message>
-    <message>
-        <source>PRP_RESTORE_FROM_PREFERENCES</source>
-        <translation> Redimensionner les fenêtres selon le fichier de préférences.</translation>
-    </message>
     <message>
         <source>ERR_DOC_NOT_EXISTS</source>
         <translation type="unfinished">Impossible d&apos;ouvrir %1.
index c46689ffb19e76fbdc2083aa08903b80fc68d2da..903e11798fcfc29a951de8f24799713bb1d33487 100644 (file)
@@ -84,7 +84,7 @@ protected:
       {
         QHelpEvent* help = static_cast<QHelpEvent*>( e );
         QWidget* w = QApplication::widgetAt( help->globalPos() );
-        if ( w && Qtx::isParent( w, this ) )
+        if ( w && w != this && Qtx::isParent( w, this ) )
         {
           QHelpEvent he( help->type(), w->mapFromGlobal( help->globalPos() ), help->globalPos() );
           QApplication::sendEvent( w, &he );
index 044d8fe88c9592a667618219601f618aef34d374..3fb5bbb0f0097d4ed32436e60a05efa3780a6bce 100644 (file)
@@ -28,6 +28,8 @@
 #include <QMessageBox>
 #include <QDesktopWidget>
 
+#include <stdio.h>
+
 /*!
   \class ProgressEvent
   \internal
index 5ad12139ce17a753ace46f9323d3f7c5736654b5..e7849756a3712db386ee470cc4c3eef36568c00c 100644 (file)
@@ -38,6 +38,8 @@
 #include <QStackedWidget>
 #include <QAbstractButton>
 
+#include <stdio.h>
+
 /*!
   \class QtxWorkstackArea::WidgetEvent
   \internal
index bb64cafa42846d37ff866b29a27176b984b42e16..ebd6c74b45d471156f7f20abe9a03dfc74aaaa58 100755 (executable)
@@ -23,6 +23,8 @@
 #include "SUIT_DataObject.h"
 #include "SUIT_DataObjectKey.h"
 
+#include <stdio.h>
+
 SUIT_DataObject::Signal* SUIT_DataObject::mySignal = 0;
 
 /*!
index 589dee0aa78ed189f61eb5423e113cb86d075a86..9583cc3f26ac542eeadcff1dd4b8fe0a4679064f 100644 (file)
@@ -163,6 +163,7 @@ SALOME_Actor
 ::SALOME_Actor():
   myRenderer(NULL),
   myInteractor(NULL),
+  myPrehighlightedCellId(-1),
   mySelectionMode(ActorSelection),
   myPreHighlightActor(SVTK_Actor::New()),
   myHighlightActor(SVTK_Actor::New()),
@@ -448,6 +449,7 @@ SALOME_Actor
               SVTK_SelectionEvent* theSelectionEvent,
               bool theIsHighlight)
 {
+  myPrehighlightedCellId = -1;
   if ( !GetPickable() )
     return false;
       
@@ -517,6 +519,7 @@ SALOME_Actor
        if ( anObjId >= 0 ) {
          myIsPreselected = CheckDimensionId(aSelectionMode,this,anObjId);
          if(myIsPreselected){
+           myPrehighlightedCellId = anObjId;
            const TColStd_IndexedMapOfInteger& aMapIndex = myPreHighlightActor->GetMapIndex();
            int anExtent = aMapIndex.Extent();
            anIsChanged |= (anExtent == 0 || anExtent > 0 && anObjId != aMapIndex(1));
@@ -594,6 +597,16 @@ SALOME_Actor
   return anIsChanged;
 }
 
+/*!
+  Returns id of the prehighlighted cell (-1 if no cell is highlighted)
+*/
+int
+SALOME_Actor
+::GetPrehighlightedCellId() const
+{
+  return myPrehighlightedCellId;
+}
+
 /*!
   To process highlight (called from SVTK_InteractorStyle)
 */
index e51d4eb4383edec3d8e9ac12ab95936c308d00ae..8c635f5f4d78a5ebcd95232a14e56717e695be8a 100644 (file)
@@ -171,6 +171,11 @@ class SVTK_EXPORT SALOME_Actor : public VTKViewer_Actor
               SVTK_SelectionEvent* theSelectionEvent,
               bool theIsHighlight);
 
+  //! Returns id of the prehighlighted cell (-1 if no cell is highlighted)
+  virtual
+  int
+  GetPrehighlightedCellId() const;
+
   //! To process highlight (called from #SVTK_InteractorStyle)
   virtual 
   bool
@@ -214,6 +219,8 @@ class SVTK_EXPORT SALOME_Actor : public VTKViewer_Actor
 
   Handle(SALOME_InteractiveObject) myIO;
 
+  int myPrehighlightedCellId;
+
   SALOME_Actor();
   ~SALOME_Actor();
 
index 11bfa36c0e391fc722670fded5d1736b8e6fbbfd..400067055d55ffc3a56967f6b66c30285717474a 100644 (file)
@@ -144,7 +144,7 @@ SVTK_Actor
       int aPartId = theMapIndex( i+1 );
       if(vtkFloatingPointType* aCoord = theMapActor->GetNodeCoord(aPartId)){
        aPoints->SetPoint(i,aCoord);
-       myUnstructuredGrid->InsertNextCell(VTK_VERTEX,1,&i);
+       myUnstructuredGrid->InsertNextCell(VTK_VERTEX,1,(vtkIdType*)&i);
       }
     }
     myUnstructuredGrid->SetPoints(aPoints);
index cab5ca695e67649dce67d9cff6276d5d3f4bd29f..c2fd4ea62cede20ed9e1e0827bc2981787a512f7 100644 (file)
 #include "VTKViewer_Transform.h"
 #include "VTKViewer_Utilities.h"
 
-#include <vtkCamera.h>
-#include <vtkRenderer.h>
-#include <vtkTextProperty.h>
-#include <vtkObjectFactory.h>
+#include <vtkAbstractVolumeMapper.h>
 #include <vtkCallbackCommand.h>
-
+#include <vtkCamera.h>
+#include <vtkDataSet.h>
+#include <vtkGenericCell.h>
+#include <vtkMapper.h>
 #include <vtkPicker.h>
 #include <vtkPointPicker.h>
-#include <vtkCellPicker.h>
-
 #include <vtkProperty.h>
+#include <vtkRenderer.h>
+#include <vtkTextProperty.h>
+#include <vtkObjectFactory.h>
 
 // undefining min and max because CASCADE's defines them and
 // it clashes with std::min(), std::max() included in utilities.h
 #undef min
 #undef max
 
-
 vtkStandardNewMacro(SVTK_Renderer);
+vtkStandardNewMacro(SVTK_CellPicker);
 
 /*!
   Constructor
@@ -67,7 +68,7 @@ SVTK_Renderer
   myPriority(0.0),
   myEventCallbackCommand(vtkCallbackCommand::New()),
   myPointPicker(vtkPointPicker::New()),
-  myCellPicker(vtkCellPicker::New()),
+  myCellPicker(SVTK_CellPicker::New()),
   myPointRectPicker(SVTK_RectPicker::New()),
   myCellRectPicker(SVTK_RectPicker::New()),
   myPreHighlightProperty(vtkProperty::New()),
@@ -751,3 +752,108 @@ SVTK_Renderer
   aCamera->SetFocalPoint(0,0,0);
   this->OnFitAll();
 }
+
+/*!
+  SVTK_CellPicker constructor
+*/
+SVTK_CellPicker::SVTK_CellPicker()
+{
+  this->Cell = vtkGenericCell::New();
+}
+
+/*!
+  SVTK_CellPicker destructor
+*/
+SVTK_CellPicker::~SVTK_CellPicker()
+{
+  this->Cell->Delete();
+}
+
+/*!
+  Redefined virtual method of the vtkCellPicker class
+*/
+double SVTK_CellPicker::IntersectWithLine(double p1[3], double p2[3], double tol, 
+                                          vtkAssemblyPath *path, 
+                                          vtkProp3D *prop3D, 
+                                          vtkAbstractMapper3D *m)
+{
+  vtkIdType numCells, cellId, minCellId;
+  int i, minSubId, subId;
+  double x[3], tMin, t, pcoords[3], minXYZ[3], minPcoords[3];
+  vtkDataSet *input;
+  vtkMapper *mapper;
+  vtkAbstractVolumeMapper *volumeMapper;
+
+  // Get the underlying dataset
+  if ( (mapper=vtkMapper::SafeDownCast(m)) != NULL )
+    {
+    input = mapper->GetInput();
+    }
+  else if ( (volumeMapper=vtkAbstractVolumeMapper::SafeDownCast(m)) != NULL )
+    {
+    input = volumeMapper->GetDataSetInput();
+    }
+  else
+    {
+    return VTK_DOUBLE_MAX;
+    }
+
+  if ( (numCells = input->GetNumberOfCells()) < 1 )
+    {
+    return 2.0;
+    }
+
+  // Intersect each cell with ray.  Keep track of one closest to
+  // the eye (within the tolerance tol) and within the clipping range). 
+  // Note that we fudge the "closest to" (tMin+this->Tolerance) a little and
+  // keep track of the cell with the best pick based on parametric
+  // coordinate (pick the minimum, maximum parametric distance). This 
+  // breaks ties in a reasonable way when cells are the same distance 
+  // from the eye (like cells lying on a 2D plane).
+  //
+  minCellId = -1;
+  minSubId = -1;
+  pcoords[0] = pcoords[1] = pcoords[2] = 0;
+  double pDistMin=VTK_DOUBLE_MAX, pDist;
+  for (tMin=VTK_DOUBLE_MAX,cellId=0; cellId<numCells; cellId++) 
+    {
+    input->GetCell(cellId, this->Cell);
+
+    if ( this->Cell->IntersectWithLine(p1, p2, tol, t, x, pcoords, subId) 
+    && t <= (tMin+this->Tolerance) )
+      {
+      pDist = this->Cell->GetParametricDistance(pcoords);
+      // This is the only difference of this method from the vtkCellPicker's one
+      static double aTolerance = 1E-7;
+      //if ( pDist < pDistMin || (pDist == pDistMin && t < tMin ) )
+      if ( pDist < pDistMin || (pDist == pDistMin && t < tMin + aTolerance ) )
+        {
+        minCellId = cellId;
+        minSubId = subId;
+        for (i=0; i<3; i++)
+          {
+          minXYZ[i] = x[i];
+          minPcoords[i] = pcoords[i];
+          }
+        tMin = t;
+        pDistMin = pDist;
+//        cout << "cell id: " << minCellId << "\n";
+        }//if minimum, maximum
+      }//if a close cell
+    }//for all cells
+  
+  //  Now compare this against other actors.
+  //
+  if ( minCellId>(-1) && tMin < this->GlobalTMin ) 
+    {
+    this->MarkPicked(path, prop3D, m, tMin, minXYZ);
+    this->CellId = minCellId;
+    this->SubId = minSubId;
+    for (i=0; i<3; i++)
+      {
+      this->PCoords[i] = minPcoords[i];
+      }
+    vtkDebugMacro("Picked cell id= " << minCellId);
+    }
+  return tMin;
+}
index 8dbd981b2f9f66d2f4101633c206abbdd3931ac1..1b08d59658e75da60fe9e36aa27fcefd42b956ee 100644 (file)
@@ -34,6 +34,7 @@
 
 #include <vtkObject.h>
 #include <vtkSmartPointer.h>
+#include <vtkCellPicker.h>
 
 class vtkRenderer;
 class vtkCallbackCommand;
@@ -41,7 +42,6 @@ class vtkRenderWindowInteractor;
 
 class vtkPicker;
 class vtkPointPicker;
-class vtkCellPicker;
 class vtkProperty;
 
 class SVTK_RectPicker;
@@ -51,6 +51,7 @@ class VTKViewer_Transform;
 class SVTK_CubeAxesActor2D;
 class VTKViewer_Actor;
 class SVTK_Selector;
+class SVTK_CellPicker;
 
 #ifdef WIN32
 #pragma warning ( disable:4251 )
@@ -236,7 +237,7 @@ class SVTK_EXPORT SVTK_Renderer : public vtkObject
   //----------------------------------------------------------------------------
   // Highlight/ Prehighlight devices
   vtkSmartPointer<vtkPointPicker> myPointPicker;
-  vtkSmartPointer<vtkCellPicker> myCellPicker;
+  vtkSmartPointer<SVTK_CellPicker> myCellPicker;
 
   vtkSmartPointer<SVTK_RectPicker> myPointRectPicker;
   vtkSmartPointer<SVTK_RectPicker> myCellRectPicker;
@@ -252,6 +253,33 @@ class SVTK_EXPORT SVTK_Renderer : public vtkObject
   vtkFloatingPointType myBndBox[6];
 };
 
+/*! 
+  \class SVTK_CellPicker
+  The class is intended to redefine the IntersectWithLine()
+  to correct the mechanism of picking coincident cells
+*/
+class SVTK_CellPicker : public vtkCellPicker
+{
+public:
+  static SVTK_CellPicker* New();
+  vtkTypeMacro(SVTK_CellPicker,vtkCellPicker);
+
+protected:
+  SVTK_CellPicker();
+  ~SVTK_CellPicker();
+
+  virtual double IntersectWithLine(double p1[3], double p2[3], double tol, 
+                                   vtkAssemblyPath *path, vtkProp3D *p, 
+                                   vtkAbstractMapper3D *m);
+
+private:
+  vtkGenericCell *Cell; //used to accelerate picking
+
+private:
+  SVTK_CellPicker(const SVTK_CellPicker&);  // Not implemented.
+  void operator=(const SVTK_CellPicker&);  // Not implemented.
+};
+
 #ifdef WIN32
 //#pragma warning ( default:4251 )
 #endif
index 630b7870a1e836b28d9fa75356cc155a9e887bc6..cd83d7505c3d784b96b3908a04327ceedda537d4 100755 (executable)
@@ -350,7 +350,7 @@ VTKViewer_GeometryFilter
               {
               for ( i=0; i < numFacePts; i++)
                 aNewPts[i] = pts[faceVerts[i]];
-              newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+              newCellId = output->InsertNextCell(aCellType,numFacePts,(vtkIdType*)aNewPts);
              if(myStoreMapping)
                myVTK2ObjIds.push_back(cellId);
               outputCD->CopyData(cd,cellId,newCellId);
@@ -375,7 +375,7 @@ VTKViewer_GeometryFilter
               {
               for ( i=0; i < numFacePts; i++)
                 aNewPts[i] = pts[faceVerts[PixelConvert[i]]];
-              newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+              newCellId = output->InsertNextCell(aCellType,numFacePts,(vtkIdType*)aNewPts);
              if(myStoreMapping)
                myVTK2ObjIds.push_back(cellId);
               outputCD->CopyData(cd,cellId,newCellId);
@@ -400,7 +400,7 @@ VTKViewer_GeometryFilter
               {
               for ( i=0; i < numFacePts; i++)
                 aNewPts[i] = pts[faceVerts[i]];
-              newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+              newCellId = output->InsertNextCell(aCellType,numFacePts,(vtkIdType*)aNewPts);
              if(myStoreMapping)
                myVTK2ObjIds.push_back(cellId);
               outputCD->CopyData(cd,cellId,newCellId);
@@ -430,7 +430,7 @@ VTKViewer_GeometryFilter
               {
               for ( i=0; i < numFacePts; i++)
                 aNewPts[i] = pts[faceVerts[i]];
-              newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+              newCellId = output->InsertNextCell(aCellType,numFacePts,(vtkIdType*)aNewPts);
              if(myStoreMapping)
                myVTK2ObjIds.push_back(cellId);
               outputCD->CopyData(cd,cellId,newCellId);
@@ -460,7 +460,7 @@ VTKViewer_GeometryFilter
               {
               for ( i=0; i < numFacePts; i++)
                 aNewPts[i] = pts[faceVerts[i]];
-              newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+              newCellId = output->InsertNextCell(aCellType,numFacePts,(vtkIdType*)aNewPts);
              if(myStoreMapping)
                myVTK2ObjIds.push_back(cellId);
               outputCD->CopyData(cd,cellId,newCellId);
@@ -489,7 +489,7 @@ VTKViewer_GeometryFilter
              for (i=0; i < pts->GetNumberOfIds(); i+=2) {
                aNewPts[0] = pts->GetId(i);
                aNewPts[1] = pts->GetId(i+1);
-               newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+               newCellId = output->InsertNextCell(aCellType,numFacePts,(vtkIdType*)aNewPts);
                if(myStoreMapping)
                  myVTK2ObjIds.push_back(cellId);
                outputCD->CopyData(cd,cellId,newCellId);
@@ -503,7 +503,7 @@ VTKViewer_GeometryFilter
                aNewPts[0] = pts->GetId(i);
                aNewPts[1] = pts->GetId(i+1);
                aNewPts[2] = pts->GetId(i+2);
-               newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+               newCellId = output->InsertNextCell(aCellType,numFacePts,(vtkIdType*)aNewPts);
                if(myStoreMapping)
                  myVTK2ObjIds.push_back(cellId);
                outputCD->CopyData(cd,cellId,newCellId);
@@ -522,7 +522,7 @@ VTKViewer_GeometryFilter
                    aNewPts[0] = pts->GetId(i);
                    aNewPts[1] = pts->GetId(i+1);
                    aNewPts[2] = pts->GetId(i+2);
-                   newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+                   newCellId = output->InsertNextCell(aCellType,numFacePts,(vtkIdType*)aNewPts);
                    if(myStoreMapping)
                      myVTK2ObjIds.push_back(cellId);
                    outputCD->CopyData(cd,cellId,newCellId);
@@ -544,7 +544,7 @@ VTKViewer_GeometryFilter
              aNewPts[2] = pts[1];
              aNewPts[1] = pts[2];
              
-             newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+             newCellId = output->InsertNextCell(aCellType,numFacePts,(vtkIdType*)aNewPts);
              if(myStoreMapping)
                myVTK2ObjIds.push_back(cellId);
              
@@ -562,7 +562,7 @@ VTKViewer_GeometryFilter
              aNewPts[4] = pts[2];
              aNewPts[5] = pts[5];
              
-             newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+             newCellId = output->InsertNextCell(aCellType,numFacePts,(vtkIdType*)aNewPts);
              if(myStoreMapping)
                myVTK2ObjIds.push_back(cellId);
              
@@ -582,7 +582,7 @@ VTKViewer_GeometryFilter
              aNewPts[6] = pts[3];
              aNewPts[7] = pts[7];
              
-             newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+             newCellId = output->InsertNextCell(aCellType,numFacePts,(vtkIdType*)aNewPts);
              if(myStoreMapping)
                myVTK2ObjIds.push_back(cellId);
              
@@ -601,7 +601,7 @@ VTKViewer_GeometryFilter
              aNewPts[4] = pts[2];
              aNewPts[5] = pts[6];
              
-             newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+             newCellId = output->InsertNextCell(aCellType,numFacePts,(vtkIdType*)aNewPts);
              if(myStoreMapping)
                myVTK2ObjIds.push_back(cellId);
              
@@ -615,7 +615,7 @@ VTKViewer_GeometryFilter
              aNewPts[4] = pts[1];
              aNewPts[5] = pts[4];
              
-             newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+             newCellId = output->InsertNextCell(aCellType,numFacePts,(vtkIdType*)aNewPts);
              if(myStoreMapping)
                myVTK2ObjIds.push_back(cellId);
              
@@ -629,7 +629,7 @@ VTKViewer_GeometryFilter
              aNewPts[4] = pts[2];
              aNewPts[5] = pts[5];
              
-             newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+             newCellId = output->InsertNextCell(aCellType,numFacePts,(vtkIdType*)aNewPts);
              if(myStoreMapping)
                myVTK2ObjIds.push_back(cellId);
              
@@ -643,7 +643,7 @@ VTKViewer_GeometryFilter
              aNewPts[4] = pts[0];
              aNewPts[5] = pts[6];
              
-             newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+             newCellId = output->InsertNextCell(aCellType,numFacePts,(vtkIdType*)aNewPts);
              if(myStoreMapping)
                myVTK2ObjIds.push_back(cellId);
              
@@ -662,7 +662,7 @@ VTKViewer_GeometryFilter
              aNewPts[3] = pts[7];
              aNewPts[4] = pts[2];
              aNewPts[5] = pts[8];
-              newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+              newCellId = output->InsertNextCell(aCellType,numFacePts,(vtkIdType*)aNewPts);
              if(myStoreMapping)
                myVTK2ObjIds.push_back(cellId);
               outputCD->CopyData(cd,cellId,newCellId);
@@ -675,7 +675,7 @@ VTKViewer_GeometryFilter
              aNewPts[3] = pts[10];
              aNewPts[4] = pts[5];
              aNewPts[5] = pts[11];
-              newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+              newCellId = output->InsertNextCell(aCellType,numFacePts,(vtkIdType*)aNewPts);
              if(myStoreMapping)
                myVTK2ObjIds.push_back(cellId);
               outputCD->CopyData(cd,cellId,newCellId);
@@ -691,7 +691,7 @@ VTKViewer_GeometryFilter
              aNewPts[5] = pts[11];
              aNewPts[6] = pts[3];
              aNewPts[7] = pts[12];
-              newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+              newCellId = output->InsertNextCell(aCellType,numFacePts,(vtkIdType*)aNewPts);
              if(myStoreMapping)
                myVTK2ObjIds.push_back(cellId);
               outputCD->CopyData(cd,cellId,newCellId);
@@ -706,7 +706,7 @@ VTKViewer_GeometryFilter
              aNewPts[5] = pts[14];
              aNewPts[6] = pts[2];
              aNewPts[7] = pts[7];
-              newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+              newCellId = output->InsertNextCell(aCellType,numFacePts,(vtkIdType*)aNewPts);
              if(myStoreMapping)
                myVTK2ObjIds.push_back(cellId);
               outputCD->CopyData(cd,cellId,newCellId);
@@ -721,7 +721,7 @@ VTKViewer_GeometryFilter
              aNewPts[5] = pts[13];
               aNewPts[6] = pts[1];
               aNewPts[7] = pts[6];
-              newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+              newCellId = output->InsertNextCell(aCellType,numFacePts,(vtkIdType*)aNewPts);
              if(myStoreMapping)
                myVTK2ObjIds.push_back(cellId);
               outputCD->CopyData(cd,cellId,newCellId);
@@ -741,7 +741,7 @@ VTKViewer_GeometryFilter
              aNewPts[6] = pts[4];
              aNewPts[7] = pts[16];
              
-             newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+             newCellId = output->InsertNextCell(aCellType,numFacePts,(vtkIdType*)aNewPts);
              if(myStoreMapping)
                myVTK2ObjIds.push_back(cellId);
              
@@ -757,7 +757,7 @@ VTKViewer_GeometryFilter
              aNewPts[6] = pts[5];
              aNewPts[7] = pts[17];
              
-             newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+             newCellId = output->InsertNextCell(aCellType,numFacePts,(vtkIdType*)aNewPts);
              if(myStoreMapping)
                myVTK2ObjIds.push_back(cellId);
              
@@ -773,7 +773,7 @@ VTKViewer_GeometryFilter
              aNewPts[6] = pts[6];
              aNewPts[7] = pts[18];
              
-             newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+             newCellId = output->InsertNextCell(aCellType,numFacePts,(vtkIdType*)aNewPts);
              if(myStoreMapping)
                myVTK2ObjIds.push_back(cellId);
              
@@ -789,7 +789,7 @@ VTKViewer_GeometryFilter
              aNewPts[6] = pts[7];
              aNewPts[7] = pts[19];
              
-             newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+             newCellId = output->InsertNextCell(aCellType,numFacePts,(vtkIdType*)aNewPts);
              if(myStoreMapping)
                myVTK2ObjIds.push_back(cellId);
              
@@ -805,7 +805,7 @@ VTKViewer_GeometryFilter
              aNewPts[6] = pts[3];
              aNewPts[7] = pts[11];
              
-             newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+             newCellId = output->InsertNextCell(aCellType,numFacePts,(vtkIdType*)aNewPts);
              if(myStoreMapping)
                myVTK2ObjIds.push_back(cellId);
              
@@ -821,7 +821,7 @@ VTKViewer_GeometryFilter
              aNewPts[6] = pts[7];
              aNewPts[7] = pts[15];
              
-             newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+             newCellId = output->InsertNextCell(aCellType,numFacePts,(vtkIdType*)aNewPts);
              if(myStoreMapping)
                myVTK2ObjIds.push_back(cellId);