Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

EventDisplay/GfxDigitListCfg.cxx

Go to the documentation of this file.
00001 #include "GfxDigitListCfg.h"
00002 #include "Registry/Registry.h"
00003 
00004 #include <iostream>
00005 using namespace std;
00006 
00007 GfxDigitListCfg::GfxDigitListCfg(Registry* init_config)
00008 {
00009 //    cerr << "GfxDigitListCfg(" << init_config << ")\n";
00010 
00011     if (init_config) this->CommitDefaultConfig(*init_config);
00012     else {
00013         Registry r(false);
00014         r.Set("SizeIs","Charge");
00015         r.Set("ScaleIs","Relative");
00016         r.Set("DigitEndStyle","BowTie");
00017         r.Set("SizeBy","Area");
00018         r.Set("ShapeIs","Rectangle");
00019         r.Set("SizeFactor",5.0);
00020         this->CommitDefaultConfig(r);
00021         this->GetConfig() = r;
00022     }
00023 
00024     Registry size_reg;
00025     size_reg.SetName("Size Is");
00026     size_reg.Set("Time","Time");
00027     size_reg.Set("Charge","Charge");
00028     
00029     Registry scale_reg;
00030     scale_reg.SetName("Scale Is");
00031     scale_reg.Set("Absolute","Absolute");
00032     scale_reg.Set("Relative","Relative");
00033 
00034     Registry sestyle_reg;
00035     sestyle_reg.SetName("Digit End Style");
00036     sestyle_reg.Set("Half","Half");
00037     sestyle_reg.Set("Full","Full");
00038     sestyle_reg.Set("BowTie","BowTie");
00039     sestyle_reg.Set("Bit","Bit");
00040     
00041     Registry sizeby_reg;
00042     sizeby_reg.SetName("Size by");
00043     sizeby_reg.Set("Area","Area");
00044     sizeby_reg.Set("Fixed","Fixed");
00045     sizeby_reg.Set("Linear","Linear");
00046     sizeby_reg.Set("LogLinear","LogLinear");
00047     sizeby_reg.Set("LogArea","LogArea");
00048 
00049     Registry shape_reg;
00050     shape_reg.SetName("Shape type");
00051     shape_reg.Set("Rectangle","Rectangle");
00052     shape_reg.Set("Ellipse","Ellipse");
00053 
00054     Registry possibles;
00055     possibles.Set("SizeIs",size_reg);
00056     possibles.Set("ScaleIs",scale_reg);
00057     possibles.Set("DigitEndStyle",sestyle_reg);
00058     possibles.Set("SizeBy",sizeby_reg);
00059     possibles.Set("ShapeIs",shape_reg);
00060 
00061     this->SetPossibles(possibles);
00062 }
00063 
00064 GfxDigitListCfg::~GfxDigitListCfg()
00065 {
00066 
00067 }
00068 
00069 double GfxDigitListCfg::GetSizeFactor()
00070 {
00071 //    cerr << this->GetConfig() << endl;
00072 
00073     double sf = 1.0;
00074     if (! this->GetConfig().Get("SizeFactor",sf)) {
00075 //        cerr << "Failed to get SizeFactor\n";
00076         return 1.0;
00077     }
00078     return sf;
00079 }
00080 
00081 // convert from Registry to enums.  
00082 // FIXME: May want to cache these in the future....
00083 
00084 GfxDigitListCfg::DigitEnd_t GfxDigitListCfg::GetStripEnd()
00085 {
00086     const char* value;
00087     if (! this->GetConfig().Get("DigitEndStyle",value)) return kFull;
00088     std::string vstr = value;
00089     if (vstr == "Half") return kHalf;
00090     if (vstr == "Bit") return kBit;
00091     if (vstr == "BowTie") return kBowTie;
00092     return kFull;
00093 }
00094 GfxDigitListCfg::MeasureScale_t GfxDigitListCfg::GetSizeIs()
00095 {
00096     const char* value;
00097     if (! this->GetConfig().Get("SizeIs",value)) return kTime;
00098     std::string vstr = value;
00099     if (vstr == "Charge") return kCharge;
00100     return kTime;
00101 }
00102 GfxDigitListCfg::ScaleIs_t GfxDigitListCfg::GetScaleIs()
00103 {
00104     const char* value;
00105     if (! this->GetConfig().Get("ScaleIs",value)) return kAbsolute;
00106     std::string vstr = value;
00107     if (vstr == "Relative") return kRelative;
00108     return kAbsolute;
00109 }
00110 GfxDigitListCfg::SizeBy_t GfxDigitListCfg::GetSizeBy()
00111 {
00112     const char* value;
00113     if (! this->GetConfig().Get("SizeBy",value)) return kArea;
00114     std::string vstr = value;
00115     if (vstr == "Fixed") return kFixed;
00116     if (vstr == "Linear") return kLinear;
00117     if (vstr == "LogLinear") return kLogLinear;
00118     if (vstr == "LogArea") return kLogArea;
00119     return kArea;
00120 }
00121 GfxDigitListCfg::ShapeIs_t GfxDigitListCfg::GetShapeIs()
00122 {
00123     const char* value;
00124     if (!this->GetConfig().Get("ShapeIs",value)) return kRectangle;
00125     std::string vstr = value;
00126     if (vstr == "Ellipse") return kEllipse;
00127     return kRectangle;
00128 }
00129 

Generated on Mon Feb 15 11:06:46 2010 for loon by  doxygen 1.3.9.1