private void ParseShapefileBeds()
        {
            if (this.ShapeFileBeds.Count == 0)
            {
                return;
            }

            var beds = new HospitalElementList();

            foreach (ShapefileRecord record in this.ShapeFileBeds)
            {
                var id     = record.Fields["ID"].ToString();
                var points = this.MapProjector.ProjectToGeographic(record.Points);
                beds.Add(new HospitalElement(id, points));
            }

            if (this.ViewModel != null)
            {
                ViewModel.RegisterElements(beds);

                var series = this.geoMap.Series["HosptialBedSeries"] as GeographicShapeControlSeries;
                if (series != null)
                {
                    series.ItemsSource = this.ViewModel.MapElements;
                }
            }
        }
        private void ParseShapefileRooms()
        {
            if (this.ShapeFileRooms.Count == 0)
            {
                return;
            }
            var elements = new HospitalElementList();

            foreach (ShapefileRecord record in this.ShapeFileRooms)
            {
                var id     = record.Fields["ID"].ToString();
                var points = this.MapProjector.ProjectToGeographic(record.Points);
                elements.Add(new HospitalElement(id, points));
            }

            var series = this.geoMap.Series["HosptialRoomSeries"] as GeographicShapeControlSeries;

            if (series != null)
            {
                series.ItemsSource = elements;
            }
        }
        public void RegisterElements(HospitalElementList elements)
        {
            if (_bedStatusPalette == null || _genderPalette == null)
            {
                throw new InvalidOperationException("BedStatusPalette and GenderPalette must be set before calling this method.");
            }

            _hospitalFloorData = new Dictionary <string, MapElementViewModel>(elements.Count());

            IEnumerable <BedData> floorData = BedData.Load();
            int freeBedsCount = 0;

            foreach (var element in elements)
            {
                string  id   = element.Id;
                BedData data = floorData.FirstOrDefault(x => x.Id == id);
                if (data != null)
                {
                    data.BedShape = element.Shape;
                    if (data.BedStatus == BedStatus.Free)
                    {
                        data.BedShape = element.Shape;
                        ++freeBedsCount;
                    }
                    _hospitalFloorData.Add(id, new MapElementViewModel(id, data, BedStatusPalette, GenderPalette));
                }
            }

            MapElements = _hospitalFloorData.Values;

            Filter = new FilterViewModel(_hospitalFloorData.Where(x => !x.Value.IsStub).Select(x => x.Value.BedData));
            Filter.FilterChanged += OnFilterChanged;

            TotalNumberOfBeds     = _hospitalFloorData.Count;
            TotalNumberOfFreeBeds = freeBedsCount;
        }