Exemple #1
0
        public void set(Mark _s, Mark _ea, Mark _n, PointF fce_tlaku)
        {
            s = _s;
            ea = _ea;
            n = _n;

            sracky.Add(_s.Point);
            funkce_tlaku.Add(fce_tlaku);
            x += fce_tlaku.X.ToString() + ", ";
            p += fce_tlaku.Y.ToString() + ", ";
            imageBox1.Invalidate();
        }
Exemple #2
0
        public MyImage(string path)
        {
            point1 = new Mark(12, Color.Red);
            point2 = new Mark(12, Color.Red);

            listLines = new List<Line>();
            //listUpperLines = new BindingList<Line>();
            //listDownerLines = new BindingList<Line>();
            listUpperLines = new BindingList<Line>();
            listDownerLines = new BindingList<Line>();

            this.path = path;
            this.name = Path.GetFileName(path);
        }
Exemple #3
0
        public void LoadProject()
        {
            if (level == 3)
                if (!SureClose("Unsaved data will be lost, do you want to continue?", "Warning"))
                    return;

            DialogResult result = openFileDialog1.ShowDialog();
            if (result == DialogResult.OK || result == DialogResult.Yes)
            {
                if (images == null)
                    images = new ImagesClass();

                ImagesClass mages = DeSerializeObject(openFileDialog1.FileName);

                projectName =  Path.GetFileNameWithoutExtension(openFileDialog1.FileName);
                this.Text = formName + projectName;

                for (int i = 0; i < mages.listFixedInImage.Count; i++)
                {
                    string[] s = mages.listFixedInImage[i].color.Replace("]", "[").Split('[');
                    mages.listFixedInImage[i].pen = new Pen(Color.FromName(s[1]), 2);
                }
                for (int i = 0; i < mages.listFixedInObject.Count; i++)
                {
                    string[] s = mages.listFixedInObject[i].color.Replace("]", "[").Split('[');
                    mages.listFixedInObject[i].pen = new Pen(Color.FromName(s[1]), 2);
                }

                MeasureParameters.k = mages.k;
                MeasureParameters.wave_lenght = mages.wave_lenght;
                MeasureParameters.L = mages.L;
                MeasureParameters.R = mages.R;
                MeasureParameters.K = mages.K;
                MeasureParameters.p0 = mages.p0;
                MeasureParameters.t0 = mages.t0;
                MeasureParameters.tau0 = mages.tau0;
                MeasureParameters.dTau = mages.dTau;
                MeasureParameters.w0 = mages.w0;
                MeasureParameters.M = mages.M;

                tb_heat.Text = mages.k.ToString(CultureInfo.CreateSpecificCulture("en-GB"));
                tb_wave.Text = mages.wave_lenght.ToString(CultureInfo.CreateSpecificCulture("en-GB"));
                tb_L.Text = mages.L.ToString(CultureInfo.CreateSpecificCulture("en-GB"));
                tb_R.Text = mages.R.ToString(CultureInfo.CreateSpecificCulture("en-GB"));
                tb_K.Text = mages.K.ToString(CultureInfo.CreateSpecificCulture("en-GB"));
                tb_p0.Text = mages.p0.ToString(CultureInfo.CreateSpecificCulture("en-GB"));

                tb_dTau.Text = mages.dTau.ToString(CultureInfo.CreateSpecificCulture("en-GB"));
                tb_tau0.Text = mages.tau0.ToString(CultureInfo.CreateSpecificCulture("en-GB"));
                tb_t0.Text = mages.t0.ToString(CultureInfo.CreateSpecificCulture("en-GB"));
                tb_mach.Text = mages.M.ToString(CultureInfo.CreateSpecificCulture("en-GB"));

                A = mages.A;
                B = mages.B;
                calibrateProfilePoint1 = mages.calibrateProfilePoint1;
                calibrateProfilePoint2 = mages.calibrateProfilePoint2;
                calibratePoint1 = mages.calibratePoint1;
                calibratePoint2 = mages.calibratePoint2;
                PercentRealLenght = mages.PercentRealLenght;
                realLength = mages.realLength;
                idealLength = mages.idealLength;
                tb_scale.Text = mages.scale.ToString();
                GlobalSettings.ratio = mages.ratio;
                listFixedInImage = mages.listFixedInImage;
                listFixedInObject = mages.listFixedInObject;

                distanceBetweenCalibratePoints = GetDistanceBetween(calibratePoint1.Point, calibratePoint2.Point);

                path_airfoil = mages.path_airfoil;
                MainWindow.arrayProfile = mages.arrayProfile;

                images = mages;

                check_eqHist.Checked = mages.isEqualizer;
                track_gamma.Value = mages.gammaCorrection;

                tb_real_length.Text = mages.tb_real;
                tb_ideal_legth.Text = mages.tb_ideal;

                tb_w0.Text = px2mm(mages.w0).ToString(CultureInfo.CreateSpecificCulture("en-GB"));

                string new_path = Path.GetDirectoryName(openFileDialog1.FileName);
                foreach (MyImage im in images.imagesList)
                {
                    im.path = new_path + "\\" + im.name;
                }

                if (!isInit)
                {
                    initProgram();
                    isInit = true;
                    flowLayoutPanel7.Enabled = false;
                    flowLayoutPanel8.Enabled = false;
                    panelScale.Enabled = false;

                    panel2.Enabled = true;
                    saveToolStripMenuItem.Enabled = true;
                }

                tabControl1.SelectedIndex = 3;

                images.getByIndex(images.pointer);
                OpenImage(new Image<Gray, Byte>(images.getActual().path));

                trackBar1.Maximum = images.getCount();
                trackBar1.Value = images.pointer + 1;
                l_min.Text = MeasureParameters.tau0.ToString();
                l_max.Text = (MeasureParameters.tau0 + (images.imagesList.Count) * MeasureParameters.dTau).ToString();

                UpdateInfo();
                UpdateObjectFixedPoints();
                UpdateStatusBar();

                foreach (MyImage im in images.imagesList)
                {
                    im.path = new_path + "\\" + im.name;
                    im.test_to_compute_DLM(ref im.EA);
                    im.setPoint1(im.point1.Point);
                }

                if (images.imagesList != null)
                {
                    foreach (Line l in images.getActual().listLines)
                    {
                        images.getActual().setLine(l, l.pointOfProfile.Point);
                    }
                }

                imageBox.Invalidate();
                setDataGrids();

                level = 3;

            }
        }
Exemple #4
0
        private void loadImage_Click(object sender, EventArgs e)
        {
            if(images.countImages != 0)
                if (!SureClose("Unsaved data will be lost, do you want to create new project?", "Warning"))
                    return;

            DialogResult result = openFileDialog.ShowDialog();
            if (result == DialogResult.OK || result == DialogResult.Yes)
            {
                if (openFileDialog.FileName != null)
                {

                    path = openFileDialog.FileName;

                    OpenDialog od = new OpenDialog(Path.GetDirectoryName(path), new DirectoryInfo(Path.GetDirectoryName(path)).Name);
                    od.ShowDialog();

                    if (od.OK == false)
                        return;

                    images = new ImagesClass(Path.GetDirectoryName(path), Path.GetExtension(path));       //vytvoreni tridy vsech obrazku

                    //tb_project_name.Text = od.name;
                    this.Text = formName + od.name;
                    projectName = od.name;
                    //calibrate Points
                    calibratePoint1 = new Mark(9, Color.Red);
                    calibratePoint2 = new Mark(9, Color.Red);
                    //calibrate moving profile
                    calibrateProfilePoint1 = new Mark(9, Color.Red);
                    calibrateProfilePoint2 = new Mark(9, Color.Red);

                    //Physical points
                    listFixedInImage = new List<ImagePoint>();
                    listFixedInObject = new List<ObjectPoint>();

                    arrayProfile = null;

                    flowLayoutPanel7.Enabled = false;
                    flowLayoutPanel8.Enabled = false;
                    panel2.Enabled = false;

                    //panel5.Enabled = true;
                    panelScale.Enabled = true;
                    //panel5.Enabled = true;
                    panelScale.Enabled = true;

                    tabControl1.SelectedIndex = 0;

                    initProgram();
                    #region Clear tb
                    tb_scale.Text = "";
                    tb_real_length.Text = "";
                    tb_ideal_legth.Text = "";

                    tb_dTau.Text = "";
                    tb_heat.Text = "";
                    tb_K.Text = "";
                    tb_L.Text = "";
                    tb_p0.Text = "";
                    tb_R.Text = "";
                    tb_t0.Text = "";
                    tb_tau0.Text = "";
                    tb_w0.Text = "";
                    tb_wave.Text = "";

                    l_min.Text = "";
                    l_max.Text = "";

                    #endregion
                    isInit = true;
                }
            }
        }
Exemple #5
0
        public MainWindow()
        {
            InitializeComponent();
            comboBoxScale.SelectedIndex = 0;
            this.Text = formName;

            try
            {
                loadSettings();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }

            toolTip1.SetToolTip(this.toNext, "[E]");
            toolTip1.SetToolTip(this.toPrevious, "[Q]");

            splitContainer1.Panel2.Enabled = false;
            flowLayoutPanel7.Enabled = false;
            flowLayoutPanel8.Enabled = false;
            panel2.Enabled = false;

            bw.DoWork += new DoWorkEventHandler(bw_LoadImage);
            bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_LoadingCompleted);
            bw_c.DoWork += new DoWorkEventHandler(bw_calculate);
            bw_c.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_calculation_complete);

            tabControl1.SelectedIndex = 0;

            //calibrate Points
            calibratePoint1 = new Mark(6, Color.Red);
            calibratePoint2 = new Mark(6, Color.Red);
            //calibrate moving profile
            calibrateProfilePoint1 = new Mark(6, Color.Red);
            calibrateProfilePoint2 = new Mark(6, Color.Red);
        }