void HypoMain::ViewLoad() { long numdat; wxString filename; wxString readline, numstring; filename = "Init/hypoprefs.ini"; wxTextFile opfile(filename); if(!opfile.Exists()) { startmod = 13; numdraw = 3; return; } opfile.Open(); readline = opfile.GetLine(0); numstring = readline.AfterFirst(' '); numstring.ToLong(&numdat); startmod = (int)numdat; readline = opfile.GetLine(1); numstring = readline.AfterFirst(' '); numstring.ToLong(&numdat); numdraw = (int)numdat; readline = opfile.GetLine(2); numstring = readline.AfterFirst(' '); numstring.ToLong(&numdat); viewheight = (int)numdat; opfile.Close(); }
void HypoApp::OptionLoad() { long numdat; wxString filename; wxString readline, numstring; filename = "Init/hypoprefs.ini"; wxTextFile opfile(filename); if(!opfile.Exists()) { viewheight = 920; viewwidth = 700; return; } opfile.Open(); readline = opfile.GetLine(2); numstring = readline.AfterFirst(' '); numstring.ToLong(&numdat); viewheight = numdat; readline = opfile.GetLine(3); numstring = readline.AfterFirst(' '); numstring.ToLong(&numdat); viewwidth = numdat; opfile.Close(); }
void ParamBox::HistLoad() { //long numdat; wxString filename, filepath; wxString readline, numstring; filepath = mod->GetPath(); filename = filepath + "/" + boxname + "-hist.ini"; wxTextFile opfile(filename); if(!opfile.Exists()) { return; } opfile.Open(); readline = opfile.GetLine(0); while(!readline.IsEmpty()) { readline = readline.AfterFirst(' '); readline.Trim(); initparams = readline; paramstoretag->Insert(initparams, 0); readline = opfile.GetNextLine(); } opfile.Close(); }
void MatchingPoints::writeToFile() { string filename = directory + string("\\") + sourceImage + destinationImage + string(".mpt"); ofstream opfile(filename); opfile<<sourceImage<<endl; opfile<<destinationImage<<endl; opfile<<srcPoints.size()<<endl; // we gotta write x,y as it is for(unsigned int i = 0; i < srcPoints.size(); i++) { opfile<<srcPoints.at(i).x<<" "<<srcPoints.at(i).y<<endl; } opfile<<destPoints.size()<<endl; for(unsigned int i = 0; i < destPoints.size(); i++) { opfile<<destPoints.at(i).x<<" "<<destPoints.at(i).y<<endl; } opfile.close(); }
void HypoMain::ViewStore() { wxString filename; wxString outline; filename = "Init/hypoview.ini"; wxTextFile opfile(filename); if(!opfile.Exists()) opfile.Create(); opfile.Open(); opfile.Clear(); outline.Printf("startmod %d", startmod); opfile.AddLine(outline); outline.Printf("numdraw %d", numdraw); opfile.AddLine(outline); outline.Printf("viewheight %d", viewheight); opfile.AddLine(outline); opfile.Write(); opfile.Close(); }
void ParamBox::HistStore() { short i; wxString filename, filepath; wxString outline; filepath = mod->GetPath(); filename = filepath + "/" + boxname + "-hist.ini"; initparams = paramstoretag->GetValue(); wxTextFile opfile(filename); if(!opfile.Exists()) opfile.Create(); opfile.Open(); opfile.Clear(); for(i=paramstoretag->GetCount()-1; i>=0; i--) { outline.Printf("initparams %s", paramstoretag->GetString(i)); opfile.AddLine(outline); } opfile.Write(); opfile.Close(); }
void HypoMain::OptionLoad() { long numdat; int check; wxString filename; wxString readline, numstring, tag; filename = "Init/hypoprefs.ini"; wxTextFile opfile(filename); if(!opfile.Exists()) { startmod = 13; numdraw = 3; ylabels = 5; diagnostic = 1; datsample = 1; basic = 0; } else { opfile.Open(); readline = opfile.GetFirstLine(); while(!readline.IsEmpty()) { tag = readline.BeforeFirst(' '); readline = readline.AfterFirst(' '); readline.Trim(); readline.ToLong(&numdat); prefstore[tag] = numdat; //if(diagnostic) ofp.WriteLine(text.Format("Model Param ID %d, Value %.4f\n", id, datval)); if(opfile.Eof()) return; readline = opfile.GetNextLine(); } opfile.Close(); startmod = prefstore["startmod"]; numdraw = prefstore["numdraw"]; viewheight = prefstore["viewheight"]; viewwidth = prefstore["viewwidth"]; ylabels = prefstore["ylabels"]; datsample = prefstore["datsample"]; basic = prefstore["basic"]; diagnostic = prefstore["diagnostic"]; } filename = "Init/hypopaths.ini"; TextFile infile; check = infile.Open(filename); if(!check) { datapath = "Data"; parampath = "Params"; outpath = ""; modpath = ""; return; } readline = infile.ReadLine(); datapath = readline.Trim(); readline = infile.ReadLine(); parampath = readline.Trim(); readline = infile.ReadLine(); outpath = readline.Trim(); readline = infile.ReadLine(); modpath = readline.Trim(); opfile.Close(); }