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.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // File : VISU_Result_i.hh
24 // Author : Alexey PETROV
27 #ifndef __VISU_RESULT_I_H__
28 #define __VISU_RESULT_I_H__
30 #include "VISU_PrsObject_i.hh"
31 #include "VISU_BoostSignals.h"
32 #include "SALOME_GenericObj_i.hh"
34 #include "SALOME_Event.hxx"
35 #include "VTKViewer.h"
37 #include <boost/shared_ptr.hpp>
46 //----------------------------------------------------------------------------
47 class TResultObserver;
50 //----------------------------------------------------------------------------
51 class VISU_I_EXPORT Result_i : public virtual POA_VISU::Result,
52 public virtual RemovableObject_i,
53 public virtual SALOME::GenericObj_i
55 Result_i(const Result_i &);
59 eRestoredComponent = -2,
75 New(SALOMEDS::Study_ptr theStudy,
76 const ESourceId& theSourceId,
77 const ECreationId& theCreationId,
78 CORBA::Boolean theIsBuildImmediately,
79 CORBA::Boolean theIsBuildFields,
80 CORBA::Boolean theIsBuildMinMax,
81 CORBA::Boolean theIsBuildGroups);
100 Build(CORBA::Boolean theIsBuildAll,
101 CORBA::Boolean theIsAtOnce);
113 SetBuildFields(CORBA::Boolean theIsBuildFields,
114 CORBA::Boolean theIsCalculateMinMax);
122 SetBuildGroups(CORBA::Boolean theIsBuildGroups);
137 VISU::Result::EntityNames*
141 VISU::Result::Entities*
142 GetEntities(const char* theMeshName);
145 VISU::Result::EntityNames*
146 GetFamilies(const char* theMeshName,
150 VISU::Result::EntityNames*
151 GetGroups(const char* theMeshName);
154 VISU::Result::EntityNames*
155 GetFields(const char* theMeshName,
159 VISU::Result::TimeStampNumbers*
160 GetTimeStampNumbers(const char* theMeshName,
162 const char* theFieldName);
166 GetNumberOfComponents(const char* theMeshName,
168 const char* theFieldName);
171 VISU::Result::EntityNames*
172 GetPartNames(const char* theMeshName);
175 VISU::Result::Resolutions*
176 GetResolutions(const char* theMeshName,
177 const char* thePartName);
180 VISU::Result::Resolution
181 GetResolution(const char* theMeshName,
182 const char* thePartName);
186 SetResolution(const char* theMeshName,
187 const char* thePartName,
188 VISU::Result::Resolution theResolution);
196 ConnectObserver(TResultObserver* theObserver,
197 boost::signalslib::connection& theConnection);
199 typedef boost::signal0<void> TUpdateObserverSignal;
201 typedef VISU_Convertor TInput;
202 typedef boost::shared_ptr<TInput> PInput;
205 ESourceId mySourceId;
206 ECreationId myCreationId;
209 std::string myFileName;
210 QFileInfo myFileInfo;
211 std::string myInitFileName;
214 Result_i(SALOMEDS::Study_ptr theStudy,
215 const ESourceId& theSourceId,
216 const ECreationId& theCreationId,
217 CORBA::Boolean theIsBuildImmediately,
218 CORBA::Boolean theIsBuildFields,
219 CORBA::Boolean theIsBuildMinMax,
220 CORBA::Boolean theIsBuildGroups);
229 Build(SALOMEDS::SObject_ptr theSObject,
230 CORBA::Boolean theIsAtOnce = true) ;
234 BuildDataTree(const std::string& theResultEntry);
238 BuildAll(SALOMEDS::SObject_ptr theSObject) ;
244 CORBA::Boolean myIsBuildImmediately;
246 CORBA::Boolean myIsEntitiesDone;
248 CORBA::Boolean myIsFieldsDone;
249 CORBA::Boolean myIsBuildFields;
251 CORBA::Boolean myIsGroupsDone;
252 CORBA::Boolean myIsBuildGroups;
254 CORBA::Boolean myIsPartsDone;
255 CORBA::Boolean myIsBuildParts;
257 CORBA::Boolean myIsMinMaxDone;
258 CORBA::Boolean myIsBuildMinMax;
259 TUpdateObserverSignal myUpdateObserverSignal;
261 CORBA::Boolean myIsAllDone;
270 Create(const char* theFileName);
274 Create(SALOMEDS::SObject_ptr theMedSObject);
278 Create(SALOME_MED::FIELD_ptr theField);
282 Restore(SALOMEDS::SObject_ptr theSObject,
283 const Storable::TRestoringMap& theMap,
284 const std::string& thePrefix,
285 CORBA::Boolean theIsMultiFile);
289 StorableEngine(SALOMEDS::SObject_ptr theSObject,
290 const Storable::TRestoringMap& theMap,
291 const std::string& thePrefix,
292 CORBA::Boolean theIsMultiFile);
296 ToStream(std::ostringstream& theStr);
298 //---------------------------------------------------------------
299 typedef std::string TFileName;
300 typedef std::vector<TFileName> TFileNames;
304 Save(SALOMEDS::SComponent_ptr theComponent,
305 const std::string& theURL,
308 TFileNames& theFileNames,
309 TFileNames& theFiles);
311 //---------------------------------------------------------------
314 CanCopy(SALOMEDS::SObject_ptr theObject);
318 CopyFrom(SALOMEDS::SObject_ptr theObject,
319 CORBA::Long& theObjectID,
320 const std::string& theTmpDir,
321 TFileNames& theFileNames);
323 //---------------------------------------------------------------
328 static const std::string myComment;
332 GetInput(const std::string& theMeshName = "",
333 VISU::Entity theEntity = VISU::NONE,
334 const std::string& theFieldName = "",
335 CORBA::Long theTimeStampNumber = -1);
339 GetInitFileName() const;
343 SetInitFileName(const std::string& theFileName);
353 GetCreationId() const;
356 SALOMEDS::SObject_var mySObject;
357 SALOMEDS::Study_var myStudyDocument;
358 SALOMEDS::SComponent_var mySComponent;
364 SALOMEDS::SObject_var
368 GetStudyDocument() const;
373 SALOMEDS::SComponent_var
374 GetSComponent() const;
377 GetEntry(const Storable::TRestoringMap& theRestoringMap);
379 // Info on structured mesh contained in TInput
381 typedef enum { AXIS_X = 0, AXIS_Y, AXIS_Z } TAxis;
382 typedef std::vector< vtkFloatingPointType > TAxisInfo;
383 const TAxisInfo* GetAxisInfo(const std::string& theMeshName,
385 gp_Dir& thePlaneNormal);
386 // Return i,j or k values and cutting plane normal for theAxis.
387 // In the case of any problems, return NULL pointer
390 TAxisInfo myComponets[ 3 ];
393 std::map< std::string, TGridInfo > myMeshName2GridInfoMap;
396 //! To find Result object as published on father of the given SObject
399 FindResult(SALOMEDS::SObject_ptr theSObject);
401 //! To get VISU::Result object published on the given SALOMEDS::SObject
403 GetResult(SALOMEDS::Study_ptr theStudy,
404 const std::string& theResultEntry);