Example #1
0
        public FixedInObject(Form w, ObjectPoint p)
        {
            InitializeComponent();
            window = (MainWindow)w;
            point = p;

            if (p.isElastic)
                this.Text = "Set elastic axis";

            if (!double.IsNaN(GlobalSettings.ratio))
            {
                tb_x.Text = px2mm(p.locationWithOutOffset.X).ToString();
                tb_y.Text = px2mm((p.locationWithOutOffset.Y * (-1))).ToString();
            }
            else
            {
                tb_x.Text = "NaN";
                tb_y.Text = "Nan";
            }
            tb_label.Text = p.label;
            tb_ratio.Text = p.ratio.ToString();

            checkBox1.Checked = p.onSurface;
            if (checkBox1.Checked)
            {
                if (p.locationWithOutOffset.Y > 0)
                    cb_upper.Checked = true;
                else
                    cb_upper.Checked = false;

                tb_sur_coor.Text = p.sufraceDist.ToString().Replace(',', '.');
            }

            btn_color.BackColor = p.pen.Color;
        }
Example #2
0
        public FixedInObject(Form w, ObjectPoint p)
        {
            InitializeComponent();
            window = (MainWindow)w;
            point  = p;

            if (p.isElastic)
            {
                this.Text = "Set elastic axis";
            }

            if (!double.IsNaN(GlobalSettings.ratio))
            {
                tb_x.Text = px2mm(p.locationWithOutOffset.X).ToString();
                tb_y.Text = px2mm((p.locationWithOutOffset.Y * (-1))).ToString();
            }
            else
            {
                tb_x.Text = "NaN";
                tb_y.Text = "Nan";
            }
            tb_label.Text = p.label;
            tb_ratio.Text = p.ratio.ToString();

            checkBox1.Checked = p.onSurface;
            if (checkBox1.Checked)
            {
                if (p.locationWithOutOffset.Y > 0)
                {
                    cb_upper.Checked = true;
                }
                else
                {
                    cb_upper.Checked = false;
                }

                tb_sur_coor.Text = p.sufraceDist.ToString().Replace(',', '.');
            }

            btn_color.BackColor = p.pen.Color;
        }
Example #3
0
 public void SetObjectPoint(ObjectPoint p)
 {
     listFixedInObject.Add(p);
     UpdateObjectFixedPoints();
     imageBox.Invalidate();
 }
Example #4
0
 public void DeleteObjectPoint(ObjectPoint p)
 {
     listFixedInObject.Remove(p);
     imageBox.Invalidate();
 }
Example #5
0
        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();
        }
Example #6
0
        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;
        }
Example #7
0
 private void btn_PointFixedInObject_Click(object sender, EventArgs e)
 {
     if (!Application.OpenForms.OfType<FixedInObject>().Any() && !Application.OpenForms.OfType<FixedInImage>().Any())
         {
             if (tabControl1.SelectedTab.Equals(tabAirfoil) && !calibrateProfilePoint1.IsEmpty() && !calibrateProfilePoint2.IsEmpty()
                 || tabControl1.SelectedTab.Equals(tabAnalyze) && !images.getActual().point1.IsEmpty() && !images.getActual().point2.IsEmpty())
             {
                 ObjectPoint tmp = new ObjectPoint(new Pen(Color.Green,2));
                 tmp.setPointLocationByPoint(cross, calibrateProfilePoint1.Point, calibrateProfilePoint2.Point);
                 listFixedInObject.Add(tmp);
                 formFixedInObject = new FixedInObject(this, tmp);
                 formFixedInObject.Show();
                 imageBox.Invalidate();
             }
             else
             {
                 MessageBox.Show("There is no object to get fixed on!");
             }
         }
 }