public void MapItemsRequest(object sender, MapItemsRequestEventArgs eventArgs) { double minZoom = eventArgs.MinZoom; Location upperLeft = eventArgs.UpperLeft; Location lowerRight = eventArgs.LowerRight; if (this.document == null) return; if (minZoom == 3) { // request areas List<StoreLocation> list = this.GetStores( upperLeft.Latitude, upperLeft.Longitude, lowerRight.Latitude, lowerRight.Longitude, StoreType.Area); eventArgs.CompleteItemsRequest(list); } if (minZoom == 9) { // request areas List<StoreLocation> list = this.GetStores( upperLeft.Latitude, upperLeft.Longitude, lowerRight.Latitude, lowerRight.Longitude, StoreType.Store); eventArgs.CompleteItemsRequest(list); } }
/// <summary> /// Callback of the GetStores async call. /// The method uses the web service response to building objects on the dynamic layer. /// </summary> internal void SetStores(List <StoreLocation> list, MapItemsRequestEventArgs request) { if (list.Count == 0) { return; } foreach (StoreLocation storeLocation in list) { // Shifts the store to the current portion of the request. storeLocation.Longitude = this.TryGetLongitudeMatchInRange(storeLocation.Longitude, request.UpperLeft.Longitude, request.LowerRight.Longitude); } request.CompleteItemsRequest(list); }
public void MapItemsRequest(object sender, MapItemsRequestEventArgs eventArgs) { if (this.isFirstRequest) { this.map = eventArgs.Layer.MapControl; this.isFirstRequest = false; } double minZoom = eventArgs.MinZoom; // Coercing (normalizing) the map portion of the request in normal [-180; 180] longitude range. Location upperLeft = map.GetCoercedLocation(eventArgs.UpperLeft); Location lowerRight = map.GetCoercedLocation(eventArgs.LowerRight); if (this.dataContext == null) { return; } if (minZoom == 3) { // request areas. List <StoreLocation> list = this.dataContext.GetStores( upperLeft.Latitude, upperLeft.Longitude, lowerRight.Latitude, lowerRight.Longitude, StoreType.Area); dataContext.SetStores(list, eventArgs); } if (minZoom == 9) { // request areas List <StoreLocation> list = this.dataContext.GetStores( upperLeft.Latitude, upperLeft.Longitude, lowerRight.Latitude, lowerRight.Longitude, StoreType.Store); this.dataContext.SetStores(list, eventArgs); } }
/// <summary> /// Callback of the GetStores async call. /// The method uses the web service response to building objects on the dynamic layer. /// </summary> internal void SetStores(List<StoreLocation> list, MapItemsRequestEventArgs request) { request.CompleteItemsRequest(list); }
public void MapItemsRequest(object sender, MapItemsRequestEventArgs eventArgs) { double minZoom = eventArgs.MinZoom; Location upperLeft = eventArgs.UpperLeft; Location lowerRight = eventArgs.LowerRight; if (this.dataContext == null) return; #if WPF if (minZoom == 3) { // request areas List<StoreLocation> list = this.dataContext.GetStores( upperLeft.Latitude, upperLeft.Longitude, lowerRight.Latitude, lowerRight.Longitude, StoreType.Area); dataContext.SetStores(list, eventArgs); } if (minZoom == 9) { // request areas List<StoreLocation> list = this.dataContext.GetStores( upperLeft.Latitude, upperLeft.Longitude, lowerRight.Latitude, lowerRight.Longitude, StoreType.Store); this.dataContext.SetStores(list, eventArgs); } #elif SILVERLIGHT const string exceptionFormat = "Store Service Exception: {0}"; EndpointAddress address = new EndpointAddress(this.serviceUri); BasicHttpBinding binding = new BasicHttpBinding() { MaxBufferSize = int.MaxValue, MaxReceivedMessageSize = int.MaxValue }; RadMapDataServiceClient client = new RadMapDataServiceClient(binding, address); client.GetStoresCompleted += this.dataContext.DataServiceGetStoresCompleted; if (minZoom == 3) { // request areas try { client.GetStoresAsync( upperLeft.Latitude, upperLeft.Longitude, lowerRight.Latitude, lowerRight.Longitude, RadMapDataServiceStoreType.Area, eventArgs); } catch (Exception ex) { throw new Exception(string.Format(exceptionFormat, ex.Message)); } } if (minZoom == 9) { // request stores try { client.GetStoresAsync( upperLeft.Latitude, upperLeft.Longitude, lowerRight.Latitude, lowerRight.Longitude, RadMapDataServiceStoreType.Store, eventArgs); } catch (Exception ex) { throw new Exception(string.Format(exceptionFormat, ex.Message)); } } #endif }