]> SALOME platform Git repositories - modules/visu.git/blob - src/VISU_I/VISU_ScalarMap_i.hh
Salome HOME
This commit was generated by cvs2git to track changes on a CVS vendor
[modules/visu.git] / src / VISU_I / VISU_ScalarMap_i.hh
1 //  VISU OBJECT : interactive object for VISU entities implementation
2 //
3 //  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //  File   : VISU_PrsObject_i.hxx
24 //  Author : Alexey PETROV
25 //  Module : VISU
26
27 #ifndef VISU_ScalarMap_i_HeaderFile
28 #define VISU_ScalarMap_i_HeaderFile
29
30 #include "VISU_Prs3d_i.hh"
31
32 class VISU_ScalarMapPL;
33
34 namespace VISU{
35   class ScalarMap_i : public virtual POA_VISU::ScalarMap,
36                       public virtual Prs3d_i
37   {
38     static int myNbPresent;
39     ScalarMap_i();
40     ScalarMap_i(const ScalarMap_i&);
41
42   public:
43     ScalarMap_i(Result_i* theResult, bool theAddToStudy = true);
44     virtual void SameAs(const ScalarMap_i* theOrigin);
45     virtual ~ScalarMap_i();
46     virtual void Destroy();
47
48     virtual VISU::VISUType GetType() { return VISU::TSCALARMAP;};
49
50     virtual CORBA::Long GetScalarMode();
51     virtual void SetScalarMode(CORBA::Long theScalarMode);
52
53     virtual VISU::Scaling GetScaling();
54     virtual void SetScaling(VISU::Scaling theScaling);
55
56     virtual void SetRange(CORBA::Double theMin, CORBA::Double theMax);
57     virtual CORBA::Double GetMin();
58     virtual CORBA::Double GetMax();
59
60     virtual void SetNbColors(CORBA::Long theNbColors);
61     virtual CORBA::Long GetNbColors();
62
63     virtual void SetOrientation(VISU::ScalarMap::Orientation theOrientation){ 
64       myOrientation = theOrientation;
65     }
66     virtual VISU::ScalarMap::Orientation GetOrientation() { return myOrientation;}
67
68     virtual void SetPosition(CORBA::Double X, CORBA::Double Y) { myPosition[0] = X; myPosition[1] = Y;}
69     virtual CORBA::Double GetPosX() { return myPosition[0];} 
70     virtual CORBA::Double GetPosY() { return myPosition[1];}
71       
72     virtual void SetSize(CORBA::Double theWidth, CORBA::Double theHeight) { 
73       myWidth = theWidth; myHeight = theHeight;
74     }
75     virtual CORBA::Double GetWidth() { return myWidth;}  
76     virtual CORBA::Double GetHeight() { return myHeight;}
77
78     virtual void SetLabels(CORBA::Long theNbLabels) { myNumberOfLabels = theNbLabels;}
79     virtual CORBA::Long GetLabels() { return myNumberOfLabels;}
80     
81     virtual void SetTitle(const char* theName) { myTitle = theName;}
82     virtual char* GetTitle() { return CORBA::string_dup(myTitle.c_str());}
83
84     typedef VISU::ScalarMap TInterface;
85     VISU_ScalarMapPL* GetScalarMapPL(){ return myScalarMapPL;}
86
87   protected:
88     Storable* Build(int theRestoring);
89     virtual void DoHook();
90
91     VISU_ScalarMapPL* myScalarMapPL;
92     const TField* myField;
93
94     string myMeshName;
95     TEntity myEntity;
96     string myFieldName;
97     int myIteration;
98
99     bool myIsFixedRange;
100     
101     std::string myTitle;
102     int myNumberOfLabels;
103     float myPosition[2], myWidth, myHeight;
104     VISU::ScalarMap::Orientation myOrientation;
105
106   public:
107     static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, 
108                           const char* theFieldName, int theIteration);
109     virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity, 
110                              const char* theFieldName, int theIteration);
111
112     virtual void ToStream(std::ostringstream& theStr);
113
114     static const string myComment;
115     virtual const char* GetComment() const;
116     virtual QString GenerateName();
117
118     virtual Storable* Restore(const Storable::TRestoringMap& theMap)
119       throw(std::logic_error&);
120     static Storable* Restore(SALOMEDS::SObject_ptr theSObject, 
121                              const string& thePrefix, const Storable::TRestoringMap& theMap)
122       throw(std::logic_error&);
123
124     virtual void Update();
125     virtual void SetMapScale(double theMapScale = 1.0);
126
127     const VISU::TField*  GetField() const { return myField;}
128     const string&  GetFieldName() const { return myFieldName;}
129
130     virtual bool IsRangeFixed() { return myIsFixedRange; }
131     virtual void SetSourceRange();
132
133     virtual int GetIteration() { return myIteration; }
134
135     virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL)
136       throw (std::runtime_error&);
137     virtual void UpdateActor(VISU_Actor* theActor);
138   };
139 }
140
141 #endif