//bool reallyShow //we create this window on start of event_execute widget for having the graph execute values defined //but we don't want to show until user clicks on "properties" on the event_execute widget static public EventGraphConfigureWindow Show(bool reallyShow) { if (EventGraphConfigureWindowBox == null) { EventGraphConfigureWindowBox = new EventGraphConfigureWindow(); EventGraphConfigureWindowBox.initializeWidgets(); } if (reallyShow) { EventGraphConfigureWindowBox.event_graph_configure.Show(); } else { EventGraphConfigureWindowBox.event_graph_configure.Hide(); } return(EventGraphConfigureWindowBox); }
// run simple public void PrepareRunSimpleGraph(double time, double speed) { //check graph properties window is not null (propably user has closed it with the DeleteEvent //then create it, but not show it if(eventGraphConfigureWin == null) eventGraphConfigureWin = EventGraphConfigureWindow.Show(false); bool paintTime = false; //paint speed if(eventGraphConfigureWin.RunsTimeActive) paintTime = true; //obtain data string [] runs = SqliteRun.SelectRuns(currentSession.UniqueID, event_execute_personID, event_execute_eventType); double timePersonAVG = SqliteSession.SelectAVGEventsOfAType(currentSession.UniqueID, event_execute_personID, event_execute_tableName, event_execute_eventType, "time"); double timeSessionAVG = SqliteSession.SelectAVGEventsOfAType(currentSession.UniqueID, -1, event_execute_tableName, event_execute_eventType, "time"); //double distancePersonAVG = SqliteSession.SelectAVGEventsOfAType(currentSession.UniqueID, event_execute_personID, event_execute_tableName, event_execute_eventType, "distance"); //double distanceSessionAVG = SqliteSession.SelectAVGEventsOfAType(currentSession.UniqueID, -1, event_execute_tableName, event_execute_eventType, "distance"); //better to know speed like: //SELECT AVG(distance/time) from run; than //SELECT AVG(distance) / SELECT AVG(time) //first is ok, because is the speed AVG //2nd is not good because it tries to do an AVG of all distances and times double speedPersonAVG = SqliteSession.SelectAVGEventsOfAType(currentSession.UniqueID, event_execute_personID, event_execute_tableName, event_execute_eventType, "distance/time"); double speedSessionAVG = SqliteSession.SelectAVGEventsOfAType(currentSession.UniqueID, -1, event_execute_tableName, event_execute_eventType, "distance/time"); double maxValue = 0; double minValue = 0; int topMargin = 10; int bottomMargin = 10; //if max value of graph is automatic if(eventGraphConfigureWin.Max == -1) { if(paintTime) { maxValue = Util.GetMax(time.ToString() + "=" + timePersonAVG.ToString() + "=" + timeSessionAVG.ToString()); foreach(string myStr in runs) { string [] run = myStr.Split(new char[] {':'}); if(Convert.ToDouble(run[6]) > maxValue) maxValue = Convert.ToDouble(run[6]); } } else { //paint speed maxValue = Util.GetMax(speed.ToString() + "=" + speedPersonAVG.ToString() + "=" + speedSessionAVG.ToString()); foreach(string myStr in runs) { string [] run = myStr.Split(new char[] {':'}); double mySpeed = Convert.ToDouble(Util.GetSpeed(run[5], run[6], true)); if(mySpeed > maxValue) maxValue = mySpeed; } } } else { maxValue = eventGraphConfigureWin.Max; topMargin = 0; } //if min value of graph is automatic if(eventGraphConfigureWin.Min == -1) { if(paintTime) { minValue = Util.GetMin(time.ToString() + "=" + timePersonAVG.ToString() + "=" + timeSessionAVG.ToString()); foreach(string myStr in runs) { string [] run = myStr.Split(new char[] {':'}); if(Convert.ToDouble(run[6]) < minValue) minValue = Convert.ToDouble(run[6]); } } else { minValue = Util.GetMin(speed.ToString() + "=" + speedPersonAVG.ToString() + "=" + speedSessionAVG.ToString()); foreach(string myStr in runs) { string [] run = myStr.Split(new char[] {':'}); double mySpeed = Convert.ToDouble(Util.GetSpeed(run[5], run[6], true)); if(mySpeed < minValue) minValue = mySpeed; } } } else { minValue = eventGraphConfigureWin.Min; bottomMargin = 0; } //paint graph if(paintTime) paintRunSimple (event_execute_drawingarea, pen_rojo, runs, time, timePersonAVG, timeSessionAVG, maxValue, minValue, topMargin, bottomMargin); else //paint speed paintRunSimple (event_execute_drawingarea, pen_azul, runs, speed, speedPersonAVG, speedSessionAVG, maxValue, minValue, topMargin, bottomMargin); //printLabels printLabelsRunSimple (time, timePersonAVG, timeSessionAVG, speed, speedPersonAVG, speedSessionAVG); // -- refresh event_execute_drawingarea.QueueDraw(); }
// run interval // distanceTotal is passed because it can change in variable distances test public void PrepareRunIntervalGraph(double distance, double lastTime, string timesString, double distanceTotal, string distancesString, bool volumeOn, RepetitiveConditionsWindow repetitiveConditionsWin) { //check graph properties window is not null (propably user has closed it with the DeleteEvent //then create it, but not show it if(eventGraphConfigureWin == null) eventGraphConfigureWin = EventGraphConfigureWindow.Show(false); bool paintTime = false; //paint speed if(eventGraphConfigureWin.RunsTimeActive) paintTime = true; //search MAX double maxValue = 0; int topMargin = 10; //if max value of graph is automatic if(eventGraphConfigureWin.Max == -1) { if(paintTime) maxValue = Util.GetMax(timesString); else { if(distancesString == "") maxValue = distance / Util.GetMin(timesString); //getMin because is on the "denominador" else maxValue = Util.GetRunIVariableDistancesSpeeds(distancesString, timesString, true); } } else { maxValue = eventGraphConfigureWin.Max; topMargin = 0; } //search min double minValue = 1000; int bottomMargin = 10; //if min value of graph is automatic if(eventGraphConfigureWin.Min == -1) { if(paintTime) minValue = Util.GetMin(timesString); else { if(distancesString == "") minValue = distance / Util.GetMax(timesString); //getMax because is in the "denominador" else minValue = Util.GetRunIVariableDistancesSpeeds(distancesString, timesString, false); } } else { minValue = eventGraphConfigureWin.Min; bottomMargin = 10; } int tracks = Util.GetNumberOfJumps(timesString, true); //paint graph paintRunInterval (event_execute_drawingarea, paintTime, distance, distanceTotal, distancesString, lastTime, timesString, Util.GetAverage(timesString), maxValue, minValue, tracks, topMargin, bottomMargin, Util.GetPosMax(timesString), Util.GetPosMin(timesString), volumeOn, repetitiveConditionsWin); // -- refresh event_execute_drawingarea.QueueDraw(); }
public void PrepareReactionTimeGraph(double time) { //check graph properties window is not null (propably user has closed it with the DeleteEvent //then create it, but not show it if(eventGraphConfigureWin == null) eventGraphConfigureWin = EventGraphConfigureWindow.Show(false); //obtain data string [] rts = SqliteReactionTime.SelectReactionTimes(currentSession.UniqueID, event_execute_personID); double timePersonAVG = SqliteSession.SelectAVGEventsOfAType( currentSession.UniqueID, event_execute_personID, event_execute_tableName, event_execute_eventType, "time"); double timeSessionAVG = SqliteSession.SelectAVGEventsOfAType( currentSession.UniqueID, -1, event_execute_tableName, event_execute_eventType, "time"); double maxValue = 0; double minValue = 0; int topMargin = 10; int bottomMargin = 10; //if max value of graph is automatic if(eventGraphConfigureWin.Max == -1) { maxValue = Util.GetMax( time.ToString() + "=" + timePersonAVG.ToString() + "=" + timeSessionAVG.ToString()); } else { maxValue = eventGraphConfigureWin.Max; topMargin = 0; } //if min value of graph is automatic if(eventGraphConfigureWin.Min == -1) { minValue = Util.GetMin( time.ToString() + "=" + timePersonAVG.ToString() + "=" + timeSessionAVG.ToString()); } else { minValue = eventGraphConfigureWin.Min; bottomMargin = 0; } //paint graph (use simple jump method) paintJumpSimple (event_execute_drawingarea, rts, time, timePersonAVG, timeSessionAVG, 0, 0, 0, maxValue, minValue, topMargin, bottomMargin); printLabelsReactionTime (time, timePersonAVG, timeSessionAVG); // -- refresh event_execute_drawingarea.QueueDraw(); }
// pulse public void PreparePulseGraph(double lastTime, string timesString) { //check graph properties window is not null (propably user has closed it with the DeleteEvent //then create it, but not show it if(eventGraphConfigureWin == null) eventGraphConfigureWin = EventGraphConfigureWindow.Show(false); //search MAX double maxValue = 0; int topMargin = 10; //if max value of graph is automatic if(eventGraphConfigureWin.Max == -1) maxValue = Util.GetMax(timesString); else { maxValue = eventGraphConfigureWin.Max; topMargin = 0; } //search MIN double minValue = 1000; int bottomMargin = 10; //if min value of graph is automatic if(eventGraphConfigureWin.Min == -1) minValue = Util.GetMin(timesString); else { minValue = eventGraphConfigureWin.Min; bottomMargin = 0; } int pulses = Util.GetNumberOfJumps(timesString, true); //paint graph paintPulse (event_execute_drawingarea, lastTime, timesString, Util.GetAverage(timesString), pulses, maxValue, minValue, topMargin, bottomMargin); // -- refresh event_execute_drawingarea.QueueDraw(); }
// multi chronopic public void PrepareMultiChronopicGraph( //double timestamp, bool cp1StartedIn, bool cp2StartedIn, bool cp3StartedIn, bool cp4StartedIn, string cp1InStr, string cp1OutStr, string cp2InStr, string cp2OutStr, string cp3InStr, string cp3OutStr, string cp4InStr, string cp4OutStr) { //check graph properties window is not null (propably user has closed it with the DeleteEvent //then create it, but not show it if(eventGraphConfigureWin == null) eventGraphConfigureWin = EventGraphConfigureWindow.Show(false); //search MAX double maxValue = 0; int topMargin = 10; //if max value of graph is automatic /* if(eventGraphConfigureWin.Max == -1) //maxValue = timestamp; //TODO: delete this, is not used here else { //maxValue = eventGraphConfigureWin.Max; //TODO topMargin = 0; } */ if(eventGraphConfigureWin.Max != -1) topMargin = 0; //search MIN double minValue = 1000; int bottomMargin = 10; //if min value of graph is automatic if(eventGraphConfigureWin.Min == -1) minValue = 0; else { minValue = eventGraphConfigureWin.Min; //TODO bottomMargin = 0; } /* int cols = Util.GetNumberOfJumps( cp1InString + "=" + cp2InString + "=" + cp3InString + "=" + cp4InString, true); */ //paint graph paintMultiChronopic (event_execute_drawingarea, //timestamp, cp1StartedIn, cp2StartedIn, cp3StartedIn, cp4StartedIn, cp1InStr, cp1OutStr, cp2InStr, cp2OutStr, cp3InStr, cp3OutStr, cp4InStr, cp4OutStr, maxValue, minValue, topMargin, bottomMargin); // -- refresh event_execute_drawingarea.QueueDraw(); }
// simple and DJ jump public void PrepareJumpSimpleGraph(double tv, double tc) { //check graph properties window is not null (propably user has closed it with the DeleteEvent //then create it, but not show it if(eventGraphConfigureWin == null) eventGraphConfigureWin = EventGraphConfigureWindow.Show(false); //obtain data string []jumps = SqliteJump.SelectJumps( currentSession.UniqueID, event_execute_personID, "", event_execute_eventType); double tvPersonAVG = SqliteSession.SelectAVGEventsOfAType( currentSession.UniqueID, event_execute_personID, event_execute_tableName, event_execute_eventType, "TV"); double tvSessionAVG = SqliteSession.SelectAVGEventsOfAType( currentSession.UniqueID, -1, event_execute_tableName, event_execute_eventType, "TV"); double tcPersonAVG = 0; double tcSessionAVG = 0; if(tc > 0) { tcPersonAVG = SqliteSession.SelectAVGEventsOfAType( currentSession.UniqueID, event_execute_personID, event_execute_tableName, event_execute_eventType, "TC"); tcSessionAVG = SqliteSession.SelectAVGEventsOfAType( currentSession.UniqueID, -1, event_execute_tableName, event_execute_eventType, "TC"); } double maxValue = 0; double minValue = 0; int topMargin = 10; int bottomMargin = 10; //if max value of graph is automatic if(eventGraphConfigureWin.Max == -1) { maxValue = Util.GetMax( tv.ToString() + "=" + tvPersonAVG.ToString() + "=" + tvSessionAVG.ToString() + "=" + tc.ToString() + "=" + tcPersonAVG.ToString() + "=" + tcSessionAVG.ToString()); foreach(string myStr in jumps) { string [] jump = myStr.Split(new char[] {':'}); if(Convert.ToDouble(jump[5]) > maxValue) maxValue = Convert.ToDouble(jump[5]); //tf if(Convert.ToDouble(jump[6]) > maxValue) maxValue = Convert.ToDouble(jump[6]); //tc } } else { maxValue = eventGraphConfigureWin.Max; topMargin = 0; } //if min value of graph is automatic if(eventGraphConfigureWin.Min == -1) { string myString = tv.ToString() + "=" + tvPersonAVG.ToString() + "=" + tvSessionAVG.ToString(); if(tc > 0) myString = myString + "=" + tc.ToString() + "=" + tcPersonAVG.ToString() + "=" + tcSessionAVG.ToString(); minValue = Util.GetMin(myString); foreach(string myStr in jumps) { string [] jump = myStr.Split(new char[] {':'}); if(Convert.ToDouble(jump[5]) < minValue) minValue = Convert.ToDouble(jump[5]); //tf if(Convert.ToDouble(jump[6]) < minValue) minValue = Convert.ToDouble(jump[6]); //tc } } else { minValue = eventGraphConfigureWin.Min; bottomMargin = 0; } //paint graph paintJumpSimple (event_execute_drawingarea, jumps, tv, tvPersonAVG, tvSessionAVG, tc, tcPersonAVG, tcSessionAVG, maxValue, minValue, topMargin, bottomMargin); //printLabels printLabelsJumpSimple (tv, tvPersonAVG, tvSessionAVG, tc, tcPersonAVG, tcSessionAVG); // -- refresh event_execute_drawingarea.QueueDraw(); }
// Reactive jump public void PrepareJumpReactiveGraph(double lastTv, double lastTc, string tvString, string tcString, bool volumeOn, RepetitiveConditionsWindow repetitiveConditionsWin) { //check graph properties window is not null (propably user has closed it with the DeleteEvent //then create it, but not show it if(eventGraphConfigureWin == null) eventGraphConfigureWin = EventGraphConfigureWindow.Show(false); Log.WriteLine("Preparing reactive A"); //search MAX double maxValue = 0; int topMargin = 10; //if max value of graph is automatic if(eventGraphConfigureWin.Max == -1) maxValue = Util.GetMax(tvString + "=" + tcString); else { maxValue = eventGraphConfigureWin.Max; topMargin = 0; } //search min double minValue = 1000; int bottomMargin = 10; //if min value of graph is automatic if(eventGraphConfigureWin.Min == -1) minValue = Util.GetMin(tvString + "=" + tcString); else { minValue = eventGraphConfigureWin.Min; bottomMargin = 10; } int jumps = Util.GetNumberOfJumps(tvString, true); //paint graph paintJumpReactive (event_execute_drawingarea, lastTv, lastTc, tvString, tcString, Util.GetAverage(tvString), Util.GetAverage(tcString), maxValue, minValue, jumps, topMargin, bottomMargin, bestOrWorstTvTcIndex(true, tvString, tcString), bestOrWorstTvTcIndex(false, tvString, tcString), volumeOn, repetitiveConditionsWin); // -- refresh event_execute_drawingarea.QueueDraw(); }
void on_event_execute_button_properties_clicked(object o, EventArgs args) { //now show the eventGraphConfigureWin eventGraphConfigureWin = EventGraphConfigureWindow.Show(true); }
void on_delete_event(object o, DeleteEventArgs args) { EventGraphConfigureWindowBox.event_graph_configure.Hide(); EventGraphConfigureWindowBox = null; }
void on_delete_event(object o, DeleteEventArgs args) { EventGraphConfigureWindowBox.event_graph_configure.Hide(); EventGraphConfigureWindowBox = null; }
//bool reallyShow //we create this window on start of event_execute widget for having the graph execute values defined //but we don't want to show until user clicks on "properties" on the event_execute widget public static EventGraphConfigureWindow Show(bool reallyShow) { if (EventGraphConfigureWindowBox == null) { EventGraphConfigureWindowBox = new EventGraphConfigureWindow (); EventGraphConfigureWindowBox.initializeWidgets(); } if(reallyShow) EventGraphConfigureWindowBox.event_graph_configure.Show (); else EventGraphConfigureWindowBox.event_graph_configure.Hide (); return EventGraphConfigureWindowBox; }