1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File : VISU_OptionalDeformation_i.cc
26 #include "VISU_OptionalDeformation_i.hh"
27 #include "VISU_Result_i.hh"
28 #include "VISU_Prs3dUtils.hh"
29 #include "VISUConfig.hh"
31 #include "VISU_OptionalDeformationPL.hxx"
35 static int MYDEBUG = 0;
37 static int MYDEBUG = 0;
40 //---------------------------------------------------------------
41 VISU::OptionalDeformation_i::OptionalDeformation_i(VISU::ColoredPrs3d_i *theColoredPrs3d):
42 Deformation_i(theColoredPrs3d)
44 if(MYDEBUG) MESSAGE("OptionalDeformation_i::OptionalDeformation_i()");
47 //---------------------------------------------------------------
48 VISU::OptionalDeformation_i::~OptionalDeformation_i()
50 if(MYDEBUG) MESSAGE("OptionalDeformation_i::~OptionalDeformation_i()");
53 //---------------------------------------------------------------
54 void VISU::OptionalDeformation_i::UseDeformation(CORBA::Boolean theFlag){
55 if(MYDEBUG) MESSAGE("OptionalDeformation_i::UseDeformation()");
57 VISU::TSetModified aModified(GetColoredPrs3d());
59 ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_OptionalDeformationPL, bool>
60 (GetSpecificDeformedPL(), &VISU_OptionalDeformationPL::UseDeformation, theFlag));
63 //---------------------------------------------------------------
64 CORBA::Boolean VISU::OptionalDeformation_i::IsDeformed(){
66 if(MYDEBUG) MESSAGE("OptionalDeformation_i::IsDeformed()");
67 return GetSpecificDeformedPL()->IsDeformed();
71 void VISU::OptionalDeformation_i::InitDeformedPipeLine(VISU_DeformationPL* theDeformedPipeLine){
73 if(MYDEBUG) MESSAGE("OptionalDeformation_i::InitDeformedPipeLine()");
74 myOptionalDeformationPL = dynamic_cast<VISU_OptionalDeformationPL*>(theDeformedPipeLine);
76 TSuperClass::InitDeformedPipeLine(myOptionalDeformationPL);
79 //---------------------------------------------------------------
80 void VISU::OptionalDeformation_i::
81 DeformationToStream(std::ostringstream& theStr)
83 Storable::DataToStream(theStr,"IsDeformed", IsDeformed());
85 TSuperClass::DeformationToStream(theStr);
88 //---------------------------------------------------------------
90 VISU::OptionalDeformation_i::RestoreDeformation(SALOMEDS::SObject_ptr theSObject,
91 const Storable::TRestoringMap& theMap)
93 UseDeformation(Storable::FindValue(theMap,"IsDeformed").toInt());
95 TSuperClass::RestoreDeformation(theSObject,theMap);
101 VISU::OptionalDeformation_i::SameAsDeformation(const Deformation_i *aDeformedPrs){
103 if(const OptionalDeformation_i* aPrs3d = dynamic_cast<const OptionalDeformation_i*>(aDeformedPrs)){
104 OptionalDeformation_i* anOrigin = const_cast<OptionalDeformation_i*>(aPrs3d);
105 UseDeformation(anOrigin->IsDeformed());
107 if(anOrigin->IsDeformed()){
108 TSuperClass::SameAsDeformation(aDeformedPrs);