VISU_Actor::VISU_Actor(){
SetDebug(MYVTKDEBUG);
- myIsShrunk = false;
- myIsShrinkable = false;
myParent = this;
myPipeLine = NULL;
myPrs3d = NULL;
+ myStoreMapping = true;
+
+ myIsShrunk = false;
+ myIsShrinkable = false;
+ myShrinkFilter = vtkShrinkPolyData::New();
+
myIO = NULL;
myName = "";
ishighlighted = false;
IsHighlighting = true;
HighlightProperty = vtkProperty::New();
- HighlightProperty->SetAmbient(0.5);
- HighlightProperty->SetDiffuse(0.3);
- HighlightProperty->SetSpecular(0.2);
+ HighlightProperty->SetAmbient(0.5);
+ HighlightProperty->SetDiffuse(0.3);
+ HighlightProperty->SetSpecular(0.2);
HighlightProperty->SetRepresentationToSurface();
HighlightProperty->SetAmbientColor(1, 1, 1);
HighlightProperty->SetDiffuseColor(1, 1, 1);
HighlightProperty->SetSpecularColor(0.5, 0.5, 0.5);
+
+ vtkProperty* aProperty = this->GetProperty();
+ aProperty->SetAmbient(0.5);
+ aProperty->SetDiffuse(0.2);
+ aProperty->SetSpecular(0.2);
+ aProperty->SetAmbientColor(1, 1, 1);
+ aProperty->SetDiffuseColor(1, 1, 1);
+ aProperty->SetSpecularColor(0.5, 0.5, 0.5);
+ this->SetProperty(aProperty);
}
VISU_Actor::~VISU_Actor(){
SALOME_Actor::SetProperty(NULL);
HighlightProperty->Delete();
if(myPipeLine) myPipeLine->UnRegister(this);
+
+ myShrinkFilter->UnRegisterAllOutputs();
+ myShrinkFilter->Delete();
}
void VISU_Actor::setIO(const Handle(SALOME_InteractiveObject)& theIO){
myPrs3d = thePrs3d;
}
-void VISU_Actor::SetPipeLine(VISU_PipeLine* thePipeLine) throw(std::runtime_error&){
+void VISU_Actor::SetPipeLine(VISU_PipeLine* thePipeLine) {
if (myPipeLine != thePipeLine){
if (myPipeLine != NULL) myPipeLine->UnRegister(this);
myPipeLine = thePipeLine;
}
void VISU_Actor::SetRepresentation(int theMode) {
- int aRepresent = GetRepresentation();
SALOME_Actor::SetRepresentation(theMode);
- if(GetMapper() && GetMapper()->GetInput()){
- vtkGeometryFilter* aGeometryFilter = vtkGeometryFilter::New();
- aGeometryFilter->SetInput(GetMapper()->GetInput());
- vtkPolyData* aPolyData = aGeometryFilter->GetOutput();
- aPolyData->Update();
- static int INCMEMORY = 7;
- float aSize = INCMEMORY*aPolyData->GetActualMemorySize()*1024.0;
- int isPoss = VISU_PipeLine::CheckAvailableMemory(aSize);
- if(MYDEBUG) MESSAGE("SetRepresentation - aSize = "<<aSize<<"; isPoss = "<<isPoss);
- aPolyData->Delete();
- if(!isPoss){
- SALOME_Actor::SetRepresentation(aRepresent);
- throw std::runtime_error("SetRepresentation >> There is no enough memory !!!");
- }
- }
+}
+
+void VISU_Actor::SetOpacity(float theValue){
+ GetProperty()->SetOpacity(theValue);
+}
+
+float VISU_Actor::GetOpacity(){
+ return GetProperty()->GetOpacity();
}
void VISU_Actor::SetShrinkable(bool theIsShrinkable){
}
void VISU_Actor::SetShrink(float theFactor){
- if(!myIsShrinkable || myIsShrunk) return;
- vtkShrinkPolyData *aShrinkFilter = vtkShrinkPolyData::New();
- aShrinkFilter->SetShrinkFactor(theFactor);
- // use for post-filtering
- aShrinkFilter->SetInput(myPassFilter[2]->GetPolyDataOutput());
- myPassFilter[3]->SetInput(aShrinkFilter->GetOutput());
- aShrinkFilter->Register(myPassFilter[3]);
- aShrinkFilter->Delete();
- myIsShrunk = true;
+ if(!myIsShrinkable) return;
+ if(vtkPolyData* aDataSet = myPassFilter.at(1)->GetPolyDataOutput()){
+ myShrinkFilter->SetShrinkFactor(theFactor);
+ myShrinkFilter->SetInput(aDataSet);
+ myPassFilter.at(2)->SetInput(myShrinkFilter->GetOutput());
+ myIsShrunk = true;
+ }
}
void VISU_Actor::UnShrink(){
if(!myIsShrunk) return;
- myPassFilter[3]->SetInput(myPassFilter[2]->GetPolyDataOutput());
- myPassFilter[3]->Modified();
- myIsShrunk = false;
+ if(vtkPolyData* aDataSet = myPassFilter.at(1)->GetPolyDataOutput()){
+ myPassFilter.at(2)->SetInput(aDataSet);
+ myPassFilter.at(2)->Modified();
+ myIsShrunk = false;
+ }
}
void VISU_Actor::SetVisibility(int theMode){
if(ishighlighted) ishighlighted=false;
}
}
+
+int VISU_Actor::GetObjId(int theVtkID){
+ if (GetRepresentation() == 0) return -1; // points
+ return myGeomFilter->GetObjId(theVtkID);
+}
+
+VISU_Actor::TVectorId VISU_Actor::GetVtkId(int theObjID){
+ return myGeomFilter->GetVtkId(theObjID);
+}