CivicAddressResolver クラス

定義

座標ベースの場所を都市の住所に解決する機能を提供します。

public ref class CivicAddressResolver sealed : System::Device::Location::ICivicAddressResolver
public sealed class CivicAddressResolver : System.Device.Location.ICivicAddressResolver
type CivicAddressResolver = class
    interface ICivicAddressResolver
Public NotInheritable Class CivicAddressResolver
Implements ICivicAddressResolver
継承
CivicAddressResolver
実装

次のプログラムは、 を呼び出 ResolveAddress して市民アドレスを同期的に解決する方法を示しています。

using System;
using System.Device.Location;
namespace ResolveAddressSync
{
    class Program
    {
        static void Main(string[] args)
        {
            ResolveAddressSync();
        }
        static void ResolveAddressSync()
        {
            GeoCoordinateWatcher watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.High);
            watcher.MovementThreshold = 1.0; // set to one meter
            watcher.TryStart(false, TimeSpan.FromMilliseconds(1000));

            CivicAddressResolver resolver = new CivicAddressResolver();

            if (watcher.Position.Location.IsUnknown == false)
            {
                CivicAddress address = resolver.ResolveAddress(watcher.Position.Location);

                if (!address.IsUnknown)
                {
                    Console.WriteLine("Country: {0}, Zip: {1}",
                            address.CountryRegion,
                            address.PostalCode);
                }
                else
                {
                    Console.WriteLine("Address unknown.");
                }
            }
        }
    }
}
Imports System.Device.Location

Module ResolveAddressSync

    Public Sub ResolveAddressSync()
        Dim watcher As GeoCoordinateWatcher
        watcher = New System.Device.Location.GeoCoordinateWatcher(GeoPositionAccuracy.High)
        Dim started As Boolean = False
        watcher.MovementThreshold = 1.0     'set to one meter
        started = watcher.TryStart(False, TimeSpan.FromMilliseconds(1000))

        Dim resolver As CivicAddressResolver = New CivicAddressResolver()
        If started Then
            If Not watcher.Position.Location.IsUnknown Then
                Dim address As CivicAddress = resolver.ResolveAddress(watcher.Position.Location)
                If Not address.IsUnknown Then
                    Console.WriteLine("Country: {0}, Zip: {1}",
                                address.CountryRegion,
                                address.PostalCode)
                Else
                    Console.WriteLine("Address unknown.")
                End If
            End If
        Else
            Console.WriteLine("GeoCoordinateWatcher timed out on start.")
        End If
    End Sub


    Public Sub Main()

        ResolveAddressSync()
        Console.WriteLine("Enter any key to quit.")
        Console.ReadLine()
    End Sub

End Module

次のプログラムは、 を呼び出 ResolveAddressAsync して市民アドレスを非同期的に解決する方法を示しています。

using System;
using System.Device.Location;
namespace ResolveAddressSync
{
    class Program
    {
        static void Main(string[] args)
        {
            ResolveAddressSync();
        }
        static void ResolveAddressSync()
        {
            GeoCoordinateWatcher watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.High);
            watcher.MovementThreshold = 1.0; // set to one meter
            watcher.TryStart(false, TimeSpan.FromMilliseconds(1000));

            CivicAddressResolver resolver = new CivicAddressResolver();

            if (watcher.Position.Location.IsUnknown == false)
            {
                CivicAddress address = resolver.ResolveAddress(watcher.Position.Location);

                if (!address.IsUnknown)
                {
                    Console.WriteLine("Country: {0}, Zip: {1}",
                            address.CountryRegion,
                            address.PostalCode);
                }
                else
                {
                    Console.WriteLine("Address unknown.");
                }
            }
        }
    }
}
Imports System.Device.Location

Module ResolveAddressSync

    Public Sub ResolveAddressSync()
        Dim watcher As GeoCoordinateWatcher
        watcher = New System.Device.Location.GeoCoordinateWatcher(GeoPositionAccuracy.High)
        Dim started As Boolean = False
        watcher.MovementThreshold = 1.0     'set to one meter
        started = watcher.TryStart(False, TimeSpan.FromMilliseconds(1000))

        Dim resolver As CivicAddressResolver = New CivicAddressResolver()
        If started Then
            If Not watcher.Position.Location.IsUnknown Then
                Dim address As CivicAddress = resolver.ResolveAddress(watcher.Position.Location)
                If Not address.IsUnknown Then
                    Console.WriteLine("Country: {0}, Zip: {1}",
                                address.CountryRegion,
                                address.PostalCode)
                Else
                    Console.WriteLine("Address unknown.")
                End If
            End If
        Else
            Console.WriteLine("GeoCoordinateWatcher timed out on start.")
        End If
    End Sub


    Public Sub Main()

        ResolveAddressSync()
        Console.WriteLine("Enter any key to quit.")
        Console.ReadLine()
    End Sub

End Module

注釈

クラスは CivicAddressResolver 、 の実装 ICivicAddressResolver を提供します。場所プロバイダーが座標と市民の住所データの両方を提供する場合は、座標ベースの場所を市民の住所に解決します。

コンストラクター

CivicAddressResolver()

CivicAddressResolver クラスの新しいインスタンスを初期化します。

メソッド

Equals(Object)

指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
ResolveAddress(GeoCoordinate)

緯度と経度に基づく場所から、都市の住所を同期的に解決します。 この呼び出しは、住所の解決中に、スレッドの呼び出し実行をブロックします。

ResolveAddressAsync(GeoCoordinate)

緯度と経度に基づいている場所から非同期的にアドレスを解決します。 呼び出しは、アドレスの解決中に、呼び出しスレッドの実行をブロックしません。

ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

イベント

ResolveAddressCompleted

ResolveAddressAsync(GeoCoordinate) の呼び出しによって開始された住所の解決が完了すると発生します。

適用対象