X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FVISU_I%2FVISU_Result_i.hh;h=b04fc0d5c85809b58eb3c68fabcb807562159daf;hb=e967b0415406f4f86ca2c9489abc8554b4c15dae;hp=4b5a30b1789b1997d3ed1902d47c4ac2e65179f4;hpb=a616d40f9eee86639c188d8a115a9a9c85a31e60;p=modules%2Fvisu.git diff --git a/src/VISU_I/VISU_Result_i.hh b/src/VISU_I/VISU_Result_i.hh index 4b5a30b1..b04fc0d5 100644 --- a/src/VISU_I/VISU_Result_i.hh +++ b/src/VISU_I/VISU_Result_i.hh @@ -1,71 +1,197 @@ -// File: VISU_Result_i.hh -// Created: Fri Jan 10 12:36:38 2003 -// Author: Alexey PETROV -// +// VISU OBJECT : interactive object for VISU entities implementation +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// File : VISU_Result_i.hh +// Author : Alexey PETROV +// Module : VISU #ifndef __VISU_RESULT_I_H__ #define __VISU_RESULT_I_H__ #include "VISUConfig.hh" +#include "VISU_BoostSignals.h" +#include "SALOME_GenericObj_i.hh" + +#include "VTKViewer.h" + +#include +#include -class vtkUnstructuredGridReader; -class vtkUnstructuredGrid; class VISU_Convertor; -class FieldInfo; -class QAD_Study; -namespace VISU{ +namespace VISU +{ + //---------------------------------------------------------------------------- + class MinMaxCunsomer: public virtual boost::signalslib::trackable + { + protected: + bool myMinMaxIsInitilized; + MinMaxCunsomer(); + + public: + virtual + bool + IsMinMaxInitilized(); + + virtual + void + UpdateMinMax(); + }; + + + //---------------------------------------------------------------------------- class Result_i : public virtual POA_VISU::Result, - public virtual Storable + public virtual RemovableObject_i, + public virtual SALOME::GenericObj_i { Result_i(); Result_i(const Result_i &); + public: - Result_i(SALOMEDS::Study_ptr theStudy); + enum ESourceId {eRestoredComponent = -2, eRestoredFile = -1, eFile = 1, eComponent = 2}; + enum ECreationId {eImportFile, eCopyAndImportFile, eImportMed, eImportMedField}; + + Result_i(SALOMEDS::Study_ptr theStudy, + const ESourceId& theSourceId, + const ECreationId& theCreationId, + CORBA::Boolean theIsBuildImmediately = true, + CORBA::Boolean theIsBuildFields = true, + CORBA::Boolean theIsBuildMinMax = true, + CORBA::Boolean theIsBuildGroups = true); + virtual ~Result_i(); + virtual void RemoveFromStudy(); + + virtual VISU::VISUType GetType() { return VISU::TRESULT;} + virtual CORBA::Boolean BuildAll(); + + virtual CORBA::Boolean Build(CORBA::Boolean theIsBuildAll, + CORBA::Boolean theIsAtOnce); + virtual CORBA::Boolean IsDone(); + + virtual CORBA::Boolean IsEntitiesDone(); + + virtual void SetBuildFields(CORBA::Boolean theIsBuildFields, + CORBA::Boolean theIsCalculateMinMax); + virtual CORBA::Boolean IsFieldsDone(); + + virtual void SetBuildGroups(CORBA::Boolean theIsBuildGroups); + virtual CORBA::Boolean IsGroupsDone(); + + virtual CORBA::Boolean IsMinMaxDone(); + + virtual + void + MinMaxConnect(MinMaxCunsomer* theMinMaxCunsomer); + + typedef boost::signal0 TUpdateMinMaxSignal; - virtual VISU::VISUType GetType() { return VISU::TRESULT;}; + typedef VISU_Convertor TInput; - typedef VISU_Convertor InputType; - typedef vtkUnstructuredGridReader OutputType; private: - InputType *myInput; - string myName; + ESourceId mySourceId; + ECreationId myCreationId; + + TInput *myInput; + std::string myName, myInitFileName; QFileInfo myFileInfo; - int myIsRestored; + protected: - virtual Storable* Build(); + virtual Storable* Build(SALOMEDS::SObject_ptr theSObject, + CORBA::Boolean theIsAtOnce = true) ; + virtual Storable* BuildAll(SALOMEDS::SObject_ptr theSObject) ; + + _PTR(Study) myStudy; + CORBA::Boolean myIsBuildImmediately; + + CORBA::Boolean myIsEntitiesDone; + CORBA::Boolean myIsFieldsDone; + CORBA::Boolean myIsGroupsDone; + CORBA::Boolean myIsMinMaxDone; + + CORBA::Boolean myIsBuildFields; + CORBA::Boolean myIsBuildGroups; + + CORBA::Boolean myIsBuildMinMax; + TUpdateMinMaxSignal myUpdateMinMaxSignal; + + CORBA::Boolean myIsAllDone; + public: + virtual int IsPossible(); + virtual Storable* Create(const char* theFileName); + virtual Storable* Create(SALOMEDS::SObject_ptr theMedSObject); virtual Storable* Create(SALOME_MED::FIELD_ptr theField); - virtual Storable* Create(SALOME_MED::MESH_ptr theMesh); - virtual Storable* Create(SALOME_MED::SUPPORT_ptr theSupport); - virtual Storable* Restore(SALOMEDS::SObject_ptr theSObject, - const string& thePrefix, const Storable::TRestoringMap& theMap) - throw(std::logic_error&); - virtual void ToStream(ostrstream& theStr); + + virtual Storable* Restore(SALOMEDS::SObject_ptr theSObject, + const Storable::TRestoringMap& theMap, + const std::string& thePrefix); + + static Storable* Restore(SALOMEDS::SObject_ptr theSObject, + const std::string& thePrefix, + const Storable::TRestoringMap& theMap); + + virtual void ToStream(std::ostringstream& theStr); virtual const char* GetComment() const; - static const string myComment; - InputType* GetInput() { return myInput;} - const char* GetName() const { return myName.c_str();} + static const std::string myComment; + TInput* GetInput(); + + const std::string& GetName() const { return myName;} const QFileInfo& GetFileInfo() const { return myFileInfo;} - int IsRestored() const { return myIsRestored;} + const std::string& GetFileName() const { return myInitFileName;} + const ECreationId& GetCreationId() const { return myCreationId;} + private: SALOMEDS::SObject_var mySObject; SALOMEDS::Study_var myStudyDocument; SALOMEDS::SComponent_var mySComponent; + public: - string GetRefFatherEntry(); - string GetEntry(); + std::string GetRefFatherEntry(); + std::string GetEntry(); const SALOMEDS::SObject_var& GetSObject() const; const SALOMEDS::Study_var& GetStudyDocument() const; const SALOMEDS::SComponent_var& GetSComponent() const; + std::string GetEntry(const std::string& theComment); + + // Info on structured mesh contained in TInput + public: + typedef enum { AXIS_X = 0, AXIS_Y, AXIS_Z } TAxis; + typedef std::vector< vtkFloatingPointType > TAxisInfo; + const TAxisInfo* GetAxisInfo(const std::string& theMeshName, + TAxis theAxis, + gp_Dir& thePlaneNormal); + // Return i,j or k values and cutting plane normal for theAxis. + // In the case of any problems, return NULL pointer + private: + struct TGridInfo { + TAxisInfo myComponets[ 3 ]; + gp_Dir myAxis [ 3 ]; + }; + std::map< std::string, TGridInfo > myMeshName2GridInfoMap; }; - Storable* ResultRestore(SALOMEDS::SObject_ptr theSObject, - const string& thePrefix, const Storable::TRestoringMap& theMap) - throw(std::logic_error&); + Result_var FindResult(SALOMEDS::SObject_ptr theSObject); - QString GenerateName(const string& theFmt, int theId); - void WriteToFile(vtkUnstructuredGrid* theDataSet, const string& theFileName); } + #endif