//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop

#include "Autolearn.h"
#include "RecognitionSystem.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "PERFGRAP"
#pragma resource "*.dfm"
TAutoLearnForm *AutoLearnForm;
//---------------------------------------------------------------------------
__fastcall TAutoLearnForm::TAutoLearnForm(TComponent* Owner)
   : TForm(Owner)
{
}

//static int n = 0;

//---------------------------------------------------------------------------
void __fastcall TAutoLearnForm::AutoLearnButtonClick(TObject *Sender)
{
//   n = 0;
   AutoLearnLabel->Caption = "";
   AutoLearnTimer->Enabled = 1;
}

//---------------------------------------------------------------------------

void __fastcall TAutoLearnForm::AutoLearnTimerTimer(TObject *Sender)
{
   if( recognitionSystem.AutoLearn() == 0 )
   {
      AutoLearnTimer->Enabled = 0;
      AutoLearnLabel->Caption = "Обучение завершено";
   }

//   n++;

//   if( n > 7 )
//   {
//      AutoLearnForm->Series1->Delete(0);
//      n--;
//   }
   AutoLearnForm->Series1->Add(
      lastDiff,
      "" ,
      clTeeColor );

//  AutoLearnForm->Series1->Delete(0); // <-- remove the first point
  // Add a new random point
//  AutoLearnForm->Series1->AddXY(AutoLearnForm->Series1->XValues->Last()+1,
//    /*Series->YValues->Last()+*/lastDiff,
//    "",clTeeColor);

}
//---------------------------------------------------------------------------

