1 // Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // File : VISU_OptionalDeformation_i.cc
24 #include "VISU_OptionalDeformation_i.hh"
25 #include "VISU_Result_i.hh"
26 #include "VISU_Prs3dUtils.hh"
27 #include "VISUConfig.hh"
29 #include "VISU_OptionalDeformationPL.hxx"
33 static int MYDEBUG = 0;
35 static int MYDEBUG = 0;
38 //---------------------------------------------------------------
39 VISU::OptionalDeformation_i::OptionalDeformation_i(VISU::ColoredPrs3d_i *theColoredPrs3d):
40 Deformation_i(theColoredPrs3d)
42 if(MYDEBUG) MESSAGE("OptionalDeformation_i::OptionalDeformation_i()");
45 //---------------------------------------------------------------
46 VISU::OptionalDeformation_i::~OptionalDeformation_i()
48 if(MYDEBUG) MESSAGE("OptionalDeformation_i::~OptionalDeformation_i()");
51 //---------------------------------------------------------------
52 void VISU::OptionalDeformation_i::UseDeformation(CORBA::Boolean theFlag){
53 if(MYDEBUG) MESSAGE("OptionalDeformation_i::UseDeformation()");
55 VISU::TSetModified aModified(GetColoredPrs3d());
57 ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_OptionalDeformationPL, bool>
58 (GetSpecificDeformedPL(), &VISU_OptionalDeformationPL::UseDeformation, theFlag));
61 //---------------------------------------------------------------
62 CORBA::Boolean VISU::OptionalDeformation_i::IsDeformed(){
64 if(MYDEBUG) MESSAGE("OptionalDeformation_i::IsDeformed()");
65 return GetSpecificDeformedPL()->IsDeformed();
69 void VISU::OptionalDeformation_i::InitDeformedPipeLine(VISU_DeformationPL* theDeformedPipeLine){
71 if(MYDEBUG) MESSAGE("OptionalDeformation_i::InitDeformedPipeLine()");
72 myOptionalDeformationPL = dynamic_cast<VISU_OptionalDeformationPL*>(theDeformedPipeLine);
74 TSuperClass::InitDeformedPipeLine(myOptionalDeformationPL);
77 //---------------------------------------------------------------
78 void VISU::OptionalDeformation_i::
79 DeformationToStream(std::ostringstream& theStr)
81 Storable::DataToStream(theStr,"IsDeformed", IsDeformed());
83 TSuperClass::DeformationToStream(theStr);
86 //---------------------------------------------------------------
88 VISU::OptionalDeformation_i::RestoreDeformation(SALOMEDS::SObject_ptr theSObject,
89 const Storable::TRestoringMap& theMap)
91 UseDeformation(Storable::FindValue(theMap,"IsDeformed").toInt());
93 TSuperClass::RestoreDeformation(theSObject,theMap);
99 VISU::OptionalDeformation_i::SameAsDeformation(const Deformation_i *aDeformedPrs){
101 if(const OptionalDeformation_i* aPrs3d = dynamic_cast<const OptionalDeformation_i*>(aDeformedPrs)){
102 OptionalDeformation_i* anOrigin = const_cast<OptionalDeformation_i*>(aPrs3d);
103 UseDeformation(anOrigin->IsDeformed());
105 if(anOrigin->IsDeformed()){
106 TSuperClass::SameAsDeformation(aDeformedPrs);