Exemplo n.º 1
0
 public static double CurrCanvasX(Figure value)
 {
     if (value is Circle)
     {
         var circle = (Circle)value;
         return (circle.Center.X - circle.Radius);
     }
     if (value is Point)
     {
         var point = (Point)value;
         return (point.X - 3);
     }
     else if (value is ConvexPolygon)
     {
         var poly = (ConvexPolygon)value;
         return poly.Center().X;
     }
     else if (value is Polyline)
     {
         var polyline = (Polyline)value;
         return polyline.Center().X;
     }
     else if (value is Segment)
     {
         var segment = (Segment)value;
         return (segment.Begin.X + segment.End.X) / 2;
     }
     return 0;
 }
Exemplo n.º 2
0
        public FigurePresenter(Figure f, AbstractGameEngine.Area parent)
        {
            this.original = f;
            Type = f.GetType();
            AParent = parent;

            // todo find another way for that?
            if (Type == typeof(ConvexPolygon))
            {
                if (parent.GetType() == typeof(GameEngine.Lands.Mountains))
                    Smoothing = 1;
                if (parent.GetType() == typeof(GameEngine.Lands.Forest))
                    Smoothing = 0.5;
                if (parent.GetType() == typeof(GameEngine.Lands.Lowland))
                    Smoothing = 0.8;
            }

            Update();
        }
Exemplo n.º 3
0
 /// <summary>
 /// Удаление выбранной фигуры (Конкретной) из списка фигур Area
 /// </summary>
 /// <param name="f">Удаляемая фигура</param>
 public void DelFigure(Figure f)
 {
     figures.Remove(f);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Добавление фигуры в список фигур Area
 /// </summary>
 /// <param name="f">Добавляемая фигура</param>
 public void AddFigure(Figure f)
 {
     figures.Add(f);
 }