Salome HOME
Improvement: Bug PAL10401 wrong sens in cut line
[modules/visu.git] / src / VISU_I / VISU_Result_i.hh
1 //  VISU OBJECT : interactive object for VISU entities implementation
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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.
10 //
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.
15 //
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
19 //
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
21 //
22 //
23 //  File   : VISU_Result_i.hh
24 //  Author : Alexey PETROV
25 //  Module : VISU
26
27 #ifndef __VISU_RESULT_I_H__
28 #define __VISU_RESULT_I_H__
29
30 #include "VISUConfig.hh"
31 #include "SALOME_GenericObj_i.hh"
32
33 #include <gp_Dir.hxx>
34
35 #include <vector>
36
37 class VISU_Convertor;
38
39 namespace VISU{
40   class Result_i : public virtual POA_VISU::Result,
41                    public virtual RemovableObject_i,
42                    public virtual SALOME::GenericObj_i
43   {
44     Result_i();
45     Result_i(const Result_i &);
46
47   public:
48     enum ESourceId {eRestoredComponent = -2, eRestoredFile = -1, eFile = 1, eComponent = 2};
49     enum ECreationId {eImportFile, eCopyAndImportFile, eImportMed, eImportMedField};
50
51     Result_i(SALOMEDS::Study_ptr theStudy,
52              const ESourceId& theSourceId,
53              const ECreationId& theCreationId);
54
55     virtual ~Result_i();
56     virtual void RemoveFromStudy();
57
58     virtual VISU::VISUType GetType() { return VISU::TRESULT;}
59     virtual CORBA::Boolean BuildAll();
60
61     typedef VISU_Convertor TInput;
62
63   private:
64     ESourceId mySourceId;
65     ECreationId myCreationId;
66
67     TInput *myInput;
68     CORBA::Boolean myIsDone;
69     std::string myName, myInitFileName;
70     QFileInfo myFileInfo;
71
72   protected:
73     virtual Storable* Build(SALOMEDS::SObject_ptr theSObject = SALOMEDS::SObject::_nil()) ;
74
75   public:
76     virtual int IsPossible();
77
78     virtual Storable* Create(const char* theFileName);
79     virtual Storable* Create(SALOMEDS::SObject_ptr theMedSObject);
80     virtual Storable* Create(SALOME_MED::FIELD_ptr theField);
81
82     virtual Storable* Restore(SALOMEDS::SObject_ptr theSObject,
83                               const Storable::TRestoringMap& theMap,
84                               const std::string& thePrefix);
85
86     static Storable* Restore(SALOMEDS::SObject_ptr theSObject,
87                              const std::string& thePrefix,
88                              const Storable::TRestoringMap& theMap);
89
90     virtual void ToStream(std::ostringstream& theStr);
91     virtual const char* GetComment() const;
92     static const std::string myComment;
93     TInput* GetInput();
94
95     const std::string& GetName() const { return myName;}
96     const QFileInfo& GetFileInfo() const { return myFileInfo;}
97     const std::string& GetFileName() const { return myInitFileName;}
98     const ECreationId& GetCreationId() const { return myCreationId;}
99
100   private:
101     SALOMEDS::SObject_var mySObject;
102     SALOMEDS::Study_var myStudyDocument;
103     SALOMEDS::SComponent_var mySComponent;
104
105   public:
106     std::string GetRefFatherEntry();
107     std::string GetEntry();
108     const SALOMEDS::SObject_var& GetSObject() const;
109     const SALOMEDS::Study_var& GetStudyDocument() const;
110     const SALOMEDS::SComponent_var& GetSComponent() const;
111     std::string GetEntry(const std::string& theComment);
112
113     // Info on structured mesh contained in TInput
114   public:
115     typedef enum { AXIS_X = 0, AXIS_Y, AXIS_Z } TAxis;
116     const std::vector< float >* GetAxisInfo(const std::string& theMeshName,
117                                             TAxis              theAxis,
118                                             gp_Dir&            thePlaneNormal);
119     // Return i,j or k values and cutting plane normal for theAxis.
120     // In the case of any problems, return NULL pointer
121   private:
122     struct TGridInfo {
123       std::vector< float > myComponets[ 3 ];
124       gp_Dir               myAxis     [ 3 ];
125     };
126     map< string, TGridInfo > myMeshName2GridInfoMap;
127   };
128
129   Result_var FindResult(SALOMEDS::SObject_ptr theSObject);
130 }
131
132 #endif