1 // VISU OBJECT : interactive object for VISU entities implementation
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
23 // File : VISU_Prs3d_i.cc
24 // Author : Alexey PETROV
27 #include "VISU_PipeLine.hxx"
28 #include "VISU_Result_i.hh"
29 #include "VISU_Prs3d_i.hh"
30 #include "VISU_Actor.h"
35 static int MYDEBUG = 1;
36 static int MYDEBUGWITHFILES = 0;
38 static int MYDEBUG = 0;
39 static int MYDEBUGWITHFILES = 0;
42 VISU::Prs3d_i::Prs3d_i(Result_i* theResult) :
43 PrsObject_i(theResult->GetStudyDocument()),
50 void VISU::Prs3d_i::SameAs(const Prs3d_i* theOrigin)
52 Prs3d_i* aOrigin = const_cast<Prs3d_i*>(theOrigin);
53 myPipeLine->ShallowCopy(aOrigin->GetPL());
56 VISU::Prs3d_i::~Prs3d_i() {
57 if(MYDEBUG) MESSAGE("Prs3d_i::~Prs3d_i()");
61 void VISU::Prs3d_i::Destroy() {
62 CORBA::Object_var anObj = _this();
63 PortableServer::POA_ptr aPOA = Base_i::GetPOA();
64 PortableServer::ObjectId_var anId = aPOA->reference_to_id(anObj);
65 aPOA->deactivate_object(anId.in());
70 void VISU::Prs3d_i::CreateActor(VISU_Actor* theActor, const Handle(SALOME_InteractiveObject)& theIO)
71 throw (std::runtime_error&)
76 Handle(SALOME_InteractiveObject) anIO = theIO;
78 anIO = new SALOME_InteractiveObject(strdup(GetEntry()),"VISU",strdup(GetName()));
79 theActor->setIO(anIO);
81 theActor->SetPipeLine(GetPipeLine());
82 theActor->SetPrs3d(this);
83 }catch(std::runtime_error& ex){
86 throw std::runtime_error("Prs3d_i::CreateActor >> unexpected exception was caught!!!");
90 void VISU::Prs3d_i::UpdateActor(VISU_Actor* theActor){
91 theActor->GetMapper()->ShallowCopy(myPipeLine->GetMapper());
95 VISU::Storable* VISU::Prs3d_i::Restore(const Storable::TRestoringMap& theMap)
96 throw(std::logic_error&)
98 myName = VISU::Storable::FindValue(theMap,"myName").latin1();
102 void VISU::Prs3d_i::ToStream(std::ostringstream& theStr){
103 Storable::DataToStream( theStr, "myName", myName.c_str() );
106 void VISU::Prs3d_i::Update(){
107 myPipeLine->Update();
110 VISU_PipeLine* VISU::Prs3d_i::GetPipeLine(){
114 VISU_PipeLine* VISU::Prs3d_i::GetPL(){
118 VISU::Result_i* VISU::Prs3d_i::GetResult(SALOMEDS::SObject_ptr theSObject){
119 VISU::Result_var aResult = FindResult(theSObject);
120 if(!aResult->_is_nil())
121 return dynamic_cast<VISU::Result_i*>(VISU::GetServant(aResult.in()));