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