]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
VISU 2008 - Introduction of the Feature Edges presentation mode
authorouv <ouv@opencascade.com>
Tue, 8 Jul 2008 08:42:38 +0000 (08:42 +0000)
committerouv <ouv@opencascade.com>
Tue, 8 Jul 2008 08:42:38 +0000 (08:42 +0000)
19 files changed:
idl/VISU_Gen.idl
resources/SalomeApp.xml
src/OBJECT/VISU_Actor.cxx
src/OBJECT/VISU_Actor.h
src/OBJECT/VISU_MeshAct.cxx
src/OBJECT/VISU_MeshAct.h
src/PIPELINE/VISU_CutLinesPL.cxx
src/PIPELINE/VISU_CutPlanesPL.cxx
src/PIPELINE/VISU_DeformedShapePL.cxx
src/PIPELINE/VISU_GaussPointsPL.cxx
src/PIPELINE/VISU_IsoSurfacesPL.cxx
src/PIPELINE/VISU_MeshPL.cxx
src/PIPELINE/VISU_PipeLine.cxx
src/PIPELINE/VISU_PipeLine.hxx
src/PIPELINE/VISU_Plot3DPL.cxx
src/PIPELINE/VISU_ScalarMapPL.cxx
src/PIPELINE/VISU_StreamLinesPL.cxx
src/PIPELINE/VISU_VectorsPL.cxx
src/VISU_I/VISU_Mesh_i.cc

index d6ae2db1f41c61fb99b8a8e7eaf63b2a76e7cdc8..f068b4ef7f76cca48bb88fffec1e036f70037b8f 100644 (file)
@@ -346,6 +346,7 @@ module VISU {
                         SHADED,
                         INSIDEFRAME,
                         SURFACEFRAME,
+                        FEATURE_EDGES,
                         SHRINK
   };
 
index 21d28a2edbbaabe3b19a76095c3da5c9c20c99e9..7bd7d5e5599cd00f641927be0d5567d9854deb29 100644 (file)
     <parameter name="scalar_def_represent"     value="2"/>
     <parameter name="scalar_def_shrink"        value="false"/>
     <parameter name="represent_shading"        value="false"/>
+    <parameter name="feature_edges_angle"      value="30.0"/>
+    <parameter name="feature_edges"            value="true"/>
+    <parameter name="boundary_edges"           value="false"/>
+    <parameter name="manifold_edges"           value="false"/>
+    <parameter name="non_manifold_edges"       value="false"/>
+    <parameter name="feature_edges_coloring"   value="false"/>
     <parameter name="scalar_bar_horizontal_height" value="0.05"/>
     <parameter name="scalar_bar_horizontal_width"  value="0.5" />
     <parameter name="scalar_bar_horizontal_x" value="0.01"/>
index 5621c531d2f3e6b0c1c442af9f1ba0244f1615ef..dfab38087892832c1cd5fca11402611458edea17 100644 (file)
@@ -58,6 +58,7 @@
 #include <vtkPolyData.h>
 #include <vtkUnstructuredGrid.h>
 #include <vtkPassThroughFilter.h>
+#include <vtkFeatureEdges.h>
 
 #include <vtkShrinkFilter.h>
 #include <vtkShrinkPolyData.h>
@@ -104,6 +105,9 @@ VISU_Actor
   myAnnotationMapper(vtkTextMapper::New()),
   myAnnotationActor(vtkTextActor::New()),
   myTextActor(VISU_FramedTextActor::New()),
+  myIsFeatureEdgesAllowed(false),
+  myIsFeatureEdgesEnabled(false),
+  myFeatureEdges(vtkFeatureEdges::New()),
   myLastSelectionMode(ActorSelection),
   myIsSubElementsHighlighted(false)
 {
@@ -125,6 +129,8 @@ VISU_Actor
   myTextActor->SetVisibility(false);
   myTextActor->SetPickable(false);
 
+  myFeatureEdges->Delete();
+
   myEventCallbackCommand->Delete();
   myEventCallbackCommand->SetClientData(this); 
   myEventCallbackCommand->SetCallback(VISU_Actor::ProcessEvents);
@@ -148,6 +154,15 @@ VISU_Actor
     SetShrink();
   else
     UnShrink();
+
+  SetFeatureEdgesAllowed(theActor->IsFeatureEdgesAllowed());
+  SetFeatureEdgesEnabled(theActor->IsFeatureEdgesEnabled());
+  SetFeatureEdgesAngle(theActor->GetFeatureEdgesAngle());
+  bool aFeatureEdges = false, aBoundaryEdges = false, aManifoldEdges = false, aNonManifoldEdges = false;
+  theActor->GetFeatureEdgesFlags( aFeatureEdges, aBoundaryEdges, aManifoldEdges, aNonManifoldEdges );
+  SetFeatureEdgesFlags( aFeatureEdges, aBoundaryEdges, aManifoldEdges, aNonManifoldEdges );
+  SetFeatureEdgesColoring(theActor->GetFeatureEdgesColoring());
+
   SetOpacity(theActor->GetOpacity());
   SetLineWidth(theActor->GetLineWidth());
   SetPosition(theActor->GetPosition());
@@ -250,6 +265,7 @@ VISU_Actor
     if(vtkMapper *aMapper = myPipeLine->GetMapper()){
       if(vtkDataSet *aDataSet = aMapper->GetInput()){
        SetShrinkable(thePipeLine->IsShrinkable());
+       SetFeatureEdgesAllowed(thePipeLine->IsFeatureEdgesAllowed());
        SetMapperInput(aDataSet);
       }
     }
@@ -279,7 +295,10 @@ VISU_Actor
 { 
   Superclass::SetRepresentation(theMode);
   if(myRepresentation == VTK_POINTS)
+  {
     UnShrink();
+    SetFeatureEdgesEnabled( false );
+  }
 }
 
 
@@ -348,6 +367,111 @@ VISU_Actor
 }
 
 
+//----------------------------------------------------------------------------
+bool
+VISU_Actor
+::IsFeatureEdgesAllowed() 
+{ 
+  return myIsFeatureEdgesAllowed;
+}
+
+void
+VISU_Actor
+::SetFeatureEdgesAllowed(bool theIsFeatureEdgesAllowed)
+{
+  myIsFeatureEdgesAllowed = theIsFeatureEdgesAllowed;
+}
+
+bool
+VISU_Actor
+::IsFeatureEdgesEnabled()
+{
+  return myIsFeatureEdgesEnabled;
+}
+
+void
+VISU_Actor
+::SetFeatureEdgesEnabled(bool theIsFeatureEdgesEnabled)
+{
+  if ( !myIsFeatureEdgesAllowed || myIsFeatureEdgesEnabled == theIsFeatureEdgesEnabled ) 
+    return;
+
+  if ( vtkPolyData* aPolyData = myPassFilter[ 2 ]->GetPolyDataOutput() )
+  {
+    if( theIsFeatureEdgesEnabled )
+    {
+      myFeatureEdges->SetInput( aPolyData );
+      myPassFilter[ 3 ]->SetInput( myFeatureEdges->GetOutput() );
+      myIsFeatureEdgesEnabled = true;
+    }
+    else
+    {
+      myPassFilter[3]->SetInput( aPolyData );
+      myPassFilter[3]->Modified();
+      myIsFeatureEdgesEnabled = false;
+      Modified();
+    }
+    myIsFeatureEdgesEnabled = theIsFeatureEdgesEnabled;
+  }
+}
+
+vtkFloatingPointType
+VISU_Actor
+::GetFeatureEdgesAngle()
+{
+  return myFeatureEdges->GetFeatureAngle();
+}
+
+void
+VISU_Actor
+::SetFeatureEdgesAngle(vtkFloatingPointType theValue)
+{
+  myFeatureEdges->SetFeatureAngle(theValue);
+  Modified();
+}
+
+void
+VISU_Actor
+::GetFeatureEdgesFlags(bool& theIsFeatureEdges,
+                      bool& theIsBoundaryEdges,
+                      bool& theIsManifoldEdges,
+                      bool& theIsNonManifoldEdges)
+{
+  theIsFeatureEdges = myFeatureEdges->GetFeatureEdges();
+  theIsBoundaryEdges = myFeatureEdges->GetBoundaryEdges();
+  theIsManifoldEdges = myFeatureEdges->GetManifoldEdges();
+  theIsNonManifoldEdges = myFeatureEdges->GetNonManifoldEdges();
+}
+
+void
+VISU_Actor
+::SetFeatureEdgesFlags(bool theIsFeatureEdges,
+                      bool theIsBoundaryEdges,
+                      bool theIsManifoldEdges,
+                      bool theIsNonManifoldEdges)
+{
+  myFeatureEdges->SetFeatureEdges(theIsFeatureEdges);
+  myFeatureEdges->SetBoundaryEdges(theIsBoundaryEdges);
+  myFeatureEdges->SetManifoldEdges(theIsManifoldEdges);
+  myFeatureEdges->SetNonManifoldEdges(theIsNonManifoldEdges);
+  Modified();
+}
+
+bool
+VISU_Actor
+::GetFeatureEdgesColoring()
+{
+  return myFeatureEdges->GetColoring();
+}
+
+void
+VISU_Actor
+::SetFeatureEdgesColoring(bool theIsColoring)
+{
+  myFeatureEdges->SetColoring(theIsColoring);
+  Modified();
+}
+
 //----------------------------------------------------------------------------
 void
 VISU_Actor
@@ -447,6 +571,11 @@ VISU_Actor
     aSize += aDataSet->GetActualMemorySize() * 1024;
   }
 
+  if(IsFeatureEdgesEnabled()){
+    vtkPolyData* aPolyData = myFeatureEdges->GetOutput();
+    aSize += aPolyData->GetActualMemorySize() * 1024;
+  }
+
   return aSize;
 }
 
index e4e26779ba11d455cc646ae291e2807d77a1e41d..70f438ec6a128a8e9e4137ca37a69fdb86579ae9 100644 (file)
@@ -48,6 +48,7 @@ class VTKViewer_ShrinkFilter;
 class VISU_PipeLine;
 class vtkPlane;
 class vtkImplicitFunctionCollection;
+class vtkFeatureEdges;
 
 class VISU_FramedTextActor;
 
@@ -62,6 +63,7 @@ namespace SVTK
   namespace Representation
   {
     const Type Surfaceframe = Insideframe + 1;
+    const Type FeatureEdges = Insideframe + 2;
   }
 }
 
@@ -164,6 +166,53 @@ class VTKOCC_EXPORT VISU_Actor :
   vtkFloatingPointType
   GetShrinkFactor();
 
+  //----------------------------------------------------------------------------
+  virtual
+  bool
+  IsFeatureEdgesAllowed();
+
+  virtual
+  void
+  SetFeatureEdgesAllowed(bool theIsFeatureEdgesAllowed);
+
+  virtual
+  bool
+  IsFeatureEdgesEnabled();
+
+  virtual
+  void
+  SetFeatureEdgesEnabled(bool theIsFeatureEdgesEnabled);
+
+  virtual
+  vtkFloatingPointType
+  GetFeatureEdgesAngle();
+
+  virtual
+  void
+  SetFeatureEdgesAngle(vtkFloatingPointType theAngle = 30.0); 
+
+  virtual
+  void
+  GetFeatureEdgesFlags(bool& theIsFeatureEdges,
+                      bool& theIsBoundaryEdges,
+                      bool& theIsManifoldEdges,
+                      bool& theIsNonManifoldEdges);
+
+  virtual
+  void
+  SetFeatureEdgesFlags(bool theIsFeatureEdges,
+                      bool theIsBoundaryEdges,
+                      bool theIsManifoldEdges,
+                      bool theIsNonManifoldEdges);
+
+  virtual
+  bool
+  GetFeatureEdgesColoring();
+
+  virtual
+  void
+  SetFeatureEdgesColoring(bool theIsColoring);
+
   //----------------------------------------------------------------------------
   virtual
   void
@@ -328,6 +377,10 @@ class VTKOCC_EXPORT VISU_Actor :
 
   vtkSmartPointer<VISU_FramedTextActor> myTextActor;
 
+  vtkSmartPointer<vtkFeatureEdges> myFeatureEdges;
+  bool myIsFeatureEdgesAllowed;
+  bool myIsFeatureEdgesEnabled;
+
   Selection_Mode myLastSelectionMode;
   bool myIsSubElementsHighlighted;
 };
index cf2e7cfc0a3a7c06339bd6af7f8aaa631c19d20c..486498dabe2278f4a96cb73d2c612c6bf8321259 100644 (file)
@@ -212,6 +212,64 @@ VISU_MeshAct
   myEdgeActor->UnShrink();
 }
 
+//----------------------------------------------------------------------------
+void
+VISU_MeshAct
+::SetFeatureEdgesAllowed(bool theIsFeatureEdgesAllowed)
+{
+  Superclass::SetFeatureEdgesAllowed(theIsFeatureEdgesAllowed);
+
+  mySurfaceActor->SetFeatureEdgesAllowed(theIsFeatureEdgesAllowed);
+}
+
+void
+VISU_MeshAct
+::SetFeatureEdgesAngle(vtkFloatingPointType theValue)
+{
+  Superclass::SetFeatureEdgesAngle(theValue);
+
+  mySurfaceActor->SetFeatureEdgesAngle(theValue);
+}
+
+void
+VISU_MeshAct
+::SetFeatureEdgesFlags(bool theIsFeatureEdges,
+                      bool theIsBoundaryEdges,
+                      bool theIsManifoldEdges,
+                      bool theIsNonManifoldEdges)
+{
+  Superclass::SetFeatureEdgesFlags(theIsFeatureEdges,
+                                  theIsBoundaryEdges,
+                                  theIsManifoldEdges,
+                                  theIsNonManifoldEdges);
+
+  mySurfaceActor->SetFeatureEdgesFlags(theIsFeatureEdges,
+                                      theIsBoundaryEdges,
+                                      theIsManifoldEdges,
+                                      theIsNonManifoldEdges);
+}
+
+void
+VISU_MeshAct
+::SetFeatureEdgesColoring(bool theIsColoring)
+{
+  Superclass::SetFeatureEdgesColoring(theIsColoring);
+
+  mySurfaceActor->SetFeatureEdgesColoring(theIsColoring);
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_MeshAct
+::SetFeatureEdgesEnabled(bool theIsFeatureEdgesEnabled)
+{
+  if(theIsFeatureEdgesEnabled && myRepresentation == VTK_POINTS)
+    return;
+
+  Superclass::SetFeatureEdgesEnabled(theIsFeatureEdgesEnabled);
+
+  mySurfaceActor->SetFeatureEdgesEnabled(theIsFeatureEdgesEnabled);
+}
 
 //----------------------------------------------------------------------------
 void 
@@ -288,6 +346,10 @@ VISU_MeshAct
     myEdgeActor->SetAllocatedRenderTime(this->AllocatedRenderTime/2.0,ren);
     myEdgeActor->RenderOpaqueGeometry(ren);
     break;
+  case FeatureEdges :
+    mySurfaceActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren);
+    mySurfaceActor->RenderOpaqueGeometry(ren);
+    break;
   }
   return 1;
 }
@@ -322,6 +384,10 @@ VISU_MeshAct
     myEdgeActor->SetAllocatedRenderTime(this->AllocatedRenderTime/2.0,ren);
     myEdgeActor->RenderTranslucentGeometry(ren);
     break;
+  case FeatureEdges :
+    mySurfaceActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren);
+    mySurfaceActor->RenderTranslucentGeometry(ren);
+    break;
   }
   return 1;
 }
index 5a5778d3832d7897ae4aeeed84e873ac551cb5a6..86ea730899b041a92156c21abdee505d4ce2fde1 100644 (file)
@@ -99,6 +99,29 @@ class VTKOCC_EXPORT VISU_MeshAct : public VISU_DataSetActor
   void
   UnShrink(); 
 
+  virtual
+  void
+  SetFeatureEdgesAllowed(bool theIsFeatureEdgesAllowed);
+
+  virtual
+  void
+  SetFeatureEdgesEnabled(bool theIsFeatureEdgesEnabled);
+
+  virtual
+  void
+  SetFeatureEdgesAngle(vtkFloatingPointType theAngle = 30.0); 
+
+  virtual
+  void
+  SetFeatureEdgesFlags(bool theIsFeatureEdges,
+                      bool theIsBoundaryEdges,
+                      bool theIsManifoldEdges,
+                      bool theIsNonManifoldEdges);
+
+  virtual
+  void
+  SetFeatureEdgesColoring(bool theIsColoring);
+
   //! Gets memory size used by the instance (bytes).
   virtual
   unsigned long int
index 3bad32d187df31620c822023e025f48bab754d2a..927a0afbba329ee41f7dfea6bfc6f4a971726bb1 100644 (file)
@@ -41,6 +41,7 @@ VISU_CutLinesPL
 ::VISU_CutLinesPL()
 {
   SetIsShrinkable(false);
+  SetIsFeatureEdgesAllowed(false);
 
   myCondition = 1;
   myPosition = 0;
index 22493a104f8b33e3ceb508f0d4579ff7479ce4af..c9f840f3ffd7d8fdb25e8207a699fda024c4e4b3 100644 (file)
@@ -46,6 +46,7 @@ VISU_CutPlanesPL
 ::VISU_CutPlanesPL()
 {
   SetIsShrinkable(false);
+  SetIsFeatureEdgesAllowed(false);
 
   myAppendPolyData = vtkAppendPolyData::New();
 
index 816c474b277d79934f9643b0e444eb4a2475026d..713dabcbed51001759121a1195dd34202aea41b5 100644 (file)
@@ -42,6 +42,7 @@ VISU_DeformedShapePL
   myScaleFactor(0.0)
 {
   SetIsShrinkable(true);
+  SetIsFeatureEdgesAllowed(false);
 
   myWarpVector = vtkWarpVector::New();
   myCellDataToPointData = vtkCellDataToPointData::New();
index ea42aaca6fe06f4a97b0187a5c9c0beac273cebd..0f5ba427e500796c4eebb9ed6d998027ebea1a3a 100644 (file)
@@ -60,6 +60,7 @@ VISU_GaussPointsPL
   myMergeFilter(VISU_GaussMergeFilter::New())
 {
   SetIsShrinkable(false);
+  SetIsFeatureEdgesAllowed(false);
 
   myWarpVector = vtkWarpVector::New();
 
index 602affdfbee3d52cc6994362d38de91a39bbb1fe..c133cad48e04bedf05069b27ef6e48c2717fba02 100644 (file)
@@ -43,6 +43,7 @@ VISU_IsoSurfacesPL
 ::VISU_IsoSurfacesPL()
 {
   SetIsShrinkable(false);
+  SetIsFeatureEdgesAllowed(false);
 
   myContourFilter = vtkContourFilter::New();
 
index 66317af0eac9ae44764e8dae18c56784f12284bb..056a545296fa3d7ddac760e991ba032391277672 100644 (file)
@@ -44,6 +44,7 @@ VISU_MeshPL
   VISU_UnstructuredGridPL(this)
 {
   SetIsShrinkable(true);
+  SetIsFeatureEdgesAllowed(true);
 }
 
 
index 4128c9824cf42536121cab7b2085f8f1a92421d7..0761bbd5e73cb0810fd1c67064db561b13f431c4 100644 (file)
@@ -47,7 +47,8 @@ static int MYDEBUG = 0;
 //----------------------------------------------------------------------------
 VISU_PipeLine
 ::VISU_PipeLine():
-  myIsShrinkable(true)
+  myIsShrinkable(true),
+  myIsFeatureEdgesAllowed(true)
 {
   if(MYDEBUG) MESSAGE("VISU_PipeLine::VISU_PipeLine - "<<this);
 }
@@ -282,6 +283,26 @@ VISU_PipeLine
 }
 
 
+//----------------------------------------------------------------------------
+bool 
+VISU_PipeLine
+::IsFeatureEdgesAllowed()
+{
+  return myIsFeatureEdgesAllowed;
+}
+
+void 
+VISU_PipeLine
+::SetIsFeatureEdgesAllowed(bool theIsFeatureEdgesAllowed)
+{
+  if(myIsFeatureEdgesAllowed == theIsFeatureEdgesAllowed)
+    return;
+
+  myIsFeatureEdgesAllowed = theIsFeatureEdgesAllowed;
+  Modified();
+}
+
+
 //----------------------------------------------------------------------------
 void
 VISU_PipeLine
index 038e8dbe762194aaf542a108a36603c410f63b9c..72ee74d2beebf520adfd368e0991f9309733d1b6 100644 (file)
@@ -132,6 +132,9 @@ public:
   bool 
   IsShrinkable();
 
+  bool 
+  IsFeatureEdgesAllowed();
+
   //----------------------------------------------------------------------------
   void
   SetImplicitFunction(vtkImplicitFunction *theFunction);
@@ -211,10 +214,14 @@ protected:
   void 
   SetIsShrinkable(bool theIsShrinkable);
 
+  void 
+  SetIsFeatureEdgesAllowed(bool theIsFeatureEdgesAllowed);
+
 private:
   //----------------------------------------------------------------------------
   vtkSmartPointer<VISU_MapperHolder> myMapperHolder;
   bool myIsShrinkable;
+  bool myIsFeatureEdgesAllowed;
 };
 
 #endif
index 7696d62e5d5453ae344ec30efd6e543808ef9011..d4a30427a50f6bfb3fcf746ddbf4bb359c4dff83 100644 (file)
@@ -59,6 +59,7 @@ VISU_Plot3DPL
   myScaleFactor(1.0)
 {
   SetIsShrinkable(false);
+  SetIsFeatureEdgesAllowed(false);
 
   myCellDataToPointData->Delete();
   myAppendPolyData->Delete();
index a8784c811a2ee3154c3bd036e4adb6687e5c6917..c14ce395527b4b8487b57d5ee465f4423e43ec36 100644 (file)
@@ -54,6 +54,7 @@ VISU_ScalarMapPL
   myMergeFilter(VISU_MergeFilter::New())
 {
   SetIsShrinkable(true);
+  SetIsFeatureEdgesAllowed(false);
 
   myAppendFilter->SetMergingInputs(true);
   myAppendFilter->Delete();
index b596155ea19ace0fa2ba5c57a50bf5a0647b4f16..82c050096fdc8757cc26cab3d224b757d35cdcd2 100644 (file)
@@ -62,6 +62,7 @@ VISU_StreamLinesPL
 ::VISU_StreamLinesPL()
 {
   SetIsShrinkable(false);
+  SetIsFeatureEdgesAllowed(false);
 
   myStream = vtkStreamLine::New();
   myCenters = vtkCellCenters::New();
index 5192eefb9364d98ace4df4742eceac1571b35a0f..c7e4ad38a17fb994172f7ed489aa760649ce0831 100644 (file)
@@ -64,6 +64,7 @@ VISU_VectorsPL
 ::VISU_VectorsPL()
 {
   SetIsShrinkable(false);
+  SetIsFeatureEdgesAllowed(false);
 
   myBaseGlyph = vtkGlyph3D::New();
   myTransformedGlyph = vtkGlyph3D::New();
index 70707f2f83a4cec73f33b190cf7e6a1f0029b488..088a3acf494d49cbc4549a65f846c526fe5a6e18 100644 (file)
@@ -531,6 +531,15 @@ VISU::Mesh_i
     anActor->GetSurfaceProperty()->SetColor(myCellColor.R, myCellColor.G, myCellColor.B);
     anActor->GetEdgeProperty()->SetColor(myLinkColor.R, myLinkColor.G, myLinkColor.B);
     anActor->GetNodeProperty()->SetColor(myNodeColor.R, myNodeColor.G, myNodeColor.B);
+
+    SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+    anActor->SetFeatureEdgesEnabled( myPresentType == VISU::FEATURE_EDGES );
+    anActor->SetFeatureEdgesAngle( aResourceMgr->doubleValue("VISU", "feature_edges_angle", 0.0) );
+    anActor->SetFeatureEdgesFlags( aResourceMgr->booleanValue("VISU", "feature_edges", false),
+                                  aResourceMgr->booleanValue("VISU", "boundary_edges", false),
+                                  aResourceMgr->booleanValue("VISU", "manifold_edges", false),
+                                  aResourceMgr->booleanValue("VISU", "non_manifold_edges", false) );
+    anActor->SetFeatureEdgesColoring( aResourceMgr->booleanValue("VISU", "feature_edges_coloring", false) );
   }
 }