예제 #1
0
        public void CollectRooms()
        {
            try
            {
                foreach (var room in RoomElements)
                {
                    var rp = new RoomProperties();
                    rp.RoomObject = room;
                    rp.RoomId     = room.Id.IntegerValue;
                    rp.RoomName   = room.Name;
                    rp.RoomNumber = room.Number;
                    rp.SourceView = FindViewSource(room);

                    var locationPoint = room.Location as LocationPoint;
                    rp.RoomLocation = locationPoint.Point;

                    var roomSeparations   = new List <ModelCurve>();
                    var roomSeparationIds = new List <ElementId>();
                    var opt = new SpatialElementBoundaryOptions();
                    var boundaryListList = room.GetBoundarySegments(opt);
                    if (null != boundaryListList)
                    {
                        if (boundaryListList.Count > 0)
                        {
                            foreach (var boundaryList in boundaryListList)
                            {
                                foreach (var segment in boundaryList)
                                {
#if RELEASE2015
                                    var element = segment.Element;
#else
                                    var element = m_doc.GetElement(segment.ElementId);
#endif
                                    if (null != element)
                                    {
                                        if (element.Category.Id.IntegerValue == (int)BuiltInCategory.OST_RoomSeparationLines)
                                        {
                                            var modelCurve = element as ModelCurve;
                                            roomSeparations.Add(modelCurve);
                                            roomSeparationIds.Add(modelCurve.Id);
                                        }
                                    }
                                }
                            }
                        }
                    }
                    rp.RoomSeparationLines    = roomSeparations;
                    rp.RoomSeparationLinesIds = roomSeparationIds;
                    RoomDictionary.Add(rp.RoomId, rp);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed to collect rooms.\n" + ex.Message, "Collect Rooms", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
예제 #2
0
 public static void Initialize()                                                         // Initialise dictionary
 {
     string[] DictionaryArray = RoomDictionary.Split(Environment.NewLine.ToCharArray()); //split input string into array of strings "goodName:badName"
     isTranslating = true;
     foreach (string roomPair in DictionaryArray)
     {
         string[] rooms = roomPair.Split(':'); //split string into goodName and badName
         try
         {
             Dict.Add(rooms[0], rooms[1]);
         }
         catch
         {
         }
     }
 }
 /// <summary>
 /// Creates a new room HTTP server class instance
 /// </summary>
 public RoomHttpServer(Version version, RoomDictionary <TRoom, TAccount> rooms, TAccountFactory accountFactory, IAccountDatabase <TAccount, TAccountFactory> accountDatabase, ILogger logger, string address) : base(version, accountFactory, accountDatabase, logger, address)
 {
     this.rooms = rooms ?? throw new ArgumentNullException();
     listener.Prefixes.Add($"{address}{GetRoomInfosHttpRequest.Type}/");
     listener.Prefixes.Add($"{address}{JoinRoomHttpRequest.Type}/");
 }