[chronojump] Encoder modes done
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Encoder modes done
- Date: Thu, 18 Jul 2013 04:38:56 +0000 (UTC)
commit 14fa4d34149f4431d77aac48af59d71ee2b9b437
Author: Xavier de Blas <xaviblas gmail com>
Date: Thu Jul 18 06:38:31 2013 +0200
Encoder modes done
src/constants.cs | 5 +++-
src/encoder.cs | 3 +-
src/gui/encoder.cs | 73 ++++++++++++++++++++++++++++++++++++++-----------
src/sqlite/encoder.cs | 4 +-
4 files changed, 64 insertions(+), 21 deletions(-)
---
diff --git a/src/constants.cs b/src/constants.cs
index 4e77a22..2cb0cf8 100644
--- a/src/constants.cs
+++ b/src/constants.cs
@@ -602,7 +602,10 @@ public class Constants
public static string EncoderGraphInputMulti = "chronojump-encoder-graph-input-multi.csv";
public enum EncoderCheckFileOp { ANALYZE_EXPORT_ALL_CURVES, ANALYZE_SAVE_IMAGE, ANALYZE_SAVE_TABLE}
- public enum EncoderSignalMode { LINEAR, LINEARINVERTED, ROTARYINERTIAL }
+ public enum EncoderSignalMode {
+ LINEAR, LINEARINVERTED, ROTARY,
+ LINEARINERTIAL, LINEARINVERTEDINERTIAL, ROTARYINERTIAL
+ }
public enum Encoder1RMMethod { NONWEIGHTED, WEIGHTED, WEIGHTED2, WEIGHTED3 }
public enum ContextMenu { NONE, EDITDELETE, DELETE }
diff --git a/src/encoder.cs b/src/encoder.cs
index e71707d..8367560 100644
--- a/src/encoder.cs
+++ b/src/encoder.cs
@@ -267,14 +267,13 @@ public class EncoderSQL
public string description;
public string future1; //active or inactive curves
public string future2; //URL of video of signals
- public string future3; //Constants.EncoderSignalMode (only on signals)
+ public string future3; //Constants.EncoderSignalMode (only on signals) (add "-0.01" for inertia
momentum)
//TODO:
//convertir signal future3 inverted de "1" a "inverted" FET
//convertir "0" i "" en "linear" FET
//pq potser sera "linear" or "linearinverted" or "rotaryinertial" FET
//fer que al capturar es gravi el future3 amb rotaryinertial o el que sigui (provar-ho amb el darrer
capturat)
-//gui/encoder.cs quan es capturi amb RI (click a capture) es desactiva el inverted i es posi ecc-con
//en un futur posar con-ecc
//linear, linear inverted i rotaryinertial com a radiobutton FET
//que findCurves trobi be totes les curves basant-se en el fixed i no en l'original pq llavors no troba les
darreres
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 248beb0..08f5fd5 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -493,6 +493,60 @@ public partial class ChronoJumpWindow
encoderAnalyzeListStore = new Gtk.ListStore (typeof (EncoderCurve));
}
+ private string getEncoderTypeByCombos() {
+ string str = "";
+ if(radiobutton_encoder_capture_linear.Active) {
+ if(checkbutton_encoder_capture_inertial.Active)
+ str = Constants.EncoderSignalMode.LINEARINERTIAL.ToString();
+ else
+ str = Constants.EncoderSignalMode.LINEAR.ToString();
+ }
+ else if(radiobutton_encoder_capture_linear_inverted.Active) {
+ if(checkbutton_encoder_capture_inertial.Active)
+ str = Constants.EncoderSignalMode.LINEARINVERTEDINERTIAL.ToString();
+ else
+ str = Constants.EncoderSignalMode.LINEARINVERTED.ToString();
+ }
+ else { //(radiobutton_encoder_capture_rotary.Active)
+ if(checkbutton_encoder_capture_inertial.Active)
+ str = Constants.EncoderSignalMode.ROTARYINERTIAL.ToString();
+ else
+ str = Constants.EncoderSignalMode.ROTARY.ToString();
+ }
+
+ if(checkbutton_encoder_capture_inertial.Active)
+ str += "-" + Util.ConvertToPoint((double) spin_encoder_capture_inertial.Value);
+
+ return str;
+ }
+
+ private void setEncoderCombos(string str) {
+ if(str == Constants.EncoderSignalMode.LINEAR.ToString()) {
+ radiobutton_encoder_capture_linear.Active = true;
+ checkbutton_encoder_capture_inertial.Active = false;
+ }
+ else if(str == Constants.EncoderSignalMode.LINEARINVERTED.ToString()) {
+ radiobutton_encoder_capture_linear_inverted.Active = true;
+ checkbutton_encoder_capture_inertial.Active = false;
+ }
+ else if(str == Constants.EncoderSignalMode.ROTARY.ToString()) {
+ radiobutton_encoder_capture_rotary.Active = true;
+ checkbutton_encoder_capture_inertial.Active = false;
+ }
+ else { //inertial machines
+ checkbutton_encoder_capture_inertial.Active = true;
+ string [] strFull = str.Split(new char[] {'-'});
+ spin_encoder_capture_inertial.Value =
+ Convert.ToDouble(Util.ChangeDecimalSeparator(strFull[1]));
+
+ if (str.StartsWith(Constants.EncoderSignalMode.LINEARINERTIAL.ToString() + "-" ))
+ radiobutton_encoder_capture_linear.Active = true;
+ else if (str.StartsWith(Constants.EncoderSignalMode.LINEARINVERTEDINERTIAL.ToString()
+ "-" ))
+ radiobutton_encoder_capture_linear_inverted.Active = true;
+ else //(str.StartsWith(Constants.EncoderSignalMode.ROTARYINERTIAL.ToString() + "-" ))
+ radiobutton_encoder_capture_rotary.Active = true;
+ }
+ }
//this is called by non gtk thread. Don't do gtk stuff here
//I suppose reading gtk is ok, changing will be the problem
@@ -509,12 +563,7 @@ public partial class ChronoJumpWindow
if(encoderPropulsive)
analysisOptions = "p";
- string future3 = Constants.EncoderSignalMode.LINEAR.ToString();
- if(radiobutton_encoder_capture_linear_inverted.Active)
- future3 = Constants.EncoderSignalMode.LINEARINVERTED.ToString();
- //if(capturingRotaryInertial)
- if(radiobutton_encoder_capture_rotary.Active && checkbutton_encoder_capture_inertial.Active)
- future3 = Constants.EncoderSignalMode.ROTARYINERTIAL.ToString();
+ string future3 = getEncoderTypeByCombos();
//see explanation on the top of this file
lastEncoderSQL = new EncoderSQL(
@@ -1024,15 +1073,8 @@ public partial class ChronoJumpWindow
encoderTimeStamp = es.GetDate(false);
encoderSignalUniqueID = es.uniqueID;
button_video_play_this_test_encoder.Sensitive = (es.future2 != "");
- radiobutton_encoder_capture_linear_inverted.Active =
- (es.future3 == Constants.EncoderSignalMode.LINEARINVERTED.ToString());
- lastRecalculateWasInverted =
radiobutton_encoder_capture_linear_inverted.Active;
- radiobutton_encoder_capture_rotary.Active =
- (es.future3 == Constants.EncoderSignalMode.ROTARYINERTIAL.ToString());
- //TODO: add also spinbutton
- checkbutton_encoder_capture_inertial.Active =
- (es.future3 == Constants.EncoderSignalMode.ROTARYINERTIAL.ToString());
+ setEncoderCombos(es.future3);
}
}
@@ -1449,8 +1491,7 @@ public partial class ChronoJumpWindow
string future3 = ""; //unused on curve
if(mode == "signal") {
myID = encoderSignalUniqueID;
- if(radiobutton_encoder_capture_linear_inverted.Active)
- future3 = Constants.EncoderSignalMode.LINEARINVERTED.ToString();
+ future3 = getEncoderTypeByCombos();
}
//assign values from lastEncoderSQL (last calculate curves or reload), and change new things
diff --git a/src/sqlite/encoder.cs b/src/sqlite/encoder.cs
index c4356ad..6f7f031 100644
--- a/src/sqlite/encoder.cs
+++ b/src/sqlite/encoder.cs
@@ -56,7 +56,7 @@ class SqliteEncoder : Sqlite
"description TEXT, " +
"future1 TEXT, " + //works as status: "active", "inactive"
"future2 TEXT, " + //URL of video of signals
- "future3 TEXT )"; //Constants.EncoderSignalMode (only on signals)
+ "future3 TEXT )"; //Constants.EncoderSignalMode (only on signals) (add "-0.01"
for inertia momentum)
dbcmd.ExecuteNonQuery();
}
@@ -82,7 +82,7 @@ class SqliteEncoder : Sqlite
es.url + "', " + es.time + ", " + es.minHeight + ", " +
Util.ConvertToPoint(es.smooth) + ", '" + es.description + "', 'active', " +
"'','" + //future2 url (this is stored later)
- es.future3 + "')" ; //future3 (Constants.EncoderSignalMode)
+ es.future3 + "')" ; //future3
Log.WriteLine(dbcmd.CommandText.ToString());
dbcmd.ExecuteNonQuery();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]