]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Implementation of the "21459: EDF 1495 SMESH: Manipulation of discrete elements with...
authorrnv <rnv@opencascade.com>
Fri, 28 Sep 2012 07:26:48 +0000 (07:26 +0000)
committerrnv <rnv@opencascade.com>
Fri, 28 Sep 2012 07:26:48 +0000 (07:26 +0000)
src/SVTK/Makefile.am
src/SVTK/SALOME_Actor.cxx
src/SVTK/SVTK_Actor.cxx
src/SVTK/SVTK_Actor.h
src/SVTK/SVTK_DeviceActor.cxx
src/SVTK/SVTK_DeviceActor.h
src/SVTK/SVTK_Utils.cxx [new file with mode: 0644]
src/SVTK/SVTK_Utils.h [new file with mode: 0644]

index 144ad705e85508099ad1ee7f8f2bf8846296dba4..c048c3f49a9e073abe496551c4c51dada3907942 100755 (executable)
@@ -60,7 +60,8 @@ salomeinclude_HEADERS= \
        SVTK_Recorder.h \
        SVTK_RecorderDlg.h \
        SVTK_ImageWriter.h \
-       SVTK_ImageWriterMgr.h
+       SVTK_ImageWriterMgr.h \
+       SVTK_Utils.h
 
 dist_libSVTK_la_SOURCES= \
        SVTK_Prs.cxx \
@@ -92,6 +93,7 @@ dist_libSVTK_la_SOURCES= \
        SVTK_RecorderDlg.cxx \
        SVTK_ImageWriter.cxx \
        SVTK_ImageWriterMgr.cxx \
+       SVTK_Utils.cxx \
        vtkPVAxesActor.h \
        vtkPVAxesActor.cxx \
        vtkPVAxesWidget.h \
index ad20490b22ba51da80df7cf4dd6ac145f25d7a07..8af1876fc9af1cfd43cc2c387f896f431d57bdce 100644 (file)
@@ -273,8 +273,8 @@ SALOME_Actor
 
   myRenderer = theRenderer;
 
-  theRenderer->AddActor( myPreHighlightActor.GetPointer() );
-  theRenderer->AddActor( myHighlightActor.GetPointer() );
+  myHighlightActor->AddToRender(theRenderer);
+  myPreHighlightActor->AddToRender(theRenderer);
   theRenderer->AddActor( myOutlineActor.GetPointer() );
   theRenderer->AddActor( myNameActor.GetPointer() );
 }
@@ -288,6 +288,9 @@ SALOME_Actor
 {
   Superclass::RemoveFromRender(theRenderer);
 
+  myHighlightActor->RemoveFromRender(theRenderer);
+  myPreHighlightActor->RemoveFromRender(theRenderer);
+
   theRenderer->RemoveActor( myPreHighlightActor.GetPointer() );
   theRenderer->RemoveActor( myHighlightActor.GetPointer() );
   theRenderer->RemoveActor( myOutlineActor.GetPointer() );
index 2ea4910cf2fde0df5cd75ab478b27a50b699ff81..0155b629a94f532e04538253dc08979ba957582e 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "SVTK_Actor.h"
 #include "SALOME_Actor.h"
+#include "SVTK_Utils.h"
 
 #include "SALOME_InteractiveObject.hxx"
 
 #include "Utils_SALOME_Exception.hxx"
 #include "utilities.h"
 
-static 
-void
-CopyPoints(vtkUnstructuredGrid* theGrid, vtkDataSet *theSourceDataSet)
-{
-  vtkPoints *aPoints = vtkPoints::New();
-  vtkIdType iEnd = theSourceDataSet->GetNumberOfPoints();
-  aPoints->SetNumberOfPoints(iEnd);
-  for(vtkIdType i = 0; i < iEnd; i++){
-    aPoints->SetPoint(i,theSourceDataSet->GetPoint(i));
-  }
-  theGrid->SetPoints(aPoints);
-  aPoints->Delete();
-}
 
 vtkStandardNewMacro(SVTK_Actor);
 
@@ -123,7 +111,7 @@ SVTK_Actor
   myUnstructuredGrid->Allocate();
 
   vtkDataSet *aSourceDataSet = theMapActor->GetInput();
-  CopyPoints(GetSource(),aSourceDataSet);
+  SVTK::CopyPoints(GetSource(),aSourceDataSet);
 
   int aNbOfParts = theMapIndex.Extent();
   for(int ind = 1; ind <= aNbOfParts; ind++){
@@ -194,7 +182,7 @@ SVTK_Actor
   myUnstructuredGrid->Allocate();
 
   vtkDataSet *aSourceDataSet = theMapActor->GetInput();
-  CopyPoints(GetSource(),aSourceDataSet);
+  SVTK::CopyPoints(GetSource(),aSourceDataSet);
 
 
   if(theMapIndex.Extent() == 2){
@@ -223,3 +211,20 @@ SVTK_Actor
 
   myMapIndex = theMapIndex;
 }
+
+/*!
+  To publish the actor an all its internal devices
+*/
+void
+SVTK_Actor
+::AddToRender(vtkRenderer* theRenderer)
+{
+  theRenderer->AddActor(this);
+}
+
+void
+SVTK_Actor
+::RemoveFromRender(vtkRenderer* theRenderer) 
+{
+  theRenderer->RemoveActor(this);
+}
index 00e92d4ce3596dcb2b6f32ce96bd21b4e5d2e870..d2b10164ea83c10af9c167914ba3dd4462c9cd02 100644 (file)
@@ -50,7 +50,7 @@ public:
   vtkTypeMacro(SVTK_Actor,SVTK_DeviceActor);
 
   //! Initialiaze the instance completely
-  void
+  virtual void
   Initialize();
 
   //! Allows to set an external source 
@@ -61,18 +61,25 @@ public:
   vtkUnstructuredGrid*
   GetSource();
 
+  virtual void
+  AddToRender(vtkRenderer* theRenderer);
+
+  virtual void
+  RemoveFromRender(vtkRenderer* theRenderer);
+
+
   //! Allow to recostruct selected cells from source SALOME_Actor and map of subindexes
-  void
+  virtual void
   MapCells(SALOME_Actor* theMapActor, 
            const TColStd_IndexedMapOfInteger& theMapIndex);
 
   //! Allow to recostruct selected points from source SALOME_Actor and map of subindexes
-  void 
+  virtual void 
   MapPoints(SALOME_Actor* theMapActor, 
             const TColStd_IndexedMapOfInteger& theMapIndex);
 
   //! Allow to recostruct selected edges from source SALOME_Actor and map of subindexes
-  void 
+  virtual void 
   MapEdge(SALOME_Actor* theMapActor, 
           const TColStd_IndexedMapOfInteger& theMapIndex);
 
index 94e6ee09d79d15f24140ac2173c685a8a00460df..bea8a52ffd4ffb1fe1736339f2bb1acda4a85b11 100644 (file)
@@ -749,3 +749,11 @@ void SVTK_DeviceActor::SetCoincident3DAllowed(bool theFlag) {
 bool SVTK_DeviceActor::IsCoincident3DAllowed() const {
   return myGeomFilter->GetAppendCoincident3D();
 }
+
+void
+SVTK_DeviceActor
+::SetResolveCoincidentTopology(bool theIsResolve)
+{
+  myIsResolveCoincidentTopology = theIsResolve;
+}
+  
\ No newline at end of file
index 12d10220fcda2fbc2cec31959e1384e59d479948..681f25263a7525427cff173d2aa349b9ab187779 100644 (file)
@@ -249,6 +249,10 @@ class SVTK_EXPORT SVTK_DeviceActor: public vtkLODActor
   virtual
   bool 
   IsCoincident3DAllowed() const;
+  
+  void
+  SetResolveCoincidentTopology(bool theIsResolve);
+    
 
 
  protected:
diff --git a/src/SVTK/SVTK_Utils.cxx b/src/SVTK/SVTK_Utils.cxx
new file mode 100644 (file)
index 0000000..77415a7
--- /dev/null
@@ -0,0 +1,43 @@
+// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+//  SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
+//  File   : SVTK_Utils.cxx
+//  Author : Roman NIKOLAEV
+
+#include "SVTK_Utils.h"
+
+#include <vtkUnstructuredGrid.h>
+
+namespace SVTK {
+  void CopyPoints(vtkUnstructuredGrid* theGrid, vtkDataSet *theSourceDataSet)
+  {
+    vtkPoints *aPoints = vtkPoints::New();
+    vtkIdType iEnd = theSourceDataSet->GetNumberOfPoints();
+    aPoints->SetNumberOfPoints(iEnd);
+    for(vtkIdType i = 0; i < iEnd; i++){
+      aPoints->SetPoint(i,theSourceDataSet->GetPoint(i));
+    }
+    theGrid->SetPoints(aPoints);
+    aPoints->Delete();
+  }  
+}
diff --git a/src/SVTK/SVTK_Utils.h b/src/SVTK/SVTK_Utils.h
new file mode 100644 (file)
index 0000000..b513630
--- /dev/null
@@ -0,0 +1,41 @@
+// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+//  SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
+//  File   : SVTK_Utils.h
+//  Author : Roman NIKOLAEV
+
+#ifndef SVTK_UTILS_H
+#define SVTK_UTILS_H
+
+#include "SVTK.h"
+
+class vtkUnstructuredGrid;
+class vtkDataSet;
+
+namespace SVTK {
+
+  SVTK_EXPORT void CopyPoints(vtkUnstructuredGrid* theGrid, vtkDataSet *theSourceDataSet);
+
+}
+
+#endif