00001 #include "GfxStripListCfg.h"
00002 #include "Registry/Registry.h"
00003
00004 #include <iostream>
00005 using namespace std;
00006
00007 GfxStripListCfg::GfxStripListCfg(Registry* init_config)
00008 {
00009
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("StripEndStyle","Full");
00017 r.Set("SizeBy","Area");
00018 r.Set("ShapeIs","Ellipse");
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("Strip 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("StripEndStyle",sestyle_reg);
00058 possibles.Set("SizeBy",sizeby_reg);
00059 possibles.Set("ShapeIs",shape_reg);
00060
00061 this->SetPossibles(possibles);
00062 }
00063
00064 GfxStripListCfg::~GfxStripListCfg()
00065 {
00066
00067 }
00068
00069 double GfxStripListCfg::GetSizeFactor()
00070 {
00071
00072
00073 double sf = 1.0;
00074 if (! this->GetConfig().Get("SizeFactor",sf)) {
00075
00076 return 1.0;
00077 }
00078 return sf;
00079 }
00080
00081
00082
00083
00084 GfxStripListCfg::StripEnd_t GfxStripListCfg::GetStripEnd()
00085 {
00086 const char* value;
00087 if (! this->GetConfig().Get("StripEnd",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 GfxStripListCfg::MeasureScale_t GfxStripListCfg::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 GfxStripListCfg::ScaleIs_t GfxStripListCfg::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 GfxStripListCfg::SizeBy_t GfxStripListCfg::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 GfxStripListCfg::ShapeIs_t GfxStripListCfg::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