FlexReport for WPF
マップカスタムフィールド
フィールドとカスタムフィールド > マップカスタムフィールド

FlexReport は、高い拡張性を持つカスタムフィールドアーキテクチャを使用してマップフィールドをサポートします。以下のトピックでは、FlexReportDesigner アプリケーションを使用してレポート内のマップフィールドをカスタマイズする方法を説明します。

FlexReportDesigner アプリケーションでマップカスタムフィールドの使用を開始するには、次の手順を実行します。

  1. C1FlexReportDesigner アプリケーションを実行します。
  2. C1FlexReportDesigner ツールバーにマップアイコンがあることを確認します。アイコンがない場合は、C1FlexReportDesigner.4.exe.settings ファイルの <customfields> セクションに次の行を追加する必要があります。
      
    コードのコピー
    <customfields>
        <item value="C1.Win.FlexReport.CustomFields.4.5.2;C1.Win.FlexReport.CustomFields.Map" />
    </customfields>
    
     
  3. 新しいレポートを作成するか、既存のレポートを開きます。例については、「クイックスタート」を参照してください。
  4. マップアイコンをクリックし、レポートまでドラッグしてマップフィールドを追加します。

これで終わりです。マップフィールドには主に次の要素があります。

C1FlexReport 定義にマップフィールドが含まれ、レポートが非同期に生成されると、マップフィールドを C1FlexViewer コントロールに表示することができません。この回避策として、C1FlexViewer.UseAsyncRendering プロパティを False に設定してください。

Map Custom Field Properties

FlexReportDesigner allows you to set important properties of the Map custom field. The Properties tab on the left-hand side displays properties for custom map field, such as Layers, Tracking, Styles, Spatial Locations and Legends.

Layers

The main part of a map is the tile layer which provides raster graphics representing the Earth surface or part of it, and zero or more layers representing spatial data.

The tile layer is specified by the TileSource property. It may be set to a VirtualEarth tile source (road, aerial, or hybrid). The tile source may be set to "none" in which case no tiles will be drawn on the map. This may be useful especially when other layers such as KML provide enough data for the map visualization.

Note that unless the tile source is "none", the tiles are loaded from a network location when the report runs, which may slow things down considerably.

Except for the tile layer, all other layers are contained in the Layers collection. Currently, three layer types are supported as described below:

Tracking

The map shown by a Map field can automatically center and zoom in on the data shown on the map. This behavior is determined by two factors:

Styles

Visual attributes of map elements are mostly defined by styles. There are several types of styles (point marker styles, line styles and KML item styles); the applicable type is determined by the context, such as points layers use point marker styles, lines layers use line styles, and so on. Usually a style may be specified as a data driven expression (so that the actual style depends on run time data), with a fallback style used by default. How style expressions are specified and evaluated is described next.

The Map custom field contains 3 style collections:

These styles are available to all layers defined on the Map, and also to other Map fields in the current report. The styles in each collection are addressable either by index or - preferably - by name (using the Name property). When a style expression evaluates to a string, that string is used to search for a matching style, first in the current map and if that fails, in all other maps on the current report (only matching type styles are searched; for example, only MarkerStyles collections are searched for a point marker style, and so on).

Spatial Locations

Points and lines layers provide two different ways to specify spatial locations for the data:

Legends

A map can have several associated legends, rendered within its bounds. To facilitate placing a legend outside the map's bounds, the legend can be associated with any map field in the report, so you can add an empty map field just to hold a legend describing another map.

Legends are contained within the Legends collection of the Map field. To add a legend, add an item to that collection. The location of a legend within its map's bounds is determined by the LegendAlignment property. Orientation determines whether items within the legend are placed vertically (default) or horizontally. Several other properties allow to fine-tune the way the legend looks.

Items within the legend are represented by the Items collection. That collection may be populated automatically with data from non-KML layers of the current map, if the Automatic property of the legend is set to True. In that case the Items collection cannot be edited. Otherwise, the legend items must be added manually.

The following types of legend items are supported:

Adding Map Fields

Now that you familiar with the basics of the custom map field, let us see how to add a map field to a report depicting the summary of Employees, Suppliers, and Customers by City.

Complete the following steps:

  1. Create the base report.

    Add a new report in the designer, with C1NWind.mdb as the data source, with the following SQL query:
    Customers and Suppliers by City

  2. Add the main map.

    You'll add the map to the report's header:

    • Make some room for the map by dragging the header's bottom edge down in the report designer.
    • Click on the Map custom field icon and drag it onto the header.
         
  3. Adjust the map's properties.

    Set the map's properties as follows (only non-defaults are shown here):

    • AutoCenter: False
    • AutoZoom: False
    • CenterLatitude: 10
    • CenterLongitude: 15
    • ShowScale: True
    • TileSource: VirtualEarthAerial
    • ZoomLevel: .55
         
  4. Add Layers.

    Click ellipsis button next to Layers collection to open LayerBase Collection Editor. Add Members 'Employees', Suppliers', and 'Customers', select the data source and set their marker style and map location properties.
    LayerBase Collection Editor

    Note that you need to add a data source every time before you add a member to the LayerBase Collection Editor as each member uses different data source.

    The design area looks like the following image:

    Design view

  5. Preview the report.

    Preview Maps in Designer