Example #1
0
        public void MapCenter(string LOCid)
        {
            try
            {
                this.lOC_COORDINATETableAdapter.Fill(this.genelDataSet.LOC_COORDINATE, LOCid);
                string keyword = this.genelDataSet.LOC_COORDINATE[0].KEYWORD;
                GP.Latitude  = this.genelDataSet.LOC_COORDINATE[0].NORTH;
                GP.Longitude = this.genelDataSet.LOC_COORDINATE[0].EAST;

                searchProvider.ClearResults();
                if (GP.Latitude == 0 && GP.Longitude == 0)
                {
                    searchProvider.Search(keyword);
                }
                else
                {
                    map.CenterPoint = GP;
                }
                //GP.Latitude = this.genelDataSet.LOC_COORDINATE[0].NORTH;
                //GP.Longitude = this.genelDataSet.LOC_COORDINATE[0].EAST;
                //mapControl1.CenterPoint = GP; //new DevExpress.XtraMap.GeoPoint(this.genelDataSet.LOC_COORDINATE[0].NORTH, this.genelDataSet.LOC_COORDINATE[0].EAST);
            }
            catch (System.Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
            }
        }
Example #2
0
        private void SearchAsync()
        {
            EndInvoke(_asyncResult);
            string search = $"{TextEditName.Text}, {SearchLookupEditState.EditValue}, {(SearchLookupEditCountry.EditValue as CodeName)?.Name}";

            BingSearchDataProvider.Search(search);
        }
Example #3
0
 void SearchAsync()
 {
     this.EndInvoke(asyncResult);
     if (idx < addresses.Count)
     {
         searchProvider.Search(addresses[idx++]);
     }
 }
        public override InformationDataProviderBase CreateDataProvider(InformationLayer layer, string search, int resultCount)
        {
            GeoPoint anchorPoint = null;

            if (AnchorPoint != null && AnchorPoint.Length > 0 && AnchorPoint.Length != 2)
            {
                throw new Exception("Invalid anchor point. Shall be a double array with 2 elements.");
            }

            if (AnchorPoint != null && AnchorPoint.Length == 2)
            {
                anchorPoint = new GeoPoint(AnchorPoint[0], AnchorPoint[1]);
            }

            SearchBoundingBox boundingBox = null;

            if (BoundingBox != null && BoundingBox.Length > 0 && BoundingBox.Length != 4)
            {
                throw new Exception("Invalid bounding box. Shall be a double array with 4 elements.");
            }

            if (BoundingBox != null && BoundingBox.Length == 4)
            {
                boundingBox = new SearchBoundingBox(BoundingBox[0], BoundingBox[1], BoundingBox[2], BoundingBox[3]);
            }

            var provider = new BingSearchDataProvider()
            {
                BingKey               = Parameters.BingMapKey,
                ConnectionProtocol    = ConnectionProtocol.Https,
                GenerateLayerItems    = true,
                MaxVisibleResultCount = resultCount,
                ProcessMouseEvents    = false
            };

            provider.SearchOptions.ResultsCount = resultCount;

            layer.DataProvider = provider;

            /*
             * var completion = new TaskCompletionSource<InformationDataProviderBase>();
             *
             * provider.SearchCompleted += (s, e) =>
             * {
             *      completion.SetResult(provider);
             * };
             */

            provider.Search(search, Culture, anchorPoint, boundingBox);

            //return completion.Task.Result;
            return(provider);
        }
        public SCMap AddBingSearchLayer(string search, BingSearchLayerOptions options = null)
        {
            options ??= new BingSearchLayerOptions();

            GeoPoint anchorPoint = null;

            if (options.AnchorPoint != null && options.AnchorPoint.Length > 0 && options.AnchorPoint.Length != 2)
            {
                throw new Exception("Invalid anchor point. Shall be a double array with 2 elements.");
            }

            if (options.AnchorPoint != null && options.AnchorPoint.Length == 2)
            {
                anchorPoint = new GeoPoint(options.AnchorPoint[0], options.AnchorPoint[1]);
            }

            SearchBoundingBox boundingBox = null;

            if (options.BoundingBox != null && options.BoundingBox.Length > 0 && options.BoundingBox.Length != 4)
            {
                throw new Exception("Invalid bounding box. Shall be a double array with 4 elements.");
            }

            if (options.BoundingBox != null && options.BoundingBox.Length == 4)
            {
                boundingBox = new SearchBoundingBox(options.BoundingBox[0], options.BoundingBox[1], options.BoundingBox[2], options.BoundingBox[3]);
            }

            var provider = new BingSearchDataProvider()
            {
                BingKey               = Parameters.BingMapKey,
                ConnectionProtocol    = ConnectionProtocol.Https,
                GenerateLayerItems    = true,
                MaxVisibleResultCount = options.ResultCount,
                ProcessMouseEvents    = false
            };

            provider.SearchOptions.ResultsCount = options.ResultCount;

            options.CreateLayer(this, provider);

            provider.Search(search, options.Culture, anchorPoint, boundingBox);

            return(this);
        }
Example #6
0
 private void search_Click(object sender, EventArgs e)
 {
     // Call the Search method.
     searchProvider.Search(tbLocation.Text);
 }