Пример #1
0
        private void TheVerticalLine_Activated(object sender, EventArgs e)
        {
            if (TVL_form.ifopenformornot == false)
            {
                TVL_form.ifopenformornot = true;
                TVL_form.SelectImage.Clear();
                for (int i = 0; i < TVL_in.O_T.Count; i++)
                {
                    for (int j = 0; j < TVL_in.O_T[i].OImage.Count; j++)
                    {
                        if (TVL_in.O_T[i].OImage[j] != null)
                        {
                            SelectImageNName M1S = new SelectImageNName();
                            M1S.Image = TVL_in.O_T[i].OImage[j];
                            M1S.ImageName = (string)TVL_in.O_T[i].OImageName[j];
                            TVL_form.SelectImage.Add(M1S);

                            index_ij ij_temp = new index_ij();
                            ij_temp.i = i;
                            ij_temp.j = j;
                            TVL_form.index_img.Add(ij_temp);
                        }
                    }
                }
                whichpicture.DataSource = null;
                whichpicture.DataSource = TVL_form.SelectImage;
                whichpicture.DisplayMember = "ImageName";
                whichpicture.ValueMember = "Image";


                for (int i = 0; i < TVL_in.O_T.Count; i++)
                {
                    for (int j = 0; j < TVL_in.O_T[i].OPoint.Count; j++)
                    {
                        if (TVL_in.O_T[i].OPoint[j]!=null)
                        {
                            SelectPointNName SPNN = new SelectPointNName();
                            SPNN.Point = TVL_in.O_T[i].OPoint[j];
                            SPNN.PointName = (string)TVL_in.O_T[i].OPointName[j];
                            SPNN.circleorpoint = 0;
                            TVL_form.SelectPoint1.Add(SPNN);

                            index_ij ij_temp = new index_ij();
                            ij_temp.i = i;
                            ij_temp.j = j;
                            TVL_form.index_1.Add(ij_temp);
                        }
                    }
                }

                for (int i = 0; i < TVL_in.O_T.Count; i++)
                {
                    for (int j = 0; j < TVL_in.O_T[i].OCircle.Count; j++)
                    {
                        if (TVL_in.O_T[i].OCircle[j] != null)
                        {
                            SelectPointNName SPNN = new SelectPointNName();
                            PointBase P_temp = new PointBase();
                            P_temp.row = TVL_in.O_T[i].OCircle[j].row;
                            P_temp.col = TVL_in.O_T[i].OCircle[j].column;
                            SPNN.Point = P_temp;
                            SPNN.PointName = TVL_in.O_T[i].OCircleName[j];
                            SPNN.circleorpoint = 1;
                            TVL_form.SelectPoint1.Add(SPNN);

                            index_ij ij_temp = new index_ij();
                            ij_temp.i = i;
                            ij_temp.j = j;
                            TVL_form.index_1.Add(ij_temp);
                        }
                    }
                }
                whichpoint1.DataSource = null;
                whichpoint1.DataSource = TVL_form.SelectPoint1;
                whichpoint1.DisplayMember = "PointName";
                whichpoint1.ValueMember = "Point";



                for (int i = 0; i < TVL_in.O_T.Count; i++)
                {
                    for (int j = 0; j < TVL_in.O_T[i].OPoint.Count; j++)
                    {
                        if (TVL_in.O_T[i].OPoint[j] != null)
                        {
                            SelectPointNName SPNN = new SelectPointNName();
                            SPNN.Point = TVL_in.O_T[i].OPoint[j];
                            SPNN.PointName = (string)TVL_in.O_T[i].OPointName[j];
                            SPNN.circleorpoint = 0;
                            TVL_form.SelectPoint2.Add(SPNN);

                            index_ij ij_temp = new index_ij();
                            ij_temp.i = i;
                            ij_temp.j = j;
                            TVL_form.index_2.Add(ij_temp);
                        }
                    }
                }

                for (int i = 0; i < TVL_in.O_T.Count; i++)
                {
                    for (int j = 0; j < TVL_in.O_T[i].OCircle.Count; j++)
                    {
                        if (TVL_in.O_T[i].OCircle[j] != null)
                        {
                            SelectPointNName SPNN = new SelectPointNName();
                            PointBase P_temp = new PointBase();
                            P_temp.row = TVL_in.O_T[i].OCircle[j].row;
                            P_temp.col = TVL_in.O_T[i].OCircle[j].column;
                            SPNN.Point = P_temp;
                            SPNN.PointName = TVL_in.O_T[i].OCircleName[j];
                            SPNN.circleorpoint = 1;
                            TVL_form.SelectPoint2.Add(SPNN);

                            index_ij ij_temp = new index_ij();
                            ij_temp.i = i;
                            ij_temp.j = j;
                            TVL_form.index_2.Add(ij_temp);
                        }
                    }
                }
                whichpoint2.DataSource = null;
                whichpoint2.DataSource = TVL_form.SelectPoint2;
                whichpoint2.DisplayMember = "PointName";
                whichpoint2.ValueMember = "Point";

                TVL_form.loadfinish = true;

                toolWindow.Clear_Object_disp();

                TVL_form.src_Image.SetImage = (HObject)whichpicture.SelectedValue;
                PointBase temp1 = (PointBase)whichpoint1.SelectedValue;
                PointBase temp2 = (PointBase)whichpoint2.SelectedValue;
                TVL_form.hv_first_row = temp1.row;
                TVL_form.hv_first_col = temp1.col;
                TVL_form.hv_Second_row = temp2.row;
                TVL_form.hv_Second_col = temp2.col;
                HOperatorSet.GenCrossContourXld(out TVL_form.ho_Cross_firstpoint, TVL_form.hv_first_row, TVL_form.hv_first_col, 10, 0);
                HOperatorSet.GenCrossContourXld(out TVL_form.ho_Cross_secondpoint, TVL_form.hv_Second_row, TVL_form.hv_Second_col, 10, 0);
                
                toolWindow.Add_Object_disp(TVL_form.ho_Cross_firstpoint, "red", "margin", 3);
                toolWindow.Add_Object_disp(TVL_form.ho_Cross_secondpoint, "blue", "margin", 3);
                toolWindow.WindowImage.SetImage = TVL_form.src_Image.GetImage;
                toolWindow.WindowImage.GetImageSize();
                toolWindow.showImage();
                toolWindow1.WindowImage.SetImage = TVL_form.src_Image.GetImage;
                toolWindow1.WindowImage.GetImageSize();
                toolWindow1.showImage();
            }
            

            if (toolWindow.WindowImage.GetImage != null)
                toolWindow.showImage();
            if (toolWindow1.WindowImage.GetImage != null)
                toolWindow1.showImage();


        }
Пример #2
0
        private void PL_distance_Activated(object sender, EventArgs e)
        {

            if (setornot == false)
            {
                if (ifopenformornot == false)
                {
                    ifopenformornot = true;

                    SelectImage.Clear();
                    for (int i = 0; i < O_T.Count; i++)
                    {
                        for (int j = 0; j < O_T[i].OImage.Count; j++)
                        {
                            if (O_T[i].OImage[j] != null)
                            {
                                SelectImageNName M1S = new SelectImageNName();
                                M1S.Image = O_T[i].OImage[j];
                                M1S.ImageName = (string)O_T[i].OImageName[j];
                                SelectImage.Add(M1S);


                                index_ij ij_temp = new index_ij();
                                ij_temp.i = i;
                                ij_temp.j = j;
                                index_img.Add(ij_temp);
                            }
                        }
                    }
                    whichpicture.DataSource = null;
                    whichpicture.DataSource = SelectImage;
                    whichpicture.DisplayMember = "ImageName";
                    whichpicture.ValueMember = "Image";


                    for (int i = 0; i < O_T.Count; i++)
                    {
                        for (int j = 0; j < O_T[i].OPoint.Count; j++)
                        {
                            if (O_T[i].OPoint[j] != null)
                            {
                                SelectPointNName SPNN = new SelectPointNName();
                                SPNN.Point = O_T[i].OPoint[j];
                                SPNN.PointName = (string)O_T[i].OPointName[j];
                                SPNN.circleorpoint = 0;
                                SelectPoint1.Add(SPNN);

                                index_ij ij_temp = new index_ij();
                                ij_temp.i = i;
                                ij_temp.j = j;
                                index_P1.Add(ij_temp);
                            }
                        }
                    }

                    for (int i = 0; i < O_T.Count; i++)
                    {
                        for (int j = 0; j < O_T[i].OCircle.Count; j++)
                        {
                            if (O_T[i].OCircle[j] != null)
                            {
                                SelectPointNName SPNN = new SelectPointNName();
                                PointBase P_temp = new PointBase();
                                P_temp.row = O_T[i].OCircle[j].row;
                                P_temp.col = O_T[i].OCircle[j].column;
                                SPNN.Point = P_temp;
                                SPNN.PointName = O_T[i].OCircleName[j];
                                SPNN.circleorpoint = 1;
                                SelectPoint1.Add(SPNN);
                                index_ij ij_temp = new index_ij();
                                ij_temp.i = i;
                                ij_temp.j = j;
                                index_C1.Add(ij_temp);
                            }
                        }
                    }
                    whichpoint1.DataSource = null;
                    whichpoint1.DataSource = SelectPoint1;
                    whichpoint1.DisplayMember = "PointName";
                    whichpoint1.ValueMember = "Point";



                    for (int i = 0; i < O_T.Count; i++)
                    {
                        for (int j = 0; j < O_T[i].OLine.Count; j++)
                        {
                            if (O_T[i].OLine[j] != null)
                            {
                                SelectLineNName SPNN = new SelectLineNName();
                                SPNN.Line = O_T[i].OLine[j];
                                SPNN.LineName = (string)O_T[i].OLineName[j];
                                SelectLine.Add(SPNN);
                                index_ij ij_temp = new index_ij();
                                ij_temp.i = i;
                                ij_temp.j = j;
                                index_L1.Add(ij_temp);
                            }
                        }
                    }
                    whichLline.DataSource = null;
                    whichLline.DataSource = SelectLine;
                    whichLline.DisplayMember = "LineName";
                    whichLline.ValueMember = "Line";

                    loadfinish = true;

                    toolWindow.Clear_Object_disp();

                    src_Image.SetImage = (HObject)whichpicture.SelectedValue;
                    PointBase temp1 = (PointBase)whichpoint1.SelectedValue;
                    Line temp2 = (Line)whichLline.SelectedValue;
                    PLD.hv_first_row = temp1.row;
                    PLD.hv_first_col = temp1.col;

                    PLD.hv_row1 = temp2.row_start;
                    PLD.hv_col1 = temp2.column_start;
                    PLD.hv_row2 = temp2.row_end;
                    PLD.hv_col2 = temp2.column_end;
                    HOperatorSet.GenCrossContourXld(out PLD.ho_Cross_firstpoint, PLD.hv_first_row, PLD.hv_first_col, 10, 0);

                    HOperatorSet.GenRegionLine(out PLD.ho_RegionLines, PLD.hv_row1, PLD.hv_col1, PLD.hv_row2, PLD.hv_col2);


                    toolWindow.Add_Object_disp(PLD.ho_Cross_firstpoint, "red", "margin", 3);
                    toolWindow.Add_Object_disp(PLD.ho_RegionLines, "green", "margin", 3);
                    toolWindow.WindowImage.CopyImagetoThis(src_Image.GetImage);
                    toolWindow.showImage();
                }

            }
            else if (setornot == true)
            {
                if (ifopenformornot == false)
                {
                    ifopenformornot = true;
                    toolWindow.showImage();
                }
            }

        }