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_IsoSurfacesPL.hxx"
28 #include "VISU_Result_i.hh"
29 #include "VISU_IsoSurfaces_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::IsoSurfaces_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
44 const char* theFieldName, int theIteration, int isMemoryCheck)
46 return VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration,isMemoryCheck);
49 int VISU::IsoSurfaces_i::myNbPresent = 0;
50 QString VISU::IsoSurfaces_i::GenerateName() { return VISU::GenerateName("IsoSurfaces",myNbPresent++);}
52 const string VISU::IsoSurfaces_i::myComment = "ISOSURFACES";
53 const char* VISU::IsoSurfaces_i::GetComment() const { return myComment.c_str();}
56 VISU::IsoSurfaces_i::IsoSurfaces_i(Result_i* theResult, bool theAddToStudy, SALOMEDS::SObject_ptr theSObject) :
57 PrsObject_i(theResult->GetStudyDocument()),
58 Prs3d_i(theResult,theSObject),
59 ScalarMap_i(theResult,theAddToStudy,theSObject)
61 myIsoSurfacesPL = NULL;
66 void VISU::IsoSurfaces_i::SameAs(const IsoSurfaces_i* theOrigin) {
67 IsoSurfaces_i* aIsoSurfaces = const_cast<IsoSurfaces_i*>(theOrigin);
68 VISU::ScalarMap_i::SameAs(theOrigin);
72 VISU::Storable* VISU::IsoSurfaces_i::Create(const char* theMeshName, VISU::Entity theEntity,
73 const char* theFieldName, int theIteration)
75 return ScalarMap_i::Create(theMeshName,theEntity,theFieldName,theIteration);
79 VISU::Storable* VISU::IsoSurfaces_i::Restore(const Storable::TRestoringMap& theMap)
80 throw(std::logic_error&)
83 SetNbSurfaces(VISU::Storable::FindValue(theMap,"myNbSurface").toInt());
84 float aMin = VISU::Storable::FindValue(theMap,"myRange[0]").toDouble();
85 float aMax = VISU::Storable::FindValue(theMap,"myRange[1]").toDouble();
86 SetSubRange(aMin,aMax);
88 return ScalarMap_i::Restore(theMap);
91 void VISU::IsoSurfaces_i::ToStream(std::ostringstream& theStr){
92 ScalarMap_i::ToStream(theStr);
94 Storable::DataToStream( theStr, "myNbSurface", int(GetNbSurfaces()) );
95 Storable::DataToStream( theStr, "myRange[0]", GetSubMin() );
96 Storable::DataToStream( theStr, "myRange[1]", GetSubMax() );
100 VISU::IsoSurfaces_i::~IsoSurfaces_i(){
101 if(MYDEBUG) MESSAGE("IsoSurfaces_i::~IsoSurfaces_i()");
105 void VISU::IsoSurfaces_i::SetNbSurfaces(CORBA::Long theNb){
106 myIsoSurfacesPL->SetNbParts(theNb);
108 CORBA::Long VISU::IsoSurfaces_i::GetNbSurfaces(){
109 return myIsoSurfacesPL->GetNbParts();
113 void VISU::IsoSurfaces_i::SetSubRange(CORBA::Double theMin, CORBA::Double theMax){
114 float aRange[2] = {theMin, theMax};
115 myIsoSurfacesPL->SetRange(aRange);
117 CORBA::Double VISU::IsoSurfaces_i::GetSubMin(){
118 return myIsoSurfacesPL->GetMin();
120 CORBA::Double VISU::IsoSurfaces_i::GetSubMax(){
121 return myIsoSurfacesPL->GetMax();
125 void VISU::IsoSurfaces_i::DoHook(){
126 if(MYDEBUG) MESSAGE("IsoSurfaces_i::DoHook()- "<<myPipeLine);
127 if(!myPipeLine) myPipeLine = VISU_IsoSurfacesPL::New();
128 myIsoSurfacesPL = dynamic_cast<VISU_IsoSurfacesPL*>(myPipeLine);
130 ScalarMap_i::DoHook();
134 void VISU::IsoSurfaces_i::SetMapScale(double theMapScale){
135 myIsoSurfacesPL->SetMapScale(theMapScale);