VAPoR  3.0.0
mousemodeparams.h
Go to the documentation of this file.
1 //************************************************************************
2 // *
3 // Copyright (C) 1024 *
4 // University Corporation for Atmospheric Research *
5 // All Rights Reserved *
6 // *
7 //************************************************************************/
8 //
9 // File: mousemodeparams.h
10 //
11 // Author: Alan Norton
12 // National Center for Atmospheric Research
13 // PO 3000, Boulder, Colorado
14 //
15 // Date: April 2014
16 //
17 // Description: Defines the MouseModeParams class.
18 // This Params class is global. Specifies the current MouseMode.
19 // Also has various static methods for controlling mouse modes
20 //
21 #ifndef MOUSEMODEPARAMS_H
22 #define MOUSEMODEPARAMS_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 
45 
46 public:
50 
53  MouseModeParams(XmlNode* parent, int winnum);
54 
56  virtual ~MouseModeParams();
57 
61  virtual void Validate(int type);
63  virtual void restart();
64 
65 
66  //Enum describes various built-in mouse modes:
68  unknownMode=1000,
69  navigateMode=0,
70  regionMode=1,
71  probeMode=3,
72  twoDDataMode=4,
73  twoDImageMode=5,
74  rakeMode=2,
75  barbMode=6,
76  isolineMode=7
77  };
79  static const char* const * GetIcon(int modeIndex){
80  return _modeXMPIcon[modeIndex];
81  }
84  static ParamsBase* CreateDefaultInstance() {return new MouseModeParams(0, -1);}
87  const std::string getShortName() {return _shortName;}
89 
90  //Static methods for controlling mouse modes
96  static int RegisterMouseMode(std::string tag, int modeType, const char* modeName, const char* const xpmIcon[]);
97 
103  static int AddMouseMode(const std::string paramsTag, int manipType, const char* name);
104 
109  static int getModeManipType(int modeIndex){
110  return _manipFromMode[modeIndex];
111  }
112 
116  static std::string getModeTag(int modeIndex){
117  return _paramsFromTag[modeIndex];
118  }
119 
123  static int getModeFromParams(string tag){return _modeFromParams[tag];}
124 
129  static const string getModeName(int index) {return _modeName[index];}
130 
134  static void RegisterMouseModes();
135 
139  return ((MouseModeParams*)Params::GetParamsInstance(_mouseModeParamsTag))->getCurrentMouseMode();
140  }
144  ((MouseModeParams*)Params::GetParamsInstance(_mouseModeParamsTag))->setCurrentMouseMode(t);
145  }
147  static int getNumMouseModes(){
148  return _modeName.size();
149  }
150 
151 
152 #ifndef DOXYGEN_SKIP_THIS
153 
154  static const string _mouseModeParamsTag;
155 
156 private:
158  int setCurrentMouseMode(int mode){
159  return SetValueLong(_mouseModeTag, "Set mouse mode",(long)mode);
160  }
161  mouseModeType getCurrentMouseMode(){
162  return (mouseModeType)GetValueLong(_mouseModeTag);
163  }
164  static const string _shortName;
165  static const string _mouseModeTag;
166  //Mouse Mode tables. Static
167 
168  static vector<string> _paramsFromTag;
169  static map<string, int> _modeFromParams;
170  static vector<int> _manipFromMode;
171  static vector<string> _modeName;
172  static map<int,const char* const *> _modeXMPIcon;
173 
174 
175 #endif //DOXYGEN_SKIP_THIS
176 };
177 
178 };
179 #endif //MOUSEMODEPARAMS_H
static std::string getModeTag(int modeIndex)
static const char *const * GetIcon(int modeIndex)
Static method identifies pixmap icon for each mode.
Nodes with state in Xml tree representation.
Definition: ParamsBase.h:90
static int getModeManipType(int modeIndex)
static ParamsBase * CreateDefaultInstance()
const std::string getShortName()
static void SetCurrentMouseMode(mouseModeType t)
static int getNumMouseModes()
Static method indicates how many mouse modes are available.
static mouseModeType GetCurrentMouseMode()
static const string getModeName(int index)
#define PARAMS_API
A Params subclass for Params classes with one unique instance.
Definition: params.h:598
Definition: DC.h:10
static int getModeFromParams(string tag)
A class for describing mouse modes in use in VAPOR.