//class : OrientedPlane
//purpose :
//=================================================================================
-class OrientedPlane: public vtkPlane
+OrientedPlane* OrientedPlane::New()
{
- SVTK_ViewWindow* myViewWindow;
-
- vtkDataSetMapper* myMapper;
-
-public:
- static OrientedPlane * New() {
- return new OrientedPlane();
- }
- static OrientedPlane * New (SVTK_ViewWindow* vw) {
- return new OrientedPlane(vw);
- }
- vtkTypeMacro(OrientedPlane, vtkPlane);
-
-
- VISU::Orientation myOrientation;
- vtkFloatingPointType myDistance;
- double myAngle[2];
-
- vtkPlaneSource* myPlaneSource;
- SALOME_Actor *myActor;
-
- void SetOrientation(VISU::Orientation theOrientation) {myOrientation = theOrientation;}
- VISU::Orientation GetOrientation() {return myOrientation;}
-
- void SetDistance(vtkFloatingPointType theDistance)
- {
- myDistance = theDistance;
- }
- vtkFloatingPointType GetDistance()
- {
- return myDistance;
- }
-
- void ShallowCopy(OrientedPlane* theOrientedPlane){
- SetNormal(theOrientedPlane->GetNormal());
- SetOrigin(theOrientedPlane->GetOrigin());
-
- myOrientation = theOrientedPlane->GetOrientation();
- myDistance = theOrientedPlane->GetDistance();
-
- myAngle[0] = theOrientedPlane->myAngle[0];
- myAngle[1] = theOrientedPlane->myAngle[1];
-
- myPlaneSource->SetNormal(theOrientedPlane->myPlaneSource->GetNormal());
- myPlaneSource->SetOrigin(theOrientedPlane->myPlaneSource->GetOrigin());
- myPlaneSource->SetPoint1(theOrientedPlane->myPlaneSource->GetPoint1());
- myPlaneSource->SetPoint2(theOrientedPlane->myPlaneSource->GetPoint2());
- }
+ return new OrientedPlane();
+}
-protected:
- OrientedPlane(SVTK_ViewWindow* vw):
- myOrientation(VISU::XY),
- myDistance(0.5),
- myViewWindow(vw)
- {
- Init();
- myViewWindow->AddActor(myActor);
- }
+OrientedPlane* OrientedPlane::New (SVTK_ViewWindow* vw)
+{
+ return new OrientedPlane(vw);
+}
- OrientedPlane():
- myOrientation(VISU::XY),
- myDistance(0.5),
- myViewWindow(NULL)
- {
- Init();
- }
+void OrientedPlane::SetOrientation(VISU::Orientation theOrientation)
+{
+ myOrientation = theOrientation;
+}
- void Init(){
- myPlaneSource = vtkPlaneSource::New();
+VISU::Orientation OrientedPlane::GetOrientation()
+{
+ return myOrientation;
+}
- myAngle[0] = myAngle[1] = 0.0;
+void OrientedPlane::SetDistance(float theDistance)
+{
+ myDistance = theDistance;
+}
- // Create and display actor
- myMapper = vtkDataSetMapper::New();
- myMapper->SetInput(myPlaneSource->GetOutput());
+float OrientedPlane::GetDistance()
+{
+ return myDistance;
+}
- myActor = SALOME_Actor::New();
- myActor->VisibilityOff();
- myActor->PickableOff();
- myActor->SetInfinitive(true);
- myActor->SetMapper(myMapper);
+void OrientedPlane::ShallowCopy(OrientedPlane* theOrientedPlane)
+{
+ SetNormal(theOrientedPlane->GetNormal());
+ SetOrigin(theOrientedPlane->GetOrigin());
+
+ myOrientation = theOrientedPlane->GetOrientation();
+ myDistance = theOrientedPlane->GetDistance();
+
+ myAngle[0] = theOrientedPlane->myAngle[0];
+ myAngle[1] = theOrientedPlane->myAngle[1];
+
+ myPlaneSource->SetNormal(theOrientedPlane->myPlaneSource->GetNormal());
+ myPlaneSource->SetOrigin(theOrientedPlane->myPlaneSource->GetOrigin());
+ myPlaneSource->SetPoint1(theOrientedPlane->myPlaneSource->GetPoint1());
+ myPlaneSource->SetPoint2(theOrientedPlane->myPlaneSource->GetPoint2());
+}
- vtkProperty* aProp = vtkProperty::New();
- vtkFloatingPointType anRGB[3];
+OrientedPlane::OrientedPlane(SVTK_ViewWindow* vw):
+ myOrientation(VISU::XY),
+ myDistance(0.5),
+ myViewWindow(vw)
+{
+ Init();
+ myViewWindow->AddActor(myActor);
+}
- SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+OrientedPlane::OrientedPlane():
+ myOrientation(VISU::XY),
+ myDistance(0.5),
+ myViewWindow(NULL)
+{
+ Init();
+}
- QColor aFillColor = aResourceMgr->colorValue("SMESH", "fill_color", QColor(0, 170, 255));
- anRGB[0] = aFillColor.red()/255.;
- anRGB[1] = aFillColor.green()/255.;
- anRGB[2] = aFillColor.blue()/255.;
- aProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
- aProp->SetOpacity(0.75);
- myActor->SetProperty(aProp);
- aProp->Delete();
-
- vtkProperty* aBackProp = vtkProperty::New();
- QColor aBackFaceColor = aResourceMgr->colorValue("SMESH", "backface_color", QColor(0, 0, 255));//@
- anRGB[0] = aBackFaceColor.red()/255.;
- anRGB[1] = aBackFaceColor.green()/255.;
- anRGB[2] = aBackFaceColor.blue()/255.;
- aBackProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
- aBackProp->SetOpacity(0.75);
- myActor->SetBackfaceProperty(aBackProp);
- aBackProp->Delete();
- }
+void OrientedPlane::Init()
+{
+ myPlaneSource = vtkPlaneSource::New();
+
+ myAngle[0] = myAngle[1] = 0.0;
- ~OrientedPlane()
- {
- if (myViewWindow)
- myViewWindow->RemoveActor(myActor);
+ // Create and display actor
+ myMapper = vtkDataSetMapper::New();
+ myMapper->SetInput(myPlaneSource->GetOutput());
- myActor->Delete();
+ myActor = SALOME_Actor::New();
+ myActor->VisibilityOff();
+ myActor->PickableOff();
+ myActor->SetInfinitive(true);
+ myActor->SetMapper(myMapper);
+
+ vtkProperty* aProp = vtkProperty::New();
+ float anRGB[3];
+
+ SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+
+ QColor aFillColor = aResourceMgr->colorValue("SMESH", "fill_color", QColor(0, 170, 255));
+ anRGB[0] = aFillColor.red()/255.;
+ anRGB[1] = aFillColor.green()/255.;
+ anRGB[2] = aFillColor.blue()/255.;
+ aProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
+ aProp->SetOpacity(0.75);
+ myActor->SetProperty(aProp);
+ aProp->Delete();
+
+ vtkProperty* aBackProp = vtkProperty::New();
+ QColor aBackFaceColor = aResourceMgr->colorValue("SMESH", "backface_color", QColor(0, 0, 255));//@
+ anRGB[0] = aBackFaceColor.red()/255.;
+ anRGB[1] = aBackFaceColor.green()/255.;
+ anRGB[2] = aBackFaceColor.blue()/255.;
+ aBackProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
+ aBackProp->SetOpacity(0.75);
+ myActor->SetBackfaceProperty(aBackProp);
+ aBackProp->Delete();
+}
- myMapper->RemoveAllInputs();
- myMapper->Delete();
+OrientedPlane::~OrientedPlane()
+{
+ if (myViewWindow)
+ myViewWindow->RemoveActor(myActor);
- myPlaneSource->UnRegisterAllOutputs();
- myPlaneSource->Delete();
- };
+ myActor->Delete();
-private:
- // Not implemented.
- OrientedPlane(const OrientedPlane&);
- void operator=(const OrientedPlane&);
-};
+ myMapper->RemoveAllInputs();
+ myMapper->Delete();
+
+ myPlaneSource->UnRegisterAllOutputs();
+ myPlaneSource->Delete();
+}
struct TSetVisiblity {
TSetVisiblity(int theIsVisible): myIsVisible(theIsVisible){}