コード例 #1
0
ファイル: Room.cs プロジェクト: baSSiLL/SchemeEditorWpf
        public List<Wall> GetWalls()
        {
            var res = new List<Wall>();
            Point prev = new Point();
            bool door = false;
            foreach (var p in Points)
            {
                Point cur = p;
                if (prev.X == 0 && prev.Y == 0)
                {
                    prev = p;
                }
                else if (cur.X < 0 && cur.Y < 0)
                {
                    door = true;
                }
                else
                {
                    if (!door)
                    {
                        var wall = new Wall();
                        wall.Start = prev;
                        wall.End = cur;
                        res.Add(wall);
                    }
                    prev = cur;
                    door = false;
                }
            }

            return res;
        }
コード例 #2
0
 private void PlaceWall(Point position)
 {
     if (LastPoint == null)
     {
         LastPoint = position;
     }
     else
     {
         var wall = new Wall { Start = LastPoint.Value, End = position };
         if ((Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift)
         {
             wall.IsDoor = true;
         }
         editor.Walls.Add(wall);
         LastPoint = position;
     }
     TempWallData = null;
 }