示例#1
0
    /// <summary>
    /// Remove an object in a plan
    /// </summary>
    /// <param name="obj">Object from all type</param>
    public void RemoveObject(Object obj)
    {
        switch (obj)
        {
        case Segment s:
            _segments.Remove(s);
            break;

        case Area a:
            _areas.Remove(a);
            break;

        case HouseWindow w:
            this.RemoveWindow(w);
            break;

        case Door d:
            _doors.Remove(d);
            break;

        case System.Windows.Controls.Image i:
            CameraCommand.ResetIsAlreadyUsed();
            break;

        default:
            Debug.WriteLine("<unknown shape>");
            break;

        case null:
            throw new ArgumentNullException(nameof(obj));
        }
    }
示例#2
0
 /// <summary>
 /// Clear all elements in the canavas.
 /// Create a new plan.
 /// Reinstanciate Invoker and Receiver
 /// Clear history
 /// </summary>
 public void ClearCanvas()
 {
     _mainWindow.canvas.Children.Clear();
     _plan     = new Plan(_mainWindow.gridGeometry.Bounds);
     _receiver = new Receiver(this);
     _invoker  = new Invoker();
     CameraCommand.ResetIsAlreadyUsed();
     _stackHistory.Clear();
 }