1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // VISU OBJECT : interactive object for VISU entities implementation
23 // File : VISU_PointMap3d_i.hh
27 #ifndef VISU_PointMap3d_i_HeaderFile
28 #define VISU_PointMap3d_i_HeaderFile
30 #include "VISU_PrsObject_i.hh"
31 #include "SALOME_GenericObj_i.hh"
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"
39 #include <vtkTimeStamp.h>
40 #include <vtkSmartPointer.h>
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
53 static int myNbPresent;
54 PointMap3d_i( const PointMap3d_i& );
56 PointMap3d_i( SALOMEDS::Study_ptr theStudy, const char* theObjectEntry);
58 virtual ~PointMap3d_i();
59 virtual VISU::VISUType GetType() { return VISU::TPOINTMAP3D;};
61 virtual void SetTitle( const char* theTitle );
62 virtual char* GetTitle();
64 virtual void RemoveFromStudy();
65 virtual void UpdateActor(VISU_ActorBase* thePointMap3dActor);
66 virtual void UpdateActors();
68 virtual void Update();
70 virtual Handle(SALOME_InteractiveObject) GetIO();
72 //----------- override Prs3d methods -----------------------------
74 //! Move the 3D presentation according to the given offset parameters
75 virtual void SetOffset(CORBA::Float theDx, CORBA::Float theDy, CORBA::Float theDz);
77 //! Gets offset parameters for the 3D presentation
78 virtual void GetOffset(CORBA::Float& theDx, CORBA::Float& theDy, CORBA::Float& theDz);
80 //! Gets memory size actually used by the presentation (Mb).
81 virtual CORBA::Float GetMemorySize();
83 //----------- override ColoredPrs3dBase methods ------------------
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);
91 virtual CORBA::Double GetSourceMin();
92 virtual CORBA::Double GetSourceMax();
93 virtual void SetSourceRange();
95 virtual CORBA::Boolean IsRangeFixed();
97 virtual void SetPosition(CORBA::Double X, CORBA::Double Y);
98 virtual CORBA::Double GetPosX();
99 virtual CORBA::Double GetPosY();
101 virtual void SetSize(CORBA::Double theWidth, CORBA::Double theHeight);
103 virtual void SetRatios(CORBA::Long theTitleSize, CORBA::Long theLabelSize,
104 CORBA::Long theBarWidth, CORBA::Long theBarHeight);
106 virtual CORBA::Double GetWidth();
107 virtual CORBA::Double GetHeight();
109 virtual void SetNbColors(CORBA::Long theNbColors);
110 virtual CORBA::Long GetNbColors();
112 virtual void SetLabels(CORBA::Long theNbLabels);
113 virtual CORBA::Long GetLabels();
115 virtual void SetLabelsFormat(const char* theFormat);
116 virtual char* GetLabelsFormat();
118 virtual void SetBarOrientation(VISU::ColoredPrs3dBase::Orientation theOrientation);
119 virtual VISU::ColoredPrs3dBase::Orientation GetBarOrientation();
121 void UseFixedRange(bool theUseFixedRange);
125 virtual VISU::Scaling GetScaling();
126 virtual void SetScaling(VISU::Scaling theScaling);
128 bool IsPositiveTable();
130 // Plot3dBase methods
132 void SetScaleFactor (CORBA::Double theScaleFactor);
133 CORBA::Double GetScaleFactor();
135 void SetContourPrs (CORBA::Boolean theIsContourPrs );
136 CORBA::Boolean GetIsContourPrs();
138 void SetNbOfContours (CORBA::Long);
139 CORBA::Long GetNbOfContours();
141 VISU_DeformedGridPL* GetSpecificPL() const { return myTablePL; }
143 // TActorFactory Methods
145 //! Gets know whether the factory instance can be used for actor management or not
146 virtual bool GetActiveState();
148 virtual void SetActiveState(bool theState);
150 //! Return modified time of the factory
151 virtual unsigned long int GetMTime();
153 //! To unregister the actor
154 virtual void RemoveActor(VISU_ActorBase* theActor);
155 virtual void RemoveActors();
157 //------ Text Properties & Label Properties ------------------------
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);
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);
189 //-------------------------------------------------------------------
190 virtual CORBA::Long GetTitleSize();
191 virtual CORBA::Long GetLabelSize();
192 virtual CORBA::Long GetBarWidth();
193 virtual CORBA::Long GetBarHeight();
195 virtual void SetUnitsVisible(CORBA::Boolean isVisible);
196 virtual CORBA::Boolean IsUnitsVisible();
198 //-------------------------------------------------------------------
201 Storable* Build(int theRestoring);
203 VISU::Table::Orientation myOrientation;
204 VISU::ColoredPrs3dBase::Orientation myBarOrientation;
206 std::string myScalarBarTitle;
208 SALOMEDS::SObject_var mySObj;
209 int myNumberOfLabels;
210 std::string myLabelsFormat;
211 vtkFloatingPointType myPosition[2],
215 myBarWidth, myBarHeight;
217 CORBA::Float myOffset[3];
218 bool myIsActiveState;
219 vtkTimeStamp myParamsTime;
220 vtkTimeStamp myUpdateTime;
222 Handle(SALOME_InteractiveObject) myIO;
227 bool myIsItalicTitle;
228 bool myIsShadowTitle;
230 vtkFloatingPointType myTitleColor[3];
233 bool myIsItalicLabel;
234 bool myIsShadowLabel;
236 vtkFloatingPointType myLabelColor[3];
238 boost::signal0<void> myUpdateActorsSignal;
239 boost::signal0<void> myRemoveActorsFromRendererSignal;
240 vtkSmartPointer<vtkActorCollection> myActorCollection;
243 // virtual Storable* Create( const VISU::PTableIDMapper& theTableIDMapper );
244 virtual Storable* Create();
245 VISU_PointMap3dActor* CreateActor();
246 VISU::PTableIDMapper GetTableIDMapper();
248 SALOMEDS::SObject_var GetSObject() const;
249 VISU_DeformedGridPL* myTablePL;
251 virtual Storable* Restore( const Storable::TRestoringMap& theMap,
252 SALOMEDS::SObject_ptr SO);
254 static Storable* StorableEngine(SALOMEDS::SObject_ptr theSObject,
255 const Storable::TRestoringMap& theMap,
256 const std::string& thePrefix,
257 CORBA::Boolean theIsMultiFile);
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();
265 virtual std::string GetObjectEntry();