Salome HOME
a999e52f39716a3fd19d671ad8e91ccc7ee9f3e4
[modules/visu.git] / src / VISU_I / VISU_PointMap3d_i.hh
1 // Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 //  VISU OBJECT : interactive object for VISU entities implementation
21 //  File   : VISU_PointMap3d_i.hh
22 //  Author : 
23 //  Module : VISU
24 //
25 #ifndef VISU_PointMap3d_i_HeaderFile
26 #define VISU_PointMap3d_i_HeaderFile
27
28 #include "VISU_PrsObject_i.hh"
29 #include "SALOME_GenericObj_i.hh"
30
31 #include "VISU_TableReader.hxx"
32 #include "VISU_PointMap3dActor.h"
33 #include "VISU_Table_i.hh"
34 #include "VISU_ActorFactory.h"
35 #include "VISU_DeformedGridPL.hxx"
36
37 #include <vtkTimeStamp.h>
38 #include <vtkSmartPointer.h>
39
40 namespace VISU
41 {
42
43   struct TActorFactory;
44
45   //==============================================================================
46   class VISU_I_EXPORT PointMap3d_i : public virtual POA_VISU::PointMap3d,
47                                      public virtual SALOME::GenericObj_i,
48                                      public virtual TActorFactory,
49                                      public virtual Table_i
50   {
51     static int myNbPresent;
52     PointMap3d_i( const PointMap3d_i& );
53   public:
54     PointMap3d_i( SALOMEDS::Study_ptr theStudy, const char* theObjectEntry);
55
56     virtual ~PointMap3d_i();
57     virtual VISU::VISUType GetType() { return VISU::TPOINTMAP3D;};
58
59     virtual void SetTitle( const char* theTitle );
60     virtual char* GetTitle();
61
62     virtual void RemoveFromStudy();
63     virtual void UpdateActor(VISU_ActorBase* thePointMap3dActor);
64     virtual void UpdateActors();
65
66     virtual void Update();
67
68     virtual Handle(SALOME_InteractiveObject) GetIO();
69
70     //----------- override Prs3d methods -----------------------------
71
72     //! Move the 3D presentation according to the given offset parameters
73     virtual void SetOffset(CORBA::Float theDx, CORBA::Float theDy, CORBA::Float theDz);
74
75     //! Gets offset parameters for the 3D presentation
76     virtual void GetOffset(CORBA::Float& theDx, CORBA::Float& theDy, CORBA::Float& theDz);
77
78     //! Do nothing, just for compilability
79     virtual void SetMarkerStd(VISU::MarkerType, VISU::MarkerScale);
80     virtual void SetMarkerTexture(CORBA::Long);
81     virtual VISU::MarkerType GetMarkerType();
82     virtual VISU::MarkerScale GetMarkerScale();
83     virtual CORBA::Long GetMarkerTexture();
84
85     //! Gets memory size actually used by the presentation (Mb).
86     virtual CORBA::Float GetMemorySize();
87
88     //----------- override ColoredPrs3dBase methods ------------------
89
90     virtual CORBA::Double GetMin();
91     virtual CORBA::Double GetMax();
92     virtual CORBA::Double GetMinTableValue();
93     virtual CORBA::Double GetMaxTableValue();
94     virtual void SetRange(CORBA::Double theMin, CORBA::Double theMax);
95
96     virtual CORBA::Double GetSourceMin();
97     virtual CORBA::Double GetSourceMax();
98     virtual void SetSourceRange();
99
100     virtual CORBA::Boolean IsRangeFixed();
101
102     virtual void SetPosition(CORBA::Double X, CORBA::Double Y);
103     virtual CORBA::Double GetPosX();
104     virtual CORBA::Double GetPosY();
105
106     virtual void SetSize(CORBA::Double theWidth, CORBA::Double theHeight);
107
108     virtual void SetRatios(CORBA::Long theTitleSize, CORBA::Long theLabelSize, 
109                            CORBA::Long theBarWidth, CORBA::Long theBarHeight);
110
111     virtual CORBA::Double GetWidth();
112     virtual CORBA::Double GetHeight();
113
114     virtual void SetNbColors(CORBA::Long theNbColors);
115     virtual CORBA::Long GetNbColors();
116
117     virtual void SetLabels(CORBA::Long theNbLabels);
118     virtual CORBA::Long GetLabels();
119
120     virtual void  SetLabelsFormat(const char* theFormat);
121     virtual char* GetLabelsFormat();
122     
123     virtual void SetBarOrientation(VISU::ColoredPrs3dBase::Orientation theOrientation);
124     virtual VISU::ColoredPrs3dBase::Orientation GetBarOrientation();
125
126     void UseFixedRange(bool theUseFixedRange);
127
128     // ScaledMap Methods
129
130     virtual VISU::Scaling GetScaling();
131     virtual void SetScaling(VISU::Scaling theScaling);
132
133     bool IsPositiveTable();
134
135     // Plot3dBase methods
136
137     void SetScaleFactor (CORBA::Double theScaleFactor);
138     CORBA::Double GetScaleFactor();
139
140     void SetContourPrs (CORBA::Boolean theIsContourPrs );
141     CORBA::Boolean GetIsContourPrs();
142
143     void SetNbOfContours (CORBA::Long);
144     CORBA::Long GetNbOfContours();
145
146     VISU_DeformedGridPL* GetSpecificPL() const { return myTablePL; }
147
148     // TActorFactory Methods
149
150     //! Gets know whether the factory instance can be used for actor management or not
151     virtual bool GetActiveState();
152
153     virtual void SetActiveState(bool theState);
154
155     //! Return modified time of the factory
156     virtual unsigned long int GetMTime();
157
158     //! To unregister the actor
159     virtual void RemoveActor(VISU_ActorBase* theActor);
160     virtual void RemoveActors();
161
162     //------ Text Properties & Label Properties ------------------------
163
164     virtual bool IsBoldTitle();
165     virtual void SetBoldTitle(bool isBold);
166     virtual bool IsItalicTitle();
167     virtual void SetItalicTitle(bool isItalic);
168     virtual bool IsShadowTitle();
169     virtual void SetShadowTitle(bool isShadow);
170     virtual int  GetTitFontType();
171     virtual void SetTitFontType(int theType);
172     virtual void GetTitleColor(vtkFloatingPointType& theR, 
173                  vtkFloatingPointType& theG, 
174                  vtkFloatingPointType& theB);
175     virtual void SetTitleColor(vtkFloatingPointType theR, 
176                  vtkFloatingPointType theG, 
177                  vtkFloatingPointType theB);    
178
179     virtual bool IsBoldLabel();
180     virtual void SetBoldLabel(bool isBold);
181     virtual bool IsItalicLabel();
182     virtual void SetItalicLabel(bool isItalic);
183     virtual bool IsShadowLabel();
184     virtual void SetShadowLabel(bool isShadow);
185     virtual int  GetLblFontType();
186     virtual void SetLblFontType(int theType);
187     virtual void GetLabelColor(vtkFloatingPointType& theR, 
188                  vtkFloatingPointType& theG, 
189                  vtkFloatingPointType& theB);
190     virtual void SetLabelColor(vtkFloatingPointType theR, 
191                  vtkFloatingPointType theG, 
192                  vtkFloatingPointType theB);
193
194     //-------------------------------------------------------------------
195     virtual CORBA::Long GetTitleSize();
196     virtual CORBA::Long GetLabelSize();
197     virtual CORBA::Long GetBarWidth();
198     virtual CORBA::Long GetBarHeight();
199
200     virtual void SetUnitsVisible(CORBA::Boolean isVisible);
201     virtual CORBA::Boolean IsUnitsVisible();
202
203     //-------------------------------------------------------------------
204
205   protected:
206     Storable* Build(int theRestoring);
207
208     VISU::Table::Orientation myOrientation;
209     VISU::ColoredPrs3dBase::Orientation myBarOrientation;
210     std::string              myTitle;
211     std::string              myScalarBarTitle;
212     bool                     myIsUnits;
213     SALOMEDS::SObject_var    mySObj;
214     int                      myNumberOfLabels;
215     std::string              myLabelsFormat;
216     vtkFloatingPointType     myPosition[2],
217                              myWidth, myHeight,
218                              myTitleSize,
219                              myLabelSize, 
220                              myBarWidth, myBarHeight;
221     bool                     myIsFixedRange;
222     CORBA::Float             myOffset[3];
223     bool                     myIsActiveState;
224     vtkTimeStamp             myParamsTime;
225     vtkTimeStamp             myUpdateTime;
226
227     Handle(SALOME_InteractiveObject) myIO;
228
229
230     //Font management
231     bool myIsBoldTitle;
232     bool myIsItalicTitle;
233     bool myIsShadowTitle;
234     int  myTitFontType;
235     vtkFloatingPointType myTitleColor[3];
236
237     bool myIsBoldLabel;
238     bool myIsItalicLabel;
239     bool myIsShadowLabel;
240     int  myLblFontType;
241     vtkFloatingPointType myLabelColor[3];
242
243     boost::signal0<void> myUpdateActorsSignal;
244     boost::signal0<void> myRemoveActorsFromRendererSignal;
245     vtkSmartPointer<vtkActorCollection> myActorCollection;
246
247   public:
248     //    virtual Storable* Create( const VISU::PTableIDMapper& theTableIDMapper );
249     virtual Storable*       Create();
250     VISU_PointMap3dActor*   CreateActor();
251     VISU::PTableIDMapper    GetTableIDMapper();
252
253     SALOMEDS::SObject_var GetSObject() const;
254     VISU_DeformedGridPL*  myTablePL;
255
256     virtual Storable* Restore( const Storable::TRestoringMap& theMap,
257                                SALOMEDS::SObject_ptr SO);
258
259     static Storable* StorableEngine(SALOMEDS::SObject_ptr theSObject,
260                                     const Storable::TRestoringMap& theMap,
261                                     const std::string& thePrefix,
262                                     CORBA::Boolean theIsMultiFile);
263
264     virtual void ToStream( std::ostringstream& theStr );
265     static const std::string myComment;
266     virtual const char* GetComment() const;
267     virtual QString GenerateName();
268     virtual QString GetTableTitle();
269
270     virtual std::string GetObjectEntry();
271   };
272 }
273
274 #endif