1 // Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 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 // VISU OBJECT : interactive object for VISU entities implementation
24 // File : VISU_Result_i.hh
25 // Author : Alexey PETROV
28 #ifndef __VISU_RESULT_I_H__
29 #define __VISU_RESULT_I_H__
31 #include "VISU_PrsObject_i.hh"
32 #include "VISU_BoostSignals.h"
33 #include "SALOME_GenericObj_i.hh"
35 #include "SALOME_Event.h"
36 #include "VTKViewer.h"
38 #include <boost/shared_ptr.hpp>
47 //----------------------------------------------------------------------------
48 class TResultObserver;
51 //----------------------------------------------------------------------------
52 class VISU_I_EXPORT Result_i : public virtual POA_VISU::Result,
53 public virtual RemovableObject_i,
54 public virtual SALOME::GenericObj_i
56 Result_i(const Result_i &);
60 eRestoredComponent = -2,
76 New(SALOMEDS::Study_ptr theStudy,
77 const ESourceId& theSourceId,
78 const ECreationId& theCreationId,
79 CORBA::Boolean theIsBuildImmediately,
80 CORBA::Boolean theIsBuildFields,
81 CORBA::Boolean theIsBuildMinMax,
82 CORBA::Boolean theIsBuildGroups);
101 Build(CORBA::Boolean theIsBuildAll,
102 CORBA::Boolean theIsAtOnce);
106 ExportMED(const char* theFileName);
118 SetBuildFields(CORBA::Boolean theIsBuildFields,
119 CORBA::Boolean theIsCalculateMinMax);
127 SetBuildGroups(CORBA::Boolean theIsBuildGroups);
142 VISU::Result::EntityNames*
146 VISU::Result::Entities*
147 GetEntities(const char* theMeshName);
150 VISU::Result::EntityNames*
151 GetFamilies(const char* theMeshName,
155 VISU::Result::EntityNames*
156 GetGroups(const char* theMeshName);
159 VISU::Result::EntityNames*
160 GetFields(const char* theMeshName,
164 VISU::Result::TimeStampNumbers*
165 GetTimeStampNumbers(const char* theMeshName,
167 const char* theFieldName);
171 GetTimeStampValues(const char* theMeshName,
173 const char* theFieldName);
177 GetNumberOfComponents(const char* theMeshName,
179 const char* theFieldName);
182 VISU::Result::EntityNames*
183 GetPartNames(const char* theMeshName);
186 VISU::Result::Resolutions*
187 GetResolutions(const char* theMeshName,
188 const char* thePartName);
191 VISU::Result::Resolution
192 GetResolution(const char* theMeshName,
193 const char* thePartName);
197 SetResolution(const char* theMeshName,
198 const char* thePartName,
199 VISU::Result::Resolution theResolution);
207 ConnectObserver(TResultObserver* theObserver,
208 boost::signalslib::connection& theConnection);
211 SALOME_MED::MedFileInfo*
214 typedef boost::signal0<void> TUpdateObserverSignal;
216 typedef VISU_Convertor TInput;
217 typedef boost::shared_ptr<TInput> PInput;
220 ESourceId mySourceId;
221 ECreationId myCreationId;
224 std::string myFileName;
225 QFileInfo myFileInfo;
226 std::string myInitFileName;
229 Result_i(SALOMEDS::Study_ptr theStudy,
230 const ESourceId& theSourceId,
231 const ECreationId& theCreationId,
232 CORBA::Boolean theIsBuildImmediately,
233 CORBA::Boolean theIsBuildFields,
234 CORBA::Boolean theIsBuildMinMax,
235 CORBA::Boolean theIsBuildGroups);
244 Build(SALOMEDS::SObject_ptr theSObject,
245 CORBA::Boolean theIsAtOnce = true) ;
249 BuildDataTree(const std::string& theResultEntry);
253 BuildAll(SALOMEDS::SObject_ptr theSObject) ;
259 CORBA::Boolean myIsBuildImmediately;
261 CORBA::Boolean myIsEntitiesDone;
263 CORBA::Boolean myIsFieldsDone;
264 CORBA::Boolean myIsBuildFields;
266 CORBA::Boolean myIsGroupsDone;
267 CORBA::Boolean myIsBuildGroups;
269 CORBA::Boolean myIsPartsDone;
270 CORBA::Boolean myIsBuildParts;
272 CORBA::Boolean myIsMinMaxDone;
273 CORBA::Boolean myIsBuildMinMax;
274 TUpdateObserverSignal myUpdateObserverSignal;
276 CORBA::Boolean myIsAllDone;
285 Create(const char* theFileName);
289 Create(SALOMEDS::SObject_ptr theMedSObject);
293 Create(SALOME_MED::FIELD_ptr theField);
297 Restore(SALOMEDS::SObject_ptr theSObject,
298 const Storable::TRestoringMap& theMap,
299 const std::string& thePrefix,
300 CORBA::Boolean theIsMultiFile);
304 StorableEngine(SALOMEDS::SObject_ptr theSObject,
305 const Storable::TRestoringMap& theMap,
306 const std::string& thePrefix,
307 CORBA::Boolean theIsMultiFile);
311 ToStream(std::ostringstream& theStr);
313 //---------------------------------------------------------------
314 typedef std::string TFileName;
315 typedef std::vector<TFileName> TFileNames;
319 Save(SALOMEDS::SComponent_ptr theComponent,
320 const std::string& theURL,
323 TFileNames& theFileNames,
324 TFileNames& theFiles);
326 //---------------------------------------------------------------
329 CanCopy(SALOMEDS::SObject_ptr theObject);
333 CopyFrom(SALOMEDS::SObject_ptr theObject,
334 CORBA::Long& theObjectID,
335 const std::string& theTmpDir,
336 TFileNames& theFileNames);
338 //---------------------------------------------------------------
343 static const std::string myComment;
347 GetInput(const std::string& theMeshName = "",
348 VISU::Entity theEntity = VISU::NONE,
349 const std::string& theFieldName = "",
350 CORBA::Long theTimeStampNumber = -1);
354 GetInitFileName() const;
358 SetInitFileName(const std::string& theFileName);
368 GetCreationId() const;
371 SALOMEDS::SObject_var mySObject;
372 SALOMEDS::Study_var myStudyDocument;
373 SALOMEDS::SComponent_var mySComponent;
379 SALOMEDS::SObject_var
383 GetStudyDocument() const;
388 SALOMEDS::SComponent_var
389 GetSComponent() const;
392 GetEntry(const Storable::TRestoringMap& theRestoringMap);
394 // Info on structured mesh contained in TInput
396 typedef enum { AXIS_X = 0, AXIS_Y, AXIS_Z } TAxis;
397 typedef std::vector< vtkFloatingPointType > TAxisInfo;
398 const TAxisInfo* GetAxisInfo(const std::string& theMeshName,
400 gp_Dir& thePlaneNormal);
401 // Return i,j or k values and cutting plane normal for theAxis.
402 // In the case of any problems, return NULL pointer
405 TAxisInfo myComponets[ 3 ];
408 std::map< std::string, TGridInfo > myMeshName2GridInfoMap;
411 //! To find Result object as published on father of the given SObject
414 FindResult(SALOMEDS::SObject_ptr theSObject);
416 //! To get VISU::Result object published on the given SALOMEDS::SObject
418 GetResult(SALOMEDS::Study_ptr theStudy,
419 const std::string& theResultEntry);