IMapTileProviderおよびIMapTileインタフェースと一部修正を加えたGrapecity.ActiveReports.configファイルを使用して、Map(Professional)コントロールにカスタムタイルプロバイダを追加し、構成することができます。カスタムタイルプロバイダをセットアップする手順を以下に示します。
Visual Basic
| Visual Basicコード (クラスの一番上に貼り付けます) |
コードのコピー
|
|---|---|
Imports System Imports System.Collections.Specialized Imports GrapeCity.ActiveReports.Extensibility.Rendering.Components.Map |
|
| Visual Basicコード (Importsステートメントの下に貼り付けます) |
コードのコピー
|
|---|---|
Public Class MyTileProvider
Implements IMapTileProvider
' タイルプロバイダの設定(ApiKey、Language、Styleなど)
Public Property Settings() As NameValueCollection
Get
Return m_Settings
End Get
Private Set
m_Settings = Value
End Set
End Property
Private m_Settings As NameValueCollection
' 指定された座標と詳細化レベルによってタイルのインスタンスを取得します
Public Sub GetTile(key As MapTileKey, success As Action(Of IMapTile), [error] As Action(Of Exception))
End Sub
End Class
|
|
C#
| C#コード (クラスの一番上に貼り付けます) |
コードのコピー
|
|---|---|
using System; using System.Collections.Specialized; using GrapeCity.ActiveReports.Extensibility.Rendering.Components.Map; |
|
| C#コード (Usingステートメントの下に貼り付けます) |
コードのコピー
|
|---|---|
public class MyTileProvider : IMapTileProvider
{
// タイルプロバイダの設定(ApiKey、Language、Styleなど)
public NameValueCollection Settings { get; private set; }
// 指定された座標と詳細化レベルによってタイルのインスタンスを取得します
public void GetTile(MapTileKey key, Action<IMapTile> success, Action<Exception> error)
{
}
}
|
|
Visual Basic
| Visual Basicコード (クラスの一番上に貼り付けます) |
コードのコピー
|
|---|---|
Imports System.IO Imports GrapeCity.ActiveReports.Extensibility.Rendering.Components.Map |
|
| Visual Basicコード (Importsステートメントの下に貼り付けます) |
コードのコピー
|
|---|---|
Public Class MyMapTile
Implements IMapTile
' タイル識別子を取得します。
Public Property Id() As MapTileKey
Get
Return m_Id
End Get
Private Set
m_Id = Value
End Set
End Property
Private m_Id As MapTileKey
' タイル画像ストリームを取得します。
Public Property Image() As Stream
Get
Return m_Image
End Get
Private Set
m_Image = Value
End Set
End Property
Private m_Image As Stream
End Class
|
|
C#
| C#コード (クラスの一番上に貼り付けます) |
コードのコピー
|
|---|---|
using System.IO; using GrapeCity.ActiveReports.Extensibility.Rendering.Components.Map; |
|
| C#コード (Usingステートメントの下に貼り付けます) |
コードのコピー
|
|---|---|
public class MyMapTile : IMapTile
{
// タイル識別子を取得します。
public MapTileKey Id { get; private set; }
// タイル画像ストリームを取得します。
public Stream Image { get; private set; }
}
|
|
| <Configuration></Configuration>タグ内に貼り付けます。 |
コードのコピー
|
|---|---|
<!-- カスタムタイルプロバイダを登録して構成します。 -->
<MapTileProvider Name="Custom" DisplayName="Custom Maps" type="YourTileProvider, AssemblyName, Version = x.x.x.x">
<Settings>
<add key="ApiKey" value="API Key" />
</Settings>
</MapTileProvider>
|
|