1 // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.salome-platform.org/
21 #include "VISU_Plot3D_i.hh"
23 #include "VISU_Result_i.hh"
25 #include "VISU_Plot3DPL.hxx"
27 #include "VISU_Actor.h"
33 static int MYDEBUG = 0;
35 static int MYDEBUG = 0;
38 int VISU::Plot3D_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
39 const char* theFieldName, int theIteration, int isMemoryCheck)
41 return VISU::ScalarMap_i::IsPossible
42 (theResult,theMeshName,theEntity,theFieldName,theIteration,isMemoryCheck);
45 int VISU::Plot3D_i::myNbPresent = 0;
46 QString VISU::Plot3D_i::GenerateName() { return VISU::GenerateName("Plot3D",myNbPresent++); }
48 const string VISU::Plot3D_i::myComment = "PLOT3D";
49 const char* VISU::Plot3D_i::GetComment() const { return myComment.c_str(); }
52 ::Plot3D_i(Result_i* theResult,
54 PrsObject_i(theResult->GetStudyDocument()),
55 Prs3d_i(theResult,theAddToStudy),
56 ColoredPrs3d_i(theResult,theAddToStudy),
57 ScalarMap_i(theResult,theAddToStudy),
62 ::Plot3D_i(Result_i* theResult,
63 SALOMEDS::SObject_ptr theSObject) :
64 PrsObject_i(theResult->GetStudyDocument()),
65 Prs3d_i(theResult,theSObject),
66 ColoredPrs3d_i(theResult,theSObject),
67 ScalarMap_i(theResult,theSObject),
71 VISU::Storable* VISU::Plot3D_i::Create (const char* theMeshName, VISU::Entity theEntity,
72 const char* theFieldName, int theIteration)
74 return ScalarMap_i::Create(theMeshName,theEntity,theFieldName,theIteration);
77 VISU::Storable* VISU::Plot3D_i::Restore (const Storable::TRestoringMap& theMap)
79 TSuperClass::Restore(theMap);
81 SetOrientation(VISU::Plot3D::Orientation(VISU::Storable::FindValue(theMap,"myBasePlane").toInt()),
82 Storable::FindValue(theMap,"aRot[0]").toDouble(),
83 Storable::FindValue(theMap,"aRot[1]").toDouble());
84 SetPlanePosition(VISU::Storable::FindValue(theMap,"myPlanePosition").toDouble(),
85 VISU::Storable::FindValue(theMap,"myPlaneCondition").toInt());
86 SetScaleFactor(VISU::Storable::FindValue(theMap,"myScaleFactor").toDouble());
87 SetContourPrs(VISU::Storable::FindValue(theMap,"myContourPrs").toInt());
88 SetNbOfContours(VISU::Storable::FindValue(theMap,"myNbOfContours").toInt());
93 void VISU::Plot3D_i::ToStream (std::ostringstream& theStr)
95 ScalarMap_i::ToStream(theStr);
97 Storable::DataToStream(theStr, "myBasePlane", int(GetOrientationType()));
98 Storable::DataToStream(theStr, "aRot[0]", GetRotateX());
99 Storable::DataToStream(theStr, "aRot[1]", GetRotateY());
100 Storable::DataToStream(theStr, "myPlanePosition", GetPlanePosition());
101 Storable::DataToStream(theStr, "myPlaneCondition", int(IsPositionRelative()));
102 Storable::DataToStream(theStr, "myScaleFactor", GetScaleFactor());
103 Storable::DataToStream(theStr, "myContourPrs", int(GetIsContourPrs()));
104 Storable::DataToStream(theStr, "myNbOfContours", int(GetNbOfContours()));
107 VISU::Plot3D_i::~Plot3D_i(){
108 if(MYDEBUG) MESSAGE("Plot3D_i::~Plot3D_i()");
111 void VISU::Plot3D_i::SetOrientation (VISU::Plot3D::Orientation theOrient,
112 CORBA::Double theXAngle, CORBA::Double theYAngle)
114 myPlot3DPL->SetOrientation(VISU_CutPlanesPL::PlaneOrientation(theOrient),
115 theXAngle,theYAngle);
118 VISU::Plot3D::Orientation VISU::Plot3D_i::GetOrientationType()
120 return VISU::Plot3D::Orientation(myPlot3DPL->GetPlaneOrientation());
123 CORBA::Double VISU::Plot3D_i::GetRotateX()
125 return myPlot3DPL->GetRotateX();
128 CORBA::Double VISU::Plot3D_i::GetRotateY()
130 return myPlot3DPL->GetRotateY();
133 void VISU::Plot3D_i::SetPlanePosition (CORBA::Double thePlanePosition,
134 CORBA::Boolean theIsRelative)
136 myPlot3DPL->SetPlanePosition(thePlanePosition, theIsRelative);
139 CORBA::Double VISU::Plot3D_i::GetPlanePosition()
141 return myPlot3DPL->GetPlanePosition();
144 CORBA::Boolean VISU::Plot3D_i::IsPositionRelative()
146 return myPlot3DPL->IsPositionRelative();
149 void VISU::Plot3D_i::SetScaleFactor (CORBA::Double theScaleFactor)
151 myPlot3DPL->SetScaleFactor(theScaleFactor);
154 CORBA::Double VISU::Plot3D_i::GetScaleFactor()
156 return myPlot3DPL->GetScaleFactor();
159 void VISU::Plot3D_i::SetNbOfContours (CORBA::Long theNb)
161 myPlot3DPL->SetNumberOfContours(theNb);
164 CORBA::Long VISU::Plot3D_i::GetNbOfContours()
166 return myPlot3DPL->GetNumberOfContours();
169 void VISU::Plot3D_i::SetContourPrs (CORBA::Boolean theIsContourPrs )
171 myPlot3DPL->SetContourPrs( theIsContourPrs );
174 CORBA::Boolean VISU::Plot3D_i::GetIsContourPrs()
176 return myPlot3DPL->GetIsContourPrs();
179 void VISU::Plot3D_i::DoHook()
181 if (!myPipeLine) myPipeLine = VISU_Plot3DPL::New();
182 myPlot3DPL = dynamic_cast<VISU_Plot3DPL*>(myPipeLine);
184 ScalarMap_i::DoHook();
189 ::CreateActor(const Handle(SALOME_InteractiveObject)& theIO)
191 if(VISU_Actor* anActor = ScalarMap_i::CreateActor(theIO)){
192 anActor->SetVTKMapping(true);
198 void VISU::Plot3D_i::SetMapScale(double theMapScale)
200 myPlot3DPL->SetMapScale(theMapScale);