2 // File : VISU_Actor.cxx
3 // Created : Wed Feb 20 18:04:42 CET 2002
4 // Author : Laurent CORNABE with help of Nicolas REJNERI
7 // Copyright : PRINCIPIA RD
10 #include "VISU_Actor.h"
11 #include "utilities.h"
14 #include <vtkObjectFactory.h>
16 VISU_Actor* VISU_Actor::New(){
17 vtkObject* ret = vtkObjectFactory::CreateInstance("VISU_Actor");
18 if(ret) return (VISU_Actor*)ret;
19 return new VISU_Actor;
21 VISU_Actor::VISU_Actor(){
22 this->Device = vtkActor::New();
24 this->EdgeDevice = vtkActor::New();
25 EdgeDevice->VisibilityOff();
26 EdgeDevice->PickableOff();
28 this->DataSource = NULL;
32 this->IsDefined = false;
33 this->IsShrunk = false;
34 this->IsShrinkable = false;
35 this->VisuActorType = 0;
36 this->Presentation = NULL;
37 myHasScalarBar = false;
38 this->HighlightProperty = NULL;
39 this->ishighlighted = false;
40 this->IsHighlighting = true;
41 this->ResultAtNode = false;
42 this->VectorComponent = -1;
43 for (int i=0; i<6; i++)
44 this->VABounds[i] = 0.;
45 strcpy(this->FieldName,"");
49 VISU_Actor::~VISU_Actor()
51 this->EdgeDevice->Delete();
55 void VISU_Actor::setScalarBar(VISU_ScalarBarActor* theBar) {
58 myHasScalarBar = true;
61 myHasScalarBar = false;
66 void VISU_Actor::setActor(vtkActor *Actor){
70 void VISU_Actor::ShallowCopy(vtkProp *prop){
71 VISU_Actor *f = VISU_Actor::SafeDownCast(prop);
74 setName( f->getName() );
78 SALOME_Actor::ShallowCopy(prop);
81 void VISU_Actor::highlight(Standard_Boolean highlight) {
82 if (this->IsHighlighting) {
83 if(highlight && !ishighlighted) {
85 // build highlight property is necessary
86 if(HighlightProperty==NULL) {
87 HighlightProperty = vtkProperty::New();
88 HighlightProperty->SetAmbient(0.5);
89 HighlightProperty->SetDiffuse(0.3);
90 HighlightProperty->SetSpecular(0.2);
91 HighlightProperty->SetRepresentationToSurface();
92 HighlightProperty->SetAmbientColor(1, 1, 1);
93 HighlightProperty->SetDiffuseColor(1, 1, 1);
94 HighlightProperty->SetSpecularColor(0.5, 0.5, 0.5);
96 this->Property = HighlightProperty;
97 }else if (!highlight) {
106 void VISU_Actor::setVABounds(const float bounds[6]){
107 for (int i=0; i<6; i++)
108 VABounds[i] = bounds[i];
112 void VISU_Actor::getVABounds(float bounds[6]){
113 for (int i=0; i<6; i++)
114 bounds[i] = VABounds[i];