/// <summary> /// Creates Rooms by orthogonally dividing the interior of the Story perimeter by a quantity of x-axis and y-axis intervals. /// Adds the new Rooms to the Rooms list. /// New Rooms conform to Corridor and Service perimeters. /// </summary> /// <param name="xRooms">Quantity Rooms along the orthogonal x-axis.</param> /// <param name="yRooms">Quantity Rooms along the orthogonal y-axis.</param> /// <param name="height">Height of the new Rooms.</param> /// <param name="setback">Offset from the Story perimeter.</param> /// <param name="name">String identifier applied to every new Room.</param> /// <param name="color">Rendering color of the Room as a Space.</param> /// <returns> /// None. /// </returns> public void RoomsByDivision(int xRooms = 1, int yRooms = 1, double height = 3.0, double setback = 0.0, string name = "", Color color = null) { if (Perimeter == null) { throw new ArgumentNullException(Messages.PERIMETER_NULL_EXCEPTION); } if (setback < 0.0) { throw new ArgumentNullException(Messages.NONPOSITIVE_VALUE_EXCEPTION); } Rooms.Clear(); var polygon = Perimeter.Offset(setback * -1.0).First(); var roomGroup = new RoomGroup(polygon, xRooms, yRooms, name); roomGroup.SetElevation(Elevation); roomGroup.SetHeight(height); Rooms.AddRange(roomGroup.Rooms); RoomsColor = color; FitRoomsToServices(); FitRoomsToCorridors(); }
/// <summary> /// Creates Rooms by orthogonally dividing the interior of the Story perimeter by a quantity of x-axis and y-axis intervals. /// Adds the new Rooms to the Rooms list. /// New Rooms conform to Corridor and Service perimeters. /// </summary> /// <param name="xRooms">Quantity Rooms along the orthogonal x-axis.</param> /// <param name="yRooms">Quantity Rooms along the orthogonal y-axis.</param> /// <param name="height">Height of the new Rooms.</param> /// <param name="setback">Offset from the Story perimeter.</param> /// <param name="name">String identifier applied to every new Room.</param> /// <param name="color">Rendering color of the Room as a Space.</param> /// <returns> /// None. /// </returns> public bool RoomsByDivision(int xRooms = 1, int yRooms = 1, double height = 3.0, double setback = 0.0, string name = "", Color color = null, bool fit = true) { if (Perimeter == null || height < 0.0 || setback < 0.0 || xRooms < 1 || yRooms < 1) { return(false); } var polygon = Perimeter.Offset(setback * -1.0).First(); var roomGroup = new RoomGroup() { Name = name, Perimeter = polygon }; roomGroup.RoomsByDivision(xRooms, yRooms, height, name); roomGroup.Elevation = Elevation; roomGroup.SetHeight(height); roomGroup.SetColor(color); var fitRooms = new List <Room>(roomGroup.Rooms); if (fit) { var toRooms = new List <Room>(Exclusions); toRooms.AddRange(Services); toRooms.AddRange(Corridors); fitRooms = FitRooms(fitRooms, toRooms); } if (fitRooms.Count == 0) { return(false); } Rooms.Clear(); Rooms.AddRange(fitRooms); return(true); }