[chronojump] Improving jumps execute graph
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Improving jumps execute graph
- Date: Thu, 14 Apr 2016 16:53:46 +0000 (UTC)
commit 0aa0884c09f8f9634bcb12a616db7859314d44e1
Author: Xavier de Blas <xaviblas gmail com>
Date: Thu Apr 14 18:50:19 2016 +0200
Improving jumps execute graph
src/exportSession.cs | 4 +++-
src/gui/chronojump.cs | 4 +++-
src/gui/eventExecute.cs | 42 ++++++++++++++++++++++++++----------------
src/gui/jump.cs | 3 ++-
src/gui/person.cs | 3 ++-
src/gui/usefulObjects.cs | 3 ++-
src/report.cs | 3 ++-
src/server.cs | 3 ++-
src/sqlite/jump.cs | 17 ++++++++++++++---
src/sqlite/main.cs | 1 +
10 files changed, 57 insertions(+), 26 deletions(-)
---
diff --git a/src/exportSession.cs b/src/exportSession.cs
index 7adc32c..cdde8d2 100644
--- a/src/exportSession.cs
+++ b/src/exportSession.cs
@@ -154,7 +154,9 @@ public class ExportSession
//Leave SQL opened in all this process
Sqlite.Open(); // ------------------------------
- myJumps= SqliteJump.SelectJumps(true, mySession.UniqueID, -1, "", "");
+ myJumps= SqliteJump.SelectJumps(true, mySession.UniqueID, -1, "", "",
+ Sqlite.Orders_by.DEFAULT, -1);
+
myJumpsRj = SqliteJumpRj.SelectJumps(true, mySession.UniqueID, -1, "", "");
myRuns= SqliteRun.SelectRuns(true, mySession.UniqueID, -1, "");
myRunsInterval = SqliteRunInterval.SelectRuns(true, mySession.UniqueID, -1, "");
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 410c869..c3af3f0 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -1485,7 +1485,9 @@ public partial class ChronoJumpWindow
private void fillTreeView_jumps (string filter, bool dbconOpened) {
string [] myJumps;
- myJumps = SqliteJump.SelectJumps(dbconOpened, currentSession.UniqueID, -1, "", "");
+ myJumps = SqliteJump.SelectJumps(dbconOpened, currentSession.UniqueID, -1, "", "",
+ Sqlite.Orders_by.DEFAULT, -1);
+
myTreeViewJumps.Fill(myJumps, filter);
expandOrMinimizeTreeView((TreeViewEvent) myTreeViewJumps, treeview_jumps);
diff --git a/src/gui/eventExecute.cs b/src/gui/eventExecute.cs
index 1c7de5f..e139259 100644
--- a/src/gui/eventExecute.cs
+++ b/src/gui/eventExecute.cs
@@ -1123,49 +1123,52 @@ public partial class ChronoJumpWindow
}
//red for TC
- count = 0;
+ count = jumps.Length;
if(tcNow > 0) {
foreach(string myStr in jumps) {
string [] jump = myStr.Split(new char[] {':'});
Rectangle rect = new Rectangle(
-
Convert.ToInt32((ancho-event_execute_rightMargin)*(count+.5)/jumps.Length)-barDesplLeft,
+
Convert.ToInt32((ancho-event_execute_rightMargin)*(count-.5)/jumps.Length)-barDesplLeft,
calculatePaintHeight(Convert.ToDouble(jump[6]), alto,
maxValue, minValue,
topMargin, bottomMargin),
barWidth, alto
);
event_execute_pixmap.DrawRectangle(pen_rojo, true, rect);
- event_execute_pixmap.DrawRectangle(pen_negro, false, rect);
- count ++;
+ if(count == jumps.Length)
+ event_execute_pixmap.DrawRectangle(pen_yellow, false, rect);
+ else
+ event_execute_pixmap.DrawRectangle(pen_negro, false, rect);
+
+ count --;
+
}
}
//blue for TF
//check it's not a take off
- count = 0;
+ count = jumps.Length;
if(tvNow > 0) {
foreach(string myStr in jumps) {
string [] jump = myStr.Split(new char[] {':'});
//jump[5] is ok fo jump.tv and for reactionTime.time
Rectangle rect = new Rectangle(
-
Convert.ToInt32((ancho-event_execute_rightMargin)*(count+.5)/jumps.Length)-barDesplLeft +tctfSep,
+
Convert.ToInt32((ancho-event_execute_rightMargin)*(count-.5)/jumps.Length)-barDesplLeft +tctfSep,
calculatePaintHeight(Convert.ToDouble(jump[5]), alto,
maxValue, minValue,
topMargin, bottomMargin),
barWidth, alto
);
event_execute_pixmap.DrawRectangle(pen_azul_claro, true, rect);
- event_execute_pixmap.DrawRectangle(pen_negro, false, rect);
- count ++;
+ if(count == jumps.Length)
+ event_execute_pixmap.DrawRectangle(pen_yellow, false, rect);
+ else
+ event_execute_pixmap.DrawRectangle(pen_negro, false, rect);
+
+ count --;
+
}
-
- //write "last" to show last jump
- layout.SetMarkup(Catalog.GetString("Last"));
- event_execute_pixmap.DrawLayout (pen_gris,
-
Convert.ToInt32((ancho-event_execute_rightMargin)*(count-.5)/jumps.Length)-barDesplLeft + tctfSep,
- 0, layout);
- }
plotSimulatedMessageIfNeededAtLast(
-
Convert.ToInt32((ancho-event_execute_rightMargin)*(count-.5)/jumps.Length)-barDesplLeft + tctfSep
+
Convert.ToInt32((ancho-event_execute_rightMargin)*(jumps.Length-.5)/jumps.Length)-barDesplLeft + tctfSep
+ barWidth/2,
alto);
@@ -1970,6 +1973,7 @@ public partial class ChronoJumpWindow
Gdk.GC pen_azul_claro_discont; //avg tf in reactive; jump avg sessionTv
Gdk.GC pen_azul_discont; //avg tf in reactive; jump avg sessionTv
Gdk.GC pen_negro; //borders of rectangle
+ Gdk.GC pen_yellow; //big yellow borders of rectangle (last event)
Gdk.GC pen_negro_discont; //guide
Gdk.GC pen_green_discont; //guide
Gdk.GC pen_gris; //textual data
@@ -1986,6 +1990,7 @@ public partial class ChronoJumpWindow
//Gdk.Color rojo = new Gdk.Color(238,0,0);
//Gdk.Color azul = new Gdk.Color(178,223,238);
Gdk.Color negro = new Gdk.Color(0,0,0);
+ Gdk.Color yellow = new Gdk.Color(0xff,0xcc,0x01);
Gdk.Color green = new Gdk.Color(0,0xff,0);
Gdk.Color gris = new Gdk.Color(0x66,0x66,0x66);
Gdk.Color beige = new Gdk.Color(0x99,0x99,0x99);
@@ -1998,6 +2003,7 @@ public partial class ChronoJumpWindow
colormap.AllocColor (ref UtilGtk.BLUE_PLOTS,true,true);
colormap.AllocColor (ref UtilGtk.LIGHT_BLUE_PLOTS,true,true);
colormap.AllocColor (ref negro,true,true);
+ colormap.AllocColor (ref yellow,true,true);
colormap.AllocColor (ref green,true,true);
colormap.AllocColor (ref gris,true,true);
colormap.AllocColor (ref beige,true,true);
@@ -2007,6 +2013,7 @@ public partial class ChronoJumpWindow
//-- Configurar los contextos graficos (pinceles)
pen_rojo = new Gdk.GC(event_execute_drawingarea.GdkWindow);
+ pen_yellow = new Gdk.GC(event_execute_drawingarea.GdkWindow);
pen_azul_claro = new Gdk.GC(event_execute_drawingarea.GdkWindow);
pen_azul = new Gdk.GC(event_execute_drawingarea.GdkWindow);
pen_rojo_discont = new Gdk.GC(event_execute_drawingarea.GdkWindow);
@@ -2035,6 +2042,7 @@ public partial class ChronoJumpWindow
pen_azul_discont.SetLineAttributes(1, Gdk.LineStyle.OnOffDash, Gdk.CapStyle.Butt,
Gdk.JoinStyle.Round);
pen_negro.Foreground = negro;
+ pen_yellow.Foreground = yellow;
pen_negro_discont.Foreground = negro;
pen_negro_discont.SetLineAttributes(1, Gdk.LineStyle.OnOffDash, Gdk.CapStyle.Butt,
Gdk.JoinStyle.Round);
@@ -2046,6 +2054,8 @@ public partial class ChronoJumpWindow
pen_beige_discont.Foreground = beige;
pen_beige_discont.SetLineAttributes(1, Gdk.LineStyle.OnOffDash, Gdk.CapStyle.Butt,
Gdk.JoinStyle.Round);
+ pen_yellow.SetLineAttributes(2, Gdk.LineStyle.Solid, Gdk.CapStyle.Butt, Gdk.JoinStyle.Round);
+
pen_brown_bold.Foreground = brown;
pen_brown_bold.SetLineAttributes(2, Gdk.LineStyle.Solid, Gdk.CapStyle.Butt,
Gdk.JoinStyle.Round);
pen_violet_bold.Foreground = violet;
diff --git a/src/gui/jump.cs b/src/gui/jump.cs
index b49ae31..76025ce 100644
--- a/src/gui/jump.cs
+++ b/src/gui/jump.cs
@@ -1569,7 +1569,8 @@ public class JumpsMoreWindow : EventMoreWindow
}
protected override string [] findTestTypesInSessions() {
- return SqliteJump.SelectJumps(false, -1, -1, "", selectedEventName);
+ return SqliteJump.SelectJumps(false, -1, -1, "", selectedEventName,
+ Sqlite.Orders_by.DEFAULT, -1);
}
void on_button_cancel_clicked (object o, EventArgs args)
diff --git a/src/gui/person.cs b/src/gui/person.cs
index 1cdf0b6..2f6894f 100644
--- a/src/gui/person.cs
+++ b/src/gui/person.cs
@@ -1552,7 +1552,8 @@ public class PersonAddModifyWindow
//if weight has changed
if(!adding && (double) spinbutton_weight.Value != weightIni) {
//see if this person has done jumps with weight
- string [] myJumpsNormal = SqliteJump.SelectJumps(false,
currentSession.UniqueID, currentPerson.UniqueID, "withWeight", "");
+ string [] myJumpsNormal = SqliteJump.SelectJumps(false,
currentSession.UniqueID, currentPerson.UniqueID, "withWeight", "",
+ Sqlite.Orders_by.DEFAULT, -1);
string [] myJumpsReactive = SqliteJumpRj.SelectJumps(false,
currentSession.UniqueID, currentPerson.UniqueID, "withWeight", "");
if(myJumpsNormal.Length > 0 || myJumpsReactive.Length > 0) {
diff --git a/src/gui/usefulObjects.cs b/src/gui/usefulObjects.cs
index 1843559..aa8adf2 100644
--- a/src/gui/usefulObjects.cs
+++ b/src/gui/usefulObjects.cs
@@ -76,7 +76,8 @@ public class PrepareEventGraphJumpSimple {
Sqlite.Open();
//select data from SQL to update graph
- jumpsAtSQL = SqliteJump.SelectJumps(true, sessionID, personID, "", type);
+ jumpsAtSQL = SqliteJump.SelectJumps(true, sessionID, personID, "", type,
+ Sqlite.Orders_by.ID_DESC, 10); //select only last 10 jumps
tvPersonAVGAtSQL = SqliteSession.SelectAVGEventsOfAType(
true, sessionID, personID,
diff --git a/src/report.cs b/src/report.cs
index d0a164f..bf01b52 100644
--- a/src/report.cs
+++ b/src/report.cs
@@ -103,7 +103,8 @@ public class Report : ExportSession
Sqlite.Open(); // ------------------------------
if(ShowSimpleJumps) {
- myJumps= SqliteJump.SelectJumps(true, sessionID, -1, "", "");
+ myJumps= SqliteJump.SelectJumps(true, sessionID, -1, "", "",
+ Sqlite.Orders_by.DEFAULT, -1);
}
if(ShowReactiveJumps) {
myJumpsRj = SqliteJumpRj.SelectJumps(true, sessionID, -1, "", "");
diff --git a/src/server.cs b/src/server.cs
index fbc9447..79ea13b 100644
--- a/src/server.cs
+++ b/src/server.cs
@@ -254,7 +254,8 @@ public class Server
int countE = 0;
int countS = 0;
- string [] jumps = SqliteJump.SelectJumps(false, currentSession.UniqueID,
person.UniqueID, "", "");
+ string [] jumps = SqliteJump.SelectJumps(false, currentSession.UniqueID,
person.UniqueID, "", "",
+ Sqlite.Orders_by.DEFAULT, -1);
Sqlite.Open();
foreach(string myJump in jumps) {
string [] js = myJump.Split(new char[] {':'});
diff --git a/src/sqlite/jump.cs b/src/sqlite/jump.cs
index 2e3c3b2..5f89696 100644
--- a/src/sqlite/jump.cs
+++ b/src/sqlite/jump.cs
@@ -93,11 +93,13 @@ class SqliteJump : Sqlite
return myLast;
}
-
+
//if all sessions, put -1 in sessionID
//if all persons, put -1 in personID
//if all types put, "" in filterType
- public static string[] SelectJumps(bool dbconOpened, int sessionID, int personID, string
filterWeight, string filterType)
+ //unlimited put -1 in limit
+ public static string[] SelectJumps(bool dbconOpened, int sessionID, int personID, string
filterWeight, string filterType,
+ Orders_by order, int limit)
{
if(!dbconOpened)
Sqlite.Open();
@@ -121,6 +123,14 @@ class SqliteJump : Sqlite
if(filterType != "")
filterTypeString = " AND jump.type == \"" + filterType + "\" ";
+ string orderByString = " ORDER BY upper(" + tp + ".name), jump.uniqueID ";
+ if(order == Orders_by.ID_DESC)
+ orderByString = " ORDER BY jump.uniqueID DESC ";
+
+ string limitString = "";
+ if(limit != -1)
+ limitString = " LIMIT " + limit;
+
dbcmd.CommandText = "SELECT " + tp + ".name, jump.*, " + tps + ".weight " +
" FROM " + tp + ", jump, " + tps +
" WHERE " + tp + ".uniqueID == jump.personID " +
@@ -130,7 +140,8 @@ class SqliteJump : Sqlite
filterTypeString +
" AND " + tps + ".personID == " + tp + ".uniqueID " +
" AND " + tps + ".sessionID == jump.sessionID " +
- " ORDER BY upper(" + tp + ".name), jump.uniqueID";
+ orderByString +
+ limitString;
LogB.SQL(dbcmd.CommandText.ToString());
dbcmd.ExecuteNonQuery();
diff --git a/src/sqlite/main.cs b/src/sqlite/main.cs
index 01c8f03..70a3451 100644
--- a/src/sqlite/main.cs
+++ b/src/sqlite/main.cs
@@ -58,6 +58,7 @@ class Sqlite
static bool creatingBlankDatabase = false;
+ public enum Orders_by { DEFAULT, ID_DESC }
//for db creation
static int creationRate;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]