プラグイン
最初にMap Appの構成について説明します。Map Appはbing.
レイヤー(Layer)
プラグインは,
エンティティ(Entity)
エンティティとは,
図6 プッシュピン
オーバーレイ(Overlay)
オーバーレイは,
パネル(Panel,Expanded Panel)
パネルは,
今回 作成するMap Appはひとつのレイヤーとプッシュピンを持っています。
プロジェクトの作成
それでは,
続いて必要なライブラリーを参照します。プロジェクト メニューの
- Microsoft.
Maps. Core. dll - Microsoft.
Maps. Extended. dll - Microsoft.
Maps. MapControl. Types. dll - Microsoft.
Maps. Plugins. dll
プラグイン クラスの作成
プラグインは,
usingディレクティブを記述し必要な型をインポートします。
using Microsoft.Maps.Core;
using Microsoft.Maps.Plugins;
そして,
public class HelloWorldPlugin : Plugin
{
}
Pluginクラスには,
public override void Initialize()
{
base.Initialize();
}
public override void Activate(System.Collections.Generic.IDictionary<string, string> activationParameters)
{
base.Activate(activationParameters);
}
以上で何もしないプラグインができました。ここに各種機能を追加していきます。
ContractのImportとExport
さて,
[ImportSingle("Microsoft/PushpinFactoryContract", ImportLoadPolicy.Synchronous)]
public PushpinFactoryContract PushpinFactoryContract { get; set; }
PushpinFactoryContractは地図上にプッシュピンを追加する機能を提供します。上記のように記述することで,