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; }
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(); }
/// <summary> /// Удаление выбранной фигуры (Конкретной) из списка фигур Area /// </summary> /// <param name="f">Удаляемая фигура</param> public void DelFigure(Figure f) { figures.Remove(f); }
/// <summary> /// Добавление фигуры в список фигур Area /// </summary> /// <param name="f">Добавляемая фигура</param> public void AddFigure(Figure f) { figures.Add(f); }