// Module : GEOM
// $Header$
-using namespace std;
/*!
\class GEOM_Actor GEOM_Actor.h
\brief This class allows to display an OpenCASCADE CAD model in a VTK viewer.
#include "GEOM_Actor.h"
+#include <vtkObjectFactory.h>
+#include <vtkPolyData.h>
+#include <vtkPolyDataMapper.h>
+#include <vtkPolyDataNormals.h>
+
+#include <vtkTransform.h>
+#include <vtkMatrix4x4.h>
+#include <vtkMath.h>
+
+#include <vtkRenderer.h>
+#include <vtkCamera.h>
+
// OpenCASCADE Includes
#include "GEOM_OCCReader.h"
#include <BRep_Tool.hxx>
+using namespace std;
+
//-------------------------------------------------------------
// Main methods
//-------------------------------------------------------------
this->myName = "";
this->HighlightProperty = NULL;
- this->ishighlighted = false;
+ this->myIsHighlighted = false;
this->subshape = false;
+ this->myIsInfinite = false;
}
GEOM_Actor::~GEOM_Actor()
// Mapper creating function
//-------------------------------------------------------------
void GEOM_Actor::CreateMapper(int theMode) {
+ this->myIsInfinite = myShape.Infinite();
if(myShape.ShapeType() == TopAbs_VERTEX) {
gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(myShape));
this->SetPosition(aPnt.X(),aPnt.Y(),aPnt.Z());
this->Property->SetSpecularColor(0.99,0.98,0.83);
}
- if(!ishighlighted) {
- if(myDisplayMode >= 1) {
+ if(!myIsHighlighted) {
+ if ( myIsPreselected )
+ this->Property = PreviewProperty;
+ else if(myDisplayMode >= 1) {
// SHADING
this->Property = ShadingProperty;
}
this->Property = WireframeProperty;
}
- if ( ispreselected )
- this->Property = PreviewProperty;
}
this->Property->Render(this, ren);
aMatrix->Delete();
} else
this->Device->Render(ren, this->Mapper);
- this->EstimatedRenderTime = WireframeMapper->GetTimeToDraw();
+ if(WireframeMapper!=NULL) this->EstimatedRenderTime = WireframeMapper->GetTimeToDraw();
+ else if(ShadingMapper!=NULL) this->EstimatedRenderTime = ShadingMapper->GetTimeToDraw();
}
// SubShape
void GEOM_Actor::GetColor(float& r,float& g,float& b) {
float color[3];
- ShadingProperty->GetColor(color);
- r = color[0];
- g = color[1];
- b = color[2];
+ ShadingProperty->GetColor(color);
+ r = color[0];
+ g = color[1];
+ b = color[2];
}
//-------------------------------------------------------------
// Highlight methods
//-------------------------------------------------------------
-void GEOM_Actor::highlight(Standard_Boolean highlight) {
+void GEOM_Actor::highlight(bool highlight) {
- if(highlight && !ishighlighted) {
- ishighlighted=true;
+ if(highlight && !myIsHighlighted) {
+ myIsHighlighted=true;
// build highlight property is necessary
if(HighlightProperty==NULL) {
HighlightProperty = vtkProperty::New();
}
else if (!highlight) {
- if(ishighlighted) {
- ishighlighted=false;
+ if(myIsHighlighted) {
+ myIsHighlighted=false;
if(myDisplayMode==1) {
//unhilight in shading
this->Property = ShadingProperty;
}
}
-bool GEOM_Actor::hasHighlight()
-{
- return true;
-}
-
void GEOM_Actor::SetHighlightProperty(vtkProperty* Prop) {
this->HighlightProperty = Prop;
}