コード例 #1
0
ファイル: FixedInImage.cs プロジェクト: rissstep/IFGPro
        public FixedInImage(Form w, ImagePoint p)
        {
            InitializeComponent();
            window = (MainWindow)w;
            point = p;

            if (GlobalSettings.ratio != Double.NaN)
            {
                tb_x.Text = px2mm(point.location.X).ToString();
                tb_y.Text = px2mm(point.location.Y).ToString();
            }
            else
            {
                tb_x.Text = "NaN";
                tb_y.Text = "Nan";
            }

            tb_label.Text = p.label;
            tb_ratio.Text = p.ratio.ToString();

            btn_color.BackColor = p.pen.Color;
        }
コード例 #2
0
ファイル: MainWindow.cs プロジェクト: rissstep/IFGPro
 public void SetImagePoint(ImagePoint p)
 {
     listFixedInImage.Add(p);
     imageBox.Invalidate();
 }
コード例 #3
0
ファイル: MainWindow.cs プロジェクト: rissstep/IFGPro
 public void DeleteImagePoint(ImagePoint p)
 {
     listFixedInImage.Remove(p);
     imageBox.Invalidate();
 }
コード例 #4
0
ファイル: MainWindow.cs プロジェクト: rissstep/IFGPro
        private void imageBox_MouseUp(object sender, MouseEventArgs e)
        {
            isMouseDown = false;
            if (isSelected.Equals("line") || isSelected.Equals("dataGrid"))
            {
                if (selectedLine != null)
                    selectedLine.Sur_Coor = images.getActual().GetSurfaceCoor(selectedLine);

                //selectedLine = null;
                //isSelected = String.Empty;
                imageBox.AutoPan = true;
                imageBox.MouseMove -= imageBox_MouseMove;
                imageBox.Invalidate();

                dataGridUpper.Update();
                dataGridDowner.Update();

                call_bw_c();
            }
            else if (isSelected.Equals("EA") || isSelected.Equals("point1") || isSelected.Equals("point2"))
            {
                //isSelected = String.Empty;
                imageBox.AutoPan = true;
                imageBox.MouseMove -= imageBox_MouseMove;
                setDataGrids();
                imageBox.Invalidate();
                call_bw_c();
            }
            else if (isSelected.Equals("description"))
            {
                isSelected = String.Empty;
                imageBox.AutoPan = true;
                imageBox.MouseMove -= imageBox_MouseMove;
                imageBox.Invalidate();
            }
            else if (isSelected.Equals("calPoint1") || isSelected.Equals("calPoint2"))
            {
                isSelected = String.Empty;
                imageBox.AutoPan = true;
                imageBox.MouseMove -= imageBox_MouseMove;
                imageBox.Invalidate();
            }
            else if (isSelected.Equals("profile"))
            {
                isSelected = String.Empty;
                imageBox.AutoPan = true;
                imageBox.MouseMove -= imageBox_MouseMove;
                imageBox.Invalidate();
                call_bw_c();
            }
            else if (isSelected.Equals("Ilabel"))
            {
                selectedImagePoint = null;
                isSelected = String.Empty;
                imageBox.AutoPan = true;
                imageBox.MouseMove -= imageBox_MouseMove;
                imageBox.Invalidate();
            }
            else if (isSelected.Equals("Olabel"))
            {
                selectedObjectPoint = null;
                isSelected = String.Empty;
                imageBox.AutoPan = true;
                imageBox.MouseMove -= imageBox_MouseMove;
                imageBox.Invalidate();
            }
            else if (isSelected.Equals("fringeLabels"))
            {

                foreach (Line l in images.getActual().listLines)
                {
                    if (l.IsHit(imageBox.PointToImage(e.Location), imageBox))
                    {
                        l.F_Index = selectedFringeLabels.label;
                        images.getActual().listFringeLabels.Remove(selectedFringeLabels);
                    }
                }
                //selectedFringeLabels = null;
                //isSelected = String.Empty;
                imageBox.AutoPan = true;
                imageBox.MouseMove -= imageBox_MouseMove;
                imageBox.Invalidate();
                setDataGrids();
                return;
            }
            else if (x == e.Location.X && y == e.Location.Y)
            {
                if (Application.OpenForms.OfType<FixedInImage>().Any())
                {
                    formFixedInImage.setPointLocation(imageBox.PointToImage(e.Location));
                }
                if (Application.OpenForms.OfType<FixedInObject>().Any())
                {
                    if (tabControl1.SelectedTab.Equals(tabAirfoil))
                        formFixedInObject.setPointLocation(imageBox.PointToImage(e.Location),
                            calibrateProfilePoint1.Point,
                            calibrateProfilePoint2.Point);
                    else if (tabControl1.SelectedTab.Equals(tabAnalyze))
                    {
                        formFixedInObject.setPointLocation(imageBox.PointToImage(e.Location),
                            images.getActual().point1.Point,
                            images.getActual().point2.Point);
                    }
                }
                cross = imageBox.PointToImage(e.Location);

                if (!isPlaying)
                    imageBox.Invalidate();

                UpdateStatusBar();
            }
            UpdateInfo();
        }
コード例 #5
0
ファイル: MainWindow.cs プロジェクト: rissstep/IFGPro
        private void imageBox_MouseDown(object sender, MouseEventArgs e)
        {
            isMouseDown = true;
            selectedFringeLabels = null;
            ImagePoint fringeLabelsPoint = FringeLabelHit(e.Location);
            if (fringeLabelsPoint != null)
            {
                offsetMovingLabelX = imageBox.PointToImage(e.Location).X;
                offsetMovingLabelY = imageBox.PointToImage(e.Location).Y;
                isSelected = "fringeLabels";
                imageBox.AutoPan = false;
                imageBox.MouseMove += imageBox_MouseMove;
                images.getActual().listFringeLabels.Add(fringeLabelsPoint);
                selectedFringeLabels = fringeLabelsPoint;
                return;
            }

            foreach (ImagePoint p in images.getActual().listFringeLabels)
            {
                if (p.IsHitLabel(e.Location, imageBox,true) || p.IsHit(e.Location,imageBox,true))
                {
                    offsetMovingLabelX = imageBox.PointToImage(e.Location).X;
                    offsetMovingLabelY = imageBox.PointToImage(e.Location).Y;
                    isSelected = "fringeLabels";
                    imageBox.AutoPan = false;
                    imageBox.MouseMove += imageBox_MouseMove;
                    selectedFringeLabels = p;
                    imageBox.Invalidate();
                    return;
                }
            }

            if (isSelected.Equals("point1") || isSelected.Equals("point2") || isSelected.Equals("EA"))
            {
                isSelected = String.Empty;
                imageBox.AutoPan = true;
                imageBox.MouseMove -= imageBox_MouseMove;
                imageBox.Invalidate();
            }
            if (selectedLine != null)
            {
                setDataGrids();
                selectedLine = null;
                isSelected = String.Empty;
            }
            if (!(isSelected == String.Empty))
            {
                isSelected = String.Empty;
            }

            //Test MoveDesc
            if (images.getActual().isDesHit(imageBox.PointToImage(e.Location), imageBox))
            {
                isSelected = "description";
                imageBox.AutoPan = false;
                imageBox.MouseMove += imageBox_MouseMove;
                imageBox.Invalidate();
                offsetMovingDesc = new SizeF(imageBox.PointToImage(e.Location).X-images.getActual().locationDesc.X,
                    imageBox.PointToImage(e.Location).Y - images.getActual().locationDesc.Y);

            }
            // testing all lines if hit
            foreach (Line l in images.getActual().listLines)
            {
                if (l.IsHit(imageBox.PointToImage(e.Location),imageBox))
                {
                    images.getActual().MakeRestorePoint(l);
                    selectedLine = l;
                    isSelected = "line";
                    imageBox.AutoPan = false;
                    imageBox.MouseMove += imageBox_MouseMove;
                    imageBox.Invalidate();
                    if (l.upSide)
                        dataGridUpper.Rows[l.Index - 1].Selected = true;
                    else
                        dataGridDowner.Rows[l.Index - 1].Selected = true;
                    return;
                }
            }

            foreach (ImagePoint p in listFixedInImage)
            {
                if(p.IsHitLabel(imageBox.PointToImage(e.Location),imageBox))
                {
                    offsetMovingLabelX = imageBox.PointToImage(e.Location).X - p.GetLabelLocation().X;
                    offsetMovingLabelY = imageBox.PointToImage(e.Location).Y - p.GetLabelLocation().Y;
                    isSelected = "Ilabel";
                    selectedImagePoint = p;
                    imageBox.AutoPan = false;
                    imageBox.MouseMove += imageBox_MouseMove;
                    imageBox.Invalidate();
                    return;
                }
            }
            foreach (ObjectPoint p in listFixedInObject)
            {
                if (p.IsHitLabel(imageBox.PointToImage(e.Location), imageBox))
                {
                    offsetMovingLabelX = imageBox.PointToImage(e.Location).X - p.GetLabelLocation().X;
                    offsetMovingLabelY = imageBox.PointToImage(e.Location).Y - p.GetLabelLocation().Y ;
                    isSelected = "Olabel";
                    selectedObjectPoint = p;
                    imageBox.AutoPan = false;
                    imageBox.MouseMove += imageBox_MouseMove;
                    imageBox.Invalidate();
                    return;
                }
            }

            //test points front and back point

            if(images.getActual().point1.IsHit(imageBox.PointToImage(e.Location),imageBox))
            {
                isSelected = "point1";
                imageBox.AutoPan = false;
                imageBox.MouseMove += imageBox_MouseMove;
                imageBox.Invalidate();
            }
            else if(images.getActual().point2.IsHit(imageBox.PointToImage(e.Location),imageBox))
            {
                isSelected = "point2";
                imageBox.AutoPan = false;
                imageBox.MouseMove += imageBox_MouseMove;
                imageBox.Invalidate();
            }
            else if (GetElasticAxis() != null && tabControl1.SelectedTab.Equals(tabAnalyze))
            {
                if (GetElasticAxis().IsHit(imageBox.PointToImage(e.Location), imageBox))
                {
                    isSelected = "EA";
                    imageBox.AutoPan = false;
                    imageBox.MouseMove += imageBox_MouseMove;
                    imageBox.Invalidate();
                }
            }
            if (calibrateProfilePoint1.IsHit(imageBox.PointToImage(e.Location), imageBox) && !tabControl1.SelectedTab.Equals(tabAnalyze))
            {
                isSelected = "calPoint1";
                imageBox.AutoPan = false;
                imageBox.MouseMove += imageBox_MouseMove;
                imageBox.Invalidate();
            }
            else if (calibrateProfilePoint2.IsHit(imageBox.PointToImage(e.Location), imageBox) && !tabControl1.SelectedTab.Equals(tabAnalyze))
            {
                isSelected = "calPoint2";
                imageBox.AutoPan = false;
                imageBox.MouseMove += imageBox_MouseMove;
                imageBox.Invalidate();
            }
            else if (IsHitProfile(arrayProfile, new PointF(e.Location.X, e.Location.Y)) && !tabControl1.SelectedTab.Equals(tabAnalyze))
            {
                isSelected = "profile";
                imageBox.AutoPan = false;
                imageBox.MouseMove += imageBox_MouseMove;
                imageBox.Invalidate();
            }

            x = e.Location.X;
            y = e.Location.Y;
        }
コード例 #6
0
ファイル: MainWindow.cs プロジェクト: rissstep/IFGPro
        private ImagePoint FringeLabelHit(Point click)
        {
            using (Graphics e = imageBox.CreateGraphics())
            {
                List<float> delkaRadku = new List<float>();
                delkaRadku.Add(0);
                int pocetRadku = 0;
                for (int i = 0; (GlobalSettings.fringeLabelsFrom + i * GlobalSettings.fringeStep) <= GlobalSettings.fringeLabelsTo; ++i)
                {

                    if (delkaRadku[pocetRadku] + e.MeasureString((GlobalSettings.fringeLabelsFrom + i * GlobalSettings.fringeStep).ToString(), GlobalSettings.fringeLabelsFont).Width > graphicsWidth)
                    {
                        pocetRadku++;
                        delkaRadku.Add(0);
                    }

                    if(IsHitLabel(click,
                        e.MeasureString((GlobalSettings.fringeLabelsFrom + i * GlobalSettings.fringeStep).ToString(), GlobalSettings.fringeLabelsFont),
                        new PointF(delkaRadku[pocetRadku] + 3, 1 + (1.5f + e.MeasureString("123", GlobalSettings.fringeLabelsFont).Height) * pocetRadku))
                        )
                    {
                        //MessageBox.Show((GlobalSettings.fringeLabelsFrom + i * GlobalSettings.fringeStep).ToString());
                        ImagePoint pointTmp = new ImagePoint(new Pen(new SolidBrush(GlobalSettings.fringeLabelsColor)), imageBox.PointToImage(click));
                        pointTmp.label = (GlobalSettings.fringeLabelsFrom + i * GlobalSettings.fringeStep).ToString();

                        return pointTmp;
                    }

                    delkaRadku[pocetRadku] += (3 + e.MeasureString((GlobalSettings.fringeLabelsFrom + i * GlobalSettings.fringeStep).ToString(), GlobalSettings.fringeLabelsFont).Width);

                }
            }

            return null;
        }
コード例 #7
0
ファイル: MainWindow.cs プロジェクト: rissstep/IFGPro
 private void btn_PointFixedInImage_Click(object sender, EventArgs e)
 {
     if (!Application.OpenForms.OfType<FixedInImage>().Any() && !Application.OpenForms.OfType<FixedInObject>().Any())
         {
             ImagePoint tmp = new ImagePoint(new Pen(Color.Green, 2),cross);
             listFixedInImage.Add(tmp);
             formFixedInImage = new FixedInImage(this, tmp);
             formFixedInImage.Show();
             imageBox.Invalidate();
         }
 }