]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
*** empty log message ***
authorvsv <vsv@opencascade.com>
Thu, 5 Jun 2008 12:12:05 +0000 (12:12 +0000)
committervsv <vsv@opencascade.com>
Thu, 5 Jun 2008 12:12:05 +0000 (12:12 +0000)
18 files changed:
src/OBJECT/VISU_Actor.cxx
src/OBJECT/VISU_Actor.h
src/OBJECT/VISU_DataSetActor.cxx
src/OBJECT/VISU_DataSetActor.h
src/OBJECT/VISU_ScalarMapAct.cxx
src/PIPELINE/VISU_DataSetMapperHolder.cxx
src/PIPELINE/VISU_DataSetMapperHolder.hxx
src/PIPELINE/VISU_MapperHolder.hxx
src/PIPELINE/VISU_PipeLine.cxx
src/PIPELINE/VISU_PipeLine.hxx
src/PIPELINE/VISU_PolyDataMapperHolder.cxx
src/PIPELINE/VISU_PolyDataMapperHolder.hxx
src/VISUGUI/VisuGUI_ClippingDlg.cxx
src/VISUGUI/VisuGUI_ClippingDlg.h
src/VISUGUI/VisuGUI_ClippingPlaneMgr.cxx
src/VISUGUI/VisuGUI_ClippingPlaneMgr.h
src/VISUGUI/VisuGUI_SegmentationMgr.cxx
src/VISUGUI/VisuGUI_SegmentationMgr.h

index ac5501ab1142ce37b14eaf5a0d8864a88e0f8e03..5621c531d2f3e6b0c1c442af9f1ba0244f1615ef 100644 (file)
@@ -717,6 +717,11 @@ vtkPlane* VISU_Actor::GetClippingPlane(vtkIdType theID)
   return NULL;
 }
 
+vtkImplicitFunctionCollection* VISU_Actor::GetClippingPlanes()
+{
+  return NULL;
+}
+
 //----------------------------------------------------------------------------
 template<class TData> std::string getScalar(TData* theData, int theId)
 {
index 688c3d85d18d8ed74f379da87e471b6a9c2b60a5..e4e26779ba11d455cc646ae291e2807d77a1e41d 100644 (file)
@@ -47,6 +47,7 @@ class vtkCallbackCommand;
 class VTKViewer_ShrinkFilter;
 class VISU_PipeLine;
 class vtkPlane;
+class vtkImplicitFunctionCollection;
 
 class VISU_FramedTextActor;
 
@@ -265,6 +266,8 @@ class VTKOCC_EXPORT VISU_Actor :
 
   virtual vtkPlane* GetClippingPlane(vtkIdType theID);
 
+  virtual vtkImplicitFunctionCollection* GetClippingPlanes();
+
   //----------------------------------------------------------------------------
   //! Apply the picking settings on the actor.
   void
index 2ac677705228721b2f12c3fe8e556ad11d070b23..ca3891ac570052a762a9502df311e1ef3d2fbc40 100644 (file)
@@ -33,7 +33,7 @@
 #include <vtkObjectFactory.h>
 #include <vtkImplicitBoolean.h>
 #include <SALOME_ExtractGeometry.h>
-#include <vtkExtractPolyDataGeometry.h>
+#include <SALOME_ExtractPolyDataGeometry.h>
 #include <vtkImplicitFunctionCollection.h>
 #include <vtkPlane.h>
 
@@ -55,14 +55,14 @@ VISU_DataSetActor
 ::VISU_DataSetActor():
   myMapper(vtkDataSetMapper::New()),
   myExtractor(SALOME_ExtractGeometry::New()),
-  myPolyDataExtractor(vtkExtractPolyDataGeometry::New()),
+  myPolyDataExtractor(SALOME_ExtractPolyDataGeometry::New()),
   myFunction(vtkImplicitBoolean::New())
 {
   if(MYDEBUG) MESSAGE("VISU_DataSetActor::VISU_DataSetActor - this = "<<this);
 
   myExtractor->SetImplicitFunction(myFunction);
   myPolyDataExtractor->SetImplicitFunction(myFunction);
-  //myExtractor->ExtractBoundaryCellsOn();
+  myExtractor->ExtractBoundaryCellsOn();
 
   myFunction->SetOperationTypeToIntersection();
 
@@ -105,6 +105,7 @@ VISU_DataSetActor
     myExtractor->SetInput(theDataSet);
     myMapper->SetInput(myExtractor->GetOutput());
   }
+  //  myMapper->SetInput(theDataSet);
   SetMapper(myMapper.GetPointer());
 }
 
index 658042294ca48b9d3b306cbc2e08939ff9982a78..4af55e3e71ce480e593ea93dcf967e373e25aaeb 100644 (file)
@@ -32,7 +32,7 @@
 
 class vtkDataSetMapper;
 class SALOME_ExtractGeometry;
-class vtkExtractPolyDataGeometry;
+class SALOME_ExtractPolyDataGeometry;
 class vtkImplicitBoolean;
 class vtkImplicitFunctionCollection;
 
@@ -85,7 +85,7 @@ class VTKOCC_EXPORT VISU_DataSetActor : public VISU_Actor
   //----------------------------------------------------------------------------
   vtkSmartPointer<vtkDataSetMapper> myMapper;
   vtkSmartPointer<SALOME_ExtractGeometry> myExtractor;
-  vtkSmartPointer<vtkExtractPolyDataGeometry> myPolyDataExtractor;
+  vtkSmartPointer<SALOME_ExtractPolyDataGeometry> myPolyDataExtractor;
   vtkSmartPointer<vtkImplicitBoolean> myFunction;
 };
 
index 5f1774becdaa2b5afcce171487fceb21f9ac0014..670a6f1404d8f11c905cdd300471d13489773242 100644 (file)
@@ -37,6 +37,7 @@
 #include "VISU_PipeLineUtils.hxx"
 
 #include <SALOME_ExtractGeometry.h>
+#include <SALOME_ExtractPolyDataGeometry.h>
 
 #include <vtkObjectFactory.h>
 #include <vtkRenderer.h>
@@ -276,12 +277,19 @@ VISU_ScalarMapAct
 {
   Superclass::SetMapperInput( theDataSet );
 
-//   myPointsActor->SetInput( theDataSet );
-//   mySurfaceActor->SetInput( theDataSet );
-//   myEdgeActor->SetInput( theDataSet );
-  myPointsActor->SetInput( myExtractor->GetOutput() );
-  mySurfaceActor->SetInput( myExtractor->GetOutput() );
-  myEdgeActor->SetInput( myExtractor->GetOutput() );
+//    myPointsActor->SetInput( theDataSet );
+//    mySurfaceActor->SetInput( theDataSet );
+//    myEdgeActor->SetInput( theDataSet );
+
+  if (theDataSet->IsA("vtkPolyData")) {
+    myPointsActor->SetInput( myPolyDataExtractor->GetOutput() );
+    mySurfaceActor->SetInput( myPolyDataExtractor->GetOutput() );
+    myEdgeActor->SetInput( myPolyDataExtractor->GetOutput() );
+  } else {
+    myPointsActor->SetInput( myExtractor->GetOutput() );
+    mySurfaceActor->SetInput( myExtractor->GetOutput() );
+    myEdgeActor->SetInput( myExtractor->GetOutput() );
+  }
 }
 
 //----------------------------------------------------------------------------
index 313c6d683595e6f37b4d510adecc54123e2f4434..0bc9e0deb98c4a7c6b40c7a0545f12f50e5d67bd 100644 (file)
@@ -297,6 +297,7 @@ VISU_DataSetMapperHolder
     if (vtkImplicitBoolean* aBoolean = myExtractGeometry->GetImplicitBoolean()) {
       vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
       aFunction->AddItem(thePlane);
+      aBoolean->Modified();
       // Check, that at least one cell present after clipping.
       // This check was introduced because of bug IPAL8849.
       vtkDataSet* aClippedDataSet = GetClippedInput();
@@ -326,6 +327,19 @@ VISU_DataSetMapperHolder
   return aPlane;
 }
 
+//----------------------------------------------------------------------------
+void VISU_DataSetMapperHolder::RemoveClippingPlane(vtkIdType theID)
+{
+  if(theID >= 0 && theID < GetNumberOfClippingPlanes()){
+    if(vtkImplicitBoolean* aBoolean = myExtractGeometry->GetImplicitBoolean()){
+      vtkImplicitFunctionCollection* aFunctions = aBoolean->GetFunction();
+      aFunctions->RemoveItem(theID);
+      aBoolean->Modified();
+    }
+  }
+}
+
+
 //----------------------------------------------------------------------------
 void
 VISU_DataSetMapperHolder
index 45fa07fe6d703347cb8f0a29d564f2ca1bc360a0..d1980248b97a8ddc5a48e73cdec8f92f8d7fa902 100644 (file)
@@ -130,6 +130,8 @@ public:
   vtkPlane* 
   GetClippingPlane(vtkIdType theID);
 
+  virtual void RemoveClippingPlane(vtkIdType theID);
+
 protected:
   //----------------------------------------------------------------------------
   VISU_DataSetMapperHolder();
index 756abdeed99bba7a2990864f94bf774978cab4da..3a87d47cd2b84dadb5a4124319488bd57e21c7dd 100644 (file)
@@ -139,6 +139,8 @@ public:
   vtkPlane* 
   GetClippingPlane(vtkIdType theID) = 0;
 
+  virtual void RemoveClippingPlane(vtkIdType theID) = 0;
+
   //----------------------------------------------------------------------------
   virtual
   void
index ea165bc078c1c073b603e35d5ab35e7f35cf4f2e..4128c9824cf42536121cab7b2085f8f1a92421d7 100644 (file)
@@ -347,6 +347,12 @@ VISU_PipeLine
   return GetMapperHolder()->GetClippingPlane(theID);
 }
 
+//----------------------------------------------------------------------------
+void VISU_PipeLine::RemoveClippingPlane(vtkIdType theID)
+{
+  return GetMapperHolder()->RemoveClippingPlane(theID);
+}
+
 //----------------------------------------------------------------------------
 vtkDataSet* 
 VISU_PipeLine
index 5301593714de39a4d3468f01f40db3f3edee2cbd..038e8dbe762194aaf542a108a36603c410f63b9c 100644 (file)
@@ -159,6 +159,8 @@ public:
   vtkPlane* 
   GetClippingPlane(vtkIdType theID);
 
+  virtual void RemoveClippingPlane(vtkIdType theID);
+
   virtual
   void
   SetPlaneParam(vtkFloatingPointType theDir[3], 
index 0b9cd22766a47430e96165a29f0e401554023c34..55abef8092155e07922f9498b6701db4640bc3c8 100644 (file)
@@ -257,6 +257,7 @@ VISU_PolyDataMapperHolder
     if (vtkImplicitBoolean* aBoolean = myExtractPolyDataGeometry->GetImplicitBoolean()) {
       vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
       aFunction->AddItem(thePlane);
+      aBoolean->Modified();
       // Check, that at least one cell present after clipping.
       // This check was introduced because of bug IPAL8849.
       vtkDataSet* aClippedDataSet = GetClippedInput();
@@ -286,6 +287,18 @@ VISU_PolyDataMapperHolder
   return aPlane;
 }
 
+//----------------------------------------------------------------------------
+void VISU_PolyDataMapperHolder::RemoveClippingPlane(vtkIdType theID)
+{
+  if(theID >= 0 && theID < GetNumberOfClippingPlanes()){
+    if(vtkImplicitBoolean* aBoolean = myExtractPolyDataGeometry->GetImplicitBoolean()){
+      vtkImplicitFunctionCollection* aFunctions = aBoolean->GetFunction();
+      aFunctions->RemoveItem(theID);
+      aBoolean->Modified();  
+    }
+  }
+}
+
 //----------------------------------------------------------------------------
 void
 VISU_PolyDataMapperHolder
index dc9848eccc1ebfbd02123f08b4312d89b1f68482..10ff1a4abeb43697d89da615b54cc0eaac10f166 100644 (file)
@@ -129,6 +129,8 @@ public:
   virtual
   vtkPlane* 
   GetClippingPlane(vtkIdType theID);
+  
+  void RemoveClippingPlane(vtkIdType theID);
 
 protected:
   //----------------------------------------------------------------------------
index 0daf34c9d0595c7709f8521ebf421a8d898cdf43..e3bab7c3325d02cc653f8723b3f1099f28b739fc 100644 (file)
@@ -649,8 +649,10 @@ void VisuGUI_ClippingDlg::applyGlobalPlanes()
   VisuGUI_SegmentationMgr* aSegmentationMgr = aVisuExtender->getSegmentationMgr(aViewWindow);
   
   myDSActor->RemoveAllClippingPlanes();
+
   const QListOfPlanes& aPlanes = aSegmentationMgr->getPlanes();
   PlaneDef aPlane;
+
   for (int i = 0; i < myGlobalPlanes->count(); i++) {
     if (myGlobalPlanes->item(i)->checkState() == Qt::Checked) {
       aPlane = aPlanes.at(i);
@@ -1383,8 +1385,8 @@ void VisuGUI_ClippingDlg::initGlobalPlanes()
     QListWidgetItem* aItem = new QListWidgetItem(aPlane.name, myGlobalPlanes);
     if (aPlane.isAuto)
       aItem->setFlags(0);
-    else
-      aItem->setCheckState(Qt::Unchecked);
+    //    else
+    aItem->setCheckState(Qt::Unchecked);
     myGlobalPlanes->addItem(aItem);
     
     //Create preview
@@ -1408,7 +1410,7 @@ void VisuGUI_ClippingDlg::initGlobalPlanes()
        break;
       }
     }
-  }
+  }  
 }
 
 
@@ -1416,7 +1418,7 @@ void VisuGUI_ClippingDlg::initGlobalPlanes()
 // function : initGlobalPlanes()
 // purpose  :
 //=================================================================================
-VISU_DataSetActor* VisuGUI_ClippingDlg::getSelectedActor()
+VISU_Actor* VisuGUI_ClippingDlg::getSelectedActor()
 {
   SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>(myVisuGUI);
 
@@ -1431,10 +1433,7 @@ VISU_DataSetActor* VisuGUI_ClippingDlg::getSelectedActor()
   if (!aPrs) return 0;
 
   VISU_Actor* aActor = VISU::FindActor(aViewWindow, aPrs);
-  if (!aActor) return 0;
-  
-  VISU_DataSetActor* aDSActor = dynamic_cast<VISU_DataSetActor*>(aActor);
-  return aDSActor;
+  return aActor;
 }
 
 //=================================================================================
index f53bc1ec476428ca21c0f6bea63ca904826525c3..87e14e86713b5cc07f4e0e0e3ce259cba5938b95 100644 (file)
@@ -58,7 +58,7 @@ class VisuGUI;
 class vtkPlaneSource;
 class vtkDataSetMapper;
 class OrientedPlane;
-class VISU_DataSetActor;
+class VISU_Actor;
 class PreviewPlane;
 
 namespace VISU {
@@ -140,7 +140,7 @@ private:
     void initGlobalPlanes();
     bool hasGlobalPlanes();
   
-    VISU_DataSetActor* getSelectedActor();
+    VISU_Actor* getSelectedActor();
 
     void applyLocalPlanes();
     void applyGlobalPlanes();
@@ -193,7 +193,7 @@ private:
     QButtonGroup* myPlaneTypeGrp;
     QListWidget*  myGlobalPlanes;
     bool myHasGlobalPl;
-    VISU_DataSetActor* myDSActor;
+    VISU_Actor* myDSActor;
     QList<PreviewPlane*> myPreviewList;
 
 protected:
index a0e1440f874bc1e41a7461bf9d400129dfa6d75b..c75610f6d6147ba9462d477881a30050cd0fe0c4 100644 (file)
@@ -23,7 +23,7 @@
 #include "VisuGUI.h"
 #include "VisuGUI_Tools.h"
 
-#include "VISU_DataSetActor.h"
+#include "VISU_Actor.h"
 
 #include <LightApp_Application.h>
 #include <SUIT_Desktop.h>
@@ -288,22 +288,19 @@ void VisuGUI_ClippingPlaneMgr::saveState()
   while ( (aActor = anActors->GetNextActor()) ) {
     VISU_Actor* vActor = VISU_Actor::SafeDownCast( aActor );
     if (vActor) {
-      VISU_DataSetActor* aDSActor = dynamic_cast<VISU_DataSetActor*>(vActor);
-      if (aDSActor) {
-       ListOfvtkPlanes aList;
-       vtkImplicitFunctionCollection* aFunctions = aDSActor->GetClippingPlanes();
-       aFunctions->InitTraversal();
-       vtkImplicitFunction* aItem;
-       while ((aItem = aFunctions->GetNextItem())) {
-         for (int i = 0; i < myPlanes.size(); i++) {
-           aPlane = myPlanes.at(i);
-           if (aPlane.plane.GetPointer() == aItem) 
-             aList.append(aPlane.plane);
-         }
+      ListOfvtkPlanes aList;
+      vtkImplicitFunctionCollection* aFunctions = vActor->GetClippingPlanes();
+      aFunctions->InitTraversal();
+      vtkImplicitFunction* aItem;
+      while ((aItem = aFunctions->GetNextItem())) {
+       for (int i = 0; i < myPlanes.size(); i++) {
+         aPlane = myPlanes.at(i);
+         if (aPlane.plane.GetPointer() == aItem) 
+           aList.append(aPlane.plane);
        }
-       myActorsMap[aDSActor] = aList;
-       aDSActor->RemoveAllClippingPlanes();
       }
+      myActorsMap[vActor] = aList;
+      vActor->RemoveAllClippingPlanes();
     }
   }
   myCopyActorsMap = myActorsMap;
@@ -313,8 +310,8 @@ void VisuGUI_ClippingPlaneMgr::saveState()
 void VisuGUI_ClippingPlaneMgr::deletePlaneFromActors(int thePlaneId)
 {
   vtkPlane* aPl = myPlanes.at(thePlaneId).plane;
-  QList<VISU_DataSetActor*> aActors = myActorsMap.keys();
-  VISU_DataSetActor* aActor;
+  QList<VISU_Actor*> aActors = myActorsMap.keys();
+  VISU_Actor* aActor;
   vtkPlane* aPlane;
   for (int i = 0; i < aActors.size(); i++) {
     aActor = aActors.at(i);
@@ -331,12 +328,12 @@ void VisuGUI_ClippingPlaneMgr::deletePlaneFromActors(int thePlaneId)
 
 
 //****************************************************************
-void VisuGUI_ClippingPlaneMgr::restoreState(const QMap<VISU_DataSetActor*, ListOfvtkPlanes>& theState)
+void VisuGUI_ClippingPlaneMgr::restoreState(const QMap<VISU_Actor*, ListOfvtkPlanes>& theState)
 {
-  QList<VISU_DataSetActor*> aActors = theState.keys();
-  VISU_DataSetActor* aActor;
+  QList<VISU_Actor*> aActors = theState.keys();
+  VISU_Actor* aActor;
   vtkPlane* aPlane;
-  QMapIterator<VISU_DataSetActor*, ListOfvtkPlanes> aIt(theState);
+  QMapIterator<VISU_Actor*, ListOfvtkPlanes> aIt(theState);
   while (aIt.hasNext()) {
     aIt.next();
     aActor = aIt.key();
index bacc1d6eebd315ba2b5a892b7f99579df9e95019..b6c57ba10e1e5d66b5d81695683881ebd45dd4cd 100644 (file)
@@ -36,7 +36,7 @@ class PreviewPlane;
 class vtkImplicitPlaneWidget;
 class vtkCallbackCommand;
 
-class VISU_DataSetActor;
+class VISU_Actor;
 
 #include <QDialog>
 #include <VisuGUI_SegmentationMgr.h>
@@ -89,7 +89,7 @@ private slots:
 
   void saveState();
   void deletePlaneFromActors(int thePlaneId);
-  void restoreState(const QMap<VISU_DataSetActor*, ListOfvtkPlanes>& theState);
+  void restoreState(const QMap<VISU_Actor*, ListOfvtkPlanes>& theState);
 
 
   VisuGUI_SegmentationMgr* mySegmentationMgr;
@@ -120,8 +120,8 @@ private slots:
   vtkSmartPointer<vtkCallbackCommand> myCallback;
 
   //Stores Actors and Ids of applied planes (position in myPlanes)
-  QMap<VISU_DataSetActor*, ListOfvtkPlanes> myActorsMap;
-  QMap<VISU_DataSetActor*, ListOfvtkPlanes> myCopyActorsMap;
+  QMap<VISU_Actor*, ListOfvtkPlanes> myActorsMap;
+  QMap<VISU_Actor*, ListOfvtkPlanes> myCopyActorsMap;
 
   double myBounds[6];
 
index 3e768972c62f28b0b240415da5a707161e050aa4..e90d25b6d4561db9ee4a3afc0583a4704ff7225e 100644 (file)
@@ -187,6 +187,20 @@ CutPlaneFunction::~CutPlaneFunction()
 {
 }
 
+// void CutPlaneFunction::removeCutPlaneFunctions(VISU_Actor* theActor)
+// {
+//   VISU_PipeLine* aPL = theActor->GetPipeLine();
+//   vtkIdType aNbPlanes = aPL->GetNumberOfClippingPlanes();
+//   CutPlaneFunction* aPlane = 0;
+//   printf("#### Before delete Nb = %i\n", aNbPlanes);
+//   for (vtkIdType i = aNbPlanes - 1; i >= 0; i--) {
+//     aPlane = dynamic_cast<CutPlaneFunction*>(aPL->GetClippingPlane(i));
+//     if (aPlane) {
+//       aPL->RemoveClippingPlane(i);
+//     }
+//   }
+//   printf("#### After delete Nb = %i\n", aPL->GetNumberOfClippingPlanes());
+// }
 
 
 
@@ -194,7 +208,7 @@ CutPlaneFunction::~CutPlaneFunction()
 //****************************************************************
 //****************************************************************
 VisuGUI_SegmentationMgr::VisuGUI_SegmentationMgr(VisuGUI* theModule, SVTK_ViewWindow* theWindow):
-  myIsPlanesNonActive(true),
+  myIsPlanesNonActive(false),
   myIsPlanesVisible(false),
   myWindow(theWindow),
   myModule(theModule),
@@ -312,7 +326,6 @@ void VisuGUI_SegmentationMgr::setPlanesNonActive(bool theNonActive)
     aPlane.plane->setActive(!theNonActive);
   }
   myWindow->Repaint();
-  
 }
 
 //****************************************************************
@@ -354,10 +367,7 @@ bool VisuGUI_SegmentationMgr::isPlanesVisible() const
 //****************************************************************
 bool VisuGUI_SegmentationMgr::isContainsPlane(VISU_Actor* theActor, vtkPlane* thePlane)
 {
-  VISU_DataSetActor* aDSActor = dynamic_cast<VISU_DataSetActor*>(theActor);
-  if (!aDSActor) return false;
-
-  vtkImplicitFunctionCollection* aFunctions = aDSActor->GetClippingPlanes();
+  vtkImplicitFunctionCollection* aFunctions = theActor->GetClippingPlanes();
   aFunctions->InitTraversal();
   vtkImplicitFunction* aItem;
   while ((aItem = aFunctions->GetNextItem())) {
index c9e7a70fbef1ce21aa6db874d5584903dcbb5481..9c072073ac793ecda2fb29d40e3b15ff8ac379b0 100644 (file)
@@ -58,6 +58,8 @@ public:
   void setActive(bool theActive);
   bool isActive() const { return myIsActive; }
 
+  //static void removeCutPlaneFunctions(VISU_Actor* theActor);
+
 protected:
   CutPlaneFunction();
   ~CutPlaneFunction();