[chronojump] New feature: Encoder analyze superpose mode done!



commit db24e139e3a96865b8a10c34141bab1783f555f6
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Apr 3 20:12:38 2018 +0200

    New feature: Encoder analyze superpose mode done!

 encoder/graph.R                      |  289 ++++++++++++++++++++++++----------
 glade/app1.glade                     |   33 ++++-
 images/encoder-analyze-superpose.png |  Bin 0 -> 486 bytes
 images/svg/icons.svg                 |   93 +++++++++---
 src/Makefile.am                      |    1 +
 src/constants.cs                     |    1 +
 src/gui/chronojumpIcons.cs           |    3 +
 src/gui/encoder.cs                   |   18 ++-
 8 files changed, 327 insertions(+), 111 deletions(-)
---
diff --git a/encoder/graph.R b/encoder/graph.R
index d0b7007..b59b77b 100644
--- a/encoder/graph.R
+++ b/encoder/graph.R
@@ -494,8 +494,7 @@ canJump <- function(encoderConfigurationName)
         return(FALSE)
 }
 
-
-paint <- function(displacement, eccon, xmin, xmax, xrange, yrange, knRanges, superpose, highlight,
+paint <- function(displacement, eccon, xmin, xmax, xrange, yrange, knRanges, superpose, nrep, highlight,
                   startX, startH, smoothingOneEC, smoothingOneC, massBody, massExtra, 
                   
encoderConfigurationName,diameter,diameterExt,anglePush,angleWeight,inertiaMomentum,gearedDown, 
#encoderConfiguration stuff
                   title, subtitle, draw, width, showLabels, marShrink, showAxes, legend,
@@ -519,7 +518,7 @@ paint <- function(displacement, eccon, xmin, xmax, xrange, yrange, knRanges, sup
         
         #eccons ec and ecS is the same here (only show one curve)
         #receive data as cumulative sum
-        lty=c(1,1,1)
+        #lty=c(1,1,1)
         
         print(c("xmin,xmax",xmin,xmax))
         
@@ -541,6 +540,21 @@ paint <- function(displacement, eccon, xmin, xmax, xrange, yrange, knRanges, sup
         
         #all in meters
         #position=position/1000
+
+       #set colors
+        colPosition = "black"
+       colSpeed = cols[1]
+       colAccel = "magenta"
+       colForce = cols[2]
+       colPower = cols[3]
+
+       ltyPosition = 1
+       ltySpeed = 1
+       ltyAccel = 1
+       ltyForce = 1
+       ltyPower = 1
+
+       superposeSeqCharsN = 5
         
         if(draw) {
                 #three vertical axis inspired on http://www.r-bloggers.com/multiple-y-axis-in-a-r-plot/
@@ -574,20 +588,34 @@ paint <- function(displacement, eccon, xmin, xmax, xrange, yrange, knRanges, sup
                 }
                 
                 par(new=T)
-                colNormal="black"
-                if(superpose)
-                        colNormal="gray30"
+#                if(superpose)
+#                        colNormal="gray30"
                 yValues = position[startX:length(position)]-min(position[startX:length(position)])
-                if(highlight==FALSE) {
+#                if(highlight==FALSE) {
                         plot(startX:length(position),yValues,type="l",xlim=xlim,ylim=ylim,
-                             xlab="",ylab="",col="black",lty=lty[1],lwd=2,axes=F)
-                        par(new=T)
-                        plot(startX:length(position),yValues,type="h",xlim=xlim,ylim=ylim,
-                             xlab="",ylab="",col="grey90",lty=lty[1],lwd=1,axes=F)
-                }
-                else
-                        
plot(startX:length(position),yValues,type="l",xlim=xlim,ylim=ylim,xlab="",ylab="",col=colNormal,lty=2,lwd=3,axes=F)
-                abline(h=0,lty=3,col="black")
+                             xlab="",ylab="",col=colPosition,lty=ltyPosition,lwd=2,axes=F)
+
+               if(superpose)
+                       addRepCharsAboveLine(yValues, colPosition, nrep)
+
+               if(! superpose) {
+                       par(new=T)
+                       plot(startX:length(position),yValues,type="h",xlim=xlim,ylim=ylim,
+                            xlab="",ylab="",col="grey90",lty=lty[1],lwd=1,axes=F)
+               }
+#                }
+#                else
+#                       
plot(startX:length(position),yValues,type="l",xlim=xlim,ylim=ylim,xlab="",ylab="",col=colNormal,lty=2,lwd=3,axes=F)
+
+               if(nrep == 1)
+               {
+                       abline(h=0,lty=3,col="black")
+
+                       #always (single or side) show 0 line
+                       if(showSpeed || showAccel || showForce || showPower)
+                               abline(h=0,lty=3,col="black")
+               }
+
 
                if(triggersOnList != "" && triggersOnList != -1)
                {
@@ -733,8 +761,7 @@ paint <- function(displacement, eccon, xmin, xmax, xrange, yrange, knRanges, sup
         #startX = inertialECstart #deactivated
         
         # ---- end of inertialECstart ----
-        
-        
+
         if(draw & showSpeed) {
                 ylimHeight = max(abs(range(speed$y)))
                 ylim=c(- 1.05 * ylimHeight, 1.05 * ylimHeight) #put 0 in the middle, and have 5% margin at 
each side
@@ -747,12 +774,15 @@ paint <- function(displacement, eccon, xmin, xmax, xrange, yrange, knRanges, sup
                 #if(inertialType == "ri" && eccon == "ce")
                 #      speedPlot=abs(speed$y)
                 
-                if(highlight==FALSE)
-                        plot(startX:length(speedPlot),speedPlot[startX:length(speedPlot)],type="l",
-                             xlim=xlim,ylim=ylim,xlab="",ylab="",col=cols[1],lty=lty[1],lwd=1,axes=F)
-                else
+                #if(highlight==FALSE)
                         plot(startX:length(speedPlot),speedPlot[startX:length(speedPlot)],type="l",
-                             xlim=xlim,ylim=ylim,xlab="",ylab="",col="darkgreen",lty=2,lwd=3,axes=F)
+                             xlim=xlim,ylim=ylim,xlab="",ylab="",col=colSpeed,lty=ltySpeed,lwd=1,axes=F)
+
+               if(superpose)
+                       addRepCharsAboveLine(speedPlot, colSpeed, nrep)
+                #else
+                #        plot(startX:length(speedPlot),speedPlot[startX:length(speedPlot)],type="l",
+                #             xlim=xlim,ylim=ylim,xlab="",ylab="",col="darkgreen",lty=2,lwd=3,axes=F)
                 
         }
         
@@ -806,7 +836,7 @@ paint <- function(displacement, eccon, xmin, xmax, xrange, yrange, knRanges, sup
         }
         
         if(eccon == "c") {
-                if(showSpeed) {
+                if(showSpeed && ! superpose) {
                         
arrows(x0=min(concentric),y0=meanSpeedC,x1=propulsiveEnd,y1=meanSpeedC,col=cols[1],code=3)
                 }
         } else {
@@ -815,7 +845,7 @@ paint <- function(displacement, eccon, xmin, xmax, xrange, yrange, knRanges, sup
                 else
                         meanSpeedE = mean(speed$y[landing:max(eccentric)])
                 
-                if(showSpeed) {
+                if(showSpeed && ! superpose) {
                         if(landing == -1)
                                 
arrows(x0=startX,y0=meanSpeedE,x1=max(eccentric),y1=meanSpeedE,col=cols[1],code=3)
                         else
@@ -831,44 +861,44 @@ paint <- function(displacement, eccon, xmin, xmax, xrange, yrange, knRanges, sup
                 if(knRanges[1] != "undefined")
                         ylim = knRanges$accely
                 
-                
-                #always (single or side) show 0 line
-                abline(h=0,lty=3,col="black")
-                
                 #plot the speed axis
                 if(showAxes & showSpeed) {
                         if(eccon == "c") {
                                 axis(4, at=c(min(axTicks(4)),0,max(axTicks(4)),meanSpeedC),
                                      labels=c(min(axTicks(4)),0,max(axTicks(4)),
                                               round(meanSpeedC,1)),
-                                     col=cols[1], lty=lty[1], line=axisLineRight, lwd=1, padj=-.5)
+                                     col=colSpeed, lty=ltySpeed, line=axisLineRight, lwd=1, padj=-.5)
                                 axis(4, at=meanSpeedC,
                                      labels="Xc",
-                                     col=cols[1], lty=lty[1], line=axisLineRight, lwd=1, padj=-2)
+                                     col=colSpeed, lty=ltySpeed, line=axisLineRight, lwd=1, padj=-2)
                         }
                         else {
                                 axis(4, at=c(min(axTicks(4)),0,max(axTicks(4)),meanSpeedE,meanSpeedC),
                                      labels=c(min(axTicks(4)),0,max(axTicks(4)),
                                               round(meanSpeedE,1),
                                               round(meanSpeedC,1)),
-                                     col=cols[1], lty=lty[1], line=axisLineRight, lwd=1, padj=-.5)
+                                     col=colSpeed, lty=ltySpeed, line=axisLineRight, lwd=1, padj=-.5)
                                 axis(4, at=c(meanSpeedE,meanSpeedC),
                                      labels=labelsXeXc,
-                                     col=cols[1], lty=lty[1], line=axisLineRight, lwd=0, padj=-2)
+                                     col=colSpeed, lty=ltySpeed, line=axisLineRight, lwd=0, padj=-2)
                         }
                         axisLineRight = axisLineRight +2
                 }
-                
+
                 if(showAccel) {
                         par(new=T)
-                        if(highlight==FALSE)
+                        #if(highlight==FALSE)
                                 plot(startX:length(accel$y),accel$y[startX:length(accel$y)],type="l",
-                                     
xlim=xlim,ylim=ylim,xlab="",ylab="",col="magenta",lty=lty[2],lwd=1,axes=F)
-                        else
-                                plot(startX:length(accel$y),accel$y[startX:length(accel$y)],type="l",
-                                     xlim=xlim,ylim=ylim,xlab="",ylab="",col="darkblue",lty=2,lwd=3,axes=F)
+                                     
xlim=xlim,ylim=ylim,xlab="",ylab="",col=colAccel,lty=ltyAccel,lwd=1,axes=F)
+
+                       if(superpose)
+                               addRepCharsAboveLine(accel$y, colAccel, nrep)
+
+                        #else
+                        #        plot(startX:length(accel$y),accel$y[startX:length(accel$y)],type="l",
+                        #             xlim=xlim,ylim=ylim,xlab="",ylab="",col="darkblue",lty=2,lwd=3,axes=F)
                 }
-                
+
                 #show propulsive stuff if line if differentiation is relevant (propulsivePhase ends before 
the end of the movement)
                 if(isPropulsive & propulsiveEnd < length(displacement)) {
                         #propulsive stuff
@@ -880,7 +910,7 @@ paint <- function(displacement, eccon, xmin, xmax, xrange, yrange, knRanges, sup
                 }
                 
                 if(showAxes & showAccel) {
-                        axis(4, col="magenta", lty=lty[1], line=axisLineRight, lwd=1, padj=-.5)
+                        axis(4, col=colAccel, lty=ltyAccel, line=axisLineRight, lwd=1, padj=-.5)
                         axisLineRight = axisLineRight +2
                 }
                 #mtext(text=paste("max accel:",round(max(accel$y),3)),side=3,at=which(accel$y == 
max(accel$y)),cex=.8,col=cols[1],line=2)
@@ -916,14 +946,18 @@ paint <- function(displacement, eccon, xmin, xmax, xrange, yrange, knRanges, sup
                 if(knRanges[1] != "undefined")
                         ylim = knRanges$force
                 par(new=T)
-                if(highlight==FALSE)
-                        plot(startX:length(force),force[startX:length(force)],type="l",
-                             xlim=xlim,ylim=ylim,xlab="",ylab="",col=cols[2],lty=lty[2],lwd=1,axes=F)
-                else
+                #if(highlight==FALSE)
                         plot(startX:length(force),force[startX:length(force)],type="l",
-                             xlim=xlim,ylim=ylim,xlab="",ylab="",col="darkblue",lty=2,lwd=3,axes=F)
+                             xlim=xlim,ylim=ylim,xlab="",ylab="",col=colForce,lty=ltyForce,lwd=1,axes=F)
+                #else
+                #        plot(startX:length(force),force[startX:length(force)],type="l",
+                #             xlim=xlim,ylim=ylim,xlab="",ylab="",col="darkblue",lty=2,lwd=3,axes=F)
+
+               if(superpose)
+                       addRepCharsAboveLine(force, colForce, nrep)
+
                 if(showAxes) {
-                        axis(4, col=cols[2], lty=lty[2], line=axisLineRight, lwd=1, padj=-.5)
+                        axis(4, col=colForce, lty=ltyForce, line=axisLineRight, lwd=1, padj=-.5)
                         axisLineRight = axisLineRight +2
                 }
                 
@@ -1009,14 +1043,21 @@ paint <- function(displacement, eccon, xmin, xmax, xrange, yrange, knRanges, sup
                 ylim=c(- 1.05 * ylimHeight, 1.05 * ylimHeight) #put 0 in the middle, and have 5% margin at 
each side
                 if(knRanges[1] != "undefined")
                         ylim = knRanges$power
-                par(new=T);
-                if(highlight==FALSE)
-                        plot(startX:length(power),power[startX:length(power)],type="l",
-                             xlim=xlim,ylim=ylim,xlab="",ylab="",col=cols[3],lty=lty[3],lwd=2,axes=F)
-                else
+                par(new=T)
+
+               lwdPower = 2
+               if(superpose)
+                       lwdPower = 1
+
+                #if(highlight==FALSE)
                         plot(startX:length(power),power[startX:length(power)],type="l",
-                             xlim=xlim,ylim=ylim,xlab="",ylab="",col="darkred",lty=2,lwd=3,axes=F)
-                
+                             
xlim=xlim,ylim=ylim,xlab="",ylab="",col=colPower,lty=ltyPower,lwd=lwdPower,axes=F)
+                #else
+                #        plot(startX:length(power),power[startX:length(power)],type="l",
+                #             xlim=xlim,ylim=ylim,xlab="",ylab="",col="darkred",lty=2,lwd=3,axes=F)
+
+               if(superpose)
+                       addRepCharsAboveLine(power, colPower, nrep)
                 
                 if(isInertial(encoderConfigurationName) && debugOld) {
                         par(new=T)
@@ -1033,18 +1074,23 @@ paint <- function(displacement, eccon, xmin, xmax, xrange, yrange, knRanges, sup
                 }
                 
                 if(eccon == "c") {
-                        
arrows(x0=min(concentric),y0=meanPowerC,x1=propulsiveEnd,y1=meanPowerC,col=cols[3],code=3)
+                       if(! superpose) {
+                               
arrows(x0=min(concentric),y0=meanPowerC,x1=propulsiveEnd,y1=meanPowerC,col=cols[3],code=3)
+                       }
                 } else {
-                        if(landing == -1) {
+                        if(landing == -1)
                                 meanPowerE = mean(power[startX:max(eccentric)])
-                                
arrows(x0=startX,y0=meanPowerE,x1=max(eccentric),y1=meanPowerE,col=cols[3],code=3)
-                        }
-                        else {
+                       else
                                 meanPowerE = mean(power[landing:max(eccentric)])
-                                
arrows(x0=landing,y0=meanPowerE,x1=max(eccentric),y1=meanPowerE,col=cols[3],code=3)
-                        }
-                        
-                        
arrows(x0=min(concentric),y0=meanPowerC,x1=propulsiveEnd,y1=meanPowerC,col=cols[3],code=3)
+
+                       if(! superpose) {
+                               if(landing == -1)
+                                       
arrows(x0=startX,y0=meanPowerE,x1=max(eccentric),y1=meanPowerE,col=cols[3],code=3)
+                               else
+                                       
arrows(x0=landing,y0=meanPowerE,x1=max(eccentric),y1=meanPowerE,col=cols[3],code=3)
+
+                               
arrows(x0=min(concentric),y0=meanPowerC,x1=propulsiveEnd,y1=meanPowerC,col=cols[3],code=3)
+                       }
                 }
                 
                 if(showAxes) {
@@ -1052,20 +1098,20 @@ paint <- function(displacement, eccon, xmin, xmax, xrange, yrange, knRanges, sup
                                 axis(4, at=c(min(axTicks(4)),0,max(axTicks(4)),meanPowerC),
                                      labels=c(min(axTicks(4)),0,max(axTicks(4)),
                                               round(meanPowerC,1)),
-                                     col=cols[3], lty=lty[1], line=axisLineRight, lwd=2, padj=-.5)
+                                     col=colPower, lty=ltyPower, line=axisLineRight, lwd=2, padj=-.5)
                                 axis(4, at=meanPowerC,
                                      labels="Xc",
-                                     col=cols[3], lty=lty[1], line=axisLineRight, lwd=2, padj=-2)
+                                     col=colPower, lty=ltyPower, line=axisLineRight, lwd=2, padj=-2)
                         }
                         else {
                                 axis(4, at=c(min(axTicks(4)),0,max(axTicks(4)),meanPowerE,meanPowerC),
                                      labels=c(min(axTicks(4)),0,max(axTicks(4)),
                                               round(meanPowerE,1),
                                               round(meanPowerC,1)),
-                                     col=cols[3], lty=lty[1], line=axisLineRight, lwd=1, padj=-.5)
+                                     col=colPower, lty=ltyPower, line=axisLineRight, lwd=1, padj=-.5)
                                 axis(4, at=c(meanPowerE,meanPowerC),
                                      labels=labelsXeXc,
-                                     col=cols[3], lty=lty[1], line=axisLineRight, lwd=0, padj=-2)
+                                     col=colPower, lty=ltyPower, line=axisLineRight, lwd=0, padj=-2)
                         }
                         axisLineRight = axisLineRight +2
                 }
@@ -1112,7 +1158,14 @@ paint <- function(displacement, eccon, xmin, xmax, xrange, yrange, knRanges, sup
         #TODO: fix this to show only the cinematic values selected by user
         #legend, axes and title
         if(draw) {
-                if(legend & showAxes) {
+               #show 0 line
+               if(nrep == 1 && (showSpeed || showAccel || showForce || showPower))
+               {
+                       abline(h=0,lty=3,col="black")
+               }
+
+                #if(legend & showAxes) {}
+                if(legend) {
                         paintVariablesLegend(showSpeed, showAccel, showForce, showPower,
                                             (triggersOnList != "" && triggersOnList != -1))
                 }
@@ -1125,38 +1178,50 @@ paint <- function(displacement, eccon, xmin, xmax, xrange, yrange, knRanges, sup
 
 paintVariablesLegend <- function(showSpeed, showAccel, showForce, showPower, showTriggers)
 {
+       colPosition = "black"
+       colSpeed = cols[1]
+       colAccel = "magenta"
+       colForce = cols[2]
+       colPower = cols[3]
+
+       ltyPosition = 1
+       ltySpeed = 1
+       ltyAccel = 1
+       ltyForce = 1
+       ltyPower = 1
+
         legendText=c(paste(translateToPrint("Distance"),"(mm)"))
-        lty=c(1)
+        lty=c(ltyPosition)
         lwd=c(2)
-        colors=c("black") 
+        colors=c(colPosition)
         ncol=1
         
         if(showSpeed) {
                 legendText=c(legendText, paste(translateToPrint("Speed"),"(m/s)"))
-                lty=c(lty,1)
+                lty=c(lty,ltySpeed)
                 lwd=c(lwd,2)
-                colors=c(colors,cols[1]) 
+                colors=c(colors,colSpeed)
                 ncol=ncol+1
         }
         if(showAccel) {
                 legendText=c(legendText, paste(translateToPrint("Accel."),"(m/s²)"))
-                lty=c(lty,1)
+                lty=c(lty,ltyAccel)
                 lwd=c(lwd,2)
-                colors=c(colors,"magenta") 
+                colors=c(colors,colAccel)
                 ncol=ncol+1
         }
         if(showForce) {
                 legendText=c(legendText, paste(translateToPrint("Force"),"(N)"))
-                lty=c(lty,1)
+                lty=c(lty,ltyForce)
                 lwd=c(lwd,2)
-                colors=c(colors,cols[2]) 
+                colors=c(colors,colForce)
                 ncol=ncol+1
         }
         if(showPower) {
                 legendText=c(legendText, paste(translateToPrint("Power"),"(W)"))
-                lty=c(lty,1)
+                lty=c(lty,ltyPower)
                 lwd=c(lwd,2)
-                colors=c(colors,cols[3]) 
+                colors=c(colors,colPower)
                 ncol=ncol+1
         }
         if(showTriggers) {
@@ -1183,6 +1248,13 @@ paintVariablesLegend <- function(showSpeed, showAccel, showForce, showPower, sho
                cex=1, bg="white", ncol=ncol, bty="n", plot=T, xpd=NA)
 }
 
+addRepCharsAboveLine <- function(variable, col, label)
+{
+       seqChars = seq(from=1, to=length(variable), length.out=5)
+       text(x=seqChars, y=variable[seqChars], labels=label, col=col, adj=c(.5,0)) #this adjust writes letter 
on the top of line
+}
+
+
 textBox <- function(x,y,text,frontCol,bgCol,xpad=.1,ypad=1){
         
         w=strwidth(text)+xpad*strwidth(text)
@@ -2992,7 +3064,7 @@ doProcess <- function(options)
                        if(! cutByTriggers(op))
                                triggersOnList = op$TriggersOnList;
 
-                        paint(displacement, repOp$eccon, myStart, myEnd, 
"undefined","undefined","undefined",FALSE,FALSE,
+                        paint(displacement, repOp$eccon, myStart, myEnd, 
"undefined","undefined","undefined",FALSE,1,FALSE,
                               
1,curves[op$Jump,3],SmoothingsEC[smoothingPos],op$SmoothingOneC,repOp$massBody,repOp$massExtra,
                               
repOp$econfName,repOp$diameter,repOp$diameterExt,repOp$anglePush,repOp$angleWeight,repOp$inertiaM,repOp$gearedDown,
                               paste(op$Title, " ", op$Analysis, " ", repOp$eccon, ". ", myCurveStr, sep=""),
@@ -3240,13 +3312,13 @@ doProcess <- function(options)
                         if(i == 1)
                                 myTitle = paste(op$Title)
                         
-                        mySubtitle = paste("curve=", rownames(curves)[i], ", ", repOp$laterality, " ", 
repOp$massExtra, "Kg", sep="")
+                        mySubtitle = paste("Repetition=", rownames(curves)[i], ", ", repOp$laterality, " ", 
repOp$massExtra, "Kg", sep="")
                         
                        triggersOnList = "";
                        if(! cutByTriggers(op))
                                triggersOnList = op$TriggersOnList;
 
-                        paint(displacement, repOp$eccon, 
curves[i,1],curves[i,2],xrange,yrange,knRanges,FALSE,FALSE,
+                        paint(displacement, repOp$eccon, 
curves[i,1],curves[i,2],xrange,yrange,knRanges,FALSE,i,FALSE,
                               1,curves[i,3],SmoothingsEC[i],op$SmoothingOneC,repOp$massBody,repOp$massExtra,
                               
repOp$econfName,repOp$diameter,repOp$diameterExt,repOp$anglePush,repOp$angleWeight,repOp$inertiaM,repOp$gearedDown,
                               myTitle,mySubtitle,
@@ -3266,7 +3338,8 @@ doProcess <- function(options)
                 }
                 par(mfrow=c(1,1))
         }
-        #      if(op$Analysis=="superpose") {  #TODO: fix on ec startH
+
+       if(op$Analysis=="superpose") {  #TODO: fix on ec startH
         #              #falta fer un graf amb les 6 curves sobreposades i les curves de potencia (per 
exemple) sobrepossades
         #              #fer que acabin al mateix punt encara que no iniciin en el mateix
         #              #arreglar que els eixos de l'esq han de seguir un ylim,
@@ -3303,7 +3376,59 @@ doProcess <- function(options)
         #              }
         #              par(new=F)
         #              #print(knRanges)
-        #      }
+
+               xrange=find.xrange(singleFile, displacement, curves)
+               yrange=find.yrange(singleFile, displacement, curves)
+
+               #if !singleFile kinematicRanges takes the 'curves' values
+               knRanges=kinematicRanges(singleFile, displacement, curves,
+                                        op$MassBody, op$MassExtra, op$ExercisePercentBodyWeight,
+                                        op$EncoderConfigurationName,op$diameter,op$diameterExt,
+                                        op$anglePush,op$angleWeight,op$inertiaMomentum,op$gearedDown,
+                                        SmoothingsEC, op$SmoothingOneC,
+                                        g, op$Eccon, isPropulsive)
+
+               for(i in 1:n) {
+                       repOp <- assignRepOptions(
+                                                 singleFile, curves, i,
+                                                 op$MassBody, op$MassExtra, op$Eccon, 
op$ExercisePercentBodyWeight,
+                                                 op$EncoderConfigurationName, op$diameter, op$diameterExt,
+                                                 op$anglePush, op$angleWeight, op$inertiaMomentum, 
op$gearedDown,
+                                                 "") #laterality
+
+                       myTitle = ""
+                       if(i == 1)
+                               myTitle = paste(op$Title)
+
+                       #mySubtitle = paste("curve=", rownames(curves)[i], ", ", repOp$laterality, " ", 
repOp$massExtra, "Kg", sep="")
+
+                       triggersOnList = "";
+                       if(! cutByTriggers(op))
+                               triggersOnList = op$TriggersOnList;
+
+                       #TODO: highlight can ve used asking user if want to highlight any repetition, and 
this will be lwd=2 or 3
+
+                       paint(displacement, repOp$eccon, curves[i,1],curves[i,2],xrange,yrange,knRanges, 
TRUE, i, FALSE,
+                             1,curves[i,3],SmoothingsEC[i],op$SmoothingOneC,repOp$massBody,repOp$massExtra,
+                             
repOp$econfName,repOp$diameter,repOp$diameterExt,repOp$anglePush,repOp$angleWeight,repOp$inertiaM,repOp$gearedDown,
+                             myTitle, "", #title, subtitle
+                             TRUE,     #draw
+                             op$Width,
+                             FALSE,    #showLabels
+                             TRUE,     #marShrink
+                             FALSE,    #showAxes
+                             (i==1),   #legend
+                             op$Analysis, isPropulsive, inertialType, repOp$exPercentBodyWeight,
+                             (op$AnalysisVariables[1] == "Speed"), #show speed
+                             (op$AnalysisVariables[2] == "Accel"), #show accel
+                             (op$AnalysisVariables[3] == "Force"), #show force
+                             (op$AnalysisVariables[4] == "Power"),  #show power
+                             triggersOnList
+                             )
+
+                       par(new=T)
+               }
+       } #end of superpose
         
         #since Chronojump 1.3.6, encoder analyze has a treeview that can show the curves
         #when an analysis is done, curves file has to be written
diff --git a/glade/app1.glade b/glade/app1.glade
index ad655fb..f4fe5ba 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -1658,6 +1658,9 @@
                                                             <placeholder/>
                                                             </child>
                                                             <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
                                                             <widget class="GtkLabel" 
id="label_start_selector_jumps">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
@@ -22414,6 +22417,31 @@ then click this button.</property>
                                                             </packing>
                                                             </child>
                                                             <child>
+                                                            <widget class="GtkRadioButton" 
id="radiobutton_encoder_analyze_superpose">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property 
name="receives_default">False</property>
+                                                            <property name="has_tooltip">True</property>
+                                                            <property name="tooltip" 
translatable="yes">Superpose</property>
+                                                            <property name="draw_indicator">False</property>
+                                                            <property 
name="group">radiobutton_encoder_analyze_powerbars</property>
+                                                            <signal name="toggled" 
handler="on_radiobutton_encoder_analyze_superpose_toggled" swapped="no"/>
+                                                            <child>
+                                                            <widget class="GtkImage" 
id="image_encoder_analyze_superpose">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property 
name="stock">gtk-missing-image</property>
+                                                            <property name="icon-size">2</property>
+                                                            </widget>
+                                                            </child>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">True</property>
+                                                            <property name="position">5</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
                                                             <widget class="GtkRadioButton" 
id="radiobutton_encoder_analyze_neuromuscular_profile">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">True</property>
@@ -22436,7 +22464,7 @@ then click this button.</property>
                                                             <packing>
                                                             <property name="expand">False</property>
                                                             <property name="fill">True</property>
-                                                            <property name="position">5</property>
+                                                            <property name="position">6</property>
                                                             </packing>
                                                             </child>
                                                             </widget>
@@ -24960,6 +24988,9 @@ then click this button.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
diff --git a/images/encoder-analyze-superpose.png b/images/encoder-analyze-superpose.png
new file mode 100644
index 0000000..c3789a7
Binary files /dev/null and b/images/encoder-analyze-superpose.png differ
diff --git a/images/svg/icons.svg b/images/svg/icons.svg
index ebc8735..3309a29 100644
--- a/images/svg/icons.svg
+++ b/images/svg/icons.svg
@@ -7256,16 +7256,16 @@
      borderopacity="1.0"
      inkscape:pageopacity="0"
      inkscape:pageshadow="2"
-     inkscape:zoom="4.5930988"
-     inkscape:cx="486.05667"
-     inkscape:cy="100.39133"
+     inkscape:zoom="4.0390625"
+     inkscape:cx="88.05039"
+     inkscape:cy="313.10745"
      inkscape:document-units="px"
      inkscape:current-layer="capa1"
      showgrid="false"
-     inkscape:window-width="1920"
-     inkscape:window-height="1014"
+     inkscape:window-width="1366"
+     inkscape:window-height="705"
      inkscape:window-x="0"
-     inkscape:window-y="27"
+     inkscape:window-y="26"
      inkscape:window-maximized="1"
      fit-margin-top="0"
      fit-margin-left="0"
@@ -7291,11 +7291,6 @@
        inkscape:locked="false" />
     <sodipodi:guide
        orientation="1,0"
-       position="131.5577,160.7895"
-       id="guide4689"
-       inkscape:locked="false" />
-    <sodipodi:guide
-       orientation="1,0"
        position="152.34678,184.66878"
        id="guide4885"
        inkscape:locked="false" />
@@ -7339,6 +7334,11 @@
        orientation="1,0"
        id="guide6489"
        inkscape:locked="false" />
+    <sodipodi:guide
+       position="136.07737,314.83172"
+       orientation="1,0"
+       id="guide3073"
+       inkscape:locked="false" />
   </sodipodi:namedview>
   <metadata
      id="metadata7">
@@ -7430,7 +7430,7 @@
        
inkscape:export-filename="/home/xavier/informatica/progs_meus/chronojump/chronojump/images/encoder-analyze-single.png"
        inkscape:export-xdpi="89.989998"
        inkscape:export-ydpi="89.989998"
-       transform="translate(0,-13.72549)">
+       transform="translate(30.986869,-13.72549)">
       <rect
          y="1003.9698"
          x="14.208096"
@@ -7442,13 +7442,13 @@
          transform="translate(-3.4494629e-6,1.1705907e-4)"
          id="g5217">
         <path
-           
style="fill:none;stroke:#ffffff;stroke-width:2.71259522;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+           
style="fill:none;stroke:#ffffff;stroke-width:2.71259522;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
            d="m 17.03509,1016.4423 c 6.83937,0.041 1.801391,-8.8682 10.346018,-8.9454"
            id="path3792-5-6-0"
            inkscape:connector-curvature="0"
            sodipodi:nodetypes="cc" />
         <path
-           
style="fill:none;stroke:#000000;stroke-width:1.93756807;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+           
style="fill:none;stroke:#000000;stroke-width:1.93756807;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
            d="m 17.158939,1016.4823 c 5.990696,-0.1088 2.447411,-9.3744 10.09832,-9.015"
            id="path3792-5-6"
            inkscape:connector-curvature="0"
@@ -7460,7 +7460,7 @@
        
inkscape:export-filename="/home/xavier/informatica/progs_meus/chronojump/chronojump/images/encoder-analyze-nmp.png"
        inkscape:export-xdpi="89.989998"
        inkscape:export-ydpi="89.989998"
-       transform="translate(0,-13.72549)">
+       transform="translate(30.986869,-13.72549)">
       <rect
          y="1003.9698"
          x="39.249966"
@@ -7469,7 +7469,7 @@
          id="rect2985-5"
          style="fill:#ffffff;fill-opacity:0;fill-rule:nonzero;stroke:none" />
       <g
-         transform="translate(-0.02496958,0)"
+         transform="translate(-0.02496958)"
          id="g5229">
         <rect
            style="fill:#4c00ff;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-opacity:1"
@@ -7479,7 +7479,7 @@
            x="39.896626"
            y="1007.9548" />
         <rect
-           
style="fill:#00ff4d;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+           
style="fill:#00ff4d;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
            id="rect3967-9-2"
            width="4.4440165"
            height="6.3793139"
@@ -7530,23 +7530,23 @@
     <text
        xml:space="preserve"
        
style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none"
-       x="9.081933"
+       x="40.068802"
        y="981.80341"
        id="text3938-3-5-7-5-9"><tspan
          sodipodi:role="line"
          id="tspan3940-6-4-1-9-8"
-         x="9.081933"
+         x="40.068802"
          y="981.80341"
          
style="font-size:2px;line-height:1.25;font-family:sans-serif">encoder-analyze-single.png</tspan></text>
     <text
        xml:space="preserve"
        
style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none"
-       x="28.738205"
+       x="59.725075"
        y="978.15656"
        id="text3938-3-5-7-5-9-8"><tspan
          sodipodi:role="line"
          id="tspan3940-6-4-1-9-8-2"
-         x="28.738205"
+         x="59.725075"
          y="978.15656"
          style="font-size:2px;line-height:1.25;font-family:sans-serif">encoder-analyze-nmp.png</tspan></text>
     <g
@@ -11307,5 +11307,56 @@
            inkscape:connector-curvature="0" />
       </g>
     </g>
+    <g
+       id="g3270"
+       
inkscape:export-filename="/home/xavier/informatica/progs_meus/chronojump/chronojump/images/encoder-analyze-superpose.png"
+       inkscape:export-xdpi="96"
+       inkscape:export-ydpi="96">
+      <rect
+         y="988.12585"
+         x="17.239494"
+         height="16"
+         width="16"
+         id="rect2985-6-61"
+         style="fill:#ffffff;fill-opacity:0;fill-rule:nonzero;stroke:none" />
+      <g
+         id="g3217">
+        <path
+           
style="fill:none;stroke:#ffffff;stroke-width:1.79999995;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+           d="m 19.385634,1000.5985 c 6.437049,0.072 3.658257,-8.99198 11.98625,-9.06918"
+           id="path3792-5-6-0-7"
+           inkscape:connector-curvature="0"
+           sodipodi:nodetypes="cc" />
+        <path
+           
style="fill:none;stroke:#ffffff;stroke-width:1.79999995;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+           d="m 19.385636,1000.624 c 6.437046,0.072 5.019954,-6.54713 11.986247,-6.25296"
+           id="path3792-5-6-0-7-2"
+           inkscape:connector-curvature="0"
+           sodipodi:nodetypes="cc" />
+        <path
+           
style="fill:none;stroke:#ff6347;stroke-width:1.20000005;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+           d="m 19.509486,1000.664 c 5.990692,-0.1088 4.582357,-6.26067 11.862339,-6.26067"
+           id="path3792-5-6-9-0"
+           inkscape:connector-curvature="0"
+           sodipodi:nodetypes="cc" />
+        <path
+           
style="fill:none;stroke:#4c00ff;stroke-width:1.20000005;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+           d="m 19.509483,1000.6385 c 5.990696,-0.1088 4.180486,-9.40534 11.831395,-9.04594"
+           id="path3792-5-6-9"
+           inkscape:connector-curvature="0"
+           sodipodi:nodetypes="cc" />
+      </g>
+    </g>
+    <text
+       xml:space="preserve"
+       
style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none"
+       x="11.457384"
+       y="976.92218"
+       id="text3938-3-5-7-5-9-2"><tspan
+         sodipodi:role="line"
+         id="tspan3940-6-4-1-9-8-8"
+         x="11.457384"
+         y="976.92218"
+         
style="font-size:2px;line-height:1.25;font-family:sans-serif">encoder-analyze-superpose.png</tspan></text>
   </g>
 </svg>
diff --git a/src/Makefile.am b/src/Makefile.am
index 2fd0bda..9a44620 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -489,6 +489,7 @@ RESOURCES = \
        ../images/encoder-analyze-cross.png,encoder-analyze-cross.png \
        ../images/encoder-analyze-1RM.png,encoder-analyze-1RM.png \
        ../images/encoder-analyze-side.png,encoder-analyze-side.png \
+       ../images/encoder-analyze-superpose.png,encoder-analyze-superpose.png \
        ../images/encoder-analyze-single.png,encoder-analyze-single.png \
        ../images/encoder-analyze-nmp.png,encoder-analyze-nmp.png \
        ../images/encoder-analyze-eccon-together.png,encoder-analyze-eccon-together.png \
diff --git a/src/constants.cs b/src/constants.cs
index 2e2af53..c667768 100644
--- a/src/constants.cs
+++ b/src/constants.cs
@@ -470,6 +470,7 @@ public class Constants
        public static string FileNameEncoderAnalyzeCrossIcon = "encoder-analyze-cross.png";
        public static string FileNameEncoderAnalyze1RMIcon = "encoder-analyze-1RM.png";
        public static string FileNameEncoderAnalyzeSideIcon = "encoder-analyze-side.png";
+       public static string FileNameEncoderAnalyzeSuperposeIcon = "encoder-analyze-superpose.png";
        public static string FileNameEncoderAnalyzeSingleIcon = "encoder-analyze-single.png";
        public static string FileNameEncoderAnalyzeNmpIcon = "encoder-analyze-nmp.png";
        
diff --git a/src/gui/chronojumpIcons.cs b/src/gui/chronojumpIcons.cs
index 31d8bf4..47d5ed3 100644
--- a/src/gui/chronojumpIcons.cs
+++ b/src/gui/chronojumpIcons.cs
@@ -481,6 +481,7 @@ public partial class ChronoJumpWindow
                UtilGtk.ColorsRadio(viewport_chronopics, radiobutton_encoder_analyze_powerbars);
                UtilGtk.ColorsRadio(viewport_chronopics, radiobutton_encoder_analyze_cross);
                UtilGtk.ColorsRadio(viewport_chronopics, radiobutton_encoder_analyze_side);
+               UtilGtk.ColorsRadio(viewport_chronopics, radiobutton_encoder_analyze_superpose);
                UtilGtk.ColorsRadio(viewport_chronopics, radiobutton_encoder_analyze_single);
                UtilGtk.ColorsRadio(viewport_chronopics, radiobutton_encoder_analyze_neuromuscular_profile);
                
@@ -547,6 +548,8 @@ public partial class ChronoJumpWindow
 
                pixbuf = new Pixbuf (null, Util.GetImagePath(false) + 
Constants.FileNameEncoderAnalyzeSideIcon);
                image_encoder_analyze_side.Pixbuf = pixbuf;
+               pixbuf = new Pixbuf (null, Util.GetImagePath(false) + 
Constants.FileNameEncoderAnalyzeSuperposeIcon);
+               image_encoder_analyze_superpose.Pixbuf = pixbuf;
                pixbuf = new Pixbuf (null, Util.GetImagePath(false) + 
Constants.FileNameEncoderAnalyzeSingleIcon);
                image_encoder_analyze_single.Pixbuf = pixbuf;
                pixbuf = new Pixbuf (null, Util.GetImagePath(false) + 
Constants.FileNameEncoderAnalyzeNmpIcon);
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 8725528..3f6cbd8 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -238,6 +238,7 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.Image image_encoder_analyze_cross;
        [Widget] Gtk.Image image_encoder_analyze_1RM;
        [Widget] Gtk.Image image_encoder_analyze_side;
+       [Widget] Gtk.Image image_encoder_analyze_superpose;
        [Widget] Gtk.Image image_encoder_analyze_single;
        [Widget] Gtk.Image image_encoder_analyze_nmp;
        [Widget] Gtk.HBox hbox_encoder_analyze_intersession;
@@ -248,7 +249,7 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.Button button_encoder_analyze_help;
 
 
-       //[Widget] Gtk.RadioButton radiobutton_encoder_analyze_superpose;
+       [Widget] Gtk.RadioButton radiobutton_encoder_analyze_superpose;
        [Widget] Gtk.CheckButton check_encoder_analyze_eccon_together;
        [Widget] Gtk.Image image_encoder_analyze_eccon_together;
        [Widget] Gtk.Image image_encoder_analyze_eccon_separated;
@@ -2684,8 +2685,11 @@ public partial class ChronoJumpWindow
                        }
                }
                
-               if(sendAnalysis == "powerBars" || sendAnalysis == "single" || sendAnalysis == "side" || 
sendAnalysis == "sideShareX")
+               if(sendAnalysis == "powerBars" || sendAnalysis == "single" ||
+                               sendAnalysis == "side" || sendAnalysis == "sideShareX" || sendAnalysis == 
"superpose")
+               {
                        analysisVariables = getAnalysisVariables(sendAnalysis);
+               }
 
                if( ! radio_encoder_analyze_individual_current_set.Active) //not current set
                {
@@ -3175,7 +3179,7 @@ public partial class ChronoJumpWindow
                        else
                                analysisVariables += ";NoRange";
                }
-               else {  //analysis == "single" || analysis == "side" || analysis == "sideShareX"
+               else {  //analysis == "single" || analysis == "side" || analysis == "sideShareX" || 
sendAnalysis == "superpose"
                        if(check_encoder_analyze_show_speed.Active)
                                analysisVariables = "Speed";
                        else
@@ -3228,10 +3232,9 @@ public partial class ChronoJumpWindow
                button_encoder_analyze_sensitiveness();
        }
 
-       /*
        private void on_radiobutton_encoder_analyze_superpose_toggled (object obj, EventArgs args) {
-               hbox_encoder_analyze_curve_num.Visible=true;
-               hbox_combo_encoder_analyze_curve_num_combo.Visible = true;
+               hbox_encoder_analyze_curve_num.Visible=false;
+               hbox_combo_encoder_analyze_curve_num_combo.Visible = false;
                hbox_combo_encoder_analyze_cross_sup.Visible=false;
                hbox_combo_encoder_analyze_1RM.Visible=false;
                check_encoder_analyze_mean_or_max.Visible=false;
@@ -3249,9 +3252,10 @@ public partial class ChronoJumpWindow
                //restore 1RM Bench Press sensitiveness
                check_encoder_analyze_mean_or_max.Sensitive = true;
                
+               encoderButtonsSensitive(encoderSensEnumStored);
                button_encoder_analyze_sensitiveness();
        }
-       */
+
        private void on_radiobutton_encoder_analyze_side_toggled (object obj, EventArgs args) {
                hbox_encoder_analyze_curve_num.Visible=false;
                hbox_combo_encoder_analyze_curve_num_combo.Visible = false;



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