1 // VISU OBJECT : interactive object for VISU entities implementation
3 // Copyright (C) 2003 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
23 // File : VISU_PrsObject_i.hxx
24 // Author : Alexey PETROV
27 #ifndef VISU_ScalarMap_i_HeaderFile
28 #define VISU_ScalarMap_i_HeaderFile
30 #include "VISU_Prs3d_i.hh"
32 class VISU_ScalarMapPL;
35 class ScalarMap_i : public virtual POA_VISU::ScalarMap,
36 public virtual Prs3d_i
38 static int myNbPresent;
40 ScalarMap_i(const ScalarMap_i&);
44 ScalarMap_i(Result_i* theResult,
47 ScalarMap_i(Result_i* theResult,
48 SALOMEDS::SObject_ptr theSObject);
49 virtual void SameAs(const ScalarMap_i* theOrigin);
50 virtual ~ScalarMap_i();
51 virtual void RemoveFromStudy();
53 virtual VISU::VISUType GetType() { return VISU::TSCALARMAP;};
55 virtual CORBA::Long GetScalarMode();
56 virtual void SetScalarMode(CORBA::Long theScalarMode);
58 virtual VISU::Scaling GetScaling();
59 virtual void SetScaling(VISU::Scaling theScaling);
61 virtual void SetRange(CORBA::Double theMin, CORBA::Double theMax);
62 virtual CORBA::Double GetMin();
63 virtual CORBA::Double GetMax();
65 virtual void SetNbColors(CORBA::Long theNbColors);
66 virtual CORBA::Long GetNbColors();
68 virtual void SetBarOrientation(VISU::ScalarMap::Orientation theOrientation){
69 myOrientation = theOrientation;
71 virtual VISU::ScalarMap::Orientation GetBarOrientation() { return myOrientation;}
73 virtual void SetPosition(CORBA::Double X, CORBA::Double Y) { myPosition[0] = X; myPosition[1] = Y;}
74 virtual CORBA::Double GetPosX() { return myPosition[0];}
75 virtual CORBA::Double GetPosY() { return myPosition[1];}
77 virtual void SetSize(CORBA::Double theWidth, CORBA::Double theHeight) {
78 myWidth = theWidth; myHeight = theHeight;
80 virtual CORBA::Double GetWidth() { return myWidth;}
81 virtual CORBA::Double GetHeight() { return myHeight;}
83 virtual void SetLabels(CORBA::Long theNbLabels) { myNumberOfLabels = theNbLabels;}
84 virtual CORBA::Long GetLabels() { return myNumberOfLabels;}
86 virtual void SetTitle(const char* theName) { myTitle = theName;}
87 virtual char* GetTitle() { return CORBA::string_dup(myTitle.c_str());}
89 virtual bool IsBoldTitle() { return myIsBoldTitle;}
90 virtual void SetBoldTitle(bool isBold) { myIsBoldTitle = isBold;}
92 virtual bool IsItalicTitle() { return myIsItalicTitle;}
93 virtual void SetItalicTitle(bool isItalic) { myIsItalicTitle = isItalic;}
95 virtual bool IsShadowTitle() { return myIsShadowTitle;}
96 virtual void SetShadowTitle(bool isShadow) { myIsShadowTitle = isShadow;}
98 virtual int GetTitFontType() { return myTitFontType;}
99 virtual void SetTitFontType(int theType) { myTitFontType = theType;}
101 virtual void GetTitleColor(float* theR, float* theG, float* theB)
102 {*theR = myTitleColor[0]; *theG = myTitleColor[1]; *theB = myTitleColor[2];}
103 virtual void SetTitleColor(float theR, float theG, float theB)
104 {myTitleColor[0] = theR; myTitleColor[1] = theG; myTitleColor[2] = theB; }
107 virtual bool IsBoldLabel() { return myIsBoldLabel;}
108 virtual void SetBoldLabel(bool isBold) { myIsBoldLabel = isBold;}
110 virtual bool IsItalicLabel() { return myIsItalicLabel;}
111 virtual void SetItalicLabel(bool isItalic) { myIsItalicLabel = isItalic;}
113 virtual bool IsShadowLabel() { return myIsShadowLabel;}
114 virtual void SetShadowLabel(bool isShadow) {myIsShadowLabel = isShadow;}
116 virtual int GetLblFontType() { return myLblFontType;}
117 virtual void SetLblFontType(int theType) { myLblFontType = theType;}
119 virtual void GetLabelColor(float* theR, float* theG, float* theB)
120 {*theR = myLabelColor[0]; *theG = myLabelColor[1]; *theB = myLabelColor[2];}
121 virtual void SetLabelColor(float theR, float theG, float theB)
122 {myLabelColor[0] = theR; myLabelColor[1] = theG; myLabelColor[2] = theB; }
124 typedef VISU::ScalarMap TInterface;
125 VISU_ScalarMapPL* GetScalarMapPL(){ return myScalarMapPL;}
128 Storable* Build(int theRestoring);
129 virtual void DoHook();
131 VISU_ScalarMapPL* myScalarMapPL;
134 // std::string myMeshName; move it to Prs3d_i
136 std::string myFieldName;
142 int myNumberOfLabels;
143 float myPosition[2], myWidth, myHeight;
144 VISU::ScalarMap::Orientation myOrientation;
148 bool myIsItalicTitle;
149 bool myIsShadowTitle;
151 float myTitleColor[3];
154 bool myIsItalicLabel;
155 bool myIsShadowLabel;
157 float myLabelColor[3];
160 static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
161 const char* theFieldName, int theIteration, int isMemoryCheck = true);
162 virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
163 const char* theFieldName, int theIteration);
165 const std::string& GetMeshName() const { return myMeshName;}
166 VISU::Entity GetEntity() const { return VISU::Entity(myEntity);}
167 const string& GetFieldName() const { return myFieldName;}
168 int GetIteration() const { return myIteration;}
170 virtual void ToStream(std::ostringstream& theStr);
172 static const std::string myComment;
173 virtual const char* GetComment() const;
174 virtual QString GenerateName();
176 virtual Storable* Restore(const Storable::TRestoringMap& theMap);
178 static Storable* Restore(SALOMEDS::SObject_ptr theSObject,
179 const std::string& thePrefix, const Storable::TRestoringMap& theMap);
181 virtual void Update() ;
182 virtual void SetMapScale(double theMapScale = 1.0);
184 const VISU::PField GetField() const { return myField;}
186 virtual bool IsRangeFixed() { return myIsFixedRange; }
187 virtual void SetSourceRange();
189 virtual int GetIteration() { return myIteration; }
191 virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
193 virtual void UpdateActor(VISU_Actor* theActor) ;