Пример #1
0
        public MevoUiSquare(MevoElement elem)
        {
            _Poly                 = new Polygon();
            _Poly.Stroke          = Brushes.Black;
            _Poly.StrokeThickness = 2;

            _Poly.Points.Add(new Point(elem.Position.X - SideLength / 2, elem.Position.Y - SideLength / 2));
            _Poly.Points.Add(new Point(elem.Position.X + SideLength / 2, elem.Position.Y - SideLength / 2));
            _Poly.Points.Add(new Point(elem.Position.X + SideLength / 2, elem.Position.Y + SideLength / 2));
            _Poly.Points.Add(new Point(elem.Position.X - SideLength / 2, elem.Position.Y + SideLength / 2));
        }
Пример #2
0
 public static MevoUiElement CreateElement(MevoElement elem)
 {
     if (elem.Type == MevoElementType.CIRCLE)
     {
         return(new MevoUiCircle(elem));
     }
     if (elem.Type == MevoElementType.TRIANGLE)
     {
         return(new MevoUiTriangle(elem));
     }
     return(new MevoUiSquare(elem));
 }
Пример #3
0
        public MevoUiTriangle(MevoElement triangle)
        {
            _Poly = new Polygon();
            _Poly.StrokeThickness = 2;
            _Poly.Stroke          = Brushes.Black;

            double topLength    = (SideLength / 2) / Math.Cos(MevoUtils.Deg2Rad(30));
            double bottomLength = Math.Sqrt(topLength * topLength - (SideLength / 2) * (SideLength / 2));

            _Poly.Points.Add(new Point(triangle.Position.X, triangle.Position.Y - topLength));
            _Poly.Points.Add(new Point(triangle.Position.X - SideLength / 2, triangle.Position.Y + bottomLength));
            _Poly.Points.Add(new Point(triangle.Position.X + SideLength / 2, triangle.Position.Y + bottomLength));
        }
Пример #4
0
 public MevoUiCircle(MevoElement elem)
 {
 }