#include "VISU_Actor.h"
#include <vtkGeometryFilter.h>
+#include <vtkDataSetMapper.h>
using namespace VISU;
using namespace std;
#ifdef _DEBUG_
static int MYDEBUG = 0;
-static int MYDEBUGWITHFILES = 0;
#else
static int MYDEBUG = 0;
-static int MYDEBUGWITHFILES = 0;
#endif
VISU::Prs3d_i::Prs3d_i(Result_i* theResult, SALOMEDS::SObject_ptr theSObject) :
myAddToStudy = true;
myPipeLine = NULL;
CORBA::String_var aName = myStudy->Name();
- INFOS("Prs3d_i - this = "<<this<<"; StudyId = "<<myStudy->StudyId()<<"; Name = '"<<aName.in()<<"'");
+ if(MYDEBUG) MESSAGE("Prs3d_i - this = "<<this<<"; StudyId = "<<myStudy->StudyId()<<"; Name = '"<<aName.in()<<"'");
}
void VISU::Prs3d_i::SameAs(const Prs3d_i* theOrigin)
}
VISU::Prs3d_i::~Prs3d_i() {
- INFOS("~Prs3d_i() - this = "<<this<<"; GetReferenceCount() = "<<myPipeLine->GetReferenceCount());
+ if(MYDEBUG) MESSAGE("~Prs3d_i() - this = "<<this<<"; GetReferenceCount() = "<<myPipeLine->GetReferenceCount());
myPipeLine->Delete();
myResult->Destroy();
}
void VISU::Prs3d_i::CreateActor(VISU_Actor* theActor, const Handle(SALOME_InteractiveObject)& theIO)
- throw (std::runtime_error&)
{
try{
Update();
if(myAddToStudy){
Handle(SALOME_InteractiveObject) anIO = theIO;
if(anIO.IsNull()){
- CORBA::String_var anEntry = mySObject->GetID();
- anIO = new SALOME_InteractiveObject(strdup(anEntry.in()),"VISU",strdup(GetName()));
+ anIO = new SALOME_InteractiveObject(mySObject->GetID(),"VISU",GetName());
}
theActor->setIO(anIO);
}
theActor->SetPipeLine(GetPipeLine());
theActor->SetPrs3d(this);
- }catch(std::runtime_error& ex){
+ }catch(std::bad_alloc& ex){
+ throw std::runtime_error("CreateActor >> No enough memory");
throw ex;
- }catch(...){
+ } catch(std::exception& ex){
+ throw ex;
+ }catch(...) {
throw std::runtime_error("CreateActor >> unexpected exception was caught!!!");
- }
+ }
}
-void VISU::Prs3d_i::UpdateActor(VISU_Actor* theActor) throw (std::runtime_error&){
- try{
- vtkGeometryFilter* aGeometryFilter = vtkGeometryFilter::New();
- vtkDataSet *aDataSet = theActor->GetMapper()->GetInput();
- aGeometryFilter->SetInput(aDataSet);
- vtkPolyData* aPolyData = aGeometryFilter->GetOutput();
- aPolyData->Update();
- static int INCMEMORY = 7;
- float aSize = INCMEMORY*aPolyData->GetActualMemorySize()*1024.0;
- int isPoss = VISU_PipeLine::CheckAvailableMemory(aSize);
- INFOS("UpdateActor - aSize = "<<aSize<<"; isPoss = "<<isPoss);
- aPolyData->Delete();
- if (aSize <= 0)
- throw std::runtime_error("Prs3d_i::UpdateActor >> Actor is empty !!!");
- if(!isPoss)
- throw std::runtime_error("Prs3d_i::UpdateActor >> There is no enough memory !!!");
-
- theActor->GetMapper()->ShallowCopy(myPipeLine->GetMapper());
- theActor->Modified();
- }catch(std::runtime_error& ex){
- throw ex;
- }catch(...){
- throw std::runtime_error("Prs3d_i::UpdateActor >> unexpected exception was caught!!!");
- }
+void VISU::Prs3d_i::UpdateActor(VISU_Actor* theActor) {
+ if(MYDEBUG) MESSAGE("Prs3d_i::UpdateActor() - this = "<<this);
+ theActor->GetMapper()->ShallowCopy(myPipeLine->GetMapper());
+ theActor->Modified();
}
VISU::Storable* VISU::Prs3d_i::Restore(const Storable::TRestoringMap& theMap)
- throw(std::logic_error&)
{
myName = VISU::Storable::FindValue(theMap,"myName").latin1();
return this;
Storable::DataToStream( theStr, "myName", myName.c_str() );
}
-void VISU::Prs3d_i::Update() throw (std::runtime_error&){
+void VISU::Prs3d_i::Update() {
+ if(MYDEBUG) MESSAGE("Prs3d_i::Update() - this = "<<this);
try{
myPipeLine->Update();
}catch(...){