myBarVisibility = theMode;
if(myScalarBar) myScalarBar->SetVisibility(myBarVisibility);
}
+
+void VISU_ScalarMapAct::SetShading(bool theOn)
+{
+ vtkProperty* aProperty = GetProperty();
+
+ if (theOn)
+ {
+ aProperty->SetAmbient(0.0);
+ aProperty->SetDiffuse(1.0);
+ }
+ else
+ {
+ aProperty->SetAmbient(1.0);
+ aProperty->SetDiffuse(0.0);
+ }
+ myProperty->DeepCopy(aProperty);
+}
+
+bool VISU_ScalarMapAct::IsShading()
+{
+ vtkProperty* aProperty = GetProperty();
+
+ return (aProperty->GetAmbient() == 0 && aProperty->GetDiffuse() == 1);
+}
#include "VISU_Actor.h"
#include "VISU_MeshAct.h"
+#include "VISU_ScalarMapAct.h"
#include "VisuGUI_MagnitudeDlg.h"
#include "VisuGUI_CursorDlg.h"
ChangeRepresentation(VISU::SHRINK);
}
+void VisuGUI::SetShadingOn() {
+ if(VISU::Prs3d_i* aPrsObject = GetSelectedPrs3d())
+ if(VISU_Actor* anActor = GetActor(aPrsObject)){
+ VISU_ScalarMapAct* aScalarMapActor = dynamic_cast<VISU_ScalarMapAct*>(anActor);
+ if (aScalarMapActor)
+ aScalarMapActor->SetShading();
+ }
+ if (VTKViewer_ViewFrame* vf = GetVtkViewFrame())
+ vf->Repaint();
+}
+void VisuGUI::SetShadingOff() {
+ if(VISU::Prs3d_i* aPrsObject = GetSelectedPrs3d())
+ if(VISU_Actor* anActor = GetActor(aPrsObject)){
+ VISU_ScalarMapAct* aScalarMapActor = dynamic_cast<VISU_ScalarMapAct*>(anActor);
+ if (aScalarMapActor)
+ aScalarMapActor->SetShading(false);
+ }
+ if (VTKViewer_ViewFrame* vf = GetVtkViewFrame())
+ vf->Repaint();
+}
//=====================================================================================
// functions : Change Propertise
else
aPresMenu->insertItem("Shrink", visuGUI, SLOT(MakeShrink()));
}
+
+ if (VISU_ScalarMapAct* anActor = dynamic_cast<VISU_ScalarMapAct*>(anVISUActor))
+ {
+ aPresMenu->insertSeparator();
+ if (anActor->IsShading())
+ aPresMenu->insertItem("Shading Off", visuGUI, SLOT(SetShadingOff()));
+ else
+ aPresMenu->insertItem("Shading On", visuGUI, SLOT(SetShadingOn()));
+ }
+
thePopup->insertItem("Representation", aPresMenu);
// Add Properties