DataEntry.StandardCamera changes - OCR as for Hong Kong, ver. 2.30.1971
This commit is contained in:
parent
9f6bfc6410
commit
36c52e5d7e
@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("2.30.1966.0")]
|
||||
[assembly: AssemblyFileVersion("2.30.1966.0")]
|
||||
[assembly: AssemblyVersion("2.30.1971.0")]
|
||||
[assembly: AssemblyFileVersion("2.30.1971.0")]
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2017-2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -16,8 +16,24 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(EntryForm));
|
||||
public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
|
||||
|
||||
const string DfltOcrWorkspaceFolder = "C:\\TBF\\OCR\\";
|
||||
const string DfltOcrWorkspaceExt = ".vrws";
|
||||
|
||||
static Dictionary<string, OcrVidi> ocrDictionary = new Dictionary<string, OcrVidi>();
|
||||
|
||||
|
||||
readonly EntryFormCfg entryFormCfg;
|
||||
|
||||
public string OcrWorkspace
|
||||
{
|
||||
get { return (entryFormCfg != null && entryFormCfg.ProcParams != null) ? entryFormCfg.ProcParams.OcrWorkspace : string.Empty; }
|
||||
}
|
||||
|
||||
public string OcrStream
|
||||
{
|
||||
get { return (entryFormCfg != null && entryFormCfg.ProcParams != null) ? entryFormCfg.ProcParams.OcrStream : string.Empty; }
|
||||
}
|
||||
|
||||
IRegReader[] regReaders;
|
||||
|
||||
|
||||
@ -28,26 +44,13 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
{
|
||||
if (entryFormCfg.DebugLevel == DebugMode.Simulate)
|
||||
{
|
||||
startImages = new string[] { "C:\\TBF\\Images\\Test\\Image1.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image2.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image3.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image4.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image5.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image1.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image2.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image3.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image4.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image5.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image1.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image2.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image3.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image4.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image5.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image1.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image2.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image3.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image4.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image5.jpg" };
|
||||
startImages = new string[] { "C:\\TBF\\Images\\Test\\Image1.jpg", "C:\\TBF\\Images\\Test\\Image2.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image3.jpg", "C:\\TBF\\Images\\Test\\Image4.jpg", "C:\\TBF\\Images\\Test\\Image5.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image1.jpg", "C:\\TBF\\Images\\Test\\Image2.jpg", "C:\\TBF\\Images\\Test\\Image3.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image4.jpg", "C:\\TBF\\Images\\Test\\Image5.jpg", "C:\\TBF\\Images\\Test\\Image1.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image2.jpg", "C:\\TBF\\Images\\Test\\Image3.jpg", "C:\\TBF\\Images\\Test\\Image4.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image5.jpg", "C:\\TBF\\Images\\Test\\Image1.jpg", "C:\\TBF\\Images\\Test\\Image2.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image3.jpg", "C:\\TBF\\Images\\Test\\Image4.jpg", "C:\\TBF\\Images\\Test\\Image5.jpg" };
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -110,7 +113,6 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
|
||||
CurrentOp currentOp;
|
||||
|
||||
|
||||
public EntryForm() { }
|
||||
|
||||
public EntryForm(Generic.IComponentCfg cfg)
|
||||
@ -213,21 +215,75 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
///
|
||||
void OpenTestStartStatesDlg(EntryForm myRef)
|
||||
{
|
||||
myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, startImages, disabled);
|
||||
string ocrMessage;
|
||||
var ocr = GetOcr(myRef.OcrWorkspace, out ocrMessage);
|
||||
myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, ocr, ocrMessage, myRef.OcrStream,
|
||||
startImages, disabled);
|
||||
modelessDlg.Show();
|
||||
}
|
||||
///
|
||||
void OpenTestEndStatesDlg(EntryForm myRef)
|
||||
{
|
||||
myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, endImages, wmStartState, wmStartStateStr, disabled, refVolume, errLimLo, errLimHi);
|
||||
string ocrMessage;
|
||||
var ocr = GetOcr(myRef.OcrWorkspace, out ocrMessage);
|
||||
myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, ocr, ocrMessage, myRef.OcrStream,
|
||||
startImages, wmStartState, wmStartStateStr, endImages, disabled,
|
||||
refVolume, errLimLo, errLimHi);
|
||||
modelessDlg.Show();
|
||||
}
|
||||
///
|
||||
void OpenDeferredTestEvalDlg(EntryForm myRef)
|
||||
{
|
||||
myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, startImages, endImages, disabled, refVolume, errLimLo, errLimHi);
|
||||
string ocrMessage;
|
||||
var ocr = GetOcr(myRef.OcrWorkspace, out ocrMessage);
|
||||
myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, ocr, ocrMessage, myRef.OcrStream,
|
||||
startImages, endImages, disabled,
|
||||
refVolume, errLimLo, errLimHi);
|
||||
modelessDlg.Show();
|
||||
}
|
||||
///
|
||||
OcrVidi GetOcr(string ocrWorkspace, out string message)
|
||||
{
|
||||
message = string.Empty;
|
||||
if (string.IsNullOrEmpty(ocrWorkspace)) return null; /// No OCR was configured
|
||||
|
||||
string fullPath = (ocrWorkspace.Contains("\\") || ocrWorkspace.Contains("/"))
|
||||
? ocrWorkspace.Replace('/', '\\')
|
||||
: System.IO.Path.Combine(DfltOcrWorkspaceFolder, ocrWorkspace);
|
||||
if (!fullPath.Contains(".")) fullPath = fullPath + DfltOcrWorkspaceExt;
|
||||
|
||||
OcrVidi ocrVidi;
|
||||
if (ocrDictionary.TryGetValue(fullPath, out ocrVidi))
|
||||
{
|
||||
log.InfoFormat("existing OcrVidi({0}) was retrieved from dictionary", fullPath);
|
||||
return ocrVidi;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
ocrVidi = new OcrVidi(fullPath);
|
||||
ocrDictionary.Add(fullPath, ocrVidi);
|
||||
log.WarnFormat("new OcrVidi({0}) was added to dictionary", fullPath);
|
||||
return ocrVidi;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (e.InnerException != null)
|
||||
{
|
||||
log.ErrorFormat("new OcrVidi({0}) thrown {1}: {2} / {3}",
|
||||
fullPath, e.GetType().ToString(), e.Message,e.InnerException.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
log.ErrorFormat("new OcrVidi({0}) thrown {1}: {2}",
|
||||
fullPath, e.GetType().ToString(), e.Message);
|
||||
}
|
||||
log.ErrorFormat("Stack trace:\r\n{0}", e.StackTrace);
|
||||
|
||||
message = string.Format("Cannot load OCR workspace:\r\n{0}\r\nOCR workspace file is {1}", e.Message, fullPath);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
@ -349,7 +405,9 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
{
|
||||
for (int i = 0; i < dlg.WaterMetersCount; i++)
|
||||
{
|
||||
wmEndState[i] = dlg.WMEndState[i];
|
||||
wmStartState[i] = dlg.WMStartState[i];
|
||||
wmStartStateStr[i] = dlg.WMStartStateStr[i];
|
||||
wmEndState[i] = dlg.WMEndState[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2017-2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using Common;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.DataEntry.StandardCamera
|
||||
@ -27,9 +28,18 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
public string ProtocolTitle3;
|
||||
public string ProtocolTitle4;
|
||||
|
||||
|
||||
/// <summary> Procedure parameters </summary>
|
||||
[XmlIgnore]
|
||||
public ProcParams ProcParams;
|
||||
public override IParamsProvider GetRuntimeProcParamsProvider() { return ProcParams; }
|
||||
public override IParamsProvider CreateProcParamsProvider() { return new ProcParams(true); }
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
EntryFormCfg()
|
||||
{
|
||||
ProcParams = new ProcParams(true);
|
||||
|
||||
Name = "DataEntry-for-Camera";
|
||||
ParentName = string.Empty;
|
||||
HideOrder = false;
|
||||
|
||||
97
TBF/Rig/DataEntry/StandardCamera/OcrVidi.cs
Normal file
97
TBF/Rig/DataEntry/StandardCamera/OcrVidi.cs
Normal file
@ -0,0 +1,97 @@
|
||||
using System.Collections.Generic;
|
||||
#if OCR
|
||||
using ViDi2;
|
||||
#endif
|
||||
|
||||
namespace TBF.Rig.DataEntry.StandardCamera
|
||||
{
|
||||
public class OcrVidi
|
||||
{
|
||||
#if OCR
|
||||
/// Static variable: OCR ViDi control can only have one instance
|
||||
static ViDi2.Runtime.IControl control;
|
||||
readonly IWorkspace workspace;
|
||||
#endif
|
||||
readonly string ocrWorkspaceFile;
|
||||
|
||||
/// <summary>
|
||||
/// Create OcrVidi wrapper class
|
||||
/// </summary>
|
||||
/// <param name="ocrWorkspaceFile">Cognex runtime workspace file (vrws)</param>
|
||||
public OcrVidi(string ocrWorkspaceFile)
|
||||
{
|
||||
this.ocrWorkspaceFile = ocrWorkspaceFile;
|
||||
#if OCR
|
||||
if (control == null)
|
||||
{
|
||||
/// Create and initialize the main control
|
||||
control = new ViDi2.Runtime.Local.Control(GpuMode.NoSupport);
|
||||
control.InitializeComputeDevices(GpuMode.NoSupport, new List<int>() { }); /// Initializes all CUDA devices
|
||||
}
|
||||
|
||||
/// Open a runtime workspace from file
|
||||
workspace = control.Workspaces.Add(string.Format("ws{0}", control.Workspaces.Count + 1), ocrWorkspaceFile);
|
||||
#endif
|
||||
}
|
||||
|
||||
public string Recognize(string streamName, string imagePath, double denominator = 1000, string format = "F3")
|
||||
{
|
||||
#if OCR
|
||||
IStream stream;
|
||||
try { stream = workspace.Streams[streamName]; }
|
||||
catch (Exception) { return string.Empty; }
|
||||
if (stream == null) return string.Empty;
|
||||
|
||||
string findedText = string.Empty; /// Hladane cislo - stav vodomera - string
|
||||
double findedValue = 0; /// Hladane cislo - stav vodomera
|
||||
bool finded = false; /// Ci sme nasli hodnotu
|
||||
|
||||
// load an image from file
|
||||
using (IImage image = new ViDi2.Local.LibraryImage(imagePath)) //disposing the image when we do not need it anymore
|
||||
{
|
||||
// allocates a sample with the image
|
||||
using (ISample sample = stream.CreateSample(image))
|
||||
{
|
||||
ITool tool = stream.Tools["Read"];
|
||||
|
||||
// process image with the blue read tool
|
||||
sample.Process(tool);
|
||||
|
||||
IBlueMarking blueReadMarking = sample.Markings[tool.Name] as IBlueMarking;
|
||||
|
||||
foreach (IBlueView view in blueReadMarking.Views)
|
||||
{
|
||||
foreach (IMatch match in view.Matches)
|
||||
{
|
||||
//System.Console.WriteLine($"This model says \" {(match as IReadModelMatch).FeatureString} \" with a score of {match.Score}");
|
||||
string word = (match as IReadModelMatch).FeatureString;
|
||||
if (word.Length >= 7 && word.Length <= 8 // hladane cislo ma od 7 do 8 znakov
|
||||
&& double.TryParse(word,out findedValue)) // a ak najdeny text je cislo
|
||||
{
|
||||
findedValue /= denominator; // Convert to m3, red digits are fractions of m3
|
||||
finded = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (finded) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (finded)
|
||||
{
|
||||
findedText = findedValue.ToString(format);
|
||||
}
|
||||
|
||||
return findedText;
|
||||
#else
|
||||
return null;
|
||||
#endif
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return ocrWorkspaceFile;
|
||||
}
|
||||
}
|
||||
}
|
||||
132
TBF/Rig/DataEntry/StandardCamera/ProcParams.cs
Normal file
132
TBF/Rig/DataEntry/StandardCamera/ProcParams.cs
Normal file
@ -0,0 +1,132 @@
|
||||
///
|
||||
/// Copyright (c) 2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.IO;
|
||||
using System.Xml.Serialization;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.DataEntry.StandardCamera
|
||||
{
|
||||
public class ProcParams : ProcedureParamsBase, IParamsProvider, IProcedureParams
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ProcParams) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public string OcrWorkspace; /// Path to a Cognex workspace file
|
||||
public string OcrStream; /// Cognex workspace stream name
|
||||
|
||||
|
||||
public override void InitializeAll()
|
||||
{
|
||||
OcrWorkspace = string.Empty;
|
||||
OcrStream = "default";
|
||||
}
|
||||
|
||||
string[] paramNames = new string[]
|
||||
{
|
||||
"OCR workspace file",
|
||||
"OCR stream",
|
||||
};
|
||||
public override string ParamName(int i) { return paramNames[i]; }
|
||||
public override int ParamsCount() { return paramNames.Length; }
|
||||
|
||||
public override string ToString(int i)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: return OcrWorkspace;
|
||||
case 1: return OcrStream;
|
||||
default: return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
public CfgUpdateFlags UpdateParam(int i, string str)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: OcrWorkspace = str; return CfgUpdateFlags.None;
|
||||
case 1: OcrStream = str; return CfgUpdateFlags.None;
|
||||
default: return CfgUpdateFlags.None;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifiy the string representation of the parameter
|
||||
/// </summary>
|
||||
/// <param name="i">Parameter ID</param>
|
||||
/// <param name="str">String representation of the parameter</param>
|
||||
/// <param name="message">In case false is returned this is the error messsage to be displayed</param>
|
||||
/// <returns>true = parameter OK, false = parameter NOK</returns>
|
||||
public bool ValidateParam(int i, string str, out string message)
|
||||
{
|
||||
message = string.Empty;
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
return true;
|
||||
case 1:
|
||||
if (!string.IsNullOrEmpty(str)) return true;
|
||||
break;
|
||||
default:
|
||||
message = "Invalid index";
|
||||
return false;
|
||||
}
|
||||
|
||||
message = ParamName(i) + " is invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
void CopyContentTo(ProcParams prms)
|
||||
{
|
||||
prms.OcrWorkspace = OcrWorkspace;
|
||||
prms.OcrStream = OcrStream;
|
||||
}
|
||||
|
||||
public IParamsProvider Clone()
|
||||
{
|
||||
ProcParams pars = new ProcParams();
|
||||
CopyContentTo(pars);
|
||||
return pars;
|
||||
}
|
||||
|
||||
public override void UpdateFromDbEntity(ComponentProcedure dbEntity)
|
||||
{
|
||||
if (dbEntity == null) return;
|
||||
try
|
||||
{
|
||||
ProcParams tmp = Serializer.Deserialize(new StringReader(dbEntity.Parameters)) as ProcParams;
|
||||
|
||||
procedureParamsEntity = dbEntity;
|
||||
componentName = dbEntity.CmpntName;
|
||||
procedure = dbEntity.Procedure;
|
||||
|
||||
if (tmp != null) tmp.CopyContentTo(this);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parameterless constructor initializes the parameters
|
||||
/// </summary>
|
||||
public ProcParams()
|
||||
{
|
||||
}
|
||||
|
||||
public ProcParams(bool initialize)
|
||||
{
|
||||
if (initialize) InitializeAll();
|
||||
}
|
||||
|
||||
public ProcParams(ComponentProcedure procParamsEntity, string componentName, Procedure procedure)
|
||||
{
|
||||
this.procedureParamsEntity = procParamsEntity;
|
||||
this.componentName = componentName;
|
||||
this.procedure = procedure;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,14 +1,16 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2017-2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using Common;
|
||||
using TBF.Rig.GenericDevices;
|
||||
using TBF.Resources;
|
||||
using System.IO;
|
||||
|
||||
namespace TBF.Rig.DataEntry.StandardCamera
|
||||
{
|
||||
@ -33,22 +35,30 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(TestStartEndForm));
|
||||
|
||||
// Set to 'true' when the form closes
|
||||
const Unit unit = Unit.m3;
|
||||
|
||||
// Set to 'true' when the form closes
|
||||
public bool Completed { get { return completed; } }
|
||||
bool completed;
|
||||
|
||||
/// <summary> Number of text boxes for serial numbers </summary>
|
||||
readonly Tst mode; /// Start, End or Deferred
|
||||
readonly Tst mode; /// Start, End or Deferred
|
||||
public readonly int WaterMetersCount;
|
||||
readonly IRegReader[] regReaders;
|
||||
readonly bool[] disabled;
|
||||
readonly string[] startImages;
|
||||
readonly string[] endImages;
|
||||
readonly double refVolume;
|
||||
readonly double warningLimLo; /// limit to display exclamation mark, typically 2x errLimLo
|
||||
readonly double warningLimHi; /// limit to display exclamation mark, typically 2x errLimHi
|
||||
readonly double warningLimLo; /// limit to display exclamation mark, typically 2x errLimLo
|
||||
readonly double warningLimHi; /// limit to display exclamation mark, typically 2x errLimHi
|
||||
readonly OcrVidi ocrVidi;
|
||||
readonly string ocrMessage;
|
||||
readonly string streamName;
|
||||
|
||||
// To be retrieved after the form closes
|
||||
double denominator; /// derived from PulsesPerLtr, passed to OcrVidi
|
||||
string format; /// derived from PulsesPerLtr, passed to OcrVidi
|
||||
|
||||
// To be retrieved after the form closes
|
||||
public double[] WMStartState;
|
||||
|
||||
// To be retrieved after the form closes
|
||||
@ -57,23 +67,26 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
// To be retrieved after the form closes
|
||||
public double[] WMEndState;
|
||||
|
||||
|
||||
const int TextBoxesCount = 24;
|
||||
|
||||
|
||||
string lastImageName;
|
||||
Bitmap lastImage; /// non-zoomed image
|
||||
int lastWmNr1;
|
||||
Bitmap lastImage; /// non-zoomed image
|
||||
Bitmap zoomedImage;
|
||||
|
||||
Thread imageProcessingThread; /// Thread to process images
|
||||
public delegate void OcrTextObtainedDelegate(int ix, bool isEnd, string text);
|
||||
OcrTextObtainedDelegate ocrTextObtained;
|
||||
|
||||
static int wmNr0b;
|
||||
static Rotation[] imageRotation;
|
||||
static Rotation imageRotation;
|
||||
static bool[] isZoomed;
|
||||
static Point[] zoomCenterLoc;
|
||||
///
|
||||
static TestStartEndForm()
|
||||
{
|
||||
wmNr0b = 0;
|
||||
imageRotation = new Rotation[TextBoxesCount];
|
||||
//imageRotation = new Rotation[TextBoxesCount];
|
||||
isZoomed = new bool[TextBoxesCount];
|
||||
zoomCenterLoc = new Point[TextBoxesCount];
|
||||
}
|
||||
@ -127,6 +140,8 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
|
||||
enabledTextBoxes = new List<TextBox>();
|
||||
|
||||
imageProcessingThread = null;
|
||||
|
||||
completed = false;
|
||||
StartForceCloseHandler();
|
||||
}
|
||||
@ -135,115 +150,141 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
/// Constructor to fill in start states
|
||||
/// </summary>
|
||||
/// <param name="waterMetersCount">Number of water meters</param>
|
||||
/// <param name="disabled">Information from CycleBeginningForm about availability of water meters</param>
|
||||
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, string[] startImages, bool[] disabled)
|
||||
/// <param name="regReaders">Array with register reader components</param>
|
||||
/// <param name="ocrVidi">Cognex wrapper object performing OCR or null</param>
|
||||
/// <param name="startImages">Array with paths to start images</param>
|
||||
/// <param name="disabled">Information from CycleBeginningForm about availability of water meters</param>
|
||||
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, OcrVidi ocrVidi, string ocrMessage, string streamName,
|
||||
string[] startImages, bool[] disabled)
|
||||
: this()
|
||||
{
|
||||
mode = Tst.Start;
|
||||
|
||||
this.regReaders = regReaders;
|
||||
this.WaterMetersCount = Math.Min(waterMetersCount, regReaders.Length);
|
||||
|
||||
this.regReaders = regReaders;
|
||||
this.WaterMetersCount = Math.Min(waterMetersCount, regReaders.Length);
|
||||
this.ocrVidi = ocrVidi;
|
||||
this.ocrMessage = ocrMessage;
|
||||
this.streamName = streamName;
|
||||
this.startImages = startImages;
|
||||
this.disabled = disabled;
|
||||
|
||||
if (startImages == null || startImages.Length != waterMetersCount)
|
||||
if (startImages == null || startImages.Length != WaterMetersCount)
|
||||
{
|
||||
throw (new Exception("Invalid 'startImages' argument"));
|
||||
throw new Exception("Invalid 'startImages' argument");
|
||||
}
|
||||
|
||||
this.endImages = new string[waterMetersCount];
|
||||
this.endImages = new string[WaterMetersCount];
|
||||
WMStartState = new double[WaterMetersCount];
|
||||
WMStartStateStr = new string[WaterMetersCount];
|
||||
|
||||
/// For large benches with WaterMetersCount LE 6 is TBF.Data.LineSize==1 (compound meters)
|
||||
int lineSize = (WaterMetersCount <= 6) ? WaterMetersCount : TBF.Data.LineSize;
|
||||
|
||||
DeterminePhysPosWMPos(TextBoxesCount, WaterMetersCount, lineSize, out phys2wm, out wm2phys);
|
||||
|
||||
Height = 555 + 30 * WaterMetersCount;
|
||||
|
||||
WMStartState = new double[waterMetersCount];
|
||||
WMStartStateStr = new string[waterMetersCount];
|
||||
}
|
||||
ConstructorCommon(regReaders);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor to fill in end states
|
||||
/// </summary>
|
||||
/// <param name="waterMetersCount">Number of water meters</param>
|
||||
/// <param name="wmStartStateStr">Information entered on test start</param>
|
||||
/// <param name="regReaders">Array with register reader components</param>
|
||||
/// <param name="ocrVidi">Cognex wrapper object performing OCR or null</param>
|
||||
/// <param name="endImages">Array with paths to end images</param>
|
||||
/// <param name="wmStartState">Array with start states in default volume units (liters)</param>
|
||||
/// <param name="wmStartStateStr">Information entered on test start</param>
|
||||
/// <param name="disabled">Information from CycleBeginningForm about availability of water meters</param>
|
||||
/// <param name="refVolume">Reference volume, it is used to verify the end state, show/hide exclamation if necessary</param>
|
||||
/// <param name="errLimLo">Error limit low, it is used to verify the end state, show/hide exclamation if necessary</param>
|
||||
/// <param name="errLimHi">Error limit high, it is used to verify the end state, show/hide exclamation if necessary</param>
|
||||
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, string[] endImages, double[] wmStartState, string[] wmStartStateStr, bool[] disabled,
|
||||
double refVolume, double errLimLo, double errLimHi)
|
||||
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, OcrVidi ocrVidi, string ocrMessage, string streamName,
|
||||
string[] startImages, double[] wmStartState, string[] wmStartStateStr, string[] endImages,
|
||||
bool[] disabled, double refVolume, double errLimLo, double errLimHi)
|
||||
: this()
|
||||
{
|
||||
mode = Tst.End;
|
||||
|
||||
this.regReaders = regReaders;
|
||||
this.WaterMetersCount = Math.Min(waterMetersCount, regReaders.Length);
|
||||
|
||||
if (endImages == null || endImages.Length != waterMetersCount ||
|
||||
wmStartState == null || wmStartState.Length != waterMetersCount ||
|
||||
wmStartStateStr == null || wmStartStateStr.Length != waterMetersCount)
|
||||
{
|
||||
throw (new Exception("Invalid argument(s)"));
|
||||
}
|
||||
|
||||
this.endImages = endImages;
|
||||
this.WMStartState = wmStartState;
|
||||
this.WMStartStateStr = wmStartStateStr;
|
||||
this.disabled = disabled;
|
||||
this.ocrVidi = ocrVidi;
|
||||
this.ocrMessage = ocrMessage;
|
||||
this.streamName = streamName;
|
||||
this.startImages = startImages;
|
||||
this.WMStartState = wmStartState;
|
||||
this.WMStartStateStr = wmStartStateStr;
|
||||
this.endImages = endImages;
|
||||
this.disabled = disabled;
|
||||
this.refVolume = refVolume;
|
||||
this.warningLimLo = 2 * errLimLo;
|
||||
this.warningLimHi = 2 * errLimHi;
|
||||
|
||||
this.startImages = new string[waterMetersCount];
|
||||
if (startImages == null || startImages.Length != WaterMetersCount ||
|
||||
wmStartState == null || wmStartState.Length != WaterMetersCount ||
|
||||
wmStartStateStr == null || wmStartStateStr.Length != WaterMetersCount ||
|
||||
endImages == null || endImages.Length != WaterMetersCount)
|
||||
{
|
||||
throw new Exception("Invalid argument(s)");
|
||||
}
|
||||
|
||||
/// For large benches with WaterMetersCount LE 6 is TBF.Data.LineSize==1 (compound meters)
|
||||
int lineSize = (WaterMetersCount <= 6) ? WaterMetersCount : TBF.Data.LineSize;
|
||||
WMEndState = new double[WaterMetersCount];
|
||||
|
||||
DeterminePhysPosWMPos(TextBoxesCount, WaterMetersCount, lineSize, out phys2wm, out wm2phys);
|
||||
ConstructorCommon(regReaders);
|
||||
}
|
||||
|
||||
Height = 555 + 30 * WaterMetersCount;
|
||||
|
||||
WMEndState = new double[waterMetersCount];
|
||||
}
|
||||
|
||||
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, string[] startImages, string[] endImages,
|
||||
bool[] disabled, double refVolume, double errLimLo, double errLimHi)
|
||||
/// <summary>
|
||||
/// Constructor for deferred evaluation, to fill in both start- and end-states
|
||||
/// </summary>
|
||||
/// <param name="waterMetersCount">Number of water meters</param>
|
||||
/// <param name="regReaders">Array with register reader components</param>
|
||||
/// <param name="ocrVidi">Cognex wrapper object performing OCR or null</param>
|
||||
/// <param name="startImages">Array with paths to start images</param>
|
||||
/// <param name="endImages">Array with paths to end images</param>
|
||||
/// <param name="disabled">Information from CycleBeginningForm about availability of water meters</param>
|
||||
/// <param name="refVolume">Reference volume, it is used to verify the end state, show/hide exclamation if necessary</param>
|
||||
/// <param name="errLimLo">Error limit low, it is used to verify the end state, show/hide exclamation if necessary</param>
|
||||
/// <param name="errLimHi">Error limit high, it is used to verify the end state, show/hide exclamation if necessary</param>
|
||||
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, OcrVidi ocrVidi, string ocrMessage, string streamName,
|
||||
string[] startImages, string[] endImages, bool[] disabled,
|
||||
double refVolume, double errLimLo, double errLimHi)
|
||||
: this()
|
||||
{
|
||||
mode = Tst.Both;
|
||||
|
||||
this.regReaders = regReaders;
|
||||
this.WaterMetersCount = Math.Min(waterMetersCount, regReaders.Length);
|
||||
this.ocrVidi = ocrVidi;
|
||||
this.ocrMessage = ocrMessage;
|
||||
this.streamName = streamName;
|
||||
this.startImages = startImages;
|
||||
this.endImages = endImages;
|
||||
this.disabled = disabled;
|
||||
this.refVolume = refVolume;
|
||||
this.warningLimLo = 2 * errLimLo;
|
||||
this.warningLimHi = 2 * errLimHi;
|
||||
|
||||
if (startImages == null || startImages.Length != waterMetersCount ||
|
||||
endImages == null || endImages.Length != waterMetersCount)
|
||||
{
|
||||
throw (new Exception("Invalid argument(s)"));
|
||||
throw new Exception("Invalid argument(s)");
|
||||
}
|
||||
|
||||
this.startImages = startImages;
|
||||
this.endImages = endImages;
|
||||
this.disabled = disabled;
|
||||
this.refVolume = refVolume;
|
||||
this.warningLimLo = 2 * errLimLo;
|
||||
this.warningLimHi = 2 * errLimHi;
|
||||
WMStartState = new double[waterMetersCount];
|
||||
WMStartStateStr = new string[waterMetersCount];
|
||||
WMEndState = new double[waterMetersCount];
|
||||
|
||||
/// For large benches with WaterMetersCount LE 6 is TBF.Data.LineSize==1 (compound meters)
|
||||
int lineSize = (WaterMetersCount <= 6) ? WaterMetersCount : TBF.Data.LineSize;
|
||||
|
||||
DeterminePhysPosWMPos(TextBoxesCount, WaterMetersCount, lineSize, out phys2wm, out wm2phys);
|
||||
|
||||
Height = 555 + 30 * WaterMetersCount;
|
||||
|
||||
WMStartState = new double[waterMetersCount];
|
||||
WMStartStateStr = new string[waterMetersCount];
|
||||
WMEndState = new double[waterMetersCount];
|
||||
ConstructorCommon(regReaders);
|
||||
}
|
||||
|
||||
void ConstructorCommon(IRegReader[] regReaders)
|
||||
{
|
||||
/// For large benches with WaterMetersCount LE 6 is TBF.Data.LineSize==1 (compound meters)
|
||||
int lineSize = (WaterMetersCount <= 6) ? WaterMetersCount : TBF.Data.LineSize;
|
||||
|
||||
DeterminePhysPosWMPos(TextBoxesCount, WaterMetersCount, lineSize, out phys2wm, out wm2phys);
|
||||
|
||||
int nrLines = (TBF.Data.WMsCount - 1) / TBF.Data.LineSize + 1;
|
||||
if (nrLines == 1)
|
||||
{
|
||||
Width = 1040;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Make sure the layout of labels/text boxes on the screen
|
||||
/// corresponds to the layout of watermeters of the test bench.
|
||||
@ -292,7 +333,7 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
|
||||
if (wmPos > 0)
|
||||
{
|
||||
labels[i].Text = string.Format("{0} {1}", Strings.Water_Meter, wmPos);
|
||||
labels[i].Text = wmPos.ToString();
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
@ -318,10 +359,11 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
}
|
||||
else
|
||||
{
|
||||
endTextBoxes[i].Enabled = true;
|
||||
enabledTextBoxes.Add(endTextBoxes[i]);
|
||||
startTextBoxes[i].Enabled = false;
|
||||
startTextBoxes[i].Text = WMStartStateStr[wmPos - 1];
|
||||
startTextBoxes[i].Enabled = true;
|
||||
startTextBoxes[i].Text = WMStartStateStr[wmPos - 1];
|
||||
endTextBoxes[i].Enabled = true;
|
||||
enabledTextBoxes.Add(startTextBoxes[i]);
|
||||
enabledTextBoxes.Add(endTextBoxes[i]);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -343,16 +385,176 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(ocrMessage))
|
||||
{
|
||||
MessageBox.Show(ocrMessage, Strings.Warning, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
}
|
||||
|
||||
int imagesCount = ImagesToProcessCount();
|
||||
log.WarnFormat("Images to process count = {0}", imagesCount);
|
||||
///
|
||||
if (imagesCount > 0 && ocrVidi != null)
|
||||
{
|
||||
log.WarnFormat("Starting image processing thread with OcrVidi={0} and OcrStream={1}", ocrVidi, streamName);
|
||||
|
||||
/// Delegate for a thread->form communication
|
||||
ocrTextObtained = new OcrTextObtainedDelegate(OnOcrTextObtained);
|
||||
|
||||
/// Show and initalize the progress bar
|
||||
imageProcessingProgressLabel.Visible = true;
|
||||
imageProcessingProgressBar.Visible = true;
|
||||
imageProcessingProgressBar.Minimum = 0;
|
||||
imageProcessingProgressBar.Value = 0;
|
||||
imageProcessingProgressBar.Maximum = imagesCount;
|
||||
|
||||
/// Start the image processing thread
|
||||
imageProcessingThread = new Thread(new ThreadStart(ImageProcessingThread));
|
||||
imageProcessingThread.Start();
|
||||
}
|
||||
}
|
||||
|
||||
private void TestStartEndForm_FormClosed(object sender, FormClosedEventArgs e)
|
||||
{
|
||||
if (imageProcessingThread != null && imageProcessingThread.IsAlive)
|
||||
{
|
||||
imageProcessingThread.Join(2000);
|
||||
}
|
||||
}
|
||||
|
||||
void Localize()
|
||||
{
|
||||
Text = Strings.Water_Meter_States;
|
||||
startLabel.Text = startLabel2.Text = Strings.Start;
|
||||
endLabel.Text = endLabel2.Text = Strings.End;
|
||||
okButton.Text = Strings.OkBtnText;
|
||||
Text = (ocrVidi != null)
|
||||
? string.Format("{0} ({1} / {2})", Strings.Water_Meter_States, ocrVidi, streamName)
|
||||
: Strings.Water_Meter_States;
|
||||
|
||||
startLabel.Text = startLabel2.Text = string.Format("{0} [{1}]", Strings.Start, unit.ToDescription());
|
||||
endLabel.Text = endLabel2.Text = string.Format("{0} [{1}]", Strings.End, unit.ToDescription());
|
||||
okButton.Text = Strings.OkBtnText;
|
||||
}
|
||||
|
||||
int ImagesToProcessCount()
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
/// Count the images
|
||||
for (int i = 0; i < WaterMetersCount; i++)
|
||||
{
|
||||
if ((mode == Tst.Start || mode == Tst.Both) && startTextBoxes[wm2phys[i + 1]].Enabled &&
|
||||
startImages != null && startImages.Length > i && !string.IsNullOrEmpty(startImages[i]))
|
||||
{
|
||||
count++;
|
||||
}
|
||||
|
||||
if ((mode == Tst.End || mode == Tst.Both) && endTextBoxes[wm2phys[i + 1]].Enabled &&
|
||||
endImages != null && endImages.Length > i && !string.IsNullOrEmpty(endImages[i]))
|
||||
{
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
void ImageProcessingThread()
|
||||
{
|
||||
Thread.Sleep(2000);
|
||||
|
||||
bool[] startImgProcessed = new bool[WaterMetersCount];
|
||||
bool[] endImgProcessed = new bool[WaterMetersCount];
|
||||
|
||||
for (int attempt = 1; attempt <= 3; attempt++)
|
||||
{
|
||||
for (int i = 0; i < WaterMetersCount; i++)
|
||||
{
|
||||
double pulsesPerLtr = (regReaders != null && regReaders.Length > i) ? regReaders[i].PulsesPerLtr : 1;
|
||||
GetOcrParameters(pulsesPerLtr, out denominator, out format);
|
||||
|
||||
if ((mode == Tst.Start || mode == Tst.Both) && startTextBoxes[wm2phys[i + 1]].Enabled &&
|
||||
startImages != null && startImages.Length > i && !string.IsNullOrEmpty(startImages[i]))
|
||||
{
|
||||
if (!startImgProcessed[i])
|
||||
{
|
||||
try
|
||||
{
|
||||
/// Process a start image
|
||||
var text = ocrVidi.Recognize(streamName, startImages[i], denominator, format); /// OCR
|
||||
this.Invoke(ocrTextObtained, new object[] { wm2phys[i + 1], false, text });
|
||||
startImgProcessed[i] = true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((mode == Tst.End || mode == Tst.Both) && endTextBoxes[wm2phys[i + 1]].Enabled &&
|
||||
endImages != null && endImages.Length > i && !string.IsNullOrEmpty(endImages[i]))
|
||||
{
|
||||
if (!endImgProcessed[i])
|
||||
{
|
||||
try
|
||||
{
|
||||
/// Process an end image
|
||||
var text = ocrVidi.Recognize(streamName, endImages[i], denominator, format); /// OCR
|
||||
this.Invoke(ocrTextObtained, new object[] { wm2phys[i + 1], true, text });
|
||||
endImgProcessed[i] = true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GetOcrParameters(double pulsesPerLtr, out double denominator, out string format)
|
||||
{
|
||||
if (pulsesPerLtr == 0.1)
|
||||
{
|
||||
denominator = 100;
|
||||
format = "F2";
|
||||
}
|
||||
else if (pulsesPerLtr == 0.01)
|
||||
{
|
||||
denominator = 10;
|
||||
format = "F1";
|
||||
}
|
||||
else if (pulsesPerLtr == 10)
|
||||
{
|
||||
denominator = 10000;
|
||||
format = "F4";
|
||||
}
|
||||
else // if (pulsesPerLtr == 1)
|
||||
{
|
||||
denominator = 1000;
|
||||
format = "F3";
|
||||
}
|
||||
}
|
||||
|
||||
public void OnOcrTextObtained(int ix, bool isEnd, string text)
|
||||
{
|
||||
if (isEnd)
|
||||
{
|
||||
if (ix < endTextBoxes.Length && endTextBoxes[ix].Enabled)
|
||||
{
|
||||
endTextBoxes[ix].Text = text;
|
||||
LoadImage(null, Tst.End, ix);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ix < startTextBoxes.Length && startTextBoxes[ix].Enabled)
|
||||
{
|
||||
startTextBoxes[ix].Text = text;
|
||||
LoadImage(null, Tst.Start, ix);
|
||||
}
|
||||
}
|
||||
|
||||
imageProcessingProgressBar.Value++;
|
||||
}
|
||||
|
||||
private void okButton_Click(object sender, EventArgs eArgs)
|
||||
{
|
||||
try
|
||||
@ -363,20 +565,28 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
|
||||
if (wmPos > 0)
|
||||
{
|
||||
if (startTextBoxes[i].Enabled)
|
||||
if (startTextBoxes[i].Enabled && startTextBoxes[i].Text != WMStartStateStr[wmPos - 1])
|
||||
{
|
||||
WMStartStateStr[wmPos - 1] = startTextBoxes[i].Text;
|
||||
WMStartState[wmPos - 1] = Utils.ParseUDouble(startTextBoxes[i].Text) * regReaders[wmPos - 1].LtrsPerPulse;
|
||||
}
|
||||
double val;
|
||||
if (Utils.TryParseUDouble(startTextBoxes[i].Text, out val))
|
||||
{
|
||||
WMStartState[wmPos - 1] = Units.ConvertFrom(unit, val); /// Convert to liters
|
||||
WMStartStateStr[wmPos - 1] = startTextBoxes[i].Text;
|
||||
}
|
||||
}
|
||||
|
||||
if (endTextBoxes[i].Enabled)
|
||||
{
|
||||
WMEndState[wmPos - 1] = Utils.ParseUDouble(endTextBoxes[i].Text) * regReaders[wmPos - 1].LtrsPerPulse;
|
||||
double val;
|
||||
if (Utils.TryParseUDouble(endTextBoxes[i].Text, out val))
|
||||
{
|
||||
WMEndState[wmPos - 1] = Units.ConvertFrom(unit, val); /// Convert to liters
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
catch (Exception e)
|
||||
{
|
||||
log.ErrorFormat("Exception: {0}", e.Message);
|
||||
return;
|
||||
@ -478,9 +688,17 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
{
|
||||
try
|
||||
{
|
||||
double startVolumeLtr = Utils.ParseUDouble(startTextBoxes[uiCtrlPos].Text) * regReaders[phys2wm[uiCtrlPos] - 1].LtrsPerPulse;
|
||||
double endVolumeLtr = Utils.ParseUDouble(endTextBoxes[uiCtrlPos].Text) * regReaders[phys2wm[uiCtrlPos] - 1].LtrsPerPulse;
|
||||
double err = 100.0 * (endVolumeLtr - startVolumeLtr - refVolume) / refVolume;
|
||||
double startV = Utils.ParseUDouble(startTextBoxes[uiCtrlPos].Text);
|
||||
double startVolumeL = (unit == Unit.pulse)
|
||||
? startV * regReaders[phys2wm[uiCtrlPos] - 1].LtrsPerPulse
|
||||
: Units.ConvertFrom(unit, startV);
|
||||
|
||||
double endV = Utils.ParseUDouble(endTextBoxes[uiCtrlPos].Text);
|
||||
double endVolumeL = (unit == Unit.pulse)
|
||||
? endV * regReaders[phys2wm[uiCtrlPos] - 1].LtrsPerPulse
|
||||
: Units.ConvertFrom(unit, endV);
|
||||
|
||||
double err = 100.0 * (endVolumeL - startVolumeL - refVolume) / refVolume;
|
||||
exclamations[uiCtrlPos].Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
}
|
||||
catch
|
||||
@ -572,7 +790,7 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
{
|
||||
if (startTextBoxes[j] == currentTextBox)
|
||||
{
|
||||
LoadImage(Tst.Start, j);
|
||||
LoadImage(currentTextBox, Tst.Start, j);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -580,7 +798,7 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
{
|
||||
if (endTextBoxes[j] == currentTextBox)
|
||||
{
|
||||
LoadImage(Tst.End, j);
|
||||
LoadImage(currentTextBox, Tst.End, j);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -593,103 +811,103 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
}
|
||||
|
||||
|
||||
private void startTextBox1_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 0); }
|
||||
private void startTextBox2_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 1); }
|
||||
private void startTextBox3_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 2); }
|
||||
private void startTextBox4_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 3); }
|
||||
private void startTextBox5_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 4); }
|
||||
private void startTextBox6_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 5); }
|
||||
private void startTextBox7_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 6); }
|
||||
private void startTextBox8_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 7); }
|
||||
private void startTextBox9_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 8); }
|
||||
private void startTextBox10_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 9); }
|
||||
private void startTextBox11_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 10); }
|
||||
private void startTextBox12_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 11); }
|
||||
private void startTextBox13_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 12); }
|
||||
private void startTextBox14_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 13); }
|
||||
private void startTextBox15_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 14); }
|
||||
private void startTextBox16_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 15); }
|
||||
private void startTextBox17_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 16); }
|
||||
private void startTextBox18_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 17); }
|
||||
private void startTextBox19_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 18); }
|
||||
private void startTextBox20_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 19); }
|
||||
private void startTextBox21_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 20); }
|
||||
private void startTextBox22_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 21); }
|
||||
private void startTextBox23_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 22); }
|
||||
private void startTextBox24_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 23); }
|
||||
private void startTextBox1_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 0); }
|
||||
private void startTextBox2_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 1); }
|
||||
private void startTextBox3_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 2); }
|
||||
private void startTextBox4_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 3); }
|
||||
private void startTextBox5_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 4); }
|
||||
private void startTextBox6_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 5); }
|
||||
private void startTextBox7_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 6); }
|
||||
private void startTextBox8_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 7); }
|
||||
private void startTextBox9_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 8); }
|
||||
private void startTextBox10_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 9); }
|
||||
private void startTextBox11_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 10); }
|
||||
private void startTextBox12_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 11); }
|
||||
private void startTextBox13_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 12); }
|
||||
private void startTextBox14_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 13); }
|
||||
private void startTextBox15_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 14); }
|
||||
private void startTextBox16_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 15); }
|
||||
private void startTextBox17_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 16); }
|
||||
private void startTextBox18_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 17); }
|
||||
private void startTextBox19_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 18); }
|
||||
private void startTextBox20_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 19); }
|
||||
private void startTextBox21_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 20); }
|
||||
private void startTextBox22_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 21); }
|
||||
private void startTextBox23_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 22); }
|
||||
private void startTextBox24_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 23); }
|
||||
private void startTextBox1_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 0); }
|
||||
private void startTextBox2_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 1); }
|
||||
private void startTextBox3_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 2); }
|
||||
private void startTextBox4_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 3); }
|
||||
private void startTextBox5_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 4); }
|
||||
private void startTextBox6_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 5); }
|
||||
private void startTextBox7_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 6); }
|
||||
private void startTextBox8_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 7); }
|
||||
private void startTextBox9_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 8); }
|
||||
private void startTextBox10_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 9); }
|
||||
private void startTextBox11_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 10); }
|
||||
private void startTextBox12_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 11); }
|
||||
private void startTextBox13_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 12); }
|
||||
private void startTextBox14_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 13); }
|
||||
private void startTextBox15_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 14); }
|
||||
private void startTextBox16_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 15); }
|
||||
private void startTextBox17_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 16); }
|
||||
private void startTextBox18_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 17); }
|
||||
private void startTextBox19_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 18); }
|
||||
private void startTextBox20_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 19); }
|
||||
private void startTextBox21_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 20); }
|
||||
private void startTextBox22_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 21); }
|
||||
private void startTextBox23_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 22); }
|
||||
private void startTextBox24_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 23); }
|
||||
private void startTextBox1_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 0); }
|
||||
private void startTextBox2_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 1); }
|
||||
private void startTextBox3_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 2); }
|
||||
private void startTextBox4_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 3); }
|
||||
private void startTextBox5_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 4); }
|
||||
private void startTextBox6_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 5); }
|
||||
private void startTextBox7_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 6); }
|
||||
private void startTextBox8_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 7); }
|
||||
private void startTextBox9_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 8); }
|
||||
private void startTextBox10_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 9); }
|
||||
private void startTextBox11_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 10); }
|
||||
private void startTextBox12_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 11); }
|
||||
private void startTextBox13_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 12); }
|
||||
private void startTextBox14_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 13); }
|
||||
private void startTextBox15_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 14); }
|
||||
private void startTextBox16_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 15); }
|
||||
private void startTextBox17_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 16); }
|
||||
private void startTextBox18_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 17); }
|
||||
private void startTextBox19_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 18); }
|
||||
private void startTextBox20_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 19); }
|
||||
private void startTextBox21_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 20); }
|
||||
private void startTextBox22_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 21); }
|
||||
private void startTextBox23_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 22); }
|
||||
private void startTextBox24_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 23); }
|
||||
|
||||
private void endTextBox1_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 0); }
|
||||
private void endTextBox2_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 1); }
|
||||
private void endTextBox3_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 2); }
|
||||
private void endTextBox4_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 3); }
|
||||
private void endTextBox5_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 4); }
|
||||
private void endTextBox6_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 5); }
|
||||
private void endTextBox7_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 6); }
|
||||
private void endTextBox8_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 7); }
|
||||
private void endTextBox9_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 8); }
|
||||
private void endTextBox10_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 9); }
|
||||
private void endTextBox11_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 10); }
|
||||
private void endTextBox12_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 11); }
|
||||
private void endTextBox13_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 12); }
|
||||
private void endTextBox14_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 13); }
|
||||
private void endTextBox15_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 14); }
|
||||
private void endTextBox16_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 15); }
|
||||
private void endTextBox17_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 16); }
|
||||
private void endTextBox18_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 17); }
|
||||
private void endTextBox19_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 18); }
|
||||
private void endTextBox20_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 19); }
|
||||
private void endTextBox21_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 20); }
|
||||
private void endTextBox22_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 21); }
|
||||
private void endTextBox24_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 22); }
|
||||
private void endTextBox23_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 23); }
|
||||
private void endTextBox1_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 0); }
|
||||
private void endTextBox2_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 1); }
|
||||
private void endTextBox3_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 2); }
|
||||
private void endTextBox4_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 3); }
|
||||
private void endTextBox5_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 4); }
|
||||
private void endTextBox6_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 5); }
|
||||
private void endTextBox7_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 6); }
|
||||
private void endTextBox8_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 7); }
|
||||
private void endTextBox9_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 8); }
|
||||
private void endTextBox10_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 9); }
|
||||
private void endTextBox11_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 10); }
|
||||
private void endTextBox12_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 11); }
|
||||
private void endTextBox13_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 12); }
|
||||
private void endTextBox14_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 13); }
|
||||
private void endTextBox15_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 14); }
|
||||
private void endTextBox16_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 15); }
|
||||
private void endTextBox17_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 16); }
|
||||
private void endTextBox18_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 17); }
|
||||
private void endTextBox19_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 18); }
|
||||
private void endTextBox20_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 19); }
|
||||
private void endTextBox21_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 20); }
|
||||
private void endTextBox22_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 21); }
|
||||
private void endTextBox23_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 22); }
|
||||
private void endTextBox24_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 23); }
|
||||
private void endTextBox1_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 0); }
|
||||
private void endTextBox2_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 1); }
|
||||
private void endTextBox3_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 2); }
|
||||
private void endTextBox4_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 3); }
|
||||
private void endTextBox5_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 4); }
|
||||
private void endTextBox6_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 5); }
|
||||
private void endTextBox7_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 6); }
|
||||
private void endTextBox8_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 7); }
|
||||
private void endTextBox9_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 8); }
|
||||
private void endTextBox10_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 9); }
|
||||
private void endTextBox11_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 10); }
|
||||
private void endTextBox12_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 11); }
|
||||
private void endTextBox13_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 12); }
|
||||
private void endTextBox14_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 13); }
|
||||
private void endTextBox15_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 14); }
|
||||
private void endTextBox16_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 15); }
|
||||
private void endTextBox17_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 16); }
|
||||
private void endTextBox18_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 17); }
|
||||
private void endTextBox19_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 18); }
|
||||
private void endTextBox20_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 19); }
|
||||
private void endTextBox21_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 20); }
|
||||
private void endTextBox22_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 21); }
|
||||
private void endTextBox24_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 22); }
|
||||
private void endTextBox23_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 23); }
|
||||
private void endTextBox1_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 0); }
|
||||
private void endTextBox2_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 1); }
|
||||
private void endTextBox3_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 2); }
|
||||
private void endTextBox4_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 3); }
|
||||
private void endTextBox5_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 4); }
|
||||
private void endTextBox6_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 5); }
|
||||
private void endTextBox7_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 6); }
|
||||
private void endTextBox8_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 7); }
|
||||
private void endTextBox9_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 8); }
|
||||
private void endTextBox10_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 9); }
|
||||
private void endTextBox11_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 10); }
|
||||
private void endTextBox12_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 11); }
|
||||
private void endTextBox13_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 12); }
|
||||
private void endTextBox14_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 13); }
|
||||
private void endTextBox15_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 14); }
|
||||
private void endTextBox16_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 15); }
|
||||
private void endTextBox17_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 16); }
|
||||
private void endTextBox18_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 17); }
|
||||
private void endTextBox19_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 18); }
|
||||
private void endTextBox20_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 19); }
|
||||
private void endTextBox21_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 20); }
|
||||
private void endTextBox22_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 21); }
|
||||
private void endTextBox23_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 22); }
|
||||
private void endTextBox24_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 23); }
|
||||
|
||||
/// <summary>
|
||||
/// Loads appropriate image into pictureBox1.Image
|
||||
@ -697,17 +915,17 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
/// </summary>
|
||||
/// <param name="startOrEnd">Tst.Start or Tst.End</param>
|
||||
/// <param name="physPos">0..23</param>
|
||||
void LoadImage(Tst startOrEnd, int physPos)
|
||||
void LoadImage(object sender, Tst startOrEnd, int physPos)
|
||||
{
|
||||
ShowUnits(startOrEnd, physPos);
|
||||
|
||||
int wmNr1b = phys2wm[physPos]; /// 0 means no WM
|
||||
wmNr0b = Math.Max(0, wmNr1b - 1);
|
||||
if (wmNr1b <= 0) return;
|
||||
|
||||
wmNr0b = wmNr1b - 1;
|
||||
|
||||
string imageFileName;
|
||||
if ((startOrEnd == Tst.Start) && (wmNr1b > 0) && (startImages[wmNr0b] != null))
|
||||
if (startOrEnd == Tst.Start && startImages[wmNr0b] != null)
|
||||
imageFileName = startImages[wmNr0b];
|
||||
else if ((startOrEnd == Tst.End) && (wmNr1b > 0) && (endImages[wmNr0b] != null))
|
||||
else if (startOrEnd == Tst.End && endImages[wmNr0b] != null)
|
||||
imageFileName = endImages[wmNr0b];
|
||||
else
|
||||
imageFileName = string.Empty;
|
||||
@ -718,6 +936,7 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
}
|
||||
|
||||
lastImageName = imageFileName;
|
||||
lastWmNr1 = wmNr1b;
|
||||
|
||||
if (string.IsNullOrEmpty(imageFileName) || !File.Exists(imageFileName))
|
||||
{
|
||||
@ -725,16 +944,31 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
}
|
||||
else
|
||||
{
|
||||
using (Bitmap tempBmp = Image.FromFile(imageFileName) as Bitmap)
|
||||
{
|
||||
int hght = tempBmp.Height;
|
||||
int leftMargin = (tempBmp.Width - hght) / 2;
|
||||
lastImage = new Bitmap(tempBmp.Clone(new Rectangle(leftMargin, 0, hght, hght), tempBmp.PixelFormat));
|
||||
if (isZoomed[wmNr0b])
|
||||
{
|
||||
zoomedImage = MakeZoomedImage(lastImage, zoomCenterLoc[wmNr0b]);
|
||||
}
|
||||
}
|
||||
using (Bitmap tempBmp = Image.FromFile(imageFileName) as Bitmap)
|
||||
{
|
||||
Rectangle rect;
|
||||
if (tempBmp.Height < tempBmp.Width)
|
||||
{
|
||||
int hght = tempBmp.Height;
|
||||
int leftMargin = (tempBmp.Width - hght) / 2;
|
||||
rect = new Rectangle(leftMargin, 0, hght, hght);
|
||||
}
|
||||
else
|
||||
{
|
||||
int hght = tempBmp.Height;
|
||||
int wdth = tempBmp.Width;
|
||||
int margin = (hght - wdth) / 2;
|
||||
rect = new Rectangle(0, margin, wdth, wdth);
|
||||
}
|
||||
//int hght = tempBmp.Height;
|
||||
//int leftMargin = (tempBmp.Width - hght) / 2;
|
||||
//lastImage = new Bitmap(tempBmp.Clone(new Rectangle(leftMargin, 0, hght, hght), tempBmp.PixelFormat));
|
||||
lastImage = new Bitmap(tempBmp.Clone(rect, tempBmp.PixelFormat));
|
||||
if (isZoomed[wmNr0b])
|
||||
{
|
||||
zoomedImage = MakeZoomedImage(lastImage, zoomCenterLoc[wmNr0b]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ShowImage();
|
||||
@ -752,7 +986,7 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
|
||||
if (me.Button == MouseButtons.Left && !isZoomed[wmNr0b])
|
||||
{
|
||||
switch (imageRotation[wmNr0b])
|
||||
switch (imageRotation)
|
||||
{
|
||||
case Rotation.R0:
|
||||
zoomCenterLoc[wmNr0b] = me.Location;
|
||||
@ -786,9 +1020,9 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
{
|
||||
if (lastImage == null) return;
|
||||
|
||||
if (++imageRotation[wmNr0b] == Rotation.Count)
|
||||
if (++imageRotation == Rotation.Count)
|
||||
{
|
||||
imageRotation[wmNr0b] = Rotation.R0;
|
||||
imageRotation = Rotation.R0;
|
||||
}
|
||||
ShowImage();
|
||||
}
|
||||
@ -807,9 +1041,17 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
return lastImage.Clone(newRect, oriImage.PixelFormat);
|
||||
}
|
||||
|
||||
///
|
||||
/// Used by ShowImage()
|
||||
///
|
||||
Brush lightBrush = new SolidBrush(Color.LightGreen);
|
||||
Brush darkBrush = new SolidBrush(Color.Green);
|
||||
Font largeFont = new Font("arial", 24.0F, FontStyle.Bold); /// normal image
|
||||
Font smallFont = new Font("arial", 12.0F, FontStyle.Bold); /// zoomed image
|
||||
|
||||
/// <summary>
|
||||
/// Show selected image in the picture box.
|
||||
/// lastImage, zoomedImage, isZoomed and imageRotation are used.
|
||||
/// lastWmNr1, lastImage, zoomedImage, isZoomed and imageRotation are used.
|
||||
/// </summary>
|
||||
void ShowImage()
|
||||
{
|
||||
@ -823,96 +1065,37 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
? new Bitmap(zoomedImage.Clone(new Rectangle(0, 0, zoomedImage.Width, zoomedImage.Height), zoomedImage.PixelFormat))
|
||||
: new Bitmap(lastImage.Clone(new Rectangle(0, 0, lastImage.Width, lastImage.Height), lastImage.PixelFormat));
|
||||
|
||||
switch (imageRotation[wmNr0b])
|
||||
switch (imageRotation)
|
||||
{
|
||||
case Rotation.R90: tempBmp.RotateFlip(RotateFlipType.Rotate270FlipNone); break;
|
||||
case Rotation.R180: tempBmp.RotateFlip(RotateFlipType.Rotate180FlipNone); break;
|
||||
case Rotation.R270: tempBmp.RotateFlip(RotateFlipType.Rotate90FlipNone); break;
|
||||
}
|
||||
|
||||
/// Write water meter number to the bitmap
|
||||
using (var grph = Graphics.FromImage(tempBmp))
|
||||
{
|
||||
Font font = isZoomed[wmNr0b] ? smallFont : largeFont;
|
||||
int margin = isZoomed[wmNr0b] ? 1 : 2;
|
||||
|
||||
int pixelsCount = 0;
|
||||
int brightness = 0;
|
||||
for (int x = margin; x <= 8 * margin; x += margin)
|
||||
{
|
||||
for (int y = margin; y <= 8 * margin; y += margin)
|
||||
{
|
||||
brightness += (int)tempBmp.GetPixel(x, y).G;
|
||||
pixelsCount++;
|
||||
}
|
||||
}
|
||||
brightness /= pixelsCount;
|
||||
|
||||
Brush brush = (brightness > 160) ? darkBrush : lightBrush;
|
||||
|
||||
grph.DrawString(lastWmNr1.ToString(), font, brush, margin, margin);
|
||||
}
|
||||
|
||||
pictureBox1.Image = tempBmp;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Updates startLabel.Text, startLabel2.Text, endLabel.Text, endLabel2.Text
|
||||
/// Appends appropriate units of volume.
|
||||
/// Handles mouse clicks and Tab-changes inside text boxes.
|
||||
/// </summary>
|
||||
/// <param name="startEnd">Tst.Start or Tst.End</param>
|
||||
/// <param name="physPos">0..24</param>
|
||||
void ShowUnits(Tst startEnd, int physPos)
|
||||
{
|
||||
int wmNr = phys2wm[physPos];
|
||||
|
||||
if (wmNr > 0 && startEnd == Tst.Start)
|
||||
{
|
||||
if (regReaders[wmNr - 1] != null)
|
||||
{
|
||||
if (physPos < 12)
|
||||
{
|
||||
startLabel.Text = string.Format("{0} [{1}]", Strings.Start, GetUnitStr(regReaders[wmNr - 1].PulsesPerLtr));
|
||||
startLabel2.Text = Strings.Start;
|
||||
}
|
||||
else
|
||||
{
|
||||
startLabel.Text = Strings.Start;
|
||||
startLabel2.Text = string.Format("{0} [{1}]", Strings.Start, GetUnitStr(regReaders[wmNr - 1].PulsesPerLtr));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
startLabel.Text = startLabel2.Text = Strings.Start;
|
||||
}
|
||||
endLabel.Text = endLabel2.Text = Strings.End;
|
||||
}
|
||||
else if (wmNr > 0 && startEnd == Tst.End)
|
||||
{
|
||||
startLabel.Text = startLabel2.Text = Strings.Start;
|
||||
|
||||
if (regReaders[wmNr - 1] != null)
|
||||
{
|
||||
if (physPos < 12)
|
||||
{
|
||||
endLabel.Text = string.Format("{0} [{1}]", Strings.End, GetUnitStr(regReaders[wmNr - 1].PulsesPerLtr));
|
||||
endLabel2.Text = Strings.End;
|
||||
}
|
||||
else
|
||||
{
|
||||
endLabel.Text = Strings.End;
|
||||
endLabel2.Text = string.Format("{0} [{1}]", Strings.End, GetUnitStr(regReaders[wmNr - 1].PulsesPerLtr));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
endLabel.Text = endLabel2.Text = Strings.End;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
startLabel.Text = startLabel2.Text = Strings.Start;
|
||||
endLabel.Text = endLabel2.Text = Strings.End;
|
||||
}
|
||||
}
|
||||
///
|
||||
string GetUnitStr(double pulsesPerLtr)
|
||||
{
|
||||
if (pulsesPerLtr == 1 || pulsesPerLtr <= float.Epsilon)
|
||||
{
|
||||
return "l";
|
||||
}
|
||||
else if (pulsesPerLtr == 0.001)
|
||||
{
|
||||
return "m3";
|
||||
}
|
||||
else if (pulsesPerLtr == 1000)
|
||||
{
|
||||
return "ml";
|
||||
}
|
||||
else
|
||||
{
|
||||
return string.Format("{0} l", 1 / pulsesPerLtr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -251,7 +251,7 @@ namespace TBF.Rig.Network.Camera.CLP1611
|
||||
{
|
||||
if ((CameraCfg.DebugLevel != DebugMode.Simulate) && (CameraCfg.DebugLevel != DebugMode.DetectedOff))
|
||||
{
|
||||
if (scpThread != null) scpThread.Join(50);
|
||||
if (scpThread != null && scpThread.IsAlive) scpThread.Join(50);
|
||||
if (rtpListenerThread != null) rtpListenerThread.Join(50);
|
||||
if (msrmntListenerThread != null) msrmntListenerThread.Join(50);
|
||||
|
||||
|
||||
@ -547,6 +547,8 @@
|
||||
</Compile>
|
||||
<Compile Include="Rig\DataEntry\StandardCamera\EntryForm.cs" />
|
||||
<Compile Include="Rig\DataEntry\StandardCamera\Factory.cs" />
|
||||
<Compile Include="Rig\DataEntry\StandardCamera\OcrVidi.cs" />
|
||||
<Compile Include="Rig\DataEntry\StandardCamera\ProcParams.cs" />
|
||||
<Compile Include="Rig\DataEntry\StandardCamera\TestStartEndForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user