]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
Fix for IPAL19044 (4x REGRESS: vertex is not displayed in VTK and broken trihedron).
authorrnv <rnv@opencascade.com>
Tue, 17 Feb 2009 13:32:53 +0000 (13:32 +0000)
committerrnv <rnv@opencascade.com>
Tue, 17 Feb 2009 13:32:53 +0000 (13:32 +0000)
src/OBJECT/GEOM_Actor.cxx
src/OBJECT/GEOM_Actor.h
src/OBJECT/GEOM_DeviceActor.cxx
src/OBJECT/GEOM_DeviceActor.h
src/OBJECT/GEOM_EdgeSource.h
src/OBJECT/GEOM_FaceSource.h

index 4d4a55f2854b571f826bea4fd2b3de36db3adde4..0ecd5d37fe04be1cd455ec958c19fe9e33a3434f 100644 (file)
@@ -102,8 +102,8 @@ GEOM_Actor::GEOM_Actor():
 
   myHighlightProp(vtkProperty::New()),
   myPreHighlightProp(vtkProperty::New()),
-  myShadingFaceProp(vtkProperty::New())
-  
+  myShadingFaceProp(vtkProperty::New()),
+  isOnlyVertex(false)
 { 
 #ifdef MYDEBUG
   MESSAGE (this<< " GEOM_Actor::GEOM_Actor");
@@ -119,6 +119,7 @@ GEOM_Actor::GEOM_Actor():
   myHighlightProp->SetAmbientColor(1, 1, 1);
   myHighlightProp->SetDiffuseColor(1, 1, 1);
   myHighlightProp->SetSpecularColor(0.5, 0.5, 0.5);
+  myHighlightProp->SetPointSize(SALOME_POINT_SIZE);
   myHighlightActor->SetProperty(myHighlightProp.GetPointer());
 
   this->myHighlightActor->SetInput(myAppendFilter->GetOutput(),false);
@@ -314,8 +315,7 @@ SetVisibility(int theVisibility)
   myOneFaceEdgeActor->SetVisibility(theVisibility && myDisplayMode == (int)eWireframe && !myIsSelected);
   myIsolatedEdgeActor->SetVisibility(theVisibility && !myIsSelected);
 
-//  myVertexActor->SetVisibility(false);// must be added new mode points 
-  myVertexActor->SetVisibility(theVisibility);
+  myVertexActor->SetVisibility(theVisibility && !myIsSelected);
 }
  
 
@@ -387,8 +387,8 @@ void GEOM_Actor::SetShape (const TopoDS_Shape& theShape,
   mySharedEdgeSource->Clear();
   myWireframeFaceSource->Clear();
   myShadingFaceSource->Clear();
-
-  TopExp_Explorer aVertexExp (theShape,TopAbs_VERTEX);
+  
+  TopExp_Explorer aVertexExp (theShape,TopAbs_VERTEX);  
   for (; aVertexExp.More(); aVertexExp.Next())
   {
      const TopoDS_Vertex& aVertex = TopoDS::Vertex(aVertexExp.Current());
@@ -399,8 +399,20 @@ void GEOM_Actor::SetShape (const TopoDS_Shape& theShape,
   // look if edges are free or shared
   TopTools_IndexedDataMapOfShapeListOfShape anEdgeMap;
   TopExp::MapShapesAndAncestors(theShape,TopAbs_EDGE,TopAbs_FACE,anEdgeMap);
-
+  
   SetShape(theShape,anEdgeMap,theIsVector);
+  isOnlyVertex = 
+    myIsolatedEdgeSource->IsEmpty() &&
+    myOneFaceEdgeSource->IsEmpty() &&
+    mySharedEdgeSource->IsEmpty() &&
+    myWireframeFaceSource->IsEmpty() &&
+    myShadingFaceSource->IsEmpty();
+
+  
+  if((bool)myShape.Infinite() || isOnlyVertex ){
+    myVertexActor->GetDeviceActor()->SetInfinitive(true);
+    myHighlightActor->GetDeviceActor()->SetInfinitive(true);
+  }
 }
 
 void GEOM_Actor::SetShape (const TopoDS_Shape& theShape,
@@ -555,7 +567,7 @@ void GEOM_Actor::Render(vtkRenderer *ren, vtkMapper *theMapper)
     this->Device->SetBackfaceProperty(this->BackfaceProperty);
   }
   this->Device->SetProperty(this->Property);
-  if(myShape.ShapeType() == TopAbs_VERTEX) {
+  /*  if(myShape.ShapeType() == TopAbs_VERTEX) {
     if(ren){
       //The parameter determine size of vertex actor relate to diagonal of RendererWindow
       static vtkFloatingPointType delta = 0.01;
@@ -570,9 +582,9 @@ void GEOM_Actor::Render(vtkRenderer *ren, vtkMapper *theMapper)
     this->GetMatrix(ren->GetActiveCamera(), aMatrix);
     this->Device->SetUserMatrix(aMatrix);
     this->Device->Render(ren,theMapper);
-    aMatrix->Delete();    
-  } else
-    this->Device->Render(ren, theMapper);
+    aMatrix->Delete();
+    } else*/
+  this->Device->Render(ren, theMapper);
 }
 
 void GEOM_Actor::ReleaseGraphicsResources(vtkWindow *)
@@ -659,6 +671,7 @@ void GEOM_Actor::SetOpacity(vtkFloatingPointType opa)
   myShadingFaceProp->SetOpacity(opa);
   myHighlightProp->SetOpacity(opa);
   myPreHighlightProp->SetOpacity(opa);
+  myVertexActor->GetProperty()->SetOpacity(opa);
 }
 
 vtkFloatingPointType GEOM_Actor::GetOpacity()
@@ -689,7 +702,7 @@ void GEOM_Actor::GetColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFlo
 
 bool GEOM_Actor::IsInfinitive()
 {
-  return (bool)(myShape.Infinite());
+  return ((bool)myShape.Infinite() || isOnlyVertex);
 }
 
 /*!
@@ -829,7 +842,7 @@ void GEOM_Actor::GetMatrix(vtkCamera* theCam, vtkMatrix4x4 *result)
         Rz[i] = (pos[i] - this->Position[i])/distance;
        }
       }
-  
+
     vtkMath::Cross(vup,Rz,Rx);
     vtkMath::Normalize(Rx);
     vtkMath::Cross(Rz,Rx,Ry);
index 1ef5ecbf32192bb7d4eed44a5af95628265ed29b..619b30bcdf1f9269a8bf14b5ffe9f03d57b90577 100644 (file)
@@ -177,6 +177,7 @@ protected:
 private:
   TopoDS_Shape myShape;
   int myNbIsos[2];
+  bool isOnlyVertex;
 
   float myDeflection;
   bool myIsRelative;
index f6950c63fcce9c222159558cd081915c9a3eac20..51f1c45d83f9f09c66aeab364e355ae8ca27d113 100755 (executable)
 #include <vtkPolyDataMapper.h>  
 #include <vtkPolyDataNormals.h>  
 #include <vtkActor.h> 
+#include <VTKViewer_Actor.h>
 #include <vtkRenderer.h> 
+
+
  
 vtkStandardNewMacro(GEOM_DeviceActor);
  
@@ -38,7 +40,7 @@ GEOM_DeviceActor::GEOM_DeviceActor():
   myStripper(vtkStripper::New(),true), 
   myPolyDataMapper(vtkPolyDataMapper::New(),true), 
   myPolyDataNormals(vtkPolyDataNormals::New(),true), 
-  myActor(vtkActor::New(),true) 
+  myActor(VTKViewer_Actor::New(),true) 
 { 
   myStripper->SetInput(myPolyDataNormals->GetOutput()); 
   myPolyDataMapper->SetInput(myStripper->GetOutput()); 
@@ -101,4 +103,4 @@ GEOM_DeviceActor::
 RemoveFromRender(vtkRenderer* theRenderer)
 {
   theRenderer->RemoveActor(myActor.GetPointer());
-}
\ No newline at end of file
+}
index 84bbbe912d5fc5d9bc680c27add0cb1a9c9d53cd..027637ac3e4907d6cff4332fcb4199b55b28b24a 100755 (executable)
@@ -36,8 +36,9 @@ typedef GEOM_SmartPtr<vtkStripper> PStripper;
 class vtkPolyDataNormals; 
 typedef GEOM_SmartPtr<vtkPolyDataNormals> PPolyDataNormals; 
  
-class vtkActor; 
-typedef GEOM_SmartPtr<vtkActor> PActor; 
+//class vtkActor;
+class VTKViewer_Actor;
+typedef GEOM_SmartPtr<VTKViewer_Actor> PActor;
  
 class vtkProperty; 
 class vtkRenderer; 
@@ -61,6 +62,8 @@ public:
 
   void AddToRender(vtkRenderer* theRenderer); 
   void RemoveFromRender(vtkRenderer* theRenderer);
+  
+  PActor GetDeviceActor() {return myActor;}
  
 protected: 
   PPolyDataNormals myPolyDataNormals; 
index 8cb2e514d13693c05bdfb393a4c2a059e8bce655..8bcfa05b22acf06ef95719d52d672468dd99f5c7 100755 (executable)
@@ -47,6 +47,9 @@ public:
                vtkPolyData* thePolyData, 
                vtkPoints* thePts,
                bool theIsVector = false); 
+
+  bool IsEmpty(){return myEdgeSet.IsEmpty();}
+
  
 protected: 
   TEdgeSet myEdgeSet;
index 6378a8edaed9f4d14589ccfa4387ba520d400cf0..2acf56a9eb5e8e9508fe00a60b339c0ea7c1e0f4 100755 (executable)
@@ -43,6 +43,7 @@ public:
  
   void AddFace(const TopoDS_Face& theFace); 
   void Clear(){ myFaceSet.Clear();} 
+  bool IsEmpty(){return myFaceSet.IsEmpty();}
  
 protected: 
   TFaceSet myFaceSet;