1 // Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // VISU OBJECT : interactive object for VISU entities implementation
21 // File : VISU_PointMap3d_i.hh
25 #ifndef VISU_PointMap3d_i_HeaderFile
26 #define VISU_PointMap3d_i_HeaderFile
28 #include "VISU_PrsObject_i.hh"
29 #include "SALOME_GenericObj_i.hh"
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"
37 #include <vtkTimeStamp.h>
38 #include <vtkSmartPointer.h>
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
51 static int myNbPresent;
52 PointMap3d_i( const PointMap3d_i& );
54 PointMap3d_i( SALOMEDS::Study_ptr theStudy, const char* theObjectEntry);
56 virtual ~PointMap3d_i();
57 virtual VISU::VISUType GetType() { return VISU::TPOINTMAP3D;};
59 virtual void SetTitle( const char* theTitle );
60 virtual char* GetTitle();
62 virtual void RemoveFromStudy();
63 virtual void UpdateActor(VISU_ActorBase* thePointMap3dActor);
64 virtual void UpdateActors();
66 virtual void Update();
68 virtual Handle(SALOME_InteractiveObject) GetIO();
70 //----------- override Prs3d methods -----------------------------
72 //! Move the 3D presentation according to the given offset parameters
73 virtual void SetOffset(CORBA::Float theDx, CORBA::Float theDy, CORBA::Float theDz);
75 //! Gets offset parameters for the 3D presentation
76 virtual void GetOffset(CORBA::Float& theDx, CORBA::Float& theDy, CORBA::Float& theDz);
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();
85 //! Gets memory size actually used by the presentation (Mb).
86 virtual CORBA::Float GetMemorySize();
88 //----------- override ColoredPrs3dBase methods ------------------
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);
96 virtual CORBA::Double GetSourceMin();
97 virtual CORBA::Double GetSourceMax();
98 virtual void SetSourceRange();
100 virtual CORBA::Boolean IsRangeFixed();
102 virtual void SetPosition(CORBA::Double X, CORBA::Double Y);
103 virtual CORBA::Double GetPosX();
104 virtual CORBA::Double GetPosY();
106 virtual void SetSize(CORBA::Double theWidth, CORBA::Double theHeight);
108 virtual void SetRatios(CORBA::Long theTitleSize, CORBA::Long theLabelSize,
109 CORBA::Long theBarWidth, CORBA::Long theBarHeight);
111 virtual CORBA::Double GetWidth();
112 virtual CORBA::Double GetHeight();
114 virtual void SetNbColors(CORBA::Long theNbColors);
115 virtual CORBA::Long GetNbColors();
117 virtual void SetLabels(CORBA::Long theNbLabels);
118 virtual CORBA::Long GetLabels();
120 virtual void SetLabelsFormat(const char* theFormat);
121 virtual char* GetLabelsFormat();
123 virtual void SetBarOrientation(VISU::ColoredPrs3dBase::Orientation theOrientation);
124 virtual VISU::ColoredPrs3dBase::Orientation GetBarOrientation();
126 void UseFixedRange(bool theUseFixedRange);
130 virtual VISU::Scaling GetScaling();
131 virtual void SetScaling(VISU::Scaling theScaling);
133 bool IsPositiveTable();
135 // Plot3dBase methods
137 void SetScaleFactor (CORBA::Double theScaleFactor);
138 CORBA::Double GetScaleFactor();
140 void SetContourPrs (CORBA::Boolean theIsContourPrs );
141 CORBA::Boolean GetIsContourPrs();
143 void SetNbOfContours (CORBA::Long);
144 CORBA::Long GetNbOfContours();
146 VISU_DeformedGridPL* GetSpecificPL() const { return myTablePL; }
148 // TActorFactory Methods
150 //! Gets know whether the factory instance can be used for actor management or not
151 virtual bool GetActiveState();
153 virtual void SetActiveState(bool theState);
155 //! Return modified time of the factory
156 virtual unsigned long int GetMTime();
158 //! To unregister the actor
159 virtual void RemoveActor(VISU_ActorBase* theActor);
160 virtual void RemoveActors();
162 //------ Text Properties & Label Properties ------------------------
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);
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);
194 //-------------------------------------------------------------------
195 virtual CORBA::Long GetTitleSize();
196 virtual CORBA::Long GetLabelSize();
197 virtual CORBA::Long GetBarWidth();
198 virtual CORBA::Long GetBarHeight();
200 virtual void SetUnitsVisible(CORBA::Boolean isVisible);
201 virtual CORBA::Boolean IsUnitsVisible();
203 //-------------------------------------------------------------------
206 Storable* Build(int theRestoring);
208 VISU::Table::Orientation myOrientation;
209 VISU::ColoredPrs3dBase::Orientation myBarOrientation;
211 std::string myScalarBarTitle;
213 SALOMEDS::SObject_var mySObj;
214 int myNumberOfLabels;
215 std::string myLabelsFormat;
216 vtkFloatingPointType myPosition[2],
220 myBarWidth, myBarHeight;
222 CORBA::Float myOffset[3];
223 bool myIsActiveState;
224 vtkTimeStamp myParamsTime;
225 vtkTimeStamp myUpdateTime;
227 Handle(SALOME_InteractiveObject) myIO;
232 bool myIsItalicTitle;
233 bool myIsShadowTitle;
235 vtkFloatingPointType myTitleColor[3];
238 bool myIsItalicLabel;
239 bool myIsShadowLabel;
241 vtkFloatingPointType myLabelColor[3];
243 boost::signal0<void> myUpdateActorsSignal;
244 boost::signal0<void> myRemoveActorsFromRendererSignal;
245 vtkSmartPointer<vtkActorCollection> myActorCollection;
248 // virtual Storable* Create( const VISU::PTableIDMapper& theTableIDMapper );
249 virtual Storable* Create();
250 VISU_PointMap3dActor* CreateActor();
251 VISU::PTableIDMapper GetTableIDMapper();
253 SALOMEDS::SObject_var GetSObject() const;
254 VISU_DeformedGridPL* myTablePL;
256 virtual Storable* Restore( const Storable::TRestoringMap& theMap,
257 SALOMEDS::SObject_ptr SO);
259 static Storable* StorableEngine(SALOMEDS::SObject_ptr theSObject,
260 const Storable::TRestoringMap& theMap,
261 const std::string& thePrefix,
262 CORBA::Boolean theIsMultiFile);
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();
270 virtual std::string GetObjectEntry();