コード例 #1
0
ファイル: WizardForm.cs プロジェクト: IJMacD/Lyapunov-C-sharp
 void Lyap_PicCompleted(object src, EventArgs e)
 {
     if (progressBar3.Value + 1 < progressBar3.Maximum)
     {
         progressBar3.Value++;
         LyapunovGenerator lyap = (LyapunovGenerator)src;
         //Lyaps[0].Image.Save(textBox1.Text + lyap.InitX + ".jpg");
         if (Confs.Count > 0)
         {
             lyap.Initialise(Confs[0]);
             lyap.Generate();
             Confs.RemoveAt(0);
         }
         else
         {
             //completed = true;
             label16.Text       = "";
             progressBar1.Value = 0;
             progressBar2.Value = 0;
             progressBar3.Value = 0;
             string msgText = "Completed in: " + CalcDuration();
             MessageBox.Show(msgText);
             //if (textBox1.Text == "") saveFileDialog1.ShowDialog();
             //MessageBox.Show("Completed!");
         }
     }
 }
コード例 #2
0
ファイル: WizardForm.cs プロジェクト: IJMacD/Lyapunov-C-sharp
 private void InitLyap(LyapunovGenerator lyap)
 {
     lyap.Progressed     += Lyap_ColumnCompleted;
     lyap.Completed      += Lyap_PicCompleted;
     lyap.LayerCompleted += lyap_LayerCompleted;
     //lyap.Died += new LyapunovGenerator.DiedHandler(Lyap_Died);
 }
コード例 #3
0
 private void NextConf(LyapunovGenerator lyap)
 {
     if (Confs.Count > 0)
     {
         if (!lyap.Working)
         {
             lyap.Initialise(Confs[0]);
             lyap.Generate();
             Confs.RemoveAt(0);
             lbl_count.Text = Confs.Count.ToString() + " pictures to generate";
         }
     }
 }
コード例 #4
0
ファイル: MainForm.cs プロジェクト: IJMacD/Lyapunov-C-sharp
        void Generate()
        {
            for (int i = 0; i < System.Environment.ProcessorCount; i++)
            {
                if (Lyaps.Count < i + 1)
                {
                    Generator l = new LyapunovGenerator();
                    if (l != null)
                    {
                        InitLyap(l);
                        Lyaps.Add(l);
                    }
                }
            }

            if (_output_pb.BackgroundImage != null)
            {
                _output_pb.BackgroundImage.Dispose();
            }

            //CreateForegroundBitmap();

            PicWidth  = _output_pb.Width;
            PicHeight = _output_pb.Height;

            progress = 0;
            toolStripStatusLabel1.Text = "Generating...";
            //toolStripProgressBar1.Maximum = PicWidth;
            toolStripProgressBar1.Value = 0;

            _Image = new Bitmap(PicWidth, PicHeight);
            _output_pb.BackgroundImage = _Image;
            _output_pb.Refresh();

            for (int j = 0; j < Lyaps.Count; j++)
            {
                double deltaX = (XMax - XMin) / Lyaps.Count;
                double xmin   = XMin + (j * deltaX);
                double xmax   = XMin + ((j + 1) * deltaX);
                int    width  = (int)(PicWidth / Lyaps.Count);
                int    startX = (int)(PicWidth / Lyaps.Count * j);
                if (Lyaps[j] == null)
                {
                    Lyaps[j] = new LyapunovGenerator();
                    InitLyap(Lyaps[j]);
                }
                Configuration conf = new Configuration(xmin, xmax, YMin, YMax, Pattern, Iterations, InitX, width, PicHeight, startX);
                Lyaps[j].Initialise(conf);
                Lyaps[j].Generate();
            }
        }
コード例 #5
0
ファイル: TilesForm.cs プロジェクト: IJMacD/Lyapunov-C-sharp
        void lyap_LayerCompleted(object src, LyapunovGenerator.LayerCompletedEventArgs e)
        {
            LyapunovGenerator sender = (LyapunovGenerator)src;

            try
            {
                if (!System.IO.Directory.Exists(sender.Conf._path + "\\" + sender.Conf._z))
                {
                    System.IO.Directory.CreateDirectory(sender.Conf._path + "\\" + sender.Conf._z);
                }
                if (e.Z != -1)
                {
                    //System.IO.File.Delete(sender.Conf._path + "\\" + sender.Conf._z + "\\" + sender.Conf._x + "_" + sender.Conf._y + ".png");
                    e.Layer.Save(sender.Conf._path + "\\" + sender.Conf._z + "\\" + sender.Conf._x + "_" + sender.Conf._y + ".png", System.Drawing.Imaging.ImageFormat.Png);
                }
            }
            catch
            {
                Confs.Clear();
                //MessageBox.Show("Problem with: " + sender.Conf._z + "x (" + sender.Conf._x + ", " + sender.Conf._y + ") please sort out!!!");

                //MessageBox.Show("File Error");
                if (fileError < 5)
                {
                    fileError++;
                    Confs.Add(sender.Conf);
                }
                else
                {
                    //Confs.Clear();
                    foreach (LyapunovGenerator lyap in Lyaps)
                    {
                        lyap.Stop();
                    }
                    if (fileError == 5)
                    {
                        MessageBox.Show("Could not save");
                    }
                    fileError      = 0;
                    btn_start.Text = "Start";
                }
            }
        }
コード例 #6
0
ファイル: TilesForm.cs プロジェクト: IJMacD/Lyapunov-C-sharp
        void Lyap_PicCompleted(object src, EventArgs e)
        {
            if (prog_tiles.Value < prog_tiles.Maximum)
            {
                prog_tiles.Value++;
            }
            LyapunovGenerator lyap = (LyapunovGenerator)src;

            //Lyaps[0].Image.Save(textBox1.Text + lyap.InitX + ".jpg");
            if (Confs.Count > 0)
            {
                NextConf(lyap);
            }
            else
            {
                //completed = true;
                prog_pri.Value   = 0;
                prog_tiles.Value = 0;
                btn_start.Text   = "Start";
            }
        }
コード例 #7
0
ファイル: TilesForm.cs プロジェクト: IJMacD/Lyapunov-C-sharp
 private void NextConf(LyapunovGenerator lyap)
 {
     if (Confs.Count > 0)
     {
         if (!lyap.Working)
         {
             if (System.IO.File.Exists(Confs[0]._path + "\\" + Confs[0]._z + "\\" + Confs[0]._x + "_" + Confs[0]._y + ".png"))
             {
                 Confs.RemoveAt(0);
                 lbl_count.Text = Confs.Count.ToString() + " pictures to generate";
                 NextConf(lyap);
             }
             else
             {
                 try
                 {
                     if (!System.IO.Directory.Exists(Confs[0]._path + "\\" + Confs[0]._z))
                     {
                         System.IO.Directory.CreateDirectory(Confs[0]._path + "\\" + Confs[0]._z);
                     }
                     System.IO.Stream str = System.IO.File.Create(Confs[0]._path + "\\" + Confs[0]._z + "\\" + Confs[0]._x + "_" + Confs[0]._y + ".png");
                     str.Dispose();
                 }
                 catch
                 {
                     Confs.RemoveAt(0);
                     lbl_count.Text = Confs.Count.ToString() + " pictures to generate";
                     NextConf(lyap);
                 }
                 lyap.Initialise(Confs[0]);
                 lyap.Generate();
                 Confs.RemoveAt(0);
                 lbl_count.Text = Confs.Count.ToString() + " pictures to generate";
             }
         }
     }
 }
コード例 #8
0
ファイル: TilesForm.cs プロジェクト: IJMacD/Lyapunov-C-sharp
 private void NextConf(LyapunovGenerator lyap)
 {
     if (Confs.Count > 0)
     {
         if (!lyap.Working)
         {
             if (System.IO.File.Exists(Confs[0]._path + "\\" + Confs[0]._z + "\\" + Confs[0]._x + "_" + Confs[0]._y + ".png"))
             {
                 Confs.RemoveAt(0);
                 lbl_count.Text = Confs.Count.ToString() + " pictures to generate";
                 NextConf(lyap);
             }
             else
             {
                 try
                 {
                     if (!System.IO.Directory.Exists(Confs[0]._path + "\\" + Confs[0]._z)) System.IO.Directory.CreateDirectory(Confs[0]._path + "\\" + Confs[0]._z);
                     System.IO.Stream str = System.IO.File.Create(Confs[0]._path + "\\" + Confs[0]._z + "\\" + Confs[0]._x + "_" + Confs[0]._y + ".png");
                     str.Dispose();
                 }
                 catch
                 {
                     Confs.RemoveAt(0);
                     lbl_count.Text = Confs.Count.ToString() + " pictures to generate";
                     NextConf(lyap);
                 }
                 lyap.Initialise(Confs[0]);
                 lyap.Generate();
                 Confs.RemoveAt(0);
                 lbl_count.Text = Confs.Count.ToString() + " pictures to generate";
             }
         }
     }
 }
コード例 #9
0
ファイル: TilesForm.cs プロジェクト: IJMacD/Lyapunov-C-sharp
        void lyap_LayerCompleted(object src, LyapunovGenerator.LayerCompletedEventArgs e)
        {
            LyapunovGenerator sender = (LyapunovGenerator)src;
            try
            {
                if (!System.IO.Directory.Exists(sender.Conf._path + "\\" + sender.Conf._z)) System.IO.Directory.CreateDirectory(sender.Conf._path + "\\" + sender.Conf._z);
                if (e.Z != -1)
                {
                    //System.IO.File.Delete(sender.Conf._path + "\\" + sender.Conf._z + "\\" + sender.Conf._x + "_" + sender.Conf._y + ".png");
                    e.Layer.Save(sender.Conf._path + "\\" + sender.Conf._z + "\\" + sender.Conf._x + "_" + sender.Conf._y + ".png", System.Drawing.Imaging.ImageFormat.Png);
                }
            }
            catch
            {
                Confs.Clear();
                //MessageBox.Show("Problem with: " + sender.Conf._z + "x (" + sender.Conf._x + ", " + sender.Conf._y + ") please sort out!!!");

                //MessageBox.Show("File Error");
                if (fileError < 5)
                {
                    fileError++;
                    Confs.Add(sender.Conf);
                }
                else
                {
                    //Confs.Clear();
                    foreach (LyapunovGenerator lyap in Lyaps) lyap.Stop();
                    if (fileError == 5) MessageBox.Show("Could not save");
                    fileError = 0;
                    btn_start.Text = "Start";
                }
            }
        }
コード例 #10
0
ファイル: TilesForm.cs プロジェクト: IJMacD/Lyapunov-C-sharp
 private void InitLyap(LyapunovGenerator lyap)
 {
     lyap.Progressed += Lyap_ColumnCompleted;
     lyap.Completed += Lyap_PicCompleted;
     lyap.LayerCompleted += lyap_LayerCompleted;
 }
コード例 #11
0
 public BenchmarkForm()
 {
     InitializeComponent();
     mylyap = new LyapunovGenerator();
     mylyap.Completed += mylyap_PicCompleted;
 }
コード例 #12
0
ファイル: WizardForm.cs プロジェクト: IJMacD/Lyapunov-C-sharp
 private void InitLyap(LyapunovGenerator lyap)
 {
     lyap.Progressed += Lyap_ColumnCompleted;
     lyap.Completed += Lyap_PicCompleted;
     lyap.LayerCompleted += lyap_LayerCompleted;
     //lyap.Died += new LyapunovGenerator.DiedHandler(Lyap_Died);
 }
コード例 #13
0
ファイル: MainForm.cs プロジェクト: IJMacD/Lyapunov-C-sharp
        void Generate()
        {
            for (int i = 0; i < System.Environment.ProcessorCount; i++)
            {
                if (Lyaps.Count < i + 1)
                {
                    Generator l = new LyapunovGenerator();
                    if (l != null)
                    {
                        InitLyap(l);
                        Lyaps.Add(l);
                    }
                }
            }

            if (_output_pb.BackgroundImage != null) _output_pb.BackgroundImage.Dispose();

            //CreateForegroundBitmap();

            PicWidth = _output_pb.Width;
            PicHeight = _output_pb.Height;

            progress = 0;
            toolStripStatusLabel1.Text = "Generating...";
            //toolStripProgressBar1.Maximum = PicWidth;
            toolStripProgressBar1.Value = 0;

            _Image = new Bitmap(PicWidth, PicHeight);
            _output_pb.BackgroundImage = _Image;
            _output_pb.Refresh();

            for (int j = 0; j < Lyaps.Count; j++)
            {
                double deltaX = (XMax - XMin) / Lyaps.Count;
                double xmin = XMin + (j * deltaX);
                double xmax = XMin + ((j + 1) * deltaX);
                int width = (int)(PicWidth / Lyaps.Count);
                int startX = (int)(PicWidth / Lyaps.Count * j);
                if (Lyaps[j] == null)
                {
                    Lyaps[j] = new LyapunovGenerator();
                    InitLyap(Lyaps[j]);
                }
                Configuration conf = new Configuration(xmin, xmax, YMin, YMax, Pattern, Iterations, InitX, width, PicHeight, startX);
                Lyaps[j].Initialise(conf);
                Lyaps[j].Generate();
            }
        }
コード例 #14
0
 private void NextConf(LyapunovGenerator lyap)
 {
     if (Confs.Count > 0)
     {
         if (!lyap.Working)
         {
             lyap.Initialise(Confs[0]);
             lyap.Generate();
             Confs.RemoveAt(0);
             lbl_count.Text = Confs.Count.ToString() + " pictures to generate";
         }
     }
 }
コード例 #15
0
 //private void addConfs(int zoom, int iterations, string path)
 //{
 //    prog_pri.Maximum = 257;
 //    prog_jobs.Maximum = (int)Math.Pow(2, 2 * zoom);
 //    prog_jobs.Value = 0;
 //    Job j = new Job(zoom, iterations, path);
 //    _ConfAdder.RunWorkerAsync(j);
 //}
 void lyap_LayerCompleted(object src, LyapunovGenerator.LayerCompletedEventArgs e)
 {
     //LyapunovGenerator sender = (LyapunovGenerator)src;
     //try
     //{
     //    if (!System.IO.Directory.Exists(sender.Conf._path + "\\" + sender.Conf._z)) System.IO.Directory.CreateDirectory(sender.Conf._path + "\\" + sender.Conf._z);
     if (e.Z == -1)
     {
         MessageBox.Show("Recons all blue");
     }
     //}
     //catch
     //{
     //    //MessageBox.Show("File Error");
     //    if (fileError < 5)
     //    {
     //        fileError++;
     //        Confs.Add(sender.Conf);
     //    }
     //    else
     //    {
     //        Confs.Clear();
     //        if (fileError == 5) MessageBox.Show("Could not save");
     //        fileError = 0;
     //        btn_start.Text = "Start";
     //    }
     //}
 }
コード例 #16
0
ファイル: WizardForm.cs プロジェクト: IJMacD/Lyapunov-C-sharp
 void lyap_LayerCompleted(object src, LyapunovGenerator.LayerCompletedEventArgs e)
 {
     e.Layer.Save(folderBrowserDialog1.SelectedPath + "\\" + GetFilename((LyapunovGenerator)src) + ".jpg");
     if (progressBar2.Value < progressBar2.Maximum)
     {
         progressBar2.Value = e.Z + 1;
         for (int i = 0; i < picsdur.Length - 1; i++)
         {
             picsdur[i] = picsdur[i + 1];
         }
         picsdur[picsdur.Length - 1] = DateTime.Now - LastPic;
         LastPic = DateTime.Now;
         if (e.Z < picsdur.Length) return;
         TimeSpan sum = TimeSpan.FromSeconds(0);
         foreach (TimeSpan picdur in picsdur)
         {
             sum += picdur;
         }
         double ave = (sum.TotalSeconds / picsdur.Length);
         //System.Diagnostics.Debugger.Log(1, "", ave.ToString() + "\n");
         TimeSpan togo = TimeSpan.FromSeconds(ave * (Lyaps[0].EndLayer - Lyaps[0].LastLayer));
         DateTime finish = DateTime.Now + togo;
         label17.Text = "Estimated Time Left: " + togo.ToString();
         label8.Text = "Estimated Finish Time: " + finish.ToString();
     }
 }
コード例 #17
0
ファイル: TilesForm.cs プロジェクト: IJMacD/Lyapunov-C-sharp
 private void InitLyap(LyapunovGenerator lyap)
 {
     lyap.Progressed     += Lyap_ColumnCompleted;
     lyap.Completed      += Lyap_PicCompleted;
     lyap.LayerCompleted += lyap_LayerCompleted;
 }
コード例 #18
0
 public BenchmarkForm()
 {
     InitializeComponent();
     mylyap            = new LyapunovGenerator();
     mylyap.Completed += mylyap_PicCompleted;
 }