1 // Copyright (C) 2007-2008 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
22 // VISU OBJECT : interactive object for VISU entities implementation
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.h"
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);
105 ExportMED(const char* theFileName);
117 SetBuildFields(CORBA::Boolean theIsBuildFields,
118 CORBA::Boolean theIsCalculateMinMax);
126 SetBuildGroups(CORBA::Boolean theIsBuildGroups);
141 VISU::Result::EntityNames*
145 VISU::Result::Entities*
146 GetEntities(const char* theMeshName);
149 VISU::Result::EntityNames*
150 GetFamilies(const char* theMeshName,
154 VISU::Result::EntityNames*
155 GetGroups(const char* theMeshName);
158 VISU::Result::EntityNames*
159 GetFields(const char* theMeshName,
163 VISU::Result::TimeStampNumbers*
164 GetTimeStampNumbers(const char* theMeshName,
166 const char* theFieldName);
170 GetNumberOfComponents(const char* theMeshName,
172 const char* theFieldName);
175 VISU::Result::EntityNames*
176 GetPartNames(const char* theMeshName);
179 VISU::Result::Resolutions*
180 GetResolutions(const char* theMeshName,
181 const char* thePartName);
184 VISU::Result::Resolution
185 GetResolution(const char* theMeshName,
186 const char* thePartName);
190 SetResolution(const char* theMeshName,
191 const char* thePartName,
192 VISU::Result::Resolution theResolution);
200 ConnectObserver(TResultObserver* theObserver,
201 boost::signalslib::connection& theConnection);
204 SALOME_MED::MedFileInfo*
207 typedef boost::signal0<void> TUpdateObserverSignal;
209 typedef VISU_Convertor TInput;
210 typedef boost::shared_ptr<TInput> PInput;
213 ESourceId mySourceId;
214 ECreationId myCreationId;
217 std::string myFileName;
218 QFileInfo myFileInfo;
219 std::string myInitFileName;
222 Result_i(SALOMEDS::Study_ptr theStudy,
223 const ESourceId& theSourceId,
224 const ECreationId& theCreationId,
225 CORBA::Boolean theIsBuildImmediately,
226 CORBA::Boolean theIsBuildFields,
227 CORBA::Boolean theIsBuildMinMax,
228 CORBA::Boolean theIsBuildGroups);
237 Build(SALOMEDS::SObject_ptr theSObject,
238 CORBA::Boolean theIsAtOnce = true) ;
242 BuildDataTree(const std::string& theResultEntry);
246 BuildAll(SALOMEDS::SObject_ptr theSObject) ;
252 CORBA::Boolean myIsBuildImmediately;
254 CORBA::Boolean myIsEntitiesDone;
256 CORBA::Boolean myIsFieldsDone;
257 CORBA::Boolean myIsBuildFields;
259 CORBA::Boolean myIsGroupsDone;
260 CORBA::Boolean myIsBuildGroups;
262 CORBA::Boolean myIsPartsDone;
263 CORBA::Boolean myIsBuildParts;
265 CORBA::Boolean myIsMinMaxDone;
266 CORBA::Boolean myIsBuildMinMax;
267 TUpdateObserverSignal myUpdateObserverSignal;
269 CORBA::Boolean myIsAllDone;
278 Create(const char* theFileName);
282 Create(SALOMEDS::SObject_ptr theMedSObject);
286 Create(SALOME_MED::FIELD_ptr theField);
290 Restore(SALOMEDS::SObject_ptr theSObject,
291 const Storable::TRestoringMap& theMap,
292 const std::string& thePrefix,
293 CORBA::Boolean theIsMultiFile);
297 StorableEngine(SALOMEDS::SObject_ptr theSObject,
298 const Storable::TRestoringMap& theMap,
299 const std::string& thePrefix,
300 CORBA::Boolean theIsMultiFile);
304 ToStream(std::ostringstream& theStr);
306 //---------------------------------------------------------------
307 typedef std::string TFileName;
308 typedef std::vector<TFileName> TFileNames;
312 Save(SALOMEDS::SComponent_ptr theComponent,
313 const std::string& theURL,
316 TFileNames& theFileNames,
317 TFileNames& theFiles);
319 //---------------------------------------------------------------
322 CanCopy(SALOMEDS::SObject_ptr theObject);
326 CopyFrom(SALOMEDS::SObject_ptr theObject,
327 CORBA::Long& theObjectID,
328 const std::string& theTmpDir,
329 TFileNames& theFileNames);
331 //---------------------------------------------------------------
336 static const std::string myComment;
340 GetInput(const std::string& theMeshName = "",
341 VISU::Entity theEntity = VISU::NONE,
342 const std::string& theFieldName = "",
343 CORBA::Long theTimeStampNumber = -1);
347 GetInitFileName() const;
351 SetInitFileName(const std::string& theFileName);
361 GetCreationId() const;
364 SALOMEDS::SObject_var mySObject;
365 SALOMEDS::Study_var myStudyDocument;
366 SALOMEDS::SComponent_var mySComponent;
372 SALOMEDS::SObject_var
376 GetStudyDocument() const;
381 SALOMEDS::SComponent_var
382 GetSComponent() const;
385 GetEntry(const Storable::TRestoringMap& theRestoringMap);
387 // Info on structured mesh contained in TInput
389 typedef enum { AXIS_X = 0, AXIS_Y, AXIS_Z } TAxis;
390 typedef std::vector< vtkFloatingPointType > TAxisInfo;
391 const TAxisInfo* GetAxisInfo(const std::string& theMeshName,
393 gp_Dir& thePlaneNormal);
394 // Return i,j or k values and cutting plane normal for theAxis.
395 // In the case of any problems, return NULL pointer
398 TAxisInfo myComponets[ 3 ];
401 std::map< std::string, TGridInfo > myMeshName2GridInfoMap;
404 //! To find Result object as published on father of the given SObject
407 FindResult(SALOMEDS::SObject_ptr theSObject);
409 //! To get VISU::Result object published on the given SALOMEDS::SObject
411 GetResult(SALOMEDS::Study_ptr theStudy,
412 const std::string& theResultEntry);