[chronojump] Encoder ecc-con phases on powerbars



commit bd4aa28c4c1ba3751225dfee8ee1074957c716c1
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu May 24 12:25:23 2012 +0200

    Encoder ecc-con phases on powerbars

 encoder/graph.R        |   13 +++++--
 glade/chronojump.glade |   78 ++++++++++++++++++++++++++++++++++++++++-------
 src/gui/encoder.cs     |   55 +++++++++++++++++++++++++++++-----
 3 files changed, 122 insertions(+), 24 deletions(-)
---
diff --git a/encoder/graph.R b/encoder/graph.R
index 33dde15..1ab0116 100644
--- a/encoder/graph.R
+++ b/encoder/graph.R
@@ -350,8 +350,13 @@ paint <- function(rawdata, eccon, xmin, xmax, yrange, knRanges, superpose, highl
 
 paintPowerPeakPowerBars <- function(paf) {
 	pafColors=c("tomato1","tomato4",topo.colors(10)[3])
+	myNums = 1:length(paf[,1])
+	if(eccon=="ecS") {
+		myEc=c("c","e")
+		myNums = paste(trunc((myNums+1)/2),myEc[(myNums%%2)+1],sep="")
+	}
 	bp <- barplot(rbind(paf[,3],paf[,4]),beside=T,col=pafColors[1:2],width=c(1.4,.6),
-			names.arg=1:n,xlim=c(1,n*3+.5),xlab="",ylab="Power (W)")
+			names.arg=myNums,xlim=c(1,n*3+.5),xlab="",ylab="Power (W)")
 	par(new=T, xpd=T)
 	plot(bp[2,],paf[,5],type="o",lwd=2,xlim=c(1,n*3+.5),axes=F,xlab="",ylab="",col=pafColors[3])
 	legend("bottom",col=pafColors, lty=c(0,0,1), lwd=c(1,1,2), pch=c(15,15,NA), legend=c("Power","Peak Power", "Time at Peak Power"), ncol=3, inset=-.2)
@@ -419,9 +424,9 @@ if(length(args) < 3) {
 	curvesPlot = FALSE
 	if(analysis=="curves") {
 		#on curves ec, show eccentric-concentric phases separately
-		if(eccon=="ec") {
-			eccon="ecS"
-		}
+#		if(eccon=="ec") {
+#			eccon="ecS"
+#		}
 		curvesPlot = TRUE
 		par(mar=c(2,2.5,1,1))
 	}
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index 5197307..ab4b3ed 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -23786,6 +23786,7 @@ on current Chronojump version.</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"/>
                                                           </widget>
                                                           <packing>
                                                             <property name="fill">False</property>
@@ -23800,6 +23801,7 @@ on current Chronojump version.</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"/>
                                                           </widget>
                                                           <packing>
                                                             <property name="fill">False</property>
@@ -24373,48 +24375,100 @@ on current Chronojump version.</property>
                                                       </packing>
                                                     </child>
                                                     <child>
-                                                      <widget class="GtkTable" id="table11">
+                                                      <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>
                                                         <child>
-                                                          <widget class="GtkLabel" id="label_encoder_analyze_curve_num">
+                                                          <widget class="GtkLabel" id="label_encoder_analyze_eccon">
                                                             <property name="visible">True</property>
                                                             <property name="sensitive">False</property>
                                                             <property name="xalign">0</property>
-                                                            <property name="label" translatable="yes">Curve number</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>
                                                           </packing>
                                                         </child>
                                                         <child>
-                                                          <widget class="GtkSpinButton" id="spin_encoder_analyze_curve_num">
+                                                          <widget class="GtkHBox" id="hbox_encoder_analyze_eccon">
                                                             <property name="visible">True</property>
                                                             <property name="sensitive">False</property>
+                                                            <property name="spacing">8</property>
+                                                            <child>
+                                                            <widget class="GtkRadioButton" id="radiobutton_encoder_eccon_together">
+                                                            <property name="label" translatable="yes">Together</property>
+                                                            <property name="visible">True</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>
+                                                            <property name="receives_default">False</property>
+                                                            <property name="active">True</property>
+                                                            <property name="draw_indicator">True</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkRadioButton" id="radiobutton_encoder_eccon_separated">
+                                                            <property name="label" translatable="yes">Separated</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_eccon_together</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">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="top_attach">1</property>
                                                             <property name="bottom_attach">2</property>
-                                                            <property name="x_options"></property>
+                                                            <property name="x_options">GTK_FILL</property>
                                                           </packing>
                                                         </child>
                                                         <child>
-                                                          <placeholder/>
+                                                          <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>
-                                                          <placeholder/>
+                                                          <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="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                          </widget>
+                                                          <packing>
+                                                            <property name="left_attach">1</property>
+                                                            <property name="right_attach">2</property>
+                                                          </packing>
                                                         </child>
                                                       </widget>
                                                       <packing>
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index f67cd85..5a340cf 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -51,6 +51,10 @@ public partial class ChronoJumpWindow
 	[Widget] Gtk.RadioButton radiobutton_encoder_analyze_single;
 	[Widget] Gtk.RadioButton radiobutton_encoder_analyze_side;
 	[Widget] Gtk.RadioButton radiobutton_encoder_analyze_superpose;
+	[Widget] Gtk.Label label_encoder_analyze_eccon;
+	[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;
@@ -91,6 +95,16 @@ public partial class ChronoJumpWindow
 		spin_encoder_jump_limit.Sensitive = true;
 	}
 
+	private void on_radiobutton_encoder_eccon_toggled (object obj, EventArgs args) {
+		if(radiobutton_encoder_concentric.Active) {
+			label_encoder_analyze_eccon.Sensitive=false;
+			hbox_encoder_analyze_eccon.Sensitive=false;
+		} else if(radiobutton_encoder_analyze_powerbars.Active) {
+			label_encoder_analyze_eccon.Sensitive=true;
+			hbox_encoder_analyze_eccon.Sensitive=true;
+		}
+	}
+
 	//TODO: garantir path windows	
 	void on_button_encoder_capture_clicked (object o, EventArgs args) 
 	{
@@ -136,7 +150,7 @@ public partial class ChronoJumpWindow
 				!radiobutton_encoder_capture_bar.Active,
 				findMass(true),
 				Util.ConvertToPoint((double) spin_encoder_smooth.Value), //R decimal: '.'
-				findEccon(),
+				findEccon(true),					//force ecS (ecc-conc separated)
 				heightHigherCondition, heightLowerCondition,
 				meanSpeedHigherCondition, meanSpeedLowerCondition,
 				maxSpeedHigherCondition, maxSpeedLowerCondition,
@@ -171,6 +185,8 @@ public partial class ChronoJumpWindow
 		} else {
 			removeColumns();
 			int curvesNum = createTreeViewEncoder(contents);
+			if(! radiobutton_encoder_concentric.Active)
+				curvesNum = curvesNum / 2;
 			spin_encoder_analyze_curve_num.SetRange(1,curvesNum);
 			button_encoder_analyze.Sensitive = true;
 		}
@@ -190,7 +206,8 @@ public partial class ChronoJumpWindow
 				(int) spin_encoder_capture_min_height.Value, 
 				!radiobutton_encoder_capture_bar.Active,
 				findMass(true),
-				findEccon(), "curves",
+				findEccon(true),					//force ecS (ecc-conc separated)
+				"curves",
 				Util.ConvertToPoint((double) spin_encoder_smooth.Value), //R decimal: '.'
 			       	0, 			//curve is not used here
 				image_encoder_width, image_encoder_height); 
@@ -231,7 +248,7 @@ public partial class ChronoJumpWindow
 				Util.GetEncoderSessionDataDir(currentSession.UniqueID),	//url
 				(! radiobutton_encoder_capture_bar.Active).ToString(),
 				findMass(false), //when save on sql, do not include person weight
-				findEccon(),
+				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,
@@ -258,7 +275,8 @@ public partial class ChronoJumpWindow
 				(int) spin_encoder_capture_min_height.Value, 
 				!radiobutton_encoder_capture_bar.Active,
 				findMass(true),
-				findEccon(), encoderAnalysis,
+				findEccon(false),		//do not force ecS (ecc-conc separated)
+				encoderAnalysis,
 				Util.ConvertToPoint((double) spin_encoder_smooth.Value), //R decimal: '.'
 				(int) spin_encoder_analyze_curve_num.Value, 
 				image_encoder_width, image_encoder_height); 
@@ -278,22 +296,39 @@ public partial class ChronoJumpWindow
 		label_encoder_analyze_curve_num.Sensitive=true;
 		spin_encoder_analyze_curve_num.Sensitive=true;
 		encoderAnalysis="single";
+		//together, mandatory
+		label_encoder_analyze_eccon.Sensitive=false;
+		hbox_encoder_analyze_eccon.Sensitive=false;
+		radiobutton_encoder_eccon_together.Active = true;
 	}
 
 	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
+		label_encoder_analyze_eccon.Sensitive=false;
+		hbox_encoder_analyze_eccon.Sensitive=false;
+		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
+		label_encoder_analyze_eccon.Sensitive=false;
+		hbox_encoder_analyze_eccon.Sensitive=false;
+		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) {
+			label_encoder_analyze_eccon.Sensitive=true;
+			hbox_encoder_analyze_eccon.Sensitive=true;
+		}
 	}
 
 	private string findMass(bool includePerson) {
@@ -309,13 +344,17 @@ public partial class ChronoJumpWindow
 		return Util.ConvertToPoint(mass); //R decimal: '.'
 	}
 	
-	private string findEccon() {	
+	private string findEccon(bool ecconSeparated) {	
 		if(radiobutton_encoder_concentric.Active)
 			return "c";
-		else
-			return "ec";
+		else {
+			if(ecconSeparated || ! radiobutton_encoder_eccon_together.Active)
+				return "ecS";
+			else 
+				return "ec";
+		}
 	}
-	
+
 
 	/* TreeView stuff */	
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]