Example #1
0
        public void DivisionTest()
        {
            var point1 = new Point(10, 10);
            var point3 = point1 / 2;

            Assert.AreEqual(point3.X, 5);
            Assert.AreEqual(point3.Y, 5);
        }
Example #2
0
        public void CopyTest()
        {
            var point = new Point(20, 20);

            Assert.AreEqual(point.Color, point.Copy().Color);
            Assert.AreEqual(point.X, point.Copy().X);
            Assert.AreEqual(point.Y, point.Copy().Y);
        }
Example #3
0
        public void MoveTest()
        {
            var point = new Point(10, 10);

            point.Move(20, 20);
            Assert.AreEqual(point.X, 30);
            Assert.AreEqual(point.Y, 30);
        }
Example #4
0
        public void ColorTests()
        {
            var point = new Point(10, 10);

            Assert.AreEqual(Color.Black, point.Color);
            point.Color = Color.Aqua;
            Assert.AreEqual(Color.Aqua, point.Color);
        }
Example #5
0
        public void AdditionTest()
        {
            var point1 = new Point(5, 5);
            var point2 = new Point(15, 15);
            var point3 = point2 + point1;

            Assert.AreEqual(20, point3.X);
            Assert.AreEqual(20, point3.Y);
        }
Example #6
0
        public void SubtractionTest()
        {
            var point1 = new Point(5, 5);
            var point2 = new Point(15, 15);
            var point3 = point2 - point1;

            Assert.AreEqual(point3.X, 10);
            Assert.AreEqual(point3.Y, 10);
        }
Example #7
0
 /// <summary>
 /// Tries to get a clickable point of the element.
 /// </summary>
 /// <param name="point">The clickable point or null, if no point was found</param>
 /// <returns>True if a point was found, false otherwise</returns>
 public bool TryGetClickablePoint(out Shapes.Point point)
 {
     return(BasicAutomationElement.TryGetClickablePoint(out point));
 }
Example #8
0
        private void btnEnter_Click(object sender, EventArgs e)
        {
            if (this.cbShape.SelectedIndex == 0 && this.cbAddOrDelete.SelectedIndex == 0)
            {
                double             d_BoxWidth   = Convert.ToDouble(this.nudBoxWidth.Value);
                double             d_BoxHeight  = Convert.ToDouble(this.nudBoxHeight.Value);
                double             d_BoxLength  = Convert.ToDouble(this.nudBoxLength.Value);
                double             d_BoxCenterX = Convert.ToDouble(this.nudBoxCenterX.Value);
                double             d_BoxCenterY = Convert.ToDouble(this.nudBoxCenterY.Value);
                double             d_BoxCenterZ = Convert.ToDouble(this.nudBoxCenterZ.Value);
                bool               rendered     = (this.cbBoxRendered.Checked == true) ? true : false;
                Shapes.BoundingBox b            = new Shapes.BoundingBox(this.txtBoxName.Text, d_BoxWidth, d_BoxHeight, d_BoxLength);
                boxes.Add(b);
                Color randomColor = Color.FromArgb(rnd.Next(256), rnd.Next(256), rnd.Next(256));
                m_ucCharting3D.plotSetup(b, randomColor);
                p3D.Point3D c = new p3D.Point3D(d_BoxCenterX, d_BoxCenterY, d_BoxCenterZ);
                box_centers.Add(c);
                box_rendered.Add(rendered);
                this.txtBoxName.Text       = "";
                this.nudBoxWidth.Value     = 0;
                this.nudBoxHeight.Value    = 0;
                this.nudBoxLength.Value    = 0;
                this.nudBoxCenterX.Value   = 0;
                this.nudBoxCenterY.Value   = 0;
                this.nudBoxCenterZ.Value   = 0;
                this.cbBoxRendered.Checked = false;
                controlsEnabled(false);
                Task.Run(() =>
                {
                    BeginInvoke(new Action(() =>
                    {
                        plotShapes();
                        controlsEnabled(true);
                    }));
                });
            }

            else if (this.cbShape.SelectedIndex == 1 && this.cbAddOrDelete.SelectedIndex == 0)
            {
                double          d_CylinderRadius      = Convert.ToDouble(this.nudCylinderRadius.Value);
                double          d_CylinderFacetNumber = Convert.ToDouble(this.nudCylinderFacetNumber.Value);
                double          d_CylinderP1X         = Convert.ToDouble(this.nudCylinderP1X.Value);
                double          d_CylinderP1Y         = Convert.ToDouble(this.nudCylinderP1Y.Value);
                double          d_CylinderP1Z         = Convert.ToDouble(this.nudCylinderP1Z.Value);
                double          d_CylinderP2X         = Convert.ToDouble(this.nudCylinderP2X.Value);
                double          d_CylinderP2Y         = Convert.ToDouble(this.nudCylinderP2Y.Value);
                double          d_CylinderP2Z         = Convert.ToDouble(this.nudCylinderP2Z.Value);
                bool            rendered = (this.cbCylinderRendered.Checked == true) ? true : false;
                Shapes.Cylinder c        = new Shapes.Cylinder(this.txtCylinderName.Text, d_CylinderRadius, d_CylinderFacetNumber, 1);
                cylinders.Add(c);
                Color randomColor = Color.FromArgb(rnd.Next(256), rnd.Next(256), rnd.Next(256));
                m_ucCharting3D.plotSetup(c, randomColor);
                p3D.Point3D p1 = new p3D.Point3D(d_CylinderP1X, d_CylinderP1Y, d_CylinderP1Z);
                cylinder_centers1.Add(p1);
                p3D.Point3D p2 = new p3D.Point3D(d_CylinderP2X, d_CylinderP2Y, d_CylinderP2Z);
                cylinder_centers2.Add(p2);
                cylinder_rendered.Add(rendered);
                this.txtCylinderName.Text         = "";
                this.nudCylinderRadius.Value      = 0;
                this.nudCylinderFacetNumber.Value = 0;
                this.nudCylinderP1X.Value         = 0;
                this.nudCylinderP1Y.Value         = 0;
                this.nudCylinderP1Z.Value         = 0;
                this.nudCylinderP2X.Value         = 0;
                this.nudCylinderP2Y.Value         = 0;
                this.nudCylinderP2Z.Value         = 0;
                this.cbCylinderRendered.Checked   = false;
                controlsEnabled(false);
                Task.Run(() =>
                {
                    BeginInvoke(new Action(() =>
                    {
                        plotShapes();
                        controlsEnabled(true);
                    }));
                });
            }

            else if (this.cbShape.SelectedIndex == 2 && this.cbAddOrDelete.SelectedIndex == 0)
            {
                double       d_PointX = Convert.ToDouble(this.nudPointX.Value);
                double       d_PointY = Convert.ToDouble(this.nudPointY.Value);
                double       d_PointZ = Convert.ToDouble(this.nudPointZ.Value);
                Shapes.Point p        = new Shapes.Point(this.txtPointName.Text);
                points.Add(p);
                Color randomColor = Color.FromArgb(rnd.Next(256), rnd.Next(256), rnd.Next(256));
                m_ucCharting3D.plotSetup(p, randomColor);
                p3D.Point3D c = new p3D.Point3D(d_PointX, d_PointY, d_PointZ);
                point_centers.Add(c);
                this.txtPointName.Text = "";
                this.nudPointX.Value   = 0;
                this.nudPointY.Value   = 0;
                this.nudPointZ.Value   = 0;
                controlsEnabled(false);
                Task.Run(() =>
                {
                    BeginInvoke(new Action(() =>
                    {
                        plotShapes();
                        controlsEnabled(true);
                    }));
                });
            }

            else if (this.cbShape.SelectedIndex == 3 && this.cbAddOrDelete.SelectedIndex == 0)
            {
                double         d_LabelX = Convert.ToDouble(this.nudLabelX.Value);
                double         d_LabelY = Convert.ToDouble(this.nudLabelY.Value);
                double         d_LabelZ = Convert.ToDouble(this.nudLabelZ.Value);
                TextAnnotation l        = new TextAnnotation();
                labels.Add(l);
                m_ucCharting3D.plotSetup(l);
                label_texts.Add(this.txtLabelText.Text);
                p3D.Point3D c = new p3D.Point3D(d_LabelX, d_LabelY, d_LabelZ);
                label_centers.Add(c);
                label_names.Add(this.txtLabelName.Text);
                this.txtLabelText.Text = "";
                this.nudLabelX.Value   = 0;
                this.nudLabelY.Value   = 0;
                this.nudLabelZ.Value   = 0;
                controlsEnabled(false);
                Task.Run(() =>
                {
                    BeginInvoke(new Action(() =>
                    {
                        plotShapes();
                        controlsEnabled(true);
                    }));
                });
            }

            else if (this.cbShape.SelectedIndex == 0 && this.cbAddOrDelete.SelectedIndex == 1)
            {
                List <int> indexes = new List <int>();

                foreach (Shapes.BoundingBox box in boxes)
                {
                    if (box.Name == this.txtDeleteName.Text)
                    {
                        indexes.Add(boxes.IndexOf(box));
                    }
                }

                foreach (int index in indexes)
                {
                    m_ucCharting3D.deleteShape(boxes[index]);
                    boxes.Remove(boxes[index]);
                    box_centers.Remove(box_centers[index]);
                }
                this.txtDeleteName.Text = "";
            }

            else if (this.cbShape.SelectedIndex == 1 && this.cbAddOrDelete.SelectedIndex == 1)
            {
                List <int> indexes = new List <int>();
                foreach (Shapes.Cylinder cylinder in cylinders)
                {
                    if (cylinder.Name == this.txtDeleteName.Text)
                    {
                        indexes.Add(cylinders.IndexOf(cylinder));
                    }
                }

                foreach (int index in indexes)
                {
                    m_ucCharting3D.deleteShape(cylinders[index]);
                    cylinders.Remove(cylinders[index]);
                    cylinder_centers1.Remove(cylinder_centers1[index]);
                    cylinder_centers2.Remove(cylinder_centers2[index]);
                }
                this.txtDeleteName.Text = "";
            }

            else if (this.cbShape.SelectedIndex == 2 && this.cbAddOrDelete.SelectedIndex == 1)
            {
                List <int> indexes = new List <int>();
                foreach (Shapes.Point point in points)
                {
                    if (point.Name == this.txtDeleteName.Text)
                    {
                        indexes.Add(points.IndexOf(point));
                    }
                }
                foreach (int index in indexes)
                {
                    m_ucCharting3D.deleteShape(points[index]);
                    points.Remove(points[index]);
                    point_centers.Remove(point_centers[index]);
                }
                this.txtDeleteName.Text = "";
            }

            else if (this.cbShape.SelectedIndex == 3 && this.cbAddOrDelete.SelectedIndex == 1)
            {
                List <int> indexes = new List <int>();
                foreach (string label in label_names)
                {
                    if (label == this.txtDeleteName.Text)
                    {
                        indexes.Add(label_names.IndexOf(label));
                    }
                }
                foreach (int index in indexes)
                {
                    m_ucCharting3D.deleteShape(labels[index]);
                    labels.Remove(labels[index]);
                    label_texts.Remove(label_texts[index]);
                    label_centers.Remove(label_centers[index]);
                    label_names.Remove(label_names[index]);
                }
                this.txtDeleteName.Text = "";
            }

            else
            {
                this.tcChartingTabs.SelectedIndex = 0;
            }
        }
Example #9
0
 /// <summary>
 /// Tries to get a clickable point of the element.
 /// </summary>
 /// <param name="point">The clickable point or null, if no point was found</param>
 /// <returns>True if a point was found, false otherwise</returns>
 public bool TryGetClickablePoint(out Shapes.Point point)
 {
     return FrameworkAutomationElement.TryGetClickablePoint(out point);
 }
 public void _DrawPoints2(Segment seg, Color color)
 {
     _LogStringDebug("_DrawPoints2");
     foreach (Shapes.Point p in seg.points)
     {
         if (!_CheckVisual2(p))
         {
             if (_CheckVisual1(p)) //This segment exists in the other window
             {
                 Shapes.Point p2 = new Shapes.Point();
                 p2.X = p.X; p2.Y = p.Y; p2.Z = p.Z;
                 p2.Draw(color);
                 pnl_Panel2.AddVisual(p2);
                 m_DrawingPoints2.Add(p2);
             }
             else
             {
                 p.Draw(color);
                 pnl_Panel2.AddVisual(p);
                 m_DrawingPoints2.Add(p);
             }
         }
     }
 }