VAPoR  3.0.0
regionparams.h
Go to the documentation of this file.
1 //************************************************************************
2 // *
3 // Copyright (C) 2004 *
4 // University Corporation for Atmospheric Research *
5 // All Rights Reserved *
6 // *
7 //************************************************************************/
8 //
9 // File: regionparams.h
10 //
11 // Author: Alan Norton
12 // National Center for Atmospheric Research
13 // PO 3000, Boulder, Colorado
14 //
15 // Date: September 2004
16 //
17 // Description: Defines the RegionParams class.
18 // This class supports parameters associted with the
19 // region panel, describing the rendering region
20 //
21 #ifndef REGIONPARAMS_H
22 #define REGIONPARAMS_H
23 
24 
25 #include <vector>
26 #include <map>
27 #include <vapor/common.h>
28 #include "params.h"
29 #include <vapor/MyBase.h>
30 
31 
32 using namespace VetsUtil;
33 
34 namespace VAPoR {
35 
36 class ViewpointParams;
37 class XmlNode;
38 class ParamNode;
53 class PARAMS_API RegionParams : public Params {
54 
55 public:
60  RegionParams(XmlNode* parent, int winnum);
61 
63  ~RegionParams();
67  virtual void Validate(int type);
69  virtual void restart();
72  static ParamsBase* CreateDefaultInstance() {return new RegionParams(0, -1);}
73 
76  const std::string getShortName() {return _shortName;}
77 
81  virtual Box* GetBox() {
82  vector<string>path;
83  path.push_back(Box::_boxTag);
84  return (Box*) GetParamsBase(path);
85  }
86 
91  double getLocalRegionMin(int coord, int timestep){
92  double exts[6];
93  GetBox()->GetLocalExtents(exts, timestep);
94  return exts[coord];
95  }
100  double getLocalRegionMax(int coord, int timestep){
101  double exts[6];
102  GetBox()->GetLocalExtents(exts, timestep);
103  return exts[coord+3];
104  }
108 
109  void getLocalRegionExtents(double exts[6],int timestep){
110  GetBox()->GetLocalExtents(exts,timestep);
111  return;
112  }
117  double getLocalRegionCenter(int indx, int timestep) {
118  return (0.5*(getLocalRegionMin(indx,timestep)+getLocalRegionMax(indx,timestep)));
119  }
120  //Methods to set the region max and min from a float value.
121  //public so accessible from router
122  //
128  int SetLocalRegionMin(int coord, double minval, int timestep);
134  int SetLocalRegionMax(int coord, double maxval, int timestep);
135 
136 
139  const vector<long> GetTimes(){ return GetBox()->GetValueLongVec(Box::_timesTag);}
140 
143  bool extentsAreVarying(){ return GetBox()->GetTimes().size()>1;}
144 
148  bool insertTime(int timestep);
149 
153  bool removeTime(int timestep);
154 
158  const vector<double> GetAllExtents(){ return GetBox()->GetValueDoubleVec(Box::_extentsTag);}
159 
164  static const vector<string> GetDomainVariables(){
165  vector<string>vec;
166  ((RegionParams*)Params::GetParamsInstance(_regionParamsTag,-1,-1))->GetValueStringVec(_domainVariablesTag, vec);
167  return vec;
168  }
173  static int SetDomainVariables(vector<string> varnames){
174  if (varnames.size() == 0) return -1;
175  return ((RegionParams*)Params::GetParamsInstance(_regionParamsTag,-1,-1))->SetValueStringVec(_domainVariablesTag, "Set Domain-defining variables",varnames);
176  }
177 #ifndef DOXYGEN_SKIP_THIS
178 private:
179  static const string _shortName;
180  static const string _domainVariablesTag;
181  void clearRegionsMap();
182 
183 #endif //DOXYGEN_SKIP_THIS
184 };
185 
186 };
187 #endif //REGIONPARAMS_H
static ParamsBase * CreateDefaultInstance()
Definition: regionparams.h:72
3D or 2D box with options for orientation angles and extents changing in time. Intended to be used in...
Definition: Box.h:43
const vector< double > GetAllExtents()
Definition: regionparams.h:158
A pure virtual class for managing parameters used in visualization.
Definition: params.h:129
double getLocalRegionMax(int coord, int timestep)
Definition: regionparams.h:100
const vector< long > GetTimes()
Definition: regionparams.h:139
static int SetDomainVariables(vector< string > varnames)
Definition: regionparams.h:173
A class for describing a 3D axis-aligned region in user space.
Definition: regionparams.h:53
Nodes with state in Xml tree representation.
Definition: ParamsBase.h:90
static const vector< string > GetDomainVariables()
Definition: regionparams.h:164
void getLocalRegionExtents(double exts[6], int timestep)
Definition: regionparams.h:109
const std::string getShortName()
Definition: regionparams.h:76
double getLocalRegionMin(int coord, int timestep)
Definition: regionparams.h:91
virtual Box * GetBox()
Definition: regionparams.h:81
double getLocalRegionCenter(int indx, int timestep)
Definition: regionparams.h:117
#define PARAMS_API
Definition: DC.h:10