Exemplo n.º 1
0
        public async Task <IActionResult> Get(double lat, double lng, double radius = 10, double popularity = 0, string categories = "")
        {
            try
            {
                var attractions = await _attractionRepository.GetAttractions(lat, lng, radius, Convert.ToInt32(popularity));

                var result = new List <Attraction>();
                foreach (var attraction in attractions)
                {
                    if (GeoCodeCalc.CalcDistance(lat, lng, attraction.lat, attraction.lng) > radius)
                    {
                        continue;
                    }
                    if (attraction.reviews < popularity)
                    {
                        continue;
                    }
                    if (!GeoSearch.HasCategory(attraction, categories))
                    {
                        continue;
                    }
                    result.Add(attraction);
                }

                return(Ok(result));
            }
            catch (Exception e)
            {
                return(StatusCode(500, e.ToString()));
            }
        }
Exemplo n.º 2
0
        public SearchResult(GeoSearch geoSearch)
        {
            m_GeoSearch = geoSearch;
            InitializeComponent();

            listSearchResults.DataSource    = m_GeoSearch.SearchResultList;
            listSearchResults.DisplayMember = "Result";
            listSearchResults.ValueMember   = "Result";

            //m_GeoSearch.NewSearchCall += m_GeoSearch_NewSearchCall;
        }
Exemplo n.º 3
0
 void client_success(GeoSearch results)
 {
     if (results.response.results != null)
     {
         foreach (City m in results.response.results)
         {
             ListCities.Add(m);
         }
         this.IsDataLoaded = true;
     }
     else
     {
         this.IsDataLoaded = false;
     }
 }
Exemplo n.º 4
0
        public void InitLightMapProjectToolBar()
        {
            barManager.Form = this;
            barManager.BeginUpdate();


            #region Create GeoSearch bar

            var geoSearchBar = new Bar(barManager, "GeoSearch");
            geoSearchBar.OptionsBar.AllowDelete             = false;
            geoSearchBar.OptionsBar.AllowQuickCustomization = false;
            geoSearchBar.OptionsBar.DisableClose            = true;
            geoSearchBar.OptionsBar.DisableCustomization    = true;
            geoSearchBar.DockStyle           = BarDockStyle.Top;
            geoSearchBar.CanDockStyle        = BarCanDockStyle.Top;
            geoSearchBar.OptionsBar.BarState = BarState.Expanded;
            geoSearchBar.Visible             = true;
            geoSearchBar.DockRow             = 0;
            geoSearchBar.DockCol             = 3;
            geoSearchBar.ApplyDockRowCol();

            //create MapSelectorTool
            var beGeoSearch = new RepositoryItemButtonEdit();
            //beGeoSearch.Buttons[0].ToolTip = "Search for administrative unit";
            beGeoSearch.Buttons[0].Kind    = ButtonPredefines.Glyph;
            beGeoSearch.Buttons[0].Caption = "Search";

            var toolTipTitle = new ToolTipTitleItem();
            toolTipTitle.Text = EidssMessages.GetForCurrentLang("gis_Geosearch_Tooltip", "Search for administrative unit");
            //"Search for administrative unit";
            var superToolTip = new SuperToolTip();
            superToolTip.Items.Add(toolTipTitle);

            var beiGeoSearch = new BarEditItem(barManager, beGeoSearch)
            {
                SmallWithoutTextWidth = 130,
                SmallWithTextWidth    = 130,
                Width    = 130,
                SuperTip = superToolTip
            };


            m_GeoSearch = new GeoSearch {
                MapControl = m_mapImage, ControlForVisualize = beiGeoSearch
            };

            geoSearchBar.AddItem(beiGeoSearch);
            beiGeoSearch.Visibility = BarItemVisibility.Always;

            beGeoSearch.ButtonClick += beGeoSearch_ButtonClick;


            #endregion

            //create map projects bar
            var mapsBar = new Bar(barManager, "MapProjects");
            mapsBar.OptionsBar.AllowDelete             = false;
            mapsBar.OptionsBar.AllowQuickCustomization = false;
            mapsBar.OptionsBar.DisableClose            = true;
            mapsBar.OptionsBar.DisableCustomization    = true;

            mapsBar.DockStyle           = BarDockStyle.Top;
            mapsBar.CanDockStyle        = BarCanDockStyle.Top;
            mapsBar.OptionsBar.BarState = BarState.Expanded;
            mapsBar.Visible             = true;
            mapsBar.DockRow             = 0;
            mapsBar.DockCol             = 0;
            mapsBar.ApplyDockRowCol();

            //create ExportImage Tool
            var mbb   = new MapBarButton();
            var mTool = new MtExportAsImage {
                MapImage = m_mapImage
            };
            mbb.MapTool = mTool;
            mapsBar.AddItem(mbb);

            //create Admin filter Tool
            mbb = new MapBarButton();
            var mTool1 = new MtAdminMask()
            {
                MapImage = m_mapImage
            };
            mbb.MapTool = mTool1;
            mapsBar.AddItem(mbb);

            //create MapSelectorTool
            var cmb = new RepositoryItemComboBox();
            var bei = new BarEditItem(barManager, cmb);
            bei.SmallWithoutTextWidth = 118;
            bei.SmallWithTextWidth    = 118;
            bei.Width = 118;

            if (m_MapSelector != null)
            {
                m_MapSelector.Dispose();
            }
            m_MapSelector = new MapSelector {
                MapControl = m_mapImage, ControlForVisualize = bei, Content = m_MapContent
            };
            m_MapSelector.MapChanging += m_MapSelector_MapChanging;

            mapsBar.AddItem(bei);

            barManager.EndUpdate();
        }