]> SALOME platform Git repositories - modules/geom.git/blobdiff - src/OBJECT/GEOM_Actor.cxx
Salome HOME
0021672: [CEA 565] Dump Study from script
[modules/geom.git] / src / OBJECT / GEOM_Actor.cxx
index 318ea45b86e54b141b2a9b0084b4f561a4f2dc26..a68e25b0ebff9086359040c393ba931416bb39d5 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -113,8 +113,7 @@ GEOM_Actor::GEOM_Actor():
 
   myHighlightProp(vtkProperty::New()),
   myPreHighlightProp(vtkProperty::New()),
-  myShadingFaceProp(vtkProperty::New()),
-  myShadingBackFaceProp(vtkProperty::New())
+  myShadingFaceProp(vtkProperty::New())
 { 
 #ifdef MYDEBUG
   MESSAGE (this<< " GEOM_Actor::GEOM_Actor");
@@ -203,7 +202,6 @@ GEOM_Actor::~GEOM_Actor()
   myHighlightProp->Delete();
   myPreHighlightProp->Delete();
   myShadingFaceProp->Delete();
-  myShadingBackFaceProp->Delete();
 } 
  
 GEOM_Actor*  
@@ -497,6 +495,12 @@ void GEOM_Actor::SetWireframeProperty(vtkProperty* Prop)
   myWireframeFaceActor->SetProperty(Prop);
 }
 
+
+vtkProperty* GEOM_Actor::GetWireframeProperty()
+{
+  return myWireframeFaceActor->GetProperty();
+}
+
 void GEOM_Actor::SetShadingProperty(vtkProperty* Prop)
 {
 #ifdef MYDEBUG
@@ -506,6 +510,12 @@ void GEOM_Actor::SetShadingProperty(vtkProperty* Prop)
 }
 
 
+vtkProperty* GEOM_Actor::GetShadingProperty()
+{
+  return myShadingFaceProp;
+}
+
+
 void GEOM_Actor::Render(vtkRenderer *ren, vtkMapper *theMapper)
 {
 #ifdef MYDEBUG
@@ -536,6 +546,7 @@ void GEOM_Actor::Render(vtkRenderer *ren, vtkMapper *theMapper)
   case eShadingWithEdges://shading with edges
     myPreHighlightProp->SetRepresentationToSurface();
     myHighlightProp->SetRepresentationToSurface();
+    myShadingFaceProp->SetRepresentationToSurface();
     break;
   }
 
@@ -543,17 +554,14 @@ void GEOM_Actor::Render(vtkRenderer *ren, vtkMapper *theMapper)
     if(myIsPreselected){
       this->myHighlightActor->SetProperty(myPreHighlightProp.GetPointer());
       myShadingFaceActor->SetProperty(myPreHighlightProp.GetPointer());
-      myShadingFaceActor->SetBackfaceProperty(myPreHighlightProp.GetPointer());
     } else {
       this->myHighlightActor->SetProperty(myShadingFaceProp.GetPointer());
       myShadingFaceActor->SetProperty(myShadingFaceProp.GetPointer());
-      myShadingFaceActor->SetBackfaceProperty(myShadingBackFaceProp.GetPointer());
     }
   }
   else{
     this->myHighlightActor->SetProperty(myHighlightProp.GetPointer());
     myShadingFaceActor->SetProperty(myHighlightProp.GetPointer());
-    myShadingFaceActor->SetBackfaceProperty(myHighlightProp.GetPointer());
   }
 
   this->Property->Render(this, ren);
@@ -664,7 +672,6 @@ void GEOM_Actor::SetOpacity(vtkFloatingPointType opa)
 {
   // enk:tested OK
   myShadingFaceProp->SetOpacity(opa);
-  myShadingBackFaceProp->SetOpacity(opa);
   myHighlightProp->SetOpacity(opa);
   myPreHighlightProp->SetOpacity(opa);
   myVertexActor->GetProperty()->SetOpacity(opa);
@@ -680,7 +687,6 @@ void GEOM_Actor::SetColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloat
 {
   // enk:tested OK
   myShadingFaceProp->SetColor(r,g,b);                          // shading color (Shading)
-  myShadingBackFaceProp->SetColor(r,g,b);                      // back face shading color (Shading)
   myVertexActor->GetProperty()->SetColor(r,g,b);               // vertex actor (Shading/Wireframe)
   if ( myDisplayMode != (int)eShadingWithEdges ) {
     myIsolatedEdgeActor->GetProperty()->SetColor(r,g,b);         // standalone edge color (Wireframe)
@@ -703,42 +709,23 @@ void GEOM_Actor::GetColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFlo
 
 void GEOM_Actor::SetMaterial(std::vector<vtkProperty*> theProps)
 {
-  int aSize = theProps.size();
-
-  if ( aSize < 1 || aSize > 2)
-    return;
-
-  // theProps[0] -- front material properties
-  // theProps[1] -- back material properties (if exist)
-  // If there are no back material properties,
-  // we get front material properties as back material
-
+  // we set material properties as back and front material
   double aCoefnt;
 
   // Set reflection coefficients
   aCoefnt = theProps[0]->GetAmbient();
   myShadingFaceProp->SetAmbient(aCoefnt);
   myVertexActor->GetProperty()->SetAmbient(aCoefnt);
-  if ( aSize == 2 )
-    aCoefnt = theProps[1]->GetAmbient();
-  myShadingBackFaceProp->SetAmbient(aCoefnt);
 
   // Set diffuse coefficients
   aCoefnt = theProps[0]->GetDiffuse();
   myShadingFaceProp->SetDiffuse(aCoefnt);
   myVertexActor->GetProperty()->SetDiffuse(aCoefnt);
-  if ( aSize == 2 )
-    aCoefnt = theProps[1]->GetDiffuse();
-  myShadingBackFaceProp->SetDiffuse(aCoefnt);
   
   // Set specular coefficients
   aCoefnt = theProps[0]->GetSpecular();
   myShadingFaceProp->SetSpecular(aCoefnt);
   myVertexActor->GetProperty()->SetSpecular(aCoefnt);
-  if ( aSize == 2 )
-    aCoefnt = theProps[1]->GetSpecular();
-  myShadingBackFaceProp->SetSpecular(aCoefnt);
-
 
   double* aColor;
 
@@ -746,48 +733,28 @@ void GEOM_Actor::SetMaterial(std::vector<vtkProperty*> theProps)
   aColor = theProps[0]->GetAmbientColor();
   myShadingFaceProp->SetAmbientColor(aColor[0], aColor[1], aColor[2]);
   myVertexActor->GetProperty()->SetAmbientColor(aColor[0], aColor[1], aColor[2]);
-  if ( aSize == 2 )
-    aColor = theProps[1]->GetAmbientColor();
-  myShadingBackFaceProp->SetAmbientColor(aColor[0], aColor[1], aColor[2]);
 
   // Set diffuse colors
   aColor = theProps[0]->GetDiffuseColor();
   myShadingFaceProp->SetDiffuseColor(aColor[0], aColor[1], aColor[2]);
   myVertexActor->GetProperty()->SetDiffuseColor(aColor[0], aColor[1], aColor[2]);
-  if ( aSize == 2 )
-    aColor = theProps[1]->GetDiffuseColor();
-  myShadingBackFaceProp->SetDiffuseColor(aColor[0], aColor[1], aColor[2]);
 
   // Set specular colors
   aColor = theProps[0]->GetSpecularColor();
   myShadingFaceProp->SetSpecularColor(aColor[0], aColor[1], aColor[2]);
   myVertexActor->GetProperty()->SetSpecularColor(aColor[0], aColor[1], aColor[2]);
-  if ( aSize == 2 )
-    aColor = theProps[1]->GetSpecularColor();
-  myShadingBackFaceProp->SetSpecularColor(aColor[0], aColor[1], aColor[2]);
 
   // Set shininess
   aCoefnt = theProps[0]->GetSpecularPower();
   myShadingFaceProp->SetSpecularPower(aCoefnt);
   myVertexActor->GetProperty()->SetSpecularPower(aCoefnt);
-  if ( aSize == 2 )
-    aCoefnt = theProps[1]->GetSpecularPower();
-  myShadingBackFaceProp->SetSpecularPower(aCoefnt);
-
-  // Set back face material property
-  myShadingFaceActor->SetBackfaceProperty(myShadingBackFaceProp.GetPointer());
 }
 
-vtkProperty* GEOM_Actor::GetFrontMaterial()
+vtkProperty* GEOM_Actor::GetMaterial()
 {
   return myShadingFaceProp;
 }
 
-vtkProperty* GEOM_Actor::GetBackMaterial()
-{
-  return myShadingBackFaceProp;
-}
-
 bool GEOM_Actor::IsInfinitive()
 {
   return ((bool)myShape.Infinite() || isOnlyVertex);
@@ -995,6 +962,27 @@ void GEOM_Actor::StoreIsoNumbers()
   myWireframeFaceSource->GetNbIso(myNbIsos[0], myNbIsos[1]);
 }
 
+void GEOM_Actor::SetIsosWidth(const int width) {
+  myWireframeFaceActor->GetProperty()->SetLineWidth(width);
+}
+
+int GEOM_Actor::GetIsosWidth() const {
+  return (int)myWireframeFaceActor->GetProperty()->GetLineWidth();
+}
+
+void GEOM_Actor::SetWidth(const int width) {
+  myIsolatedEdgeActor->GetProperty()->SetLineWidth(width);
+  myOneFaceEdgeActor->GetProperty()->SetLineWidth(width);
+  mySharedEdgeActor->GetProperty()->SetLineWidth(width);
+  myHighlightProp->SetLineWidth(width);
+  myPreHighlightProp->SetLineWidth(width+1);
+
+}
+
+int GEOM_Actor::GetWidth() const {
+  return (int)myIsolatedEdgeActor->GetProperty()->GetLineWidth();
+}
+    
 void GEOM_Actor::RestoreIsoNumbers()
 {
   if ( myNbIsos[0] > 0 || myNbIsos[1] > 0 )