]> SALOME platform Git repositories - modules/visu.git/blob - src/VISU_I/VISU_OptionalDeformation_i.cc
Salome HOME
IPAL21489 Filter by Scalars... does not show visible elements for some presentations.
[modules/visu.git] / src / VISU_I / VISU_OptionalDeformation_i.cc
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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.
10 //
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.
15 //
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
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //  File   : VISU_OptionalDeformation_i.cc
23 //  Author : 
24 //  Module : VISU
25 //
26 #include "VISU_OptionalDeformation_i.hh"
27 #include "VISU_Result_i.hh"
28 #include "VISU_Prs3dUtils.hh"
29 #include "VISUConfig.hh"
30
31 #include "VISU_OptionalDeformationPL.hxx"
32
33
34 #ifdef _DEBUG_
35 static int MYDEBUG = 0;
36 #else
37 static int MYDEBUG = 0;
38 #endif
39
40 //---------------------------------------------------------------
41 VISU::OptionalDeformation_i::OptionalDeformation_i(VISU::ColoredPrs3d_i *theColoredPrs3d):
42   Deformation_i(theColoredPrs3d)
43 {
44   if(MYDEBUG) MESSAGE("OptionalDeformation_i::OptionalDeformation_i()");
45 }
46
47 //---------------------------------------------------------------
48 VISU::OptionalDeformation_i::~OptionalDeformation_i()
49 {
50   if(MYDEBUG) MESSAGE("OptionalDeformation_i::~OptionalDeformation_i()");
51 }
52
53 //---------------------------------------------------------------
54 void VISU::OptionalDeformation_i::UseDeformation(CORBA::Boolean theFlag){
55   if(MYDEBUG) MESSAGE("OptionalDeformation_i::UseDeformation()");
56
57   VISU::TSetModified aModified(GetColoredPrs3d());
58
59   ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_OptionalDeformationPL, bool>
60                    (GetSpecificDeformedPL(), &VISU_OptionalDeformationPL::UseDeformation, theFlag));
61 }
62
63 //---------------------------------------------------------------
64 CORBA::Boolean VISU::OptionalDeformation_i::IsDeformed(){
65
66   if(MYDEBUG) MESSAGE("OptionalDeformation_i::IsDeformed()");
67   return GetSpecificDeformedPL()->IsDeformed();
68 }
69
70
71 void VISU::OptionalDeformation_i::InitDeformedPipeLine(VISU_DeformationPL* theDeformedPipeLine){
72
73   if(MYDEBUG) MESSAGE("OptionalDeformation_i::InitDeformedPipeLine()");
74   myOptionalDeformationPL = dynamic_cast<VISU_OptionalDeformationPL*>(theDeformedPipeLine);
75
76   TSuperClass::InitDeformedPipeLine(myOptionalDeformationPL);
77 }
78
79 //---------------------------------------------------------------
80 void VISU::OptionalDeformation_i::
81 DeformationToStream(std::ostringstream& theStr)
82 {
83   Storable::DataToStream(theStr,"IsDeformed", IsDeformed());
84   if(IsDeformed())
85     TSuperClass::DeformationToStream(theStr);
86 }
87
88 //---------------------------------------------------------------
89 void
90 VISU::OptionalDeformation_i::RestoreDeformation(SALOMEDS::SObject_ptr theSObject,
91                                                 const Storable::TRestoringMap& theMap)
92 {
93   UseDeformation(Storable::FindValue(theMap,"IsDeformed").toInt());
94   if(IsDeformed())
95     TSuperClass::RestoreDeformation(theSObject,theMap);
96 }
97
98
99
100 void 
101 VISU::OptionalDeformation_i::SameAsDeformation(const Deformation_i *aDeformedPrs){
102
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());
106     
107     if(anOrigin->IsDeformed()){
108       TSuperClass::SameAsDeformation(aDeformedPrs);
109     }
110   }
111 }