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_PrsObject_i.cxx
24 // Author : Alexey PETROV
27 #include "VISU_CutPlanesPL.hxx"
28 #include "VISU_Result_i.hh"
29 #include "VISU_CutPlanes_i.hh"
30 #include "VISU_Actor.h"
36 static int MYDEBUG = 0;
37 static int MYDEBUGWITHFILES = 0;
39 static int MYDEBUG = 0;
40 static int MYDEBUGWITHFILES = 0;
43 int VISU::CutPlanes_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
44 const char* theFieldName, int theIteration)
46 return VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration);
50 int VISU::CutPlanes_i::myNbPresent = 0;
51 QString VISU::CutPlanes_i::GenerateName() { return VISU::GenerateName("CutPlanes",myNbPresent++);}
54 const string VISU::CutPlanes_i::myComment = "CUTPLANES";
55 const char* VISU::CutPlanes_i::GetComment() const { return myComment.c_str();}
58 VISU::CutPlanes_i::CutPlanes_i(Result_i* theResult, bool theAddToStudy) :
59 PrsObject_i(theResult->GetStudyDocument()),
61 ScalarMap_i(theResult, theAddToStudy)
67 void VISU::CutPlanes_i::Destroy(){
68 ScalarMap_i::Destroy();
72 void VISU::CutPlanes_i::SameAs(const CutPlanes_i* theOrigin){
73 CutPlanes_i* aCutPlanes = const_cast<CutPlanes_i*>(theOrigin);
74 VISU::ScalarMap_i::SameAs(theOrigin);
76 //SetNbPlanes(aCutPlanes->GetNbPlanes());
77 //SetDisplacement(aCutPlanes->GetDisplacement());
78 //SetOrientationType(aCutPlanes->GetOrientationType());
79 //SetRotateX(aCutPlanes->GetRotateX());
80 //SetRotateY(aCutPlanes->GetRotateY());
84 VISU::Storable* VISU::CutPlanes_i::Create(const char* theMeshName, VISU::Entity theEntity,
85 const char* theFieldName, int theIteration)
87 return ScalarMap_i::Create(theMeshName,theEntity,theFieldName,theIteration);
91 VISU::Storable* VISU::CutPlanes_i::Restore(const Storable::TRestoringMap& theMap)
92 throw(std::logic_error&)
94 ScalarMap_i::Restore(theMap);
96 SetNbPlanes(VISU::Storable::FindValue(theMap,"myNbPlanes").toInt());
97 SetDisplacement(VISU::Storable::FindValue(theMap,"myDisplacement").toDouble());
98 SetOrientationType(VISU::CutPlanes::Orientation(VISU::Storable::FindValue(theMap,"myBasePlane").toInt()));
99 SetRotateX(VISU::Storable::FindValue(theMap,"aRot[0]").toDouble());
100 SetRotateY(VISU::Storable::FindValue(theMap,"aRot[1]").toDouble());
106 void VISU::CutPlanes_i::ToStream(std::ostringstream& theStr){
107 ScalarMap_i::ToStream(theStr);
109 Storable::DataToStream( theStr, "myNbPlanes", int(GetNbPlanes()) );
110 Storable::DataToStream( theStr, "myDisplacement", GetDisplacement() );
111 Storable::DataToStream( theStr, "myBasePlane", int(GetOrientationType()) );
112 Storable::DataToStream( theStr, "aRot[0]", GetRotateX() );
113 Storable::DataToStream( theStr, "aRot[1]", GetRotateY() );
117 VISU::Storable* VISU::CutPlanes_i::Restore(SALOMEDS::SObject_ptr theSObject,
118 const string& thePrefix, const Storable::TRestoringMap& theMap)
119 throw(std::logic_error&)
121 VISU::Result_i* pResult = GetResult(theSObject);
123 VISU::CutPlanes_i* pResent = new VISU::CutPlanes_i(pResult);
124 return pResent->Restore(theMap);
130 VISU::CutPlanes_i::~CutPlanes_i(){
131 if(MYDEBUG) MESSAGE("CutPlanes_i::~CutPlanes_i()");
135 void VISU::CutPlanes_i::SetOrientationType(VISU::CutPlanes::Orientation theOrient){
136 myCutPlanesPL->SetPlaneOrientation(VISU_CutPlanesPL::PlaneOrientation(theOrient));
138 VISU::CutPlanes::Orientation VISU::CutPlanes_i::GetOrientationType() {
139 return VISU::CutPlanes::Orientation(myCutPlanesPL->GetPlaneOrientation());
143 void VISU::CutPlanes_i::SetDisplacement(CORBA::Double theDisp) {
144 myCutPlanesPL->SetDisplacement(theDisp);
146 CORBA::Double VISU::CutPlanes_i::GetDisplacement() {
147 return myCutPlanesPL->GetDisplacement();
151 void VISU::CutPlanes_i::SetPlanePosition(CORBA::Long thePlaneNumber, CORBA::Double thePlanePosition){
152 myCutPlanesPL->SetPartPosition(thePlaneNumber,thePlanePosition);
154 CORBA::Double VISU::CutPlanes_i::GetPlanePosition(CORBA::Long thePlaneNumber){
155 return myCutPlanesPL->GetPartPosition(thePlaneNumber);
159 void VISU::CutPlanes_i::SetDefault(CORBA::Long thePlaneNumber){
160 myCutPlanesPL->SetPartDefault(thePlaneNumber);
162 CORBA::Boolean VISU::CutPlanes_i::IsDefault(CORBA::Long thePlaneNumber){
163 return myCutPlanesPL->IsPartDefault(thePlaneNumber);
167 void VISU::CutPlanes_i::SetNbPlanes(CORBA::Long theNb) {
168 myCutPlanesPL->SetNbParts(theNb);
170 CORBA::Long VISU::CutPlanes_i::GetNbPlanes() {
171 return myCutPlanesPL->GetNbParts();
175 void VISU::CutPlanes_i::SetRotateX(CORBA::Double theAngle){
176 myCutPlanesPL->SetRotateX(theAngle);
178 CORBA::Double VISU::CutPlanes_i::GetRotateX(){
179 return myCutPlanesPL->GetRotateX();
183 void VISU::CutPlanes_i::SetRotateY(CORBA::Double theAngle){
184 myCutPlanesPL->SetRotateY(theAngle);
186 CORBA::Double VISU::CutPlanes_i::GetRotateY(){
187 return myCutPlanesPL->GetRotateY();
191 void VISU::CutPlanes_i::DoHook(){
192 if(!myPipeLine) myPipeLine = VISU_CutPlanesPL::New();
193 myCutPlanesPL = dynamic_cast<VISU_CutPlanesPL*>(myPipeLine);
195 ScalarMap_i::DoHook();