25 #include <vapor/XmlNode.h>
26 #include <vapor/ExpatParseMgr.h>
27 #include <vapor/ParamNode.h>
31 #include <vapor/common.h>
44 class ViewpointParams;
141 XmlNode *parent,
const string &name,
int winNum
146 if(winNum < 0) SetLocal(
false);
else SetLocal(
true);
158 virtual int GetInstanceIndex();
166 return _currentParamsInstance[make_pair(pType,winnum)];
175 return GetCurrentParamsInstanceIndex(GetTypeFromTag(tag),winnum);
184 _currentParamsInstance[make_pair(pType,winnum)] = instance;
194 static Params* GetParamsInstance(
int pType,
int winnum = -1,
int instance = -1);
204 return GetParamsInstance(GetTypeFromTag(tag), winnum, instance);
213 Params* p = GetParamsInstance(pType, winnum, -1);
216 return GetDefaultParams(pType);
225 return _defaultParamsInstance[pType];
235 return _defaultParamsInstance[GetTypeFromTag(tag)];
244 _defaultParamsInstance[pType] = p;
254 _defaultParamsInstance[GetTypeFromTag(tag)] = p;
260 static Params* CreateDefaultParams(
int pType);
269 static int GetNumParamsInstances(
int pType,
int winnum);
279 return GetNumParamsInstances(GetTypeFromTag(tag), winnum);
289 _paramsInstances[make_pair(pType,winnum)].push_back(p);
290 if (pType == 3) assert (_paramsInstances[make_pair(pType,winnum)].size() <= 1);
301 AppendParamsInstance(GetTypeFromTag(tag),winnum, p);
310 static void RemoveParamsInstance(
int pType,
int winnum,
int instance);
319 map< pair<int,int>, vector<Params*> >::const_iterator it = _paramsInstances.find(make_pair(pType,winnum));
320 if (it == _paramsInstances.end())
return (*
new vector<Params*>);
321 return _paramsInstances[make_pair(pType,winnum)];
329 static int GetAllParamsInstances(
string tag, vector<Params*>&);
335 static int DeleteVisualizer(
int viznum);
345 return GetAllParamsInstances(GetTypeFromTag(tag),winnum);
353 static map <int, vector<Params*> >* cloneAllParamsInstances(
int winnum);
360 static vector <Params*>* cloneAllDefaultParams();
367 GetRootNode()->SetElementLong(_VisualizerNumTag,(
long)vnum);
385 virtual const std::string getShortName()=0;
405 virtual void Validate(
int type)=0;
411 static bool IsRenderingEnabled(
int winnum);
417 bool isRenderParams()
const;
425 bool isBasicParams()
const;
429 virtual void restart() = 0;
433 virtual int GetVizNum() {
return (
int)(GetValueLong(_VisualizerNumTag));}
450 return SetValueLong(_LocalTag,
"set local or global",(
long)lg);
456 return (GetValueLong(_LocalTag) != 0);
468 #ifndef DOXYGEN_SKIP_THIS
470 static Params* CreateDummyParams(std::string tag);
471 static void BailOut (
const char *errstr,
const char *fname,
int lineno);
473 static int getNumDummyClasses(){
return _dummyParamsInstances.size();}
474 static Params* getDummyParamsInstance(
int i) {
return _dummyParamsInstances[i];}
475 static void addDummyParamsInstance(Params*
const & p ) {_dummyParamsInstances.push_back(p);}
477 static void clearDummyParamsInstances();
478 static const std::string paramName(ParamsBaseType t);
480 static const string _regionParamsTag;
481 static const string _viewpointParamsTag;
482 static const string _animationParamsTag;
483 static const string _visualizerFeaturesParamsTag;
484 static const string _arrowParamsTag;
485 static const string _isolineParamsTag;
486 static const string _RefinementLevelTag;
487 static const string _CompressionLevelTag;
488 static const string _VisualizerNumTag;
489 static const string _LocalTag;
490 static const string _IsoControlTag;
491 static const string _IsoValueTag;
492 static const string _Variables3DTag;
493 static const string _Variables2DTag;
508 virtual int SetValueLong(
string tag,
const char* description,
long value)
509 {
return ParamsBase::SetValueLong(tag,description,value,
this);}
521 virtual int SetValueLong(
string tag,
const char* description,
const vector<long>& value)
522 {
return ParamsBase::SetValueLong(tag, description, value,
this);}
535 {
return ParamsBase::SetValueDouble(tag,description,value,
this);}
547 virtual int SetValueDouble(
string tag,
const char* description,
const vector<double>& value)
548 {
return ParamsBase::SetValueDouble(tag,description,value,
this);}
561 virtual int SetValueString(
string tag,
const char* description,
const string& value)
562 {
return ParamsBase::SetValueString(tag,description,value,
this);}
576 {
return ParamsBase::SetValueStringVec(tag, description, value,
this);}
578 #ifndef DOXYGEN_SKIP_THIS
581 static map<pair<int,int>,vector<Params*> > _paramsInstances;
583 static map<pair<int,int>,
int> _currentParamsInstance;
587 static map<int, Params*> _defaultParamsInstance;
588 static vector<Params*> _dummyParamsInstances;
589 #endif //DOXYGEN_SKIP_THIS
608 #ifndef DOXYGEN_SKIP_THIS
612 class DummyParams :
public Params {
614 DummyParams(XmlNode *parent,
const std::string tag,
int winnum);
615 virtual ~DummyParams(){}
616 virtual void restart(){}
618 virtual void Validate(
int) {
return;}
620 virtual bool usingVariable(
const std::string& ){
623 const std::string getShortName(){
return _tag;}
630 #endif //DOXYGEN_SKIP_THIS
static void AppendParamsInstance(const std::string tag, int winnum, Params *p)
virtual void SetVizNum(int vnum)
3D or 2D box with options for orientation angles and extents changing in time. Intended to be used in...
A pure virtual class for managing parameters used in visualization.
virtual int SetValueDouble(string tag, const char *description, const vector< double > &value)
virtual int SetValueStringVec(string tag, const char *description, const vector< string > &value)
static int GetCurrentParamsInstanceIndex(const std::string tag, int winnum)
static Params * GetParamsInstance(const std::string tag, int winnum=-1, int instance=-1)
static Params * GetCurrentParamsInstance(int pType, int winnum)
virtual int SetLocal(bool lg)
virtual int SetValueString(string tag, const char *description, const string &value)
Nodes with state in Xml tree representation.
virtual int SetValueLong(string tag, const char *description, const vector< long > &value)
static void SetCurrentParamsInstanceIndex(int pType, int winnum, int instance)
static Params * GetDefaultParams(ParamsBase::ParamsBaseType pType)
static void SetDefaultParams(const string &tag, Params *p)
virtual int SetValueDouble(string tag, const char *description, double value)
virtual int SetValueLong(string tag, const char *description, long value)
Params(int winNum, const string &name)
Deprecated constructor, needed for built-in classes that do not have associated XML node: ...
BasicParams(XmlNode *parent, const string &name)
static vector< Params * > & GetAllParamsInstances(const std::string tag, int winnum)
static Params * GetDefaultParams(const string &tag)
static int GetNumParamsInstances(const std::string tag, int winnum)
static void SetDefaultParams(int pType, Params *p)
A Params subclass for Params classes with one unique instance.
static int GetCurrentParamsInstanceIndex(int pType, int winnum)
static vector< Params * > & GetAllParamsInstances(int pType, int winnum)
static void AppendParamsInstance(int pType, int winnum, Params *p)