00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef __VISU_RESULT_I_H__
00029 #define __VISU_RESULT_I_H__
00030
00031 #include "VISU_PrsObject_i.hh"
00032 #include "VISU_BoostSignals.h"
00033 #include "SALOME_GenericObj_i.hh"
00034
00035 #include "SALOME_Event.h"
00036 #include "VTKViewer.h"
00037
00038 #include <boost/shared_ptr.hpp>
00039 #include <gp_Dir.hxx>
00040 #include <vector>
00041 #include <map>
00042
00043 class VISU_Convertor;
00044
00045 namespace VISU
00046 {
00047
00048 class TResultObserver;
00049
00050
00051
00052 class VISU_I_EXPORT Result_i : public virtual POA_VISU::Result,
00053 public virtual RemovableObject_i,
00054 public virtual SALOME::GenericObj_i
00055 {
00056 Result_i(const Result_i &);
00057
00058 public:
00059 enum ESourceId {
00060 eRestoredComponent = -2,
00061 eRestoredFile = -1,
00062 eSavedFile = 0,
00063 eFile = 1,
00064 eComponent = 2
00065 };
00066
00067 enum ECreationId {
00068 eImportFile,
00069 eCopyAndImportFile,
00070 eImportMed,
00071 eImportMedField
00072 };
00073
00074 static
00075 Result_i*
00076 New(SALOMEDS::Study_ptr theStudy,
00077 const ESourceId& theSourceId,
00078 const ECreationId& theCreationId,
00079 CORBA::Boolean theIsBuildImmediately,
00080 CORBA::Boolean theIsBuildFields,
00081 CORBA::Boolean theIsBuildMinMax,
00082 CORBA::Boolean theIsBuildGroups);
00083
00084 virtual
00085 void
00086 RemoveFromStudy();
00087
00088 virtual
00089 VISU::VISUType
00090 GetType()
00091 {
00092 return VISU::TRESULT;
00093 }
00094
00095 virtual
00096 CORBA::Boolean
00097 BuildAll();
00098
00099 virtual
00100 CORBA::Boolean
00101 Build(CORBA::Boolean theIsBuildAll,
00102 CORBA::Boolean theIsAtOnce);
00103
00104 virtual
00105 CORBA::Boolean
00106 ExportMED(const char* theFileName);
00107
00108 virtual
00109 CORBA::Boolean
00110 IsDone();
00111
00112 virtual
00113 CORBA::Boolean
00114 IsEntitiesDone();
00115
00116 virtual
00117 void
00118 SetBuildFields(CORBA::Boolean theIsBuildFields,
00119 CORBA::Boolean theIsCalculateMinMax);
00120
00121 virtual
00122 CORBA::Boolean
00123 IsFieldsDone();
00124
00125 virtual
00126 void
00127 SetBuildGroups(CORBA::Boolean theIsBuildGroups);
00128
00129 virtual
00130 CORBA::Boolean
00131 IsGroupsDone();
00132
00133 virtual
00134 CORBA::Boolean
00135 IsMinMaxDone();
00136
00137 virtual
00138 CORBA::Boolean
00139 IsPartsDone();
00140
00141 virtual
00142 VISU::Result::EntityNames*
00143 GetMeshNames();
00144
00145 virtual
00146 VISU::Result::Entities*
00147 GetEntities(const char* theMeshName);
00148
00149 virtual
00150 VISU::Result::EntityNames*
00151 GetFamilies(const char* theMeshName,
00152 Entity theEntity);
00153
00154 virtual
00155 VISU::Result::EntityNames*
00156 GetGroups(const char* theMeshName);
00157
00158 virtual
00159 VISU::Result::EntityNames*
00160 GetFields(const char* theMeshName,
00161 Entity theEntity);
00162
00163 virtual
00164 VISU::Result::TimeStampNumbers*
00165 GetTimeStampNumbers(const char* theMeshName,
00166 Entity theEntity,
00167 const char* theFieldName);
00168
00169 virtual
00170 VISU::double_array*
00171 GetTimeStampValues(const char* theMeshName,
00172 Entity theEntity,
00173 const char* theFieldName);
00174
00175 virtual
00176 CORBA::Long
00177 GetNumberOfComponents(const char* theMeshName,
00178 Entity theEntity,
00179 const char* theFieldName);
00180
00181 virtual
00182 VISU::Result::EntityNames*
00183 GetPartNames(const char* theMeshName);
00184
00185 virtual
00186 VISU::Result::Resolutions*
00187 GetResolutions(const char* theMeshName,
00188 const char* thePartName);
00189
00190 virtual
00191 VISU::Result::Resolution
00192 GetResolution(const char* theMeshName,
00193 const char* thePartName);
00194
00195 virtual
00196 void
00197 SetResolution(const char* theMeshName,
00198 const char* thePartName,
00199 VISU::Result::Resolution theResolution);
00200
00201 virtual
00202 void
00203 UpdateObservers();
00204
00205 virtual
00206 void
00207 ConnectObserver(TResultObserver* theObserver,
00208 boost::signalslib::connection& theConnection);
00209
00210 virtual
00211 SALOME_MED::MedFileInfo*
00212 GetMEDFileInfo();
00213
00214 typedef boost::signal0<void> TUpdateObserverSignal;
00215
00216 typedef VISU_Convertor TInput;
00217 typedef boost::shared_ptr<TInput> PInput;
00218
00219 private:
00220 ESourceId mySourceId;
00221 ECreationId myCreationId;
00222
00223 PInput myInput;
00224 std::string myFileName;
00225 QFileInfo myFileInfo;
00226 std::string myInitFileName;
00227
00228 protected:
00229 Result_i(SALOMEDS::Study_ptr theStudy,
00230 const ESourceId& theSourceId,
00231 const ECreationId& theCreationId,
00232 CORBA::Boolean theIsBuildImmediately,
00233 CORBA::Boolean theIsBuildFields,
00234 CORBA::Boolean theIsBuildMinMax,
00235 CORBA::Boolean theIsBuildGroups);
00236
00237 Result_i();
00238
00239 virtual
00240 ~Result_i();
00241
00242 virtual
00243 Storable*
00244 Build(SALOMEDS::SObject_ptr theSObject,
00245 CORBA::Boolean theIsAtOnce = true) ;
00246
00247 virtual
00248 void
00249 BuildDataTree(const std::string& theResultEntry);
00250
00251 virtual
00252 Storable*
00253 BuildAll(SALOMEDS::SObject_ptr theSObject) ;
00254
00255 ESourceId
00256 GetSourceId() const;
00257
00258 _PTR(Study) myStudy;
00259 CORBA::Boolean myIsBuildImmediately;
00260
00261 CORBA::Boolean myIsEntitiesDone;
00262
00263 CORBA::Boolean myIsFieldsDone;
00264 CORBA::Boolean myIsBuildFields;
00265
00266 CORBA::Boolean myIsGroupsDone;
00267 CORBA::Boolean myIsBuildGroups;
00268
00269 CORBA::Boolean myIsPartsDone;
00270 CORBA::Boolean myIsBuildParts;
00271
00272 CORBA::Boolean myIsMinMaxDone;
00273 CORBA::Boolean myIsBuildMinMax;
00274 TUpdateObserverSignal myUpdateObserverSignal;
00275
00276 CORBA::Boolean myIsAllDone;
00277
00278 public:
00279 virtual
00280 size_t
00281 IsPossible();
00282
00283 virtual
00284 Storable*
00285 Create(const char* theFileName);
00286
00287 virtual
00288 Storable*
00289 Create(SALOMEDS::SObject_ptr theMedSObject);
00290
00291 virtual
00292 Storable*
00293 Create(SALOME_MED::FIELD_ptr theField);
00294
00295 virtual
00296 Storable*
00297 Restore(SALOMEDS::SObject_ptr theSObject,
00298 const Storable::TRestoringMap& theMap,
00299 const std::string& thePrefix,
00300 CORBA::Boolean theIsMultiFile);
00301
00302 static
00303 Storable*
00304 StorableEngine(SALOMEDS::SObject_ptr theSObject,
00305 const Storable::TRestoringMap& theMap,
00306 const std::string& thePrefix,
00307 CORBA::Boolean theIsMultiFile);
00308
00309 virtual
00310 void
00311 ToStream(std::ostringstream& theStr);
00312
00313
00314 typedef std::string TFileName;
00315 typedef std::vector<TFileName> TFileNames;
00316
00317 virtual
00318 bool
00319 Save(SALOMEDS::SComponent_ptr theComponent,
00320 const std::string& theURL,
00321 bool theIsMultiFile,
00322 bool theIsASCII,
00323 TFileNames& theFileNames,
00324 TFileNames& theFiles);
00325
00326
00327 virtual
00328 CORBA::Boolean
00329 CanCopy(SALOMEDS::SObject_ptr theObject);
00330
00331 virtual
00332 bool
00333 CopyFrom(SALOMEDS::SObject_ptr theObject,
00334 CORBA::Long& theObjectID,
00335 const std::string& theTmpDir,
00336 TFileNames& theFileNames);
00337
00338
00339 virtual
00340 const char*
00341 GetComment() const;
00342
00343 static const std::string myComment;
00344
00345 virtual
00346 PInput
00347 GetInput(const std::string& theMeshName = "",
00348 VISU::Entity theEntity = VISU::NONE,
00349 const std::string& theFieldName = "",
00350 CORBA::Long theTimeStampNumber = -1);
00351
00352 virtual
00353 std::string
00354 GetInitFileName() const;
00355
00356 virtual
00357 void
00358 SetInitFileName(const std::string& theFileName);
00359
00360 virtual
00361 std::string
00362 GetFileName() const;
00363
00364 QFileInfo
00365 GetFileInfo() const;
00366
00367 ECreationId
00368 GetCreationId() const;
00369
00370 private:
00371 SALOMEDS::SObject_var mySObject;
00372 SALOMEDS::Study_var myStudyDocument;
00373 SALOMEDS::SComponent_var mySComponent;
00374
00375 public:
00376 std::string
00377 GetEntry();
00378
00379 SALOMEDS::SObject_var
00380 GetSObject() const;
00381
00382 SALOMEDS::Study_var
00383 GetStudyDocument() const;
00384
00385 _PTR(Study)
00386 GetStudy() const;
00387
00388 SALOMEDS::SComponent_var
00389 GetSComponent() const;
00390
00391 std::string
00392 GetEntry(const Storable::TRestoringMap& theRestoringMap);
00393
00394
00395 public:
00396 typedef enum { AXIS_X = 0, AXIS_Y, AXIS_Z } TAxis;
00397 typedef std::vector< vtkFloatingPointType > TAxisInfo;
00398 const TAxisInfo* GetAxisInfo(const std::string& theMeshName,
00399 TAxis theAxis,
00400 gp_Dir& thePlaneNormal);
00401
00402
00403 private:
00404 struct TGridInfo {
00405 TAxisInfo myComponets[ 3 ];
00406 gp_Dir myAxis [ 3 ];
00407 };
00408 std::map< std::string, TGridInfo > myMeshName2GridInfoMap;
00409 };
00410
00412 VISU_I_EXPORT
00413 Result_var
00414 FindResult(SALOMEDS::SObject_ptr theSObject);
00415
00417 Result_i*
00418 GetResult(SALOMEDS::Study_ptr theStudy,
00419 const std::string& theResultEntry);
00420 }
00421
00422 #endif