ok cross x punti

This commit is contained in:
Samuele E. Locatelli
2021-02-10 19:36:24 +01:00
parent 2aa6112113
commit 7a41ce29fa
3 changed files with 78 additions and 14 deletions
+4
View File
@@ -318,6 +318,7 @@
this.lblOrigD.Size = new System.Drawing.Size(15, 13);
this.lblOrigD.TabIndex = 3;
this.lblOrigD.Text = "D";
this.lblOrigD.Click += new System.EventHandler(this.lblOrigD_Click);
//
// lblOrigA
//
@@ -327,6 +328,7 @@
this.lblOrigA.Size = new System.Drawing.Size(14, 13);
this.lblOrigA.TabIndex = 2;
this.lblOrigA.Text = "A";
this.lblOrigA.Click += new System.EventHandler(this.lblOrigA_Click);
//
// lblOrigC
//
@@ -336,6 +338,7 @@
this.lblOrigC.Size = new System.Drawing.Size(14, 13);
this.lblOrigC.TabIndex = 1;
this.lblOrigC.Text = "C";
this.lblOrigC.Click += new System.EventHandler(this.lblOrigC_Click);
//
// lblOrigB
//
@@ -345,6 +348,7 @@
this.lblOrigB.Size = new System.Drawing.Size(14, 13);
this.lblOrigB.TabIndex = 0;
this.lblOrigB.Text = "B";
this.lblOrigB.Click += new System.EventHandler(this.lblOrigB_Click);
//
// checkLive
//
+71 -12
View File
@@ -35,6 +35,8 @@ namespace ThermalImageStreamerDemo
}
}
protected int currPoint = -1;
/// <summary>
/// Ultima immagine recuperata
/// </summary>
@@ -127,7 +129,7 @@ namespace ThermalImageStreamerDemo
if (liveView)
{
takePicture();
drawPoints();
drawCrossAtPoints();
calculateTarget();
displayImages();
updateTempDisplay();
@@ -141,7 +143,7 @@ namespace ThermalImageStreamerDemo
}
}
private void drawPoints()
private void drawCrossAtPoints()
{
if (lastThermalImage != null)
{
@@ -421,19 +423,29 @@ namespace ThermalImageStreamerDemo
lblPoint.Text = $"({mea.X},{mea.Y}) --> ({lastPoint.X},{lastPoint.Y})";
if (pointSetup)
{
// max 4 punti... sae sono oltre --> resetto
// max 4 punti... se sono già FULL --> imposto singolo valore nuovo
if (origPoints.curr >= 4)
{
origPoints = new SetPoints();
if (currPoint >= 0)
{
origPoints.Coords[currPoint] = lastPoint;
}
else
{
origPoints = new SetPoints();
}
}
// salvo coordinate in base al num corrente...
try
else
{
origPoints.Coords.Add(lastPoint);
origPoints.curr++;
// salvo coordinate in base al num corrente...
try
{
origPoints.Coords.Add(lastPoint);
origPoints.curr++;
}
catch
{ }
}
catch
{ }
updateDisplay();
}
else if (readTemp)
@@ -630,9 +642,9 @@ namespace ThermalImageStreamerDemo
private void chkReadTemp_CheckedChanged(object sender, EventArgs e)
{
// deselezione setup punti
if (chkPointSetup.Checked)
if (pointSetup)
{
chkPointSetup.Checked = false;
pointSetup = false;
}
if (!readTemp)
{
@@ -655,5 +667,52 @@ namespace ThermalImageStreamerDemo
txtMinTemp.Enabled = !chkAutoTemp.Checked;
txtMaxTemp.Enabled = !chkAutoTemp.Checked;
}
private void lblOrigA_Click(object sender, EventArgs e)
{
lblOrigA.ForeColor = toggleEditPoint(0);
}
/// <summary>
/// Verifica se il punto era in edit, altrimenti segnala e lo attiva... restituendo colore x il controllo
/// </summary>
/// <param name="selPoint"></param>
private Color toggleEditPoint(int selPoint)
{
Color answ = Color.Black;
lblOrigA.ForeColor = answ;
lblOrigB.ForeColor = answ;
lblOrigC.ForeColor = answ;
lblOrigD.ForeColor = answ;
readTemp = false;
pointSetup = true;
if (currPoint == selPoint)
{
// deseleziono
currPoint = -1;
}
else
{
// indico selezionato
currPoint = selPoint;
answ = Color.Green;
}
return answ;
}
private void lblOrigB_Click(object sender, EventArgs e)
{
lblOrigB.ForeColor = toggleEditPoint(1);
}
private void lblOrigC_Click(object sender, EventArgs e)
{
lblOrigC.ForeColor = toggleEditPoint(2);
}
private void lblOrigD_Click(object sender, EventArgs e)
{
lblOrigD.ForeColor = toggleEditPoint(3);
}
}
}
+3 -2
View File
@@ -6,15 +6,16 @@ using System.Threading.Tasks;
namespace ThermoCamUtils
{
public class Enums
public class Enums
{
}
public enum pointList
{
A=0,
A = 0,
B,
C,
D
}
}