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_Result_i.hh
24 // Author : Alexey PETROV
27 #ifndef __VISU_RESULT_I_H__
28 #define __VISU_RESULT_I_H__
30 #include "VISUConfig.hh"
31 #include "VISU_BoostSignals.h"
32 #include "SALOME_GenericObj_i.hh"
34 #include "VTKViewer.h"
43 //----------------------------------------------------------------------------
44 class MinMaxCunsomer: public virtual boost::signalslib::trackable
47 bool myMinMaxIsInitilized;
61 //----------------------------------------------------------------------------
62 class Result_i : public virtual POA_VISU::Result,
63 public virtual RemovableObject_i,
64 public virtual SALOME::GenericObj_i
67 Result_i(const Result_i &);
70 enum ESourceId {eRestoredComponent = -2, eRestoredFile = -1, eFile = 1, eComponent = 2};
71 enum ECreationId {eImportFile, eCopyAndImportFile, eImportMed, eImportMedField};
73 Result_i(SALOMEDS::Study_ptr theStudy,
74 const ESourceId& theSourceId,
75 const ECreationId& theCreationId,
76 CORBA::Boolean theIsBuildImmediately = true,
77 CORBA::Boolean theIsBuildFields = true,
78 CORBA::Boolean theIsBuildMinMax = true,
79 CORBA::Boolean theIsBuildGroups = true);
82 virtual void RemoveFromStudy();
84 virtual VISU::VISUType GetType() { return VISU::TRESULT;}
85 virtual CORBA::Boolean BuildAll();
87 virtual CORBA::Boolean Build(CORBA::Boolean theIsBuildAll,
88 CORBA::Boolean theIsAtOnce);
89 virtual CORBA::Boolean IsDone();
91 virtual CORBA::Boolean IsEntitiesDone();
93 virtual void SetBuildFields(CORBA::Boolean theIsBuildFields,
94 CORBA::Boolean theIsCalculateMinMax);
95 virtual CORBA::Boolean IsFieldsDone();
97 virtual void SetBuildGroups(CORBA::Boolean theIsBuildGroups);
98 virtual CORBA::Boolean IsGroupsDone();
100 virtual CORBA::Boolean IsMinMaxDone();
104 MinMaxConnect(MinMaxCunsomer* theMinMaxCunsomer);
106 typedef boost::signal0<void> TUpdateMinMaxSignal;
108 typedef VISU_Convertor TInput;
111 ESourceId mySourceId;
112 ECreationId myCreationId;
115 std::string myName, myInitFileName;
116 QFileInfo myFileInfo;
119 virtual Storable* Build(SALOMEDS::SObject_ptr theSObject,
120 CORBA::Boolean theIsAtOnce = true) ;
121 virtual Storable* BuildAll(SALOMEDS::SObject_ptr theSObject) ;
124 CORBA::Boolean myIsBuildImmediately;
126 CORBA::Boolean myIsEntitiesDone;
127 CORBA::Boolean myIsFieldsDone;
128 CORBA::Boolean myIsGroupsDone;
129 CORBA::Boolean myIsMinMaxDone;
131 CORBA::Boolean myIsBuildFields;
132 CORBA::Boolean myIsBuildGroups;
134 CORBA::Boolean myIsBuildMinMax;
135 TUpdateMinMaxSignal myUpdateMinMaxSignal;
137 CORBA::Boolean myIsAllDone;
140 virtual int IsPossible();
142 virtual Storable* Create(const char* theFileName);
143 virtual Storable* Create(SALOMEDS::SObject_ptr theMedSObject);
144 virtual Storable* Create(SALOME_MED::FIELD_ptr theField);
146 virtual Storable* Restore(SALOMEDS::SObject_ptr theSObject,
147 const Storable::TRestoringMap& theMap,
148 const std::string& thePrefix);
150 static Storable* Restore(SALOMEDS::SObject_ptr theSObject,
151 const std::string& thePrefix,
152 const Storable::TRestoringMap& theMap);
154 virtual void ToStream(std::ostringstream& theStr);
155 virtual const char* GetComment() const;
156 static const std::string myComment;
159 const std::string& GetName() const { return myName;}
160 const QFileInfo& GetFileInfo() const { return myFileInfo;}
161 const std::string& GetFileName() const { return myInitFileName;}
162 const ECreationId& GetCreationId() const { return myCreationId;}
165 SALOMEDS::SObject_var mySObject;
166 SALOMEDS::Study_var myStudyDocument;
167 SALOMEDS::SComponent_var mySComponent;
170 std::string GetRefFatherEntry();
171 std::string GetEntry();
172 const SALOMEDS::SObject_var& GetSObject() const;
173 const SALOMEDS::Study_var& GetStudyDocument() const;
174 const SALOMEDS::SComponent_var& GetSComponent() const;
175 std::string GetEntry(const std::string& theComment);
177 // Info on structured mesh contained in TInput
179 typedef enum { AXIS_X = 0, AXIS_Y, AXIS_Z } TAxis;
180 typedef std::vector< vtkFloatingPointType > TAxisInfo;
181 const TAxisInfo* GetAxisInfo(const std::string& theMeshName,
183 gp_Dir& thePlaneNormal);
184 // Return i,j or k values and cutting plane normal for theAxis.
185 // In the case of any problems, return NULL pointer
188 TAxisInfo myComponets[ 3 ];
191 std::map< std::string, TGridInfo > myMeshName2GridInfoMap;
194 Result_var FindResult(SALOMEDS::SObject_ptr theSObject);