/// <summary> /// Loads the display from a save point /// </summary> /// <param name="save"></param> public void LoadSave(DisplaySave save) { // set fields displayObjects = save.displayObjects; transform.CenterPoint = save.center; transform.Scale = save.scale; DisplayGrid = save.DisplayGrid; }
/// <summary> /// Resets teh display /// </summary> public void Reset() { // set new display objects displayObjects = new List<IDisplayObject>(); // display grid DisplayGrid = new GridDisplay(); displayObjects.Add(DisplayGrid); // center transform transform.CenterPoint = new Coordinates(0, 0); // default zoom transform.Scale = 6.0f; // redraw this.Invalidate(); }
/// <summary> /// Constructor /// </summary> public RoadDisplay() { // create the display InitializeComponent(); // make sure we're not in design mode if (!this.DesignMode) { // initialize the tranform before calling InitializeComponent so the OnResize method works properly transform = new WorldTransform(); // set our style base.SetStyle(ControlStyles.UserPaint, true); base.SetStyle(ControlStyles.AllPaintingInWmPaint, true); base.SetStyle(ControlStyles.Opaque, true); base.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); base.SetStyle(ControlStyles.ResizeRedraw, true); base.SetStyle(ControlStyles.Selectable, true); // set new display objects displayObjects = new List<IDisplayObject>(); // display grid DisplayGrid = new GridDisplay(); displayObjects.Add(DisplayGrid); } }