/// <summary> /// Version of FindLocation that searches using a LatLong object /// </summary> /// <param name="aLatLong">a LatLong</param> /// <returns></returns> public Location FindLocation(LatLong aLatLong) { Location[] location = null; try { if (aLatLong == null) { throw new System.ArgumentNullException("LatLong cannot be null"); } //OK find something FindSpecification fs = new FindSpecification(); fs.DataSourceName = "MapPoint.NA"; LatLong locationLatLong = aLatLong; GetInfoOptions infoOptions = new GetInfoOptions(); location = theMapPointFindService.GetLocationInfo(locationLatLong, MAPPOINT_NA, infoOptions); } catch (ArgumentNullException e) { throw e; // rethrow for app to handle } catch (Exception e) { throw e; // rethrow for app to handle } return(location[0]); // zero position should be the best match }
public Fotofly.Address FindAddress(GpsPosition gpsPosition, string country, bool useCache) { Fotofly.Address returnValue = new Fotofly.Address(); // Check Resolver Cache if (this.resolverCache != null && useCache) { returnValue = this.resolverCache.FindAddress(gpsPosition); if (returnValue != null && returnValue.IsValidAddress) { return(returnValue); } } // Reset incase null from above returnValue = new Fotofly.Address(); // Set the LatLong LatLong latLong = new LatLong(); latLong.Latitude = gpsPosition.Latitude.Numeric; latLong.Longitude = gpsPosition.Longitude.Numeric; // Set the datasource BingMapsDataSources dataSource = this.LiveMapsDataSource(country); GetInfoOptions options = new GetInfoOptions(); options.IncludeAddresses = true; options.IncludeAllEntityTypes = false; GetLocationInfoRequest infoRequest = new GetLocationInfoRequest(); infoRequest.dataSourceName = "MapPoint." + dataSource.ToString(); infoRequest.options = options; infoRequest.location = latLong; Location[] places = null; try { places = this.findService.GetLocationInfo(null, null, latLong, infoRequest.dataSourceName, options); } catch (EndpointNotFoundException e) { throw new Exception("Unable to find\\connect to Bing Map WebService", e); } catch (TimeoutException e) { throw new Exception("Bing Map call timed out", e); } catch (Exception e) { places = null; } if (places != null && places.Length > 0 && places[0].Address != null) { returnValue.Country = places[0].Address.CountryRegion; returnValue.Region = this.LookupRegionName(places[0].Address.Subdivision, returnValue.Country); returnValue.City = places[0].Address.PrimaryCity; returnValue.AddressLine = places[0].Address.AddressLine; } else { // Add to Failure to cache if (this.resolverCache != null) { this.resolverCache.AddToReverseFailedRecords(gpsPosition); } } return(returnValue); }
public void Read (TProtocol iprot) { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.String) { Id = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.Struct) { Options = new GetInfoOptions(); Options.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); }
public void send_getTopologyInfoWithOpts(string id, GetInfoOptions options) #endif { oprot_.WriteMessageBegin(new TMessage("getTopologyInfoWithOpts", TMessageType.Call, seqid_)); getTopologyInfoWithOpts_args args = new getTopologyInfoWithOpts_args(); args.Id = id; args.Options = options; args.Write(oprot_); oprot_.WriteMessageEnd(); #if SILVERLIGHT return oprot_.Transport.BeginFlush(callback, state); #else oprot_.Transport.Flush(); #endif }
public IAsyncResult send_getTopologyInfoWithOpts(AsyncCallback callback, object state, string id, GetInfoOptions options)
public TopologyInfo getTopologyInfoWithOpts(string id, GetInfoOptions options) { #if !SILVERLIGHT send_getTopologyInfoWithOpts(id, options); return recv_getTopologyInfoWithOpts(); #else var asyncResult = Begin_getTopologyInfoWithOpts(null, null, id, options); return End_getTopologyInfoWithOpts(asyncResult); #endif }
public IAsyncResult Begin_getTopologyInfoWithOpts(AsyncCallback callback, object state, string id, GetInfoOptions options) { return send_getTopologyInfoWithOpts(callback, state, id, options); }