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&);
43 ScalarMap_i(Result_i* theResult, bool theAddToStudy = true,
44 SALOMEDS::SObject_ptr theSObject = SALOMEDS::SObject::_nil());
45 virtual void SameAs(const ScalarMap_i* theOrigin);
46 virtual ~ScalarMap_i();
47 virtual void RemoveFromStudy();
49 virtual VISU::VISUType GetType() { return VISU::TSCALARMAP;};
51 virtual CORBA::Long GetScalarMode();
52 virtual void SetScalarMode(CORBA::Long theScalarMode);
54 virtual VISU::Scaling GetScaling();
55 virtual void SetScaling(VISU::Scaling theScaling);
57 virtual void SetRange(CORBA::Double theMin, CORBA::Double theMax);
58 virtual CORBA::Double GetMin();
59 virtual CORBA::Double GetMax();
61 virtual void SetNbColors(CORBA::Long theNbColors);
62 virtual CORBA::Long GetNbColors();
64 virtual void SetBarOrientation(VISU::ScalarMap::Orientation theOrientation){
65 myOrientation = theOrientation;
67 virtual VISU::ScalarMap::Orientation GetBarOrientation() { return myOrientation;}
69 virtual void SetPosition(CORBA::Double X, CORBA::Double Y) { myPosition[0] = X; myPosition[1] = Y;}
70 virtual CORBA::Double GetPosX() { return myPosition[0];}
71 virtual CORBA::Double GetPosY() { return myPosition[1];}
73 virtual void SetSize(CORBA::Double theWidth, CORBA::Double theHeight) {
74 myWidth = theWidth; myHeight = theHeight;
76 virtual CORBA::Double GetWidth() { return myWidth;}
77 virtual CORBA::Double GetHeight() { return myHeight;}
79 virtual void SetLabels(CORBA::Long theNbLabels) { myNumberOfLabels = theNbLabels;}
80 virtual CORBA::Long GetLabels() { return myNumberOfLabels;}
82 virtual void SetTitle(const char* theName) { myTitle = theName;}
83 virtual char* GetTitle() { return CORBA::string_dup(myTitle.c_str());}
85 virtual bool IsBoldTitle() { return myIsBoldTitle;}
86 virtual void SetBoldTitle(bool isBold) { myIsBoldTitle = isBold;}
88 virtual bool IsItalicTitle() { return myIsItalicTitle;}
89 virtual void SetItalicTitle(bool isItalic) { myIsItalicTitle = isItalic;}
91 virtual bool IsShadowTitle() { return myIsShadowTitle;}
92 virtual void SetShadowTitle(bool isShadow) { myIsShadowTitle = isShadow;}
94 virtual int GetTitFontType() { return myTitFontType;}
95 virtual void SetTitFontType(int theType) { myTitFontType = theType;}
97 virtual void GetTitleColor(float* theR, float* theG, float* theB)
98 {*theR = myTitleColor[0]; *theG = myTitleColor[1]; *theB = myTitleColor[2];}
99 virtual void SetTitleColor(float theR, float theG, float theB)
100 {myTitleColor[0] = theR; myTitleColor[1] = theG; myTitleColor[2] = theB; }
103 virtual bool IsBoldLabel() { return myIsBoldLabel;}
104 virtual void SetBoldLabel(bool isBold) { myIsBoldLabel = isBold;}
106 virtual bool IsItalicLabel() { return myIsItalicLabel;}
107 virtual void SetItalicLabel(bool isItalic) { myIsItalicLabel = isItalic;}
109 virtual bool IsShadowLabel() { return myIsShadowLabel;}
110 virtual void SetShadowLabel(bool isShadow) {myIsShadowLabel = isShadow;}
112 virtual int GetLblFontType() { return myLblFontType;}
113 virtual void SetLblFontType(int theType) { myLblFontType = theType;}
115 virtual void GetLabelColor(float* theR, float* theG, float* theB)
116 {*theR = myLabelColor[0]; *theG = myLabelColor[1]; *theB = myLabelColor[2];}
117 virtual void SetLabelColor(float theR, float theG, float theB)
118 {myLabelColor[0] = theR; myLabelColor[1] = theG; myLabelColor[2] = theB; }
120 typedef VISU::ScalarMap TInterface;
121 VISU_ScalarMapPL* GetScalarMapPL(){ return myScalarMapPL;}
124 Storable* Build(int theRestoring);
125 virtual void DoHook();
127 VISU_ScalarMapPL* myScalarMapPL;
138 int myNumberOfLabels;
139 float myPosition[2], myWidth, myHeight;
140 VISU::ScalarMap::Orientation myOrientation;
144 bool myIsItalicTitle;
145 bool myIsShadowTitle;
147 float myTitleColor[3];
150 bool myIsItalicLabel;
151 bool myIsShadowLabel;
153 float myLabelColor[3];
156 static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
157 const char* theFieldName, int theIteration, int isMemoryCheck = true);
158 virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
159 const char* theFieldName, int theIteration);
161 virtual void ToStream(std::ostringstream& theStr);
163 static const string myComment;
164 virtual const char* GetComment() const;
165 virtual QString GenerateName();
167 virtual Storable* Restore(const Storable::TRestoringMap& theMap);
169 static Storable* Restore(SALOMEDS::SObject_ptr theSObject,
170 const string& thePrefix, const Storable::TRestoringMap& theMap);
172 virtual void Update() ;
173 virtual void SetMapScale(double theMapScale = 1.0);
175 const VISU::PField GetField() const { return myField;}
176 const string& GetFieldName() const { return myFieldName;}
178 virtual bool IsRangeFixed() { return myIsFixedRange; }
179 virtual void SetSourceRange();
181 virtual int GetIteration() { return myIteration; }
183 virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
185 virtual void UpdateActor(VISU_Actor* theActor) ;