Beispiel #1
0
        void UpdateText()
        {
            if (String.IsNullOrWhiteSpace(City))
            {
                Text = String.Empty;
            }
            else if (String.IsNullOrWhiteSpace(CityDistrict))
            {
                Text = String.Format("{0} {1}", Locality.GetEnumTitle(), City);
            }
            else
            {
                Text = String.Format("{0} {1} ({2})", Locality.GetEnumTitle(), City, CityDistrict);
            }

            if (osmId == default(long) && City != default(string))
            {
                logger.Debug("Запрос id для города {0}({1})...", City, CityDistrict);
                IOsmService svc = OsmWorker.GetOsmService();
                if (svc == null)
                {
                    logger.Warn("Не удалось получить id города.");
                    return;
                }
                osmId = svc.GetCityId(City, CityDistrict, Locality.ToString());
                logger.Debug("id={0}", osmId);
                OnCitySelected();
            }
        }
Beispiel #2
0
        private void fillAutocomplete()
        {
            if (String.IsNullOrWhiteSpace(Street.Name))
            {
                if (completionListStore != null)
                {
                    completionListStore.Clear();
                }
            }
            else
            {
                logger.Info("Запрос домов на {0}...", Street.Name);
                IOsmService svc = OsmWorker.GetOsmService();

                List <OsmHouse> houses;
                if (Street.Districts == null)
                {
                    houses = svc.GetHouseNumbersWithoutDistrict(Street.CityId, Street.Name);
                }
                else
                {
                    houses = svc.GetHouseNumbers(Street.CityId, Street.Name, Street.Districts);
                }

                //Удаляем литеры А у домов где других литер нет.
                foreach (var house in houses.Where(x => x.Letter == "А" || x.Letter == "а" || x.Letter == "A" || x.Letter == "a"))
                {
                    if (!houses.Any(x => x.HouseNumber == house.HouseNumber && x.Letter != house.Letter))
                    {
                        house.Letter = String.Empty;
                    }
                }
                houses = houses.OrderBy(x => x.ComplexNumber, new StringWorks.NaturalStringComparerNonStatic()).ToList();

                completionListStore = new ListStore(typeof(string), typeof(long), typeof(OsmHouse));
                foreach (var h in houses)
                {
                    completionListStore.AppendValues(h.ComplexNumber, h.Id, h);
                }
                this.Completion.Model = completionListStore;
                logger.Debug("Получено {0} домов...", houses.Count);
            }
            if (CompletionLoaded != null)
            {
                Gtk.Application.Invoke(CompletionLoaded);
            }
        }
Beispiel #3
0
        private void fillAutocomplete()
        {
            logger.Info("Запрос улиц...");
            IOsmService svc     = OsmWorker.GetOsmService();
            var         streets = svc.GetStreets(CityId);

            completionListStore = new ListStore(typeof(string), typeof(string));
            foreach (var s in streets)
            {
                completionListStore.AppendValues(
                    s.Name,
                    s.Districts
                    );
            }
            this.Completion.Model = completionListStore;
            logger.Debug("Получено {0} улиц...", streets.Count);
            if (this.HasFocus)
            {
                this.Completion.Complete();
            }
        }
Beispiel #4
0
        private void fillAutocomplete()
        {
            logger.Info("Запрос городов...");
            IOsmService svc    = OsmWorker.GetOsmService();
            var         cities = svc.GetCities();

            completionListStore = new ListStore(typeof(string), typeof(string), typeof(LocalityType), typeof(long));
            foreach (var c in cities)
            {
                completionListStore.AppendValues(
                    c.Name,
                    c.SuburbDistrict,
                    c.LocalityType,
                    c.OsmId
                    );
            }
            logger.Debug("Получено {0} городов...", cities.Count);
            this.Completion.Model = completionListStore;
            queryIsRunning        = false;
            if (this.HasFocus)
            {
                this.Completion.Complete();
            }
        }