VAPoR  3.0.0
isolineparams.h
Go to the documentation of this file.
1 
2 #ifndef ISOLINEPARAMS_H
3 #define ISOLINEPARAMS_H
4 
5 #include "vapor/ParamNode.h"
6 #include "params.h"
7 #include "datastatus.h"
8 #include "mapperfunction.h"
9 #include "transferfunction.h"
10 
11 namespace VAPoR {
18 public:
19  IsolineParams(XmlNode *parent, int winnum);
20 
23  return new IsolineParams(0, -1);
24  }
25 
27  const std::string getShortName() {return _shortName;}
28 
30  virtual ~IsolineParams();
31 
33  virtual void restart();
34 
38  virtual Box* GetBox() {
39  if (VariablesAre3D()){
40  ParamNode* pNode = GetRootNode()->GetNode(IsolineParams::_3DBoxTag);
41  if (pNode) {
42  return (Box*)pNode->GetNode(Box::_boxTag)->GetParamsBase();
43  }
44  else assert(0);
45  return 0;
46  } else {
47  ParamNode* pNode = GetRootNode()->GetNode(IsolineParams::_2DBoxTag);
48  if (pNode) {
49  return (Box*)pNode->GetNode(Box::_boxTag)->GetParamsBase();
50  }
51  else assert(0);
52  return 0;
53  }
54  }
55 
60  virtual void Validate(int type);
61 
65  virtual bool IsOpaque() {return true;}
66 
71  virtual bool usingVariable(const std::string& varname){
72  if (GetVariableName() == varname) return true;
73  return false;
74  }
75 
79  void setSelectedPointLocal(const double point[3]){
80  for (int i = 0; i<3; i++) _selectPoint[i] = point[i];
81  }
85  virtual const double* getSelectedPointLocal() {
86  return _selectPoint;
87  }
88 
91  const vector<double> GetIsolineLocalExtents(){
92  return (GetBox()->GetLocalExtents());
93  }
96  void GetLocalExtents(double exts[6]){
97  GetBox()->GetLocalExtents(exts);
98  }
101  void SetLocalExtents(const vector<double>&exts){
102  GetBox()->SetLocalExtents(exts, this);
103  setAllBypass(false);
104  }
108  return ((float)GetValueDouble(_lineThicknessTag));
109  }
112  void SetLineThickness(double val){
113  SetValueDouble(_lineThicknessTag, "Set contour line thickness", val);
114  }
118  return (float)GetValueDouble(_panelLineThicknessTag);
119  }
122  void SetPanelLineThickness(double val){
123  SetValueDouble(_panelLineThicknessTag, "Set line thickness in image", val);
124  }
127  float GetTextSize(){
128  return ((float)GetValueDouble(_textSizeTag));
129  }
132  void SetTextSize(double val){
133  SetValueDouble(_textSizeTag, "Set text size", val);
134  }
139  float GetTextDensity(){
140  return ((float)GetValueDouble(_textDensityTag));
141  }
145  void SetTextDensity(double val){
146  SetValueDouble(_textDensityTag, "Set text density", val);
147  }
150  bool textEnabled() {
151  return (0 != GetValueLong(_textEnabledTag));
152  }
155  void SetTextEnabled(bool val){
156  SetValueLong(_textEnabledTag, "enable/disable isoline text",(long)val);
157  }
160  bool UseSingleColor() {
161  return (0 != GetValueLong(_useSingleColorTag));
162  }
165  void SetUseSingleColor(bool val) {
166  SetValueLong(_useSingleColorTag, "enable/disable use single color", (long)val);
167  }
170  void SetSingleColor(double clr[3]){
171  vector<double> dcolors;
172  for (int i = 0; i<3; i++) dcolors.push_back(clr[i]);
173  SetValueDouble(_singleColorTag,"Specify single color",dcolors);
174  }
178  const vector<double> GetSingleColor(){
179  return GetValueDoubleVec(_singleColorTag);
180  }
183  void SetPanelBackgroundColor(const float rgb[3]);
184 
188  const vector<double> GetPanelBackgroundColor();
189 
193  void getLineColor(int isoNum, float lineColor[3]);
194 
198  return GetIsoControl()->getIsoValues().size();
199  }
200 
203  int GetNumVariables3D();
204 
207  int GetNumVariables2D();
208 
211  IsoControl* GetIsoControl(){
212  vector<string>path;
213  if (VariablesAre3D()) path.push_back(_Variables3DTag);
214  else path.push_back(_Variables2DTag);
215  path.push_back(GetVariableName());
216  path.push_back(_IsoControlTag);
217  if (!GetRootNode()->GetNode(path)) return 0;
218  return (IsoControl*)(GetRootNode()->GetNode(path)->GetParamsBase());
219  }
220 
225  IsoControl* GetIsoControl(string varname, bool is3D){
226  vector<string>path;
227  if (is3D) path.push_back(_Variables3DTag);
228  else path.push_back(_Variables2DTag);
229  path.push_back(varname);
230  path.push_back(_IsoControlTag);
231  if (!GetRootNode()->GetNode(path)) return 0;
232  return (IsoControl*)(GetRootNode()->GetNode(path)->GetParamsBase());
233  }
234 
240  int SetIsoControl(const string varname, IsoControl* iControl, bool is3D);
241 
244  virtual MapperFunction* GetMapperFunc(){
245  return (MapperFunction*)GetIsoControl();
246  }
249  vector<double> GetIsovalues(){
250  return GetIsoControl()->getIsoValues();
251  }
254  void SetIsovalues(const vector<double>& values){
255  GetIsoControl()->setIsoValues(values);
256  setAllBypass(false);
257  }
260  void SetTextLabelType(int val){
261  SetValueLong(_textTypeTag,"set text label type",val);
262  }
266  return GetValueLong(_textTypeTag);
267  }
270  void SetNumDigits(int val){
271  SetValueLong(_numDigitsTag,"set display digits",val);
272  }
276  return GetValueLong(_numDigitsTag);
277  }
280  void SetHistoBounds(const float bnds[2]){
281  IsoControl* isoContr = GetIsoControl();
282  if(!isoContr) return;
283  if(isoContr->getMinHistoValue() == bnds[0] &&
284  isoContr->getMaxHistoValue() == bnds[1]) return;
285  isoContr->setMinMaxHistoValue(bnds[0],bnds[1]);
286 
287  isoContr->setMinMaxMapValue(bnds[0],bnds[1]);
288 
289  setAllBypass(false);
290  }
293  void GetHistoBounds(float bounds[2]){
294  if (!GetIsoControl()){
295  bounds[0] = 0.f;
296  bounds[1] = 1.f;
297  } else {
298  bounds[0]=GetIsoControl()->getMinHistoValue();
299  bounds[1]=GetIsoControl()->getMaxHistoValue();
300  }
301  }
302 
304  virtual void hookupTF(TransferFunction* , int );
305 
309  void spaceIsovals(float miniso, float spacing);
310 
311 #ifndef DOXYGEN_SKIP_THIS
312 private:
313  static const string _shortName;
314  static const string _numDigitsTag;
315  static const string _panelBackgroundColorTag;
316  static const string _isolineExtentsTag;
317  static const string _lineThicknessTag;
318  static const string _panelLineThicknessTag;
319  static const string _textSizeTag;
320  static const string _textDensityTag;
321  static const string _2DBoxTag;
322  static const string _3DBoxTag;
323  static const string _editBoundsTag;
324  static const string _textEnabledTag;
325  static const string _useSingleColorTag;
326  static const string _singleColorTag;
327  static const string _textTypeTag;
328 
329  double _selectPoint[3];
330  float _histoBounds[2];
331 #endif //DOXYGEN_SKIP_THIS
332 }; //End of Class IsolineParams
333 };
334 #endif //ISOLINEPARAMS_H
335 
ParamsBase * GetParamsBase() const
Definition: ParamNode.h:510
3D or 2D box with options for orientation angles and extents changing in time. Intended to be used in...
Definition: Box.h:43
void SetNumDigits(int val)
A Params subclass for managing parameters used by Renderers.
Definition: renderparams.h:57
const vector< double > GetSingleColor()
virtual const double * getSelectedPointLocal()
Definition: isolineparams.h:85
IsoControl * GetIsoControl(string varname, bool is3D)
void SetLocalExtents(const vector< double > &exts)
void SetIsovalues(const vector< double > &values)
void SetSingleColor(double clr[3])
Nodes with state in Xml tree representation.
Definition: ParamsBase.h:90
void SetTextEnabled(bool val)
vector< double > GetIsovalues()
const std::string getShortName()
Required virtual method provides a short name for use in the gui.
Definition: isolineparams.h:27
void setSelectedPointLocal(const double point[3])
Definition: isolineparams.h:79
void SetLineThickness(double val)
virtual MapperFunction * GetMapperFunc()
virtual bool usingVariable(const std::string &varname)
Definition: isolineparams.h:71
void SetTextDensity(double val)
void SetHistoBounds(const float bnds[2])
const vector< double > GetIsolineLocalExtents()
Definition: isolineparams.h:91
static ParamsBase * CreateDefaultInstance()
Required static creation method.
Definition: isolineparams.h:22
IsoControl * GetIsoControl()
void SetPanelLineThickness(double val)
virtual bool IsOpaque()
Definition: isolineparams.h:65
void SetTextSize(double val)
void GetHistoBounds(float bounds[2])
ParamNode * GetNode(const vector< string > &tagpath)
#define PARAMS_API
Definition: DC.h:10
void GetLocalExtents(double exts[6])
Definition: isolineparams.h:96
An Xml tree.
Definition: ParamNode.h:30
void SetUseSingleColor(bool val)
virtual Box * GetBox()
Definition: isolineparams.h:38
void SetTextLabelType(int val)
Class that supports rendering of contour lines (isolines)
Definition: isolineparams.h:17