[chronojump] Implemented Encoder exercises (lot of changes)
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Implemented Encoder exercises (lot of changes)
- Date: Sat, 2 Jun 2012 00:31:23 +0000 (UTC)
commit 7749735788b7bad311f411a5c5ad56a0cad8f51a
Author: Xavier de Blas <xaviblas gmail com>
Date: Sat Jun 2 02:27:44 2012 +0200
Implemented Encoder exercises (lot of changes)
encoder/graph.R | 17 +-
glade/chronojump.glade | 583 ++++++++++++++++++++++--------------------------
src/encoder.cs | 88 +++++---
src/gui/chronojump.cs | 3 +-
src/gui/encoder.cs | 248 +++++++++++++++------
src/sqlite/encoder.cs | 115 +++++++---
6 files changed, 594 insertions(+), 460 deletions(-)
---
diff --git a/encoder/graph.R b/encoder/graph.R
index ed65498..25dde84 100644
--- a/encoder/graph.R
+++ b/encoder/graph.R
@@ -299,7 +299,8 @@ paint <- function(rawdata, eccon, xmin, xmax, yrange, knRanges, superpose, highl
#mark when it's air and land
#if it was a eccon concentric-eccentric, will be useful to calculate flight time
#but this eccon will be not done
- if(draw & (!superpose || (superpose & highlight)) & isJump) {
+ #if(draw & (!superpose || (superpose & highlight)) & isJump) {
+ if(draw & (!superpose || (superpose & highlight)) & exercisePercentBodyWeight == 100) {
weight=mass*9.81
abline(h=weight,lty=1,col=cols[2]) #body force, lower than this, person in the air (in a jump)
takeoff = max(which(force>=weight))
@@ -449,7 +450,7 @@ if(length(args) < 3) {
outputData1=args[3]
outputData2=args[4]
minHeight=as.numeric(args[5])*10 #from cm to mm
- isJump=as.logical(args[6])
+ exercisePercentBodyWeight=as.numeric(args[6]) #was isJump=as.logical(args[6])
mass=as.numeric(args[7])
eccon=args[8]
analysis=args[9]
@@ -462,8 +463,8 @@ if(length(args) < 3) {
titleType = "execution"
- if(isJump)
- titleType="jump"
+ #if(isJump)
+ # titleType="jump"
curvesPlot = FALSE
if(analysis=="curves") {
@@ -486,12 +487,12 @@ if(length(args) < 3) {
#this are separated movements
#maybe all are concentric (there's no returning to 0 phase)
- #this version of curves will have added specific data cols: type, mass, smoothingOne, dateTime
+ #this version of curves will have added specific data cols: exerciseName, mass, smoothingOne, dateTime
inputMultiData=read.csv(file=file,sep=",")
rawdata = NULL
count = 1
start = NULL; end = NULL; startH = NULL
- type = NULL; mass = NULL; smooth = NULL; dateTime = NULL
+ exerciseName = NULL; mass = NULL; smooth = NULL; dateTime = NULL
for(i in 1:length(inputMultiData[,1])) {
print (i)
dataTemp=scan(file=as.vector(inputMultiData$fullURL[i]),sep=",")
@@ -500,13 +501,13 @@ if(length(args) < 3) {
start[i] = count
end[i] = length(dataTemp) + count -1
startH[i] = 0
- type[i] = as.vector(inputMultiData$type[i])
+ exerciseName[i] = as.vector(inputMultiData$exerciseName[i])
mass[i] = inputMultiData$mass[i]
smooth[i] = inputMultiData$smoothingOne[i]
dateTime[i] = inputMultiData$dateTime[i]
count = count + length(dataTemp)
}
- curves = data.frame(start,end,startH,type,mass,smooth,dateTime,stringsAsFactors=F)
+ curves = data.frame(start,end,startH,exerciseName,mass,smooth,dateTime,stringsAsFactors=F)
rownames(curves)=1:length(rownames(curves))
#print(curves)
n=length(curves[,1])
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index 05668c3..a0537ae 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -24008,120 +24008,95 @@ Evaluator can use real name or nickname.</property>
<property name="visible">True</property>
<property name="spacing">12</property>
<child>
- <widget class="GtkFrame" id="frame16">
+ <widget class="GtkVBox" id="vbox48">
<property name="visible">True</property>
- <property name="label_xalign">0</property>
- <property name="label_yalign">0.69999998807907104</property>
- <property name="shadow_type">out</property>
+ <property name="spacing">4</property>
<child>
- <widget class="GtkAlignment" id="alignment19">
+ <widget class="GtkFrame" id="frame18">
<property name="visible">True</property>
- <property name="top_padding">4</property>
- <property name="bottom_padding">4</property>
- <property name="left_padding">10</property>
- <property name="right_padding">10</property>
+ <property name="label_xalign">0</property>
+ <property name="label_yalign">0.69999998807907104</property>
+ <property name="shadow_type">out</property>
<child>
- <widget class="GtkHBox" id="hbox58">
+ <widget class="GtkAlignment" id="alignment22">
<property name="visible">True</property>
- <property name="spacing">5</property>
+ <property name="left_padding">12</property>
<child>
- <widget class="GtkTable" id="table7">
+ <widget class="GtkHBox" id="hbox81">
<property name="visible">True</property>
- <property name="n_rows">2</property>
- <property name="n_columns">3</property>
- <property name="column_spacing">6</property>
- <property name="row_spacing">6</property>
- <child>
- <widget class="GtkLabel" id="label76">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Kg</property>
- </widget>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options"></property>
- <property name="y_options"></property>
- </packing>
- </child>
+ <property name="spacing">12</property>
<child>
- <widget class="GtkLabel" id="label83">
+ <widget class="GtkHBox" id="hbox82">
<property name="visible">True</property>
- <property name="label" translatable="yes">Kg</property>
- </widget>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="x_options"></property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <widget class="GtkSpinButton" id="spin_encoder_jump_weight">
+ <property name="spacing">2</property>
+ <child>
+ <widget class="GtkHBox" id="hbox_combo_encoder_exercise">
<property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">â</property>
- <property name="adjustment">0 0 300 1 10 0</property>
- <property name="climb_rate">1</property>
- <property name="snap_to_ticks">True</property>
- <property name="numeric">True</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options"></property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <widget class="GtkSpinButton" id="spin_encoder_bar_weight">
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="button_encoder_exercise_info">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="invisible_char">â</property>
- <property name="adjustment">10 1 300 1 10 0</property>
- <property name="climb_rate">1</property>
- <property name="snap_to_ticks">True</property>
- <property name="numeric">True</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="x_options"></property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <widget class="GtkHBox" id="hbox85">
+ <property name="receives_default">True</property>
+ <property name="has_tooltip">True</property>
+ <property name="tooltip" translatable="yes">Add new exercise</property>
+ <signal name="clicked" handler="on_button_encoder_exercise_info_clicked"/>
+ <child>
+ <widget class="GtkImage" id="image4">
<property name="visible">True</property>
- <property name="spacing">10</property>
+ <property name="stock">gtk-info</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
<child>
- <widget class="GtkRadioButton" id="radiobutton_encoder_capture_jump">
- <property name="label" translatable="yes">Jump</property>
+ <widget class="GtkButton" id="button_encoder_exercise_add">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- <property name="group">radiobutton_encoder_capture_bar</property>
- <signal name="toggled" handler="on_radiobutton_encoder_capture_jump_toggled"/>
+ <property name="receives_default">True</property>
+ <property name="has_tooltip">True</property>
+ <property name="tooltip" translatable="yes">Add new exercise</property>
+ <signal name="clicked" handler="on_button_encoder_exercise_add_clicked"/>
+ <child>
+ <widget class="GtkImage" id="image2986">
+ <property name="visible">True</property>
+ <property name="stock">gtk-add</property>
+ </widget>
+ </child>
</widget>
<packing>
- <property name="position">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
</packing>
</child>
- <child>
- <widget class="GtkHBox" id="hbox76">
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox83">
<property name="visible">True</property>
<property name="spacing">4</property>
<child>
- <widget class="GtkLabel" id="label_encoder_person_weight">
+ <widget class="GtkLabel" id="label88">
<property name="visible">True</property>
- <property name="xalign">1</property>
- <property name="label" translatable="yes">0</property>
+ <property name="label" translatable="yes">Extra weight</property>
</widget>
<packing>
<property name="expand">False</property>
@@ -24130,10 +24105,14 @@ Evaluator can use real name or nickname.</property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label80">
+ <widget class="GtkSpinButton" id="spin_encoder_extra_weight">
<property name="visible">True</property>
- <property name="xalign">1</property>
- <property name="label" translatable="yes">+</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">â</property>
+ <property name="adjustment">10 1 300 1 10 0</property>
+ <property name="climb_rate">1</property>
+ <property name="snap_to_ticks">True</property>
+ <property name="numeric">True</property>
</widget>
<packing>
<property name="expand">False</property>
@@ -24141,185 +24120,178 @@ Evaluator can use real name or nickname.</property>
<property name="position">1</property>
</packing>
</child>
+ <child>
+ <widget class="GtkLabel" id="label89">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Kg</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">1</property>
+ <property name="position">2</property>
</packing>
</child>
</widget>
<packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="position">1</property>
</packing>
</child>
<child>
- <widget class="GtkRadioButton" id="radiobutton_encoder_capture_bar">
- <property name="label" translatable="yes">Weight bar</property>
+ <widget class="GtkHBox" id="hbox_combo_encoder_eccon">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
- <property name="active">True</property>
- <property name="draw_indicator">True</property>
- <signal name="toggled" handler="on_radiobutton_encoder_capture_bar_toggled"/>
- </widget>
- <packing>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <widget class="GtkVBox" id="vbox2">
- <property name="visible">True</property>
- <property name="spacing">6</property>
- <child>
- <widget class="GtkRadioButton" id="radiobutton_encoder_concentric">
- <property name="label" translatable="yes">Concentric</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="active">True</property>
- <property name="draw_indicator">True</property>
- <signal name="toggled" handler="on_radiobutton_encoder_eccon_toggled"/>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
- <property name="fill">False</property>
- <property name="position">0</property>
+ <property name="position">2</property>
</packing>
</child>
<child>
- <widget class="GtkRadioButton" id="radiobutton_encoder_eccentric-concentric">
- <property name="label" translatable="yes">Eccentric-concentric</property>
+ <widget class="GtkHBox" id="hbox_combo_encoder_laterality">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="draw_indicator">True</property>
- <property name="group">radiobutton_encoder_concentric</property>
- <signal name="toggled" handler="on_radiobutton_encoder_eccon_toggled"/>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
- <property name="fill">False</property>
- <property name="position">1</property>
+ <property name="position">3</property>
</packing>
</child>
</widget>
- <packing>
- <property name="position">1</property>
- </packing>
</child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label84">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"><b>Exercise</b></property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="type">label_item</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkFrame" id="frame16">
+ <property name="visible">True</property>
+ <property name="label_xalign">0</property>
+ <property name="label_yalign">0.69999998807907104</property>
+ <property name="shadow_type">out</property>
+ <child>
+ <widget class="GtkAlignment" id="alignment19">
+ <property name="visible">True</property>
+ <property name="top_padding">4</property>
+ <property name="bottom_padding">4</property>
+ <property name="left_padding">10</property>
+ <property name="right_padding">10</property>
<child>
- <widget class="GtkTable" id="table9">
+ <widget class="GtkHBox" id="hbox58">
<property name="visible">True</property>
- <property name="n_rows">2</property>
- <property name="n_columns">3</property>
- <property name="column_spacing">6</property>
- <property name="row_spacing">6</property>
+ <property name="spacing">5</property>
<child>
- <widget class="GtkLabel" id="label81">
+ <widget class="GtkHBox" id="hbox76">
<property name="visible">True</property>
- <property name="xalign">1</property>
- <property name="label" translatable="yes">cm</property>
- </widget>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options"></property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <widget class="GtkSpinButton" id="spin_encoder_capture_min_height">
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label82">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Recording time</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkSpinButton" id="spin_encoder_capture_time">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">â</property>
- <property name="adjustment">30 1 300 1 10 0</property>
+ <property name="adjustment">10 5 99 1 10 0</property>
<property name="climb_rate">1</property>
<property name="snap_to_ticks">True</property>
<property name="numeric">True</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options"></property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <widget class="GtkLabel" id="label78">
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label71">
<property name="visible">True</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">Minimal height</property>
+ <property name="label" translatable="yes">s</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
</widget>
<packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options"></property>
- <property name="y_options"></property>
+ <property name="position">0</property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label82">
+ <widget class="GtkHBox" id="hbox85">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label78">
<property name="visible">True</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">Recording time</property>
- </widget>
- <packing>
- <property name="x_options"></property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <widget class="GtkSpinButton" id="spin_encoder_capture_time">
+ <property name="label" translatable="yes">Minimal height</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkSpinButton" id="spin_encoder_capture_min_height">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">â</property>
- <property name="adjustment">10 5 99 1 10 0</property>
+ <property name="adjustment">30 1 300 1 10 0</property>
<property name="climb_rate">1</property>
<property name="snap_to_ticks">True</property>
<property name="numeric">True</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="x_options"></property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <widget class="GtkLabel" id="label71">
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label81">
<property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">s</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">cm</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
</widget>
<packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="position">1</property>
</packing>
</child>
- </widget>
- <packing>
- <property name="position">2</property>
- </packing>
- </child>
- <child>
- <widget class="GtkVBox" id="vbox4">
- <property name="visible">True</property>
- <property name="spacing">6</property>
<child>
<widget class="GtkHBox" id="hbox86">
<property name="visible">True</property>
@@ -24333,8 +24305,7 @@ Evaluator can use real name or nickname.</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="pack_type">end</property>
- <property name="position">1</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
@@ -24351,15 +24322,12 @@ Evaluator can use real name or nickname.</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
+ <property name="position">1</property>
</packing>
</child>
</widget>
<packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
+ <property name="position">2</property>
</packing>
</child>
<child>
@@ -24414,36 +24382,32 @@ Evaluator can use real name or nickname.</property>
</child>
</widget>
<packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
+ <property name="position">3</property>
</packing>
</child>
</widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">3</property>
- </packing>
</child>
</widget>
</child>
- </widget>
- </child>
- <child>
- <widget class="GtkLabel" id="label75">
- <property name="visible">True</property>
- <property name="label" translatable="yes"><b>Options</b></property>
- <property name="use_markup">True</property>
+ <child>
+ <widget class="GtkLabel" id="label75">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"><b>Options</b></property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="type">label_item</property>
+ </packing>
+ </child>
</widget>
<packing>
- <property name="type">label_item</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
</packing>
</child>
</widget>
<packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
@@ -24808,19 +24772,16 @@ Evaluator can use real name or nickname.</property>
<property name="left_padding">10</property>
<property name="right_padding">10</property>
<child>
- <widget class="GtkHBox" id="hbox79">
+ <widget class="GtkHBox" id="hbox87">
<property name="visible">True</property>
- <property name="spacing">30</property>
+ <property name="spacing">12</property>
<child>
- <widget class="GtkTable" id="table12">
+ <widget class="GtkHBox" id="hbox88">
<property name="visible">True</property>
- <property name="n_rows">2</property>
- <property name="n_columns">2</property>
- <property name="column_spacing">12</property>
- <property name="row_spacing">4</property>
+ <property name="spacing">12</property>
<child>
<widget class="GtkRadioButton" id="radiobutton_encoder_analyze_powerbars">
- <property name="label" translatable="yes">Show power bars</property>
+ <property name="label" translatable="yes">Power bars</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@@ -24828,35 +24789,64 @@ Evaluator can use real name or nickname.</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_radiobutton_encoder_analyze_powerbars_toggled"/>
</widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
</child>
<child>
- <widget class="GtkRadioButton" id="radiobutton_encoder_analyze_single">
- <property name="label" translatable="yes">Single curve</property>
+ <widget class="GtkRadioButton" id="radiobutton_encoder_analyze_side">
+ <property name="label" translatable="yes">Side compare</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<property name="group">radiobutton_encoder_analyze_powerbars</property>
- <signal name="toggled" handler="on_radiobutton_encoder_analyze_single_toggled"/>
+ <signal name="toggled" handler="on_radiobutton_encoder_analyze_side_toggled"/>
</widget>
<packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
+ <property name="position">1</property>
</packing>
</child>
<child>
- <widget class="GtkRadioButton" id="radiobutton_encoder_analyze_side">
- <property name="label" translatable="yes">Side compare</property>
+ <widget class="GtkHBox" id="hbox74">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkRadioButton" id="radiobutton_encoder_analyze_single">
+ <property name="label" translatable="yes">Single curve</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<property name="group">radiobutton_encoder_analyze_powerbars</property>
- <signal name="toggled" handler="on_radiobutton_encoder_analyze_side_toggled"/>
+ <signal name="toggled" handler="on_radiobutton_encoder_analyze_single_toggled"/>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkSpinButton" id="spin_encoder_analyze_curve_num">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">â</property>
+ <property name="adjustment">1 1 40 1 10 0</property>
+ <property name="climb_rate">1</property>
+ <property name="snap_to_ticks">True</property>
+ <property name="numeric">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</widget>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
</packing>
</child>
<child>
@@ -24869,34 +24859,20 @@ Evaluator can use real name or nickname.</property>
<signal name="toggled" handler="on_radiobutton_encoder_analyze_superpose_toggled"/>
</widget>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
+ <property name="position">3</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
+ <property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
- <widget class="GtkVSeparator" id="vseparator1">
+ <widget class="GtkHBox" id="hbox79">
<property name="visible">True</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <widget class="GtkTable" id="table10">
- <property name="visible">True</property>
- <property name="n_rows">2</property>
- <property name="n_columns">2</property>
- <property name="column_spacing">12</property>
- <property name="row_spacing">4</property>
+ <property name="spacing">10</property>
<child>
<widget class="GtkLabel" id="label_encoder_analyze_eccon">
<property name="visible">True</property>
@@ -24905,9 +24881,10 @@ Evaluator can use real name or nickname.</property>
<property name="label" translatable="yes">Ecc-conc phases</property>
</widget>
<packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_FILL</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
</packing>
</child>
<child>
@@ -24946,50 +24923,18 @@ Evaluator can use real name or nickname.</property>
</child>
</widget>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- </packing>
- </child>
- <child>
- <widget class="GtkLabel" id="label_encoder_analyze_curve_num">
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Curve number</property>
- </widget>
- </child>
- <child>
- <widget class="GtkHBox" id="hbox74">
- <property name="visible">True</property>
- <child>
- <widget class="GtkSpinButton" id="spin_encoder_analyze_curve_num">
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">â</property>
- <property name="adjustment">1 1 40 1 10 0</property>
- <property name="climb_rate">1</property>
- <property name="snap_to_ticks">True</property>
- <property name="numeric">True</property>
- </widget>
- <packing>
<property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="pack_type">end</property>
<property name="position">0</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
- <property name="position">2</property>
+ <property name="fill">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
</packing>
</child>
</widget>
diff --git a/src/encoder.cs b/src/encoder.cs
index 134c033..1095faa 100644
--- a/src/encoder.cs
+++ b/src/encoder.cs
@@ -29,7 +29,7 @@ public class EncoderParams
private int time;
private string mass; //to pass always as "." to R
private int minHeight;
- private bool isJump;
+ private int exercisePercentBodyWeight; //was private bool isJump; (if it's 0 is like "jump")
private string eccon;
private string analysis;
private string smooth; //to pass always as "." to R
@@ -51,7 +51,7 @@ public class EncoderParams
{
}
- public EncoderParams(int time, int minHeight, bool isJump, string mass, string smooth, string eccon,
+ public EncoderParams(int time, int minHeight, int exercisePercentBodyWeight, string mass, string smooth, string eccon,
double heightHigherCondition, double heightLowerCondition,
double meanSpeedHigherCondition, double meanSpeedLowerCondition,
double maxSpeedHigherCondition, double maxSpeedLowerCondition,
@@ -60,7 +60,7 @@ public class EncoderParams
{
this.time = time;
this.minHeight = minHeight;
- this.isJump = isJump;
+ this.exercisePercentBodyWeight = exercisePercentBodyWeight;
this.mass = mass;
this.smooth = smooth;
this.eccon = eccon;
@@ -78,7 +78,7 @@ public class EncoderParams
public string ToString1 ()
{
- return time.ToString() + " " + minHeight.ToString() + " " + isJump.ToString() +
+ return time.ToString() + " " + minHeight.ToString() + " " + exercisePercentBodyWeight.ToString() +
" " + mass.ToString() + " " + smooth + " " + eccon +
" " + heightHigherCondition.ToString() + " " + heightLowerCondition.ToString() +
" " + Util.ConvertToPoint(meanSpeedHigherCondition.ToString()) +
@@ -89,11 +89,11 @@ public class EncoderParams
" " + peakPowerHigherCondition.ToString() + " " + peakPowerLowerCondition.ToString();
}
- public EncoderParams(int minHeight, bool isJump, string mass, string eccon,
+ public EncoderParams(int minHeight, int exercisePercentBodyWeight, string mass, string eccon,
string analysis, string smooth, int curve, int width, int height)
{
this.minHeight = minHeight;
- this.isJump = isJump;
+ this.exercisePercentBodyWeight = exercisePercentBodyWeight;
this.mass = mass;
this.eccon = eccon;
this.analysis = analysis;
@@ -105,7 +105,7 @@ public class EncoderParams
public string ToString2 ()
{
- return minHeight + " " + isJump + " " + mass + " " + eccon + " " + analysis + " " +
+ return minHeight + " " + exercisePercentBodyWeight + " " + mass + " " + eccon + " " + analysis + " " +
smooth + " " + curve + " " + width + " " + height;
}
@@ -179,36 +179,53 @@ public class EncoderSQL
public string uniqueID;
public int personID;
public int sessionID;
- public string name;
- public string url;
- public string type;
- public string extraWeight;
+ public int exerciseID;
public string eccon;
+ public string laterality;
+ public string extraWeight;
+ public string streamOrCurve;
+ public string filename;
+ public string url;
public int time;
public int minHeight;
public double smooth;
public string description;
+ public string future1;
+ public string future2;
+ public string future3;
+ public string exerciseName;
- private string ecconLong;
+ public string ecconLong;
public EncoderSQL ()
{
}
- public EncoderSQL (string uniqueID, int personID, int sessionID, string name, string url, string type, string extraWeight, string eccon, int time, int minHeight, double smooth, string description)
+ public EncoderSQL (string uniqueID, int personID, int sessionID, int exerciseID,
+ string eccon, string laterality, string extraWeight, string streamOrCurve,
+ string filename, string url, int time, int minHeight, double smooth,
+ string description, string future1, string future2, string future3,
+ string exerciseName
+ )
{
this.uniqueID = uniqueID;
this.personID = personID;
this.sessionID = sessionID;
- this.name = name;
- this.url = url;
- this.type = type;
- this.extraWeight = extraWeight;
+ this.exerciseID = exerciseID;
this.eccon = eccon;
+ this.laterality = laterality;
+ this.extraWeight = extraWeight;
+ this.streamOrCurve = streamOrCurve;
+ this.filename = filename;
+ this.url = url;
this.time = time;
this.minHeight = minHeight;
this.smooth = smooth;
this.description = description;
+ this.future1 = future1;
+ this.future2 = future2;
+ this.future3 = future3;
+ this.exerciseName = exerciseName;
if(eccon == "c")
ecconLong = Catalog.GetString("Concentric");
@@ -217,9 +234,9 @@ public class EncoderSQL
}
public string GetDate(bool pretty) {
- int pointPos = name.LastIndexOf('.');
+ int pointPos = filename.LastIndexOf('.');
int dateLength = 19; //YYYY-MM-DD_hh-mm-ss
- string date = name.Substring(pointPos - dateLength, dateLength);
+ string date = filename.Substring(pointPos - dateLength, dateLength);
if(pretty) {
string [] dateParts = date.Split(new char[] {'_'});
date = dateParts[0] + " " + dateParts[1].Replace('-',':');
@@ -227,17 +244,10 @@ public class EncoderSQL
return date;
}
- private string typePretty() {
- if(type.EndsWith("BAR"))
- return Catalog.GetString("Weight bar");
- else
- return Catalog.GetString("Jump");
- }
-
public string [] ToStringArray () {
string [] str = new String [6];
str[0] = uniqueID;
- str[1] = typePretty();
+ str[1] = exerciseName;
str[2] = ecconLong;
str[3] = extraWeight;
str[4] = GetDate(true);
@@ -246,3 +256,27 @@ public class EncoderSQL
}
}
+
+public class EncoderExercise
+{
+ public EncoderExercise() {
+ }
+
+ public int uniqueID;
+ public string name;
+ public int percentBodyWeight;
+ public string ressistance;
+ public string description;
+
+ public EncoderExercise(int uniqueID, string name, int percentBodyWeight, string ressistance, string description)
+ {
+ this.uniqueID = uniqueID;
+ this.name = name;
+ this.percentBodyWeight = percentBodyWeight;
+ this.ressistance = ressistance;
+ this.description = description;
+ }
+
+ ~EncoderExercise() {}
+}
+
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index e95ead6..499bae2 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -496,7 +496,7 @@ public partial class ChronoJumpWindow
createdStatsWin = true;
//stats_win_initializeSession();
- encoderInitializeVariables();
+ encoderInitializeStuff();
}
@@ -5170,7 +5170,6 @@ Console.WriteLine("X");
hbox_execute_test.Sensitive = true;
- label_encoder_person_weight.Text = currentPersonSession.Weight.ToString();
button_encoder_analyze.Sensitive = radiobutton_encoder_analyze_data_user_curves.Active;
}
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 13254ce..494a899 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -30,16 +30,12 @@ using Mono.Unix;
public partial class ChronoJumpWindow
{
- [Widget] Gtk.SpinButton spin_encoder_bar_weight;
- [Widget] Gtk.SpinButton spin_encoder_jump_weight;
+ [Widget] Gtk.SpinButton spin_encoder_extra_weight;
[Widget] Gtk.SpinButton spin_encoder_smooth;
[Widget] Gtk.Button button_encoder_capture;
[Widget] Gtk.Button button_encoder_recalculate;
[Widget] Gtk.Button button_encoder_load_stream;
- [Widget] Gtk.Label label_encoder_person_weight;
- [Widget] Gtk.RadioButton radiobutton_encoder_concentric;
- [Widget] Gtk.RadioButton radiobutton_encoder_capture_bar;
[Widget] Gtk.Viewport viewport_image_encoder_capture;
[Widget] Gtk.Image image_encoder_bell;
[Widget] Gtk.SpinButton spin_encoder_capture_time;
@@ -54,6 +50,14 @@ public partial class ChronoJumpWindow
[Widget] Gtk.Button button_encoder_save_all_curves;
[Widget] Gtk.Button button_encoder_save_stream;
+ [Widget] Gtk.Box hbox_combo_encoder_exercise;
+ [Widget] Gtk.ComboBox combo_encoder_exercise;
+ [Widget] Gtk.Box hbox_combo_encoder_eccon;
+ [Widget] Gtk.ComboBox combo_encoder_eccon;
+ [Widget] Gtk.Box hbox_combo_encoder_laterality;
+ [Widget] Gtk.ComboBox combo_encoder_laterality;
+
+
[Widget] Gtk.Button button_encoder_analyze;
[Widget] Gtk.RadioButton radiobutton_encoder_analyze_data_current_stream;
[Widget] Gtk.RadioButton radiobutton_encoder_analyze_data_user_curves;
@@ -66,7 +70,6 @@ public partial class ChronoJumpWindow
[Widget] Gtk.Box hbox_encoder_analyze_eccon;
[Widget] Gtk.RadioButton radiobutton_encoder_eccon_both;
[Widget] Gtk.RadioButton radiobutton_encoder_eccon_together;
- [Widget] Gtk.Label label_encoder_analyze_curve_num;
[Widget] Gtk.SpinButton spin_encoder_analyze_curve_num;
[Widget] Gtk.Viewport viewport_image_encoder_analyze;
[Widget] Gtk.Image image_encoder_analyze;
@@ -96,14 +99,14 @@ public partial class ChronoJumpWindow
//TODO: Put person name in graph (at title,with small separation, or inside graph at topright) (if we click on another person on treeview person, we need to know wich person was last generated graph)
//TODO: if mode is ecc-con, curves used have to be eccon
//TODO: when change person: unsensitive: recalculate, capture graph, treeview capture, buttons caputre on bottom, analyze button
+ //TODO: when selected user curves, Single curve spinbutton have to grow. Also do it if person changes
+ //TODO: laterality have to be shown on treeviews: stream and curve. also check that is correct in database
//TODO: put chronopic detection in a generic place. Done But:
//TODO: solve the problem of connecting two different chronopics
//
- //TODO: if user has no curves, has to stop, multi file gets generated with title row but no curves. Fixed, but need to (best) don't allow to analyze, or show a clear message, blanking the graphic
//TODO:put zoom,unzoom (at side of delete curve) in capture curves (for every curve)
//TODO: treeview on analyze
- //TODO: Add exercise. at capture add combobox of exercises or treeview that pop ups (maybe genericWin). squat, benchpress, jump. change weight bar, and jump radiobuttons to this combobox, addoption of others, and add them on sqlite
//to analyze: user has to select: session, athlete, exercise,
//TODO: single curve, and side, checkbox to show1 param, 2 or three
@@ -112,7 +115,7 @@ public partial class ChronoJumpWindow
//
- private void encoderInitializeVariables() {
+ private void encoderInitializeStuff() {
encoder_pulsebar_capture.Fraction = 1;
encoder_pulsebar_capture.Text = "";
encoder_pulsebar_analyze.Fraction = 1;
@@ -121,19 +124,13 @@ public partial class ChronoJumpWindow
//the glade cursor_changed does not work on mono 1.2.5 windows
treeview_encoder_curves.CursorChanged += on_treeview_encoder_curves_cursor_changed;
sensitiveEncoderRowButtons(false);
- }
-
- private void on_radiobutton_encoder_capture_bar_toggled (object obj, EventArgs args) {
- spin_encoder_bar_weight.Sensitive = true;
- spin_encoder_jump_weight.Sensitive = false;
- }
- private void on_radiobutton_encoder_capture_jump_toggled (object obj, EventArgs args) {
- spin_encoder_bar_weight.Sensitive = false;
- spin_encoder_jump_weight.Sensitive = true;
+ createEncoderCombos();
+ sensitiveEncoderGlobalButtons(false);
}
private void on_radiobutton_encoder_eccon_toggled (object obj, EventArgs args) {
- if(radiobutton_encoder_concentric.Active) {
+ if(Util.FindOnArray(':',1,0,UtilGtk.ComboGetActive(combo_encoder_eccon),
+ encoderEcconTranslation) == "Concentric") {
label_encoder_analyze_eccon.Sensitive=false;
hbox_encoder_analyze_eccon.Sensitive=false;
} else if(radiobutton_encoder_analyze_powerbars.Active) {
@@ -184,7 +181,9 @@ public partial class ChronoJumpWindow
EncoderParams ep = new EncoderParams(
(int) spin_encoder_capture_time.Value,
(int) spin_encoder_capture_min_height.Value,
- !radiobutton_encoder_capture_bar.Active,
+ Convert.ToInt32(
+ Util.FindOnArray(':', 2, 3, UtilGtk.ComboGetActive(combo_encoder_exercise),
+ encoderExercisesTranslationAndBodyPWeight) ),
findMass(true),
Util.ConvertToPoint((double) spin_encoder_smooth.Value), //R decimal: '.'
findEccon(true), //force ecS (ecc-conc separated)
@@ -225,7 +224,8 @@ public partial class ChronoJumpWindow
} else {
removeColumns();
int curvesNum = createTreeViewEncoder(contents);
- if(! radiobutton_encoder_concentric.Active)
+ if(Util.FindOnArray(':',1,0,UtilGtk.ComboGetActive(combo_encoder_eccon),
+ encoderEcconTranslation) != "Concentric")
curvesNum = curvesNum / 2;
spin_encoder_analyze_curve_num.SetRange(1,curvesNum);
sensitiveEncoderGlobalButtons(true);
@@ -245,7 +245,9 @@ public partial class ChronoJumpWindow
{
EncoderParams ep = new EncoderParams(
(int) spin_encoder_capture_min_height.Value,
- !radiobutton_encoder_capture_bar.Active,
+ Convert.ToInt32(
+ Util.FindOnArray(':', 2, 3, UtilGtk.ComboGetActive(combo_encoder_exercise),
+ encoderExercisesTranslationAndBodyPWeight) ),
findMass(true),
findEccon(true), //force ecS (ecc-conc separated)
"curves",
@@ -277,7 +279,7 @@ public partial class ChronoJumpWindow
string [] columnsString = {
Catalog.GetString("ID"),
- Catalog.GetString("Type"),
+ Catalog.GetString("Exercise"),
Catalog.GetString("Contraction"),
Catalog.GetString("Extra weight"),
Catalog.GetString("Date"),
@@ -305,7 +307,7 @@ public partial class ChronoJumpWindow
string [] columnsString = {
Catalog.GetString("ID"),
- Catalog.GetString("Type"),
+ Catalog.GetString("Exercise"),
Catalog.GetString("Contraction"),
Catalog.GetString("Extra weight"),
Catalog.GetString("Date"),
@@ -331,15 +333,12 @@ public partial class ChronoJumpWindow
currentPerson.UniqueID, currentSession.UniqueID, "stream");
foreach(EncoderSQL es in data) { //it will run only one time
- Util.CopyEncoderDataToTemp(es.url, es.name);
- if(es.type.EndsWith("BAR")) { //BAR or JUMP
- radiobutton_encoder_capture_bar.Active = true;
- spin_encoder_bar_weight.Value = Convert.ToInt32(es.extraWeight);
- } else {
- radiobutton_encoder_capture_bar.Active = false;
- spin_encoder_jump_weight.Value = Convert.ToInt32(es.extraWeight);
- }
- radiobutton_encoder_concentric.Active = es.eccon == "c";
+ Util.CopyEncoderDataToTemp(es.url, es.filename);
+ UtilGtk.ComboMakeActive(combo_encoder_exercise, es.exerciseName);
+ UtilGtk.ComboMakeActive(combo_encoder_eccon, es.ecconLong);
+ UtilGtk.ComboMakeActive(combo_encoder_laterality, es.laterality);
+ spin_encoder_extra_weight.Value = Convert.ToInt32(es.extraWeight);
+
spin_encoder_capture_min_height.Value = es.minHeight;
spin_encoder_smooth.Value = es.smooth;
encoderTimeStamp = es.GetDate(false);
@@ -398,22 +397,22 @@ public partial class ChronoJumpWindow
//mode is different than type.
//mode can be curve, allCurves or stream
//type is to print on db at type column: curve or stream + (bar or jump)
- string type = "";
+ string streamOrCurve = "";
string feedback = "";
string fileSaved = "";
string path = "";
if(mode == "curve") {
- type = "curve";
+ streamOrCurve = "curve";
decimal curveNum = (decimal) treeviewEncoderCurvesEventSelectedID(); //on c and ec: 1,2,3,4,...
if(ecconLast != "c")
curveNum = decimal.Truncate((curveNum +1) /2); //1,1,2,2,...
feedback = string.Format(Catalog.GetString("Curve {0} saved"), curveNum);
} else if(mode == "allCurves") {
- type = "curve";
+ streamOrCurve = "curve";
feedback = Catalog.GetString("All curves saved");
} else //mode == "stream"
- type = "stream";
+ streamOrCurve = "stream";
string desc = Util.RemoveTildeAndColonAndDot(entry_encoder_capture_comment.Text.ToString());
//Log.WriteLine(desc);
@@ -442,11 +441,6 @@ public partial class ChronoJumpWindow
path = Util.GetEncoderSessionDataStreamDir(currentSession.UniqueID);
}
- if(radiobutton_encoder_capture_bar.Active)
- type += "BAR";
- else
- type += "JUMP";
-
string myID = "-1";
if(mode == "stream")
myID = encoderStreamUniqueID;
@@ -454,15 +448,24 @@ public partial class ChronoJumpWindow
EncoderSQL eSQL = new EncoderSQL(
myID,
currentPerson.UniqueID, currentSession.UniqueID,
+ Convert.ToInt32(
+ Util.FindOnArray(':', 2, 0, UtilGtk.ComboGetActive(combo_encoder_exercise),
+ encoderExercisesTranslationAndBodyPWeight) ), //exerciseID
+ findEccon(true), //force ecS (ecc-conc separated)
+ UtilGtk.ComboGetActive(combo_encoder_laterality),
+ findMass(false), //when save on sql, do not include person weight
+ streamOrCurve,
fileSaved, //to know date do: select substr(name,-23,19) from encoder;
path, //url
- type,
- findMass(false), //when save on sql, do not include person weight
- findEccon(true), //force ecS (ecc-conc separated)
(int) spin_encoder_capture_time.Value,
(int) spin_encoder_capture_min_height.Value,
(double) spin_encoder_smooth.Value,
- desc);
+ desc,
+ "","","",
+ Util.FindOnArray(':', 2, 1, UtilGtk.ComboGetActive(combo_encoder_exercise),
+ encoderExercisesTranslationAndBodyPWeight) //exerciseName (english)
+ );
+
//if is a stream that we just loaded, then don't insert, do an update
//we know it because encoderUniqueID is != than "-1" if we loaded something from database
@@ -487,6 +490,16 @@ public partial class ChronoJumpWindow
//TODO: garantir path windows
private void on_button_encoder_analyze_clicked (object o, EventArgs args)
{
+ //if userCurves and no data, return
+ if(radiobutton_encoder_analyze_data_user_curves.Active) {
+ ArrayList data = SqliteEncoder.Select(false, -1,
+ currentPerson.UniqueID, currentSession.UniqueID, "curve");
+ if(data.Count == 0)
+ return;
+ //TODO: in the future plot a "no curves" message,
+ //or beter done allow to analyze if there's no curves
+ }
+
encoderThreadStart(encoderModes.ANALYZE);
}
@@ -501,7 +514,9 @@ public partial class ChronoJumpWindow
//-1 because data will be different on any curve
ep = new EncoderParams(
-1,
- !radiobutton_encoder_capture_bar.Active,
+ Convert.ToInt32(
+ Util.FindOnArray(':', 2, 3, UtilGtk.ComboGetActive(combo_encoder_exercise),
+ encoderExercisesTranslationAndBodyPWeight) ),
"-1", //mass
findEccon(false), //do not force ecS (ecc-conc separated)
encoderAnalysis,
@@ -513,32 +528,29 @@ public partial class ChronoJumpWindow
dataFileName = Util.GetEncoderGraphInputMulti();
//create dataFileName
- double bodyMass = Convert.ToDouble(label_encoder_person_weight.Text);
+ double bodyMass = Convert.ToDouble(currentPersonSession.Weight);
ArrayList data = SqliteEncoder.Select(false, -1,
currentPerson.UniqueID, currentSession.UniqueID, "curve");
- //TODO: in the future plot a "no curves" message, or beter done allow to analyze if there's no curves
- if(data.Count == 0)
- return;
-
-
TextWriter writer = File.CreateText(dataFileName);
- writer.WriteLine("type,mass,smoothingOne,dateTime,fullURL");
+ writer.WriteLine("exerciseName,mass,smoothingOne,dateTime,fullURL");
foreach(EncoderSQL eSQL in data) {
- double mass = Convert.ToDouble(eSQL.extraWeight); //TODO: check this
- if(eSQL.type == "curveJUMP")
- mass += bodyMass;
+ double mass = Convert.ToDouble(eSQL.extraWeight); //TODO: future problem if this has '%'
+ EncoderExercise ex = (EncoderExercise) SqliteEncoder.SelectEncoderExercises(eSQL.exerciseID)[0];
+ mass += bodyMass * ex.percentBodyWeight / 100.0;
- writer.WriteLine(eSQL.type + "," + mass.ToString() + "," +
+ writer.WriteLine(ex.name + "," + mass.ToString() + "," +
Util.ConvertToPoint(eSQL.smooth) + "," + eSQL.GetDate(true) + "," +
- eSQL.url + Path.DirectorySeparatorChar + eSQL.name);
+ eSQL.url + Path.DirectorySeparatorChar + eSQL.filename);
}
writer.Flush();
((IDisposable)writer).Dispose();
} else {
ep = new EncoderParams(
(int) spin_encoder_capture_min_height.Value,
- !radiobutton_encoder_capture_bar.Active,
+ Convert.ToInt32(
+ Util.FindOnArray(':', 2, 3, UtilGtk.ComboGetActive(combo_encoder_exercise),
+ encoderExercisesTranslationAndBodyPWeight) ),
findMass(true),
findEccon(false), //do not force ecS (ecc-conc separated)
encoderAnalysis,
@@ -569,7 +581,6 @@ public partial class ChronoJumpWindow
//show curve_num only on simple and superpose
private void on_radiobutton_encoder_analyze_single_toggled (object obj, EventArgs args) {
- label_encoder_analyze_curve_num.Sensitive=true;
spin_encoder_analyze_curve_num.Sensitive=true;
encoderAnalysis="single";
//together, mandatory
@@ -579,7 +590,6 @@ public partial class ChronoJumpWindow
}
private void on_radiobutton_encoder_analyze_superpose_toggled (object obj, EventArgs args) {
- label_encoder_analyze_curve_num.Sensitive=true;
spin_encoder_analyze_curve_num.Sensitive=true;
encoderAnalysis="superpose";
//together, mandatory
@@ -588,7 +598,6 @@ public partial class ChronoJumpWindow
radiobutton_encoder_eccon_together.Active = true;
}
private void on_radiobutton_encoder_analyze_side_toggled (object obj, EventArgs args) {
- label_encoder_analyze_curve_num.Sensitive=false;
spin_encoder_analyze_curve_num.Sensitive=false;
encoderAnalysis="side";
//together, mandatory
@@ -597,31 +606,32 @@ public partial class ChronoJumpWindow
radiobutton_encoder_eccon_together.Active = true;
}
private void on_radiobutton_encoder_analyze_powerbars_toggled (object obj, EventArgs args) {
- label_encoder_analyze_curve_num.Sensitive=false;
spin_encoder_analyze_curve_num.Sensitive=false;
encoderAnalysis="powerBars";
//can select together or separated
- if(! radiobutton_encoder_concentric.Active) {
+ if(Util.FindOnArray(':',1,0,UtilGtk.ComboGetActive(combo_encoder_eccon),
+ encoderEcconTranslation) != "Concentric") {
label_encoder_analyze_eccon.Sensitive=true;
hbox_encoder_analyze_eccon.Sensitive=true;
}
}
private string findMass(bool includePerson) {
- double mass = 0;
- if(radiobutton_encoder_capture_bar.Active)
- mass = spin_encoder_bar_weight.Value;
- else {
- mass = spin_encoder_jump_weight.Value;
- if(includePerson)
- mass += Convert.ToDouble(label_encoder_person_weight.Text);
+ double mass = spin_encoder_extra_weight.Value;
+ if(includePerson) {
+ //TODO: maybe better have a currentEncoderExercise global variable
+ int exPBodyWeight = Convert.ToInt32(
+ Util.FindOnArray(':', 2, 3, UtilGtk.ComboGetActive(combo_encoder_exercise),
+ encoderExercisesTranslationAndBodyPWeight) );
+ mass += currentPersonSession.Weight * exPBodyWeight / 100.0;
}
return Util.ConvertToPoint(mass); //R decimal: '.'
}
private string findEccon(bool ecconSeparated) {
- if(radiobutton_encoder_concentric.Active)
+ if(Util.FindOnArray(':',1,0,UtilGtk.ComboGetActive(combo_encoder_eccon),
+ encoderEcconTranslation) == "Concentric")
return "c";
else {
if(ecconSeparated || ! radiobutton_encoder_eccon_together.Active)
@@ -630,6 +640,98 @@ public partial class ChronoJumpWindow
return "ec";
}
}
+
+ /* encoder exercise stuff */
+
+
+ string [] encoderExercisesTranslationAndBodyPWeight;
+ string [] encoderEcconTranslation;
+ string [] encoderLateralityTranslation;
+
+ protected void createEncoderCombos() {
+ //create combo exercises
+ combo_encoder_exercise = ComboBox.NewText ();
+ ArrayList encoderExercises = SqliteEncoder.SelectEncoderExercises(-1);
+ encoderExercisesTranslationAndBodyPWeight = new String [encoderExercises.Count];
+ string [] exerciseNamesToCombo = new String [encoderExercises.Count];
+ int i =0;
+ foreach(EncoderExercise ex in encoderExercises) {
+ encoderExercisesTranslationAndBodyPWeight[i] =
+ ex.uniqueID + ":" + ex.name + ":" + Catalog.GetString(ex.name) + ":" + ex.percentBodyWeight;
+ exerciseNamesToCombo[i] = Catalog.GetString(ex.name);
+ i++;
+ }
+ UtilGtk.ComboUpdate(combo_encoder_exercise, exerciseNamesToCombo, "");
+ combo_encoder_exercise.Active = UtilGtk.ComboMakeActive(combo_encoder_exercise,
+ Catalog.GetString(((EncoderExercise) encoderExercises[0]).name));
+ combo_encoder_exercise.Changed += new EventHandler (on_combo_encoder_exercise_changed);
+
+ //create combo eccon
+ string [] comboEcconOptions = { "Concentric", "Eccentric-concentric" };
+ string [] comboEcconOptionsTranslated = {
+ Catalog.GetString("Concentric"), Catalog.GetString("Eccentric-concentric") };
+ encoderEcconTranslation = new String [comboEcconOptions.Length];
+ for(int j=0; j < 2 ; j++)
+ encoderEcconTranslation[j] = comboEcconOptions[j] + ":" + comboEcconOptionsTranslated[j];
+ combo_encoder_eccon = ComboBox.NewText ();
+ UtilGtk.ComboUpdate(combo_encoder_eccon, comboEcconOptionsTranslated, "");
+ combo_encoder_eccon.Active = UtilGtk.ComboMakeActive(combo_encoder_eccon,
+ Catalog.GetString(comboEcconOptions[0]));
+ combo_encoder_eccon.Changed += new EventHandler (on_combo_encoder_eccon_changed);
+
+ //create combo laterality
+ string [] comboLateralityOptions = { "Both", "Right", "Left" };
+ string [] comboLateralityOptionsTranslated = {
+ Catalog.GetString("Both"), Catalog.GetString("Right"), Catalog.GetString("Left") };
+ encoderLateralityTranslation = new String [comboLateralityOptions.Length];
+ for(int j=0; j < 3 ; j++)
+ encoderLateralityTranslation[j] =
+ comboLateralityOptions[j] + ":" + comboLateralityOptionsTranslated[j];
+ combo_encoder_laterality = ComboBox.NewText ();
+ UtilGtk.ComboUpdate(combo_encoder_laterality, comboLateralityOptions, "");
+ combo_encoder_laterality.Active = UtilGtk.ComboMakeActive(combo_encoder_laterality,
+ Catalog.GetString(comboLateralityOptions[0]));
+ combo_encoder_laterality.Changed += new EventHandler (on_combo_encoder_laterality_changed);
+
+ //pack combos
+
+ hbox_combo_encoder_exercise.PackStart(combo_encoder_exercise, true, true, 0);
+ hbox_combo_encoder_exercise.ShowAll();
+ combo_encoder_exercise.Sensitive = true;
+
+ hbox_combo_encoder_eccon.PackStart(combo_encoder_eccon, true, true, 0);
+ hbox_combo_encoder_eccon.ShowAll();
+ combo_encoder_eccon.Sensitive = true;
+
+ hbox_combo_encoder_laterality.PackStart(combo_encoder_laterality, true, true, 0);
+ hbox_combo_encoder_laterality.ShowAll();
+ combo_encoder_laterality.Sensitive = true;
+ }
+
+ void on_combo_encoder_exercise_changed (object o, EventArgs args)
+ {
+ //TODO
+ }
+
+ void on_combo_encoder_eccon_changed (object o, EventArgs args)
+ {
+ //TODO
+ }
+
+ void on_combo_encoder_laterality_changed (object o, EventArgs args)
+ {
+ //TODO
+ }
+
+ void on_button_encoder_exercise_info_clicked (object o, EventArgs args)
+ {
+ //TODO
+ }
+
+ void on_button_encoder_exercise_add_clicked (object o, EventArgs args)
+ {
+ //TODO
+ }
/* TreeView stuff */
diff --git a/src/sqlite/encoder.cs b/src/sqlite/encoder.cs
index fb91cfa..da4268f 100644
--- a/src/sqlite/encoder.cs
+++ b/src/sqlite/encoder.cs
@@ -73,11 +73,14 @@ class SqliteEncoder : Sqlite
es.uniqueID = "NULL";
dbcmd.CommandText = "INSERT INTO " + Constants.EncoderTable +
- " (uniqueID, personID, sessionID, name, url, type, extraWeight, eccon, time, minHeight, smooth, description)" +
- " VALUES (" + es.uniqueID + ", "
- + es.personID + ", " + es.sessionID + ", '" + es.name + "', '" + es.url + "', '" + es.type + "', '"
- + es.extraWeight + "', '" + es.eccon + "', " + es.time + ", " + es.minHeight + ", "
- + Util.ConvertToPoint(es.smooth) + ", '" + es.description + "')" ;
+ " (uniqueID, personID, sessionID, exerciseID, eccon, laterality, extraWeight, streamOrCurve, filename, url, time, minHeight, smooth, description, future1, future2, future3)" +
+ " VALUES (" + es.uniqueID + ", " +
+ es.personID + ", " + es.sessionID + ", " +
+ es.exerciseID + ", '" + es.eccon + "', '" +
+ es.laterality + "', '" + es.extraWeight + "', '" +
+ es.streamOrCurve + "', '" + es.filename + "', '" +
+ es.url + "', " + es.time + ", " + es.minHeight + ", " +
+ Util.ConvertToPoint(es.smooth) + ", '" + es.description + "', '', '', '')" ;
Log.WriteLine(dbcmd.CommandText.ToString());
dbcmd.ExecuteNonQuery();
@@ -104,16 +107,21 @@ class SqliteEncoder : Sqlite
dbcmd.CommandText = "UPDATE " + Constants.EncoderTable + " SET " +
" personID = " + es.personID +
", sessionID = " + es.sessionID +
- ", name = '" + es.name +
- "', url = '" + es.url +
- "', type = '" + es.type +
+ ", exerciseID = " + es.exerciseID +
+ ", eccon = '" + es.eccon +
+ "', laterality = '" + es.laterality +
"', extraWeight = '" + es.extraWeight +
- "', eccon = '" + es.eccon +
+ "', streamOrCurve = '" + es.streamOrCurve +
+ "', filename = '" + es.filename +
+ "', url = '" + es.url +
"', time = " + es.time +
", minHeight = " + es.minHeight +
", smooth = " + Util.ConvertToPoint(es.smooth) +
- ", description = '" + es.description + "'" +
- " WHERE uniqueID == " + es.uniqueID ;
+ ", description = '" + es.description +
+ "', future1 = '" + es.future1 +
+ "', future2 = '" + es.future2 +
+ "', future3 = '" + es.future3 +
+ "' WHERE uniqueID == " + es.uniqueID ;
Log.WriteLine(dbcmd.CommandText.ToString());
dbcmd.ExecuteNonQuery();
@@ -124,24 +132,24 @@ class SqliteEncoder : Sqlite
public static ArrayList Select (bool dbconOpened,
- int uniqueID, int personID, int sessionID, string typeStartsWith)
+ int uniqueID, int personID, int sessionID, string streamOrCurve)
{
if(! dbconOpened)
dbcon.Open();
string uniqueIDStr = "";
if(uniqueID != -1)
- uniqueIDStr = " AND uniqueID = " + uniqueID;
+ uniqueIDStr = " AND " + Constants.EncoderTable + ".uniqueID = " + uniqueID;
- string typeStr = "";
- if(typeStartsWith == "stream")
- typeStr = " AND SUBSTR(type,1,6)='stream'";
- else if(typeStartsWith == "curve")
- typeStr = " AND SUBSTR(type,1,5)='curve'";
-
- dbcmd.CommandText = "SELECT * FROM " + Constants.EncoderTable +
- " WHERE personID = " + personID + " AND sessionID = " + sessionID +
- typeStr + uniqueIDStr;
+ dbcmd.CommandText = "SELECT " +
+ Constants.EncoderTable + ".*, " + Constants.EncoderExerciseTable + ".name FROM " +
+ Constants.EncoderTable + ", " + Constants.EncoderExerciseTable +
+ " WHERE personID = " + personID + " AND sessionID = " + sessionID +
+ " AND streamOrCurve = '" + streamOrCurve +
+ "' AND " + Constants.EncoderTable + ".exerciseID = " +
+ Constants.EncoderExerciseTable + ".uniqueID " +
+ uniqueIDStr;
+ Log.WriteLine(dbcmd.CommandText.ToString());
SqliteDataReader reader;
reader = dbcmd.ExecuteReader();
@@ -154,15 +162,21 @@ class SqliteEncoder : Sqlite
reader[0].ToString(), //uniqueID
Convert.ToInt32(reader[1].ToString()), //personID
Convert.ToInt32(reader[2].ToString()), //sessionID
- reader[3].ToString(), //name
- reader[4].ToString(), //url
- reader[5].ToString(), //type
+ Convert.ToInt32(reader[3].ToString()), //exerciseID
+ reader[4].ToString(), //eccon
+ reader[5].ToString(), //laterality
reader[6].ToString(), //extraWeight
- reader[7].ToString(), //eccon
- Convert.ToInt32(reader[8].ToString()), //time
- Convert.ToInt32(reader[9].ToString()), //minHeight
- Convert.ToDouble(Util.ChangeDecimalSeparator(reader[10].ToString())), //smooth
- reader[11].ToString() //description
+ reader[7].ToString(), //streamOrCurve
+ reader[8].ToString(), //filename
+ reader[9].ToString(), //url
+ Convert.ToInt32(reader[10].ToString()), //time
+ Convert.ToInt32(reader[11].ToString()), //minHeight
+ Convert.ToDouble(Util.ChangeDecimalSeparator(reader[12].ToString())), //smooth
+ reader[13].ToString(), //description
+ reader[14].ToString(), //future1
+ reader[15].ToString(), //future2
+ reader[16].ToString(), //future3
+ reader[17].ToString() //EncoderExercise.name
);
array.Add (es);
}
@@ -222,8 +236,47 @@ class SqliteEncoder : Sqlite
foreach(string line in iniEncoderExercises) {
string [] parts = line.Split(new char[] {':'});
- InsertExercise(false,parts[0],Convert.ToInt32(parts[1]),parts[2],parts[3]);
+ InsertExercise(false, parts[0], Convert.ToInt32(parts[1]), parts[2], parts[3]);
}
}
+
+ //if submited a -1, returns an especific EncoderExercise that can be read like this
+ //EncoderExercise ex = (EncoderExercise) SqliteEncoder.SelectEncoderExercises(eSQL.exerciseID)[0];
+ public static ArrayList SelectEncoderExercises(int uniqueID)
+ {
+ dbcon.Open();
+
+ string uniqueIDStr = "";
+ if(uniqueID != -1)
+ uniqueIDStr = " WHERE " + Constants.EncoderExerciseTable + ".uniqueID = " + uniqueID;
+
+ dbcmd.CommandText = "SELECT * FROM " + Constants.EncoderExerciseTable + uniqueIDStr;
+
+ Log.WriteLine(dbcmd.CommandText.ToString());
+ dbcmd.ExecuteNonQuery();
+
+ SqliteDataReader reader;
+ reader = dbcmd.ExecuteReader();
+
+ ArrayList array = new ArrayList(1);
+ EncoderExercise ex = new EncoderExercise();
+ while(reader.Read()) {
+ ex = new EncoderExercise (
+ Convert.ToInt32(reader[0].ToString()), //uniqueID
+ reader[1].ToString(), //name
+ Convert.ToInt32(reader[2].ToString()), //percentBodyWeight
+ reader[3].ToString(), //ressistance
+ reader[4].ToString() //description
+ );
+ array.Add(ex);
+ }
+
+ reader.Close();
+ //close database connection
+ dbcon.Close();
+
+ return array;
+ }
+
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]