Fix for IPAL19044 (4x REGRESS: vertex is not displayed in VTK and broken trihedron) in 5X version.

This commit is contained in:
rnv 2009-02-17 13:44:20 +00:00
parent 1779c0f954
commit 83b0b2bda2
6 changed files with 33 additions and 12 deletions

View File

@ -102,8 +102,8 @@ GEOM_Actor::GEOM_Actor():
myHighlightProp(vtkProperty::New()), myHighlightProp(vtkProperty::New()),
myPreHighlightProp(vtkProperty::New()), myPreHighlightProp(vtkProperty::New()),
myShadingFaceProp(vtkProperty::New()) myShadingFaceProp(vtkProperty::New()),
isOnlyVertex(false)
{ {
#ifdef MYDEBUG #ifdef MYDEBUG
MESSAGE (this<< " GEOM_Actor::GEOM_Actor"); MESSAGE (this<< " GEOM_Actor::GEOM_Actor");
@ -119,6 +119,7 @@ GEOM_Actor::GEOM_Actor():
myHighlightProp->SetAmbientColor(1, 1, 1); myHighlightProp->SetAmbientColor(1, 1, 1);
myHighlightProp->SetDiffuseColor(1, 1, 1); myHighlightProp->SetDiffuseColor(1, 1, 1);
myHighlightProp->SetSpecularColor(0.5, 0.5, 0.5); myHighlightProp->SetSpecularColor(0.5, 0.5, 0.5);
myHighlightProp->SetPointSize(SALOME_POINT_SIZE);
myHighlightActor->SetProperty(myHighlightProp.GetPointer()); myHighlightActor->SetProperty(myHighlightProp.GetPointer());
this->myHighlightActor->SetInput(myAppendFilter->GetOutput(),false); this->myHighlightActor->SetInput(myAppendFilter->GetOutput(),false);
@ -314,8 +315,7 @@ SetVisibility(int theVisibility)
myOneFaceEdgeActor->SetVisibility(theVisibility && myDisplayMode == (int)eWireframe && !myIsSelected); myOneFaceEdgeActor->SetVisibility(theVisibility && myDisplayMode == (int)eWireframe && !myIsSelected);
myIsolatedEdgeActor->SetVisibility(theVisibility && !myIsSelected); myIsolatedEdgeActor->SetVisibility(theVisibility && !myIsSelected);
// myVertexActor->SetVisibility(false);// must be added new mode points myVertexActor->SetVisibility(theVisibility && !myIsSelected);// must be added new mode points
myVertexActor->SetVisibility(theVisibility);
} }
@ -401,6 +401,18 @@ void GEOM_Actor::SetShape (const TopoDS_Shape& theShape,
TopExp::MapShapesAndAncestors(theShape,TopAbs_EDGE,TopAbs_FACE,anEdgeMap); TopExp::MapShapesAndAncestors(theShape,TopAbs_EDGE,TopAbs_FACE,anEdgeMap);
SetShape(theShape,anEdgeMap,theIsVector); 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, 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->SetBackfaceProperty(this->BackfaceProperty);
} }
this->Device->SetProperty(this->Property); this->Device->SetProperty(this->Property);
if(myShape.ShapeType() == TopAbs_VERTEX) { /* if(myShape.ShapeType() == TopAbs_VERTEX) {
if(ren){ if(ren){
//The parameter determine size of vertex actor relate to diagonal of RendererWindow //The parameter determine size of vertex actor relate to diagonal of RendererWindow
static vtkFloatingPointType delta = 0.01; static vtkFloatingPointType delta = 0.01;
@ -571,7 +583,7 @@ void GEOM_Actor::Render(vtkRenderer *ren, vtkMapper *theMapper)
this->Device->SetUserMatrix(aMatrix); this->Device->SetUserMatrix(aMatrix);
this->Device->Render(ren,theMapper); this->Device->Render(ren,theMapper);
aMatrix->Delete(); aMatrix->Delete();
} else } else*/
this->Device->Render(ren, theMapper); this->Device->Render(ren, theMapper);
} }
@ -659,6 +671,7 @@ void GEOM_Actor::SetOpacity(vtkFloatingPointType opa)
myShadingFaceProp->SetOpacity(opa); myShadingFaceProp->SetOpacity(opa);
myHighlightProp->SetOpacity(opa); myHighlightProp->SetOpacity(opa);
myPreHighlightProp->SetOpacity(opa); myPreHighlightProp->SetOpacity(opa);
myVertexActor->GetProperty()->SetOpacity(opa);
} }
vtkFloatingPointType GEOM_Actor::GetOpacity() vtkFloatingPointType GEOM_Actor::GetOpacity()
@ -689,7 +702,7 @@ void GEOM_Actor::GetColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFlo
bool GEOM_Actor::IsInfinitive() bool GEOM_Actor::IsInfinitive()
{ {
return (bool)(myShape.Infinite()); return ((bool)myShape.Infinite() || isOnlyVertex);
} }
/*! /*!

View File

@ -178,6 +178,7 @@ protected:
private: private:
TopoDS_Shape myShape; TopoDS_Shape myShape;
int myNbIsos[2]; int myNbIsos[2];
bool isOnlyVertex;
float myDeflection; float myDeflection;
bool myIsRelative; bool myIsRelative;

View File

@ -29,7 +29,7 @@
#include <vtkPolyDataMapper.h> #include <vtkPolyDataMapper.h>
#include <vtkPolyDataNormals.h> #include <vtkPolyDataNormals.h>
#include <vtkActor.h> #include <vtkActor.h>
#include <VTKViewer_Actor.h>
#include <vtkRenderer.h> #include <vtkRenderer.h>
vtkStandardNewMacro(GEOM_DeviceActor); vtkStandardNewMacro(GEOM_DeviceActor);
@ -38,7 +38,7 @@ GEOM_DeviceActor::GEOM_DeviceActor():
myStripper(vtkStripper::New(),true), myStripper(vtkStripper::New(),true),
myPolyDataMapper(vtkPolyDataMapper::New(),true), myPolyDataMapper(vtkPolyDataMapper::New(),true),
myPolyDataNormals(vtkPolyDataNormals::New(),true), myPolyDataNormals(vtkPolyDataNormals::New(),true),
myActor(vtkActor::New(),true) myActor(VTKViewer_Actor::New(),true)
{ {
myStripper->SetInput(myPolyDataNormals->GetOutput()); myStripper->SetInput(myPolyDataNormals->GetOutput());
myPolyDataMapper->SetInput(myStripper->GetOutput()); myPolyDataMapper->SetInput(myStripper->GetOutput());

View File

@ -36,8 +36,9 @@ typedef GEOM_SmartPtr<vtkStripper> PStripper;
class vtkPolyDataNormals; class vtkPolyDataNormals;
typedef GEOM_SmartPtr<vtkPolyDataNormals> PPolyDataNormals; typedef GEOM_SmartPtr<vtkPolyDataNormals> PPolyDataNormals;
class vtkActor; //class vtkActor;
typedef GEOM_SmartPtr<vtkActor> PActor; class VTKViewer_Actor;
typedef GEOM_SmartPtr<VTKViewer_Actor> PActor;
class vtkProperty; class vtkProperty;
class vtkRenderer; class vtkRenderer;
@ -62,6 +63,8 @@ public:
void AddToRender(vtkRenderer* theRenderer); void AddToRender(vtkRenderer* theRenderer);
void RemoveFromRender(vtkRenderer* theRenderer); void RemoveFromRender(vtkRenderer* theRenderer);
PActor GetDeviceActor() {return myActor;}
protected: protected:
PPolyDataNormals myPolyDataNormals; PPolyDataNormals myPolyDataNormals;
PPolyDataMapper myPolyDataMapper; PPolyDataMapper myPolyDataMapper;

View File

@ -48,6 +48,9 @@ public:
vtkPoints* thePts, vtkPoints* thePts,
bool theIsVector = false); bool theIsVector = false);
bool IsEmpty(){return myEdgeSet.IsEmpty();}
protected: protected:
TEdgeSet myEdgeSet; TEdgeSet myEdgeSet;
// The <myIsVector> flag is common for all edges, because the shape, // The <myIsVector> flag is common for all edges, because the shape,

View File

@ -43,6 +43,7 @@ public:
void AddFace(const TopoDS_Face& theFace); void AddFace(const TopoDS_Face& theFace);
void Clear(){ myFaceSet.Clear();} void Clear(){ myFaceSet.Clear();}
bool IsEmpty(){return myFaceSet.IsEmpty();}
protected: protected:
TFaceSet myFaceSet; TFaceSet myFaceSet;