예제 #1
0
        public ApartmentsGroup(IEnumerable <ApartmentInfo> apartments)
        {
            if (apartments == null)
            {
                throw new ArgumentNullException(nameof(apartments));
            }
            var apartmentList = new List <ApartmentInfo>(apartments);

            if (apartmentList.Count == 0)
            {
                throw new ArgumentOutOfRangeException(nameof(apartments));
            }
            Title      = GetGroupTitle(apartmentList);
            Location   = CoreModelsHelper.GetPointsRect(apartmentList.Select(x => x.Location).ToArray()).LocationMiddle;
            HasNewest  = apartmentList.Any(x => x.IsNewest());
            AllIsOld   = apartmentList.All(x => x.IsOld());
            Apartments = apartmentList;
        }
예제 #2
0
        public Region(int id, string name, string colorHex, IEnumerable <PointLatLng> locations)
        {
            if (locations == null)
            {
                throw new ArgumentNullException(nameof(locations));
            }
            _locations = locations.ToArray();
            if (_locations.Length == 0)
            {
                throw new ArgumentOutOfRangeException(nameof(locations));
            }

            _rect    = CoreModelsHelper.GetPointsRect(_locations);
            Id       = id;
            Name     = name;
            ColorHex = colorHex;
            Center   = _rect.LocationMiddle;
        }