マッピング サービス

マッピング サービスは ePlot DWF を作成します。

ePlot DWF は、主にオフラインでの表示や印刷に使用するために作られています。ePlot DWF には MgPlotSpecification が含まれており、これを使用してページ サイズや余白を定義できます。また、オプションの MgLayout も含まれており、これを使用して、プロットに含める追加コンポーネント(凡例やカスタム ロゴなど)を定義することもできます。レイアウトは、リポジトリの印刷レイアウトに従います。PrintLayout スキーマに関する説明は、『Infrastructure Map Server Web API リファレンス』を参照してください。

複数のシートを使用して ePlot DWF を作成するには、MgMapPlotCollection を使用します。コレクション内の各アイテムは、1 つのシートを表す MgMapPlot です。

注:

複数の DWF を印刷する場合、マップ名がシート名になります。DWF ファイル内の各シートは固有の名前を持たなければならないため、DWF ファイル内のシートごとに個別の MgMap オブジェクトを作成する必要があります。

次の例では、2 つのシートがあり、複数の印刷を行う DWF を作成します。2 番目のシートでは最初のシートと同じマップ領域を表示しますが、印刷レイアウトによって表題と凡例情報が追加されます。

$dwfVersion = new MgDwfVersion("6.01", "1.2");
 
$plotSpec = new MgPlotSpecification(8.5, 11, 
  MgPageUnitsType::Inches);
$plotSpec->SetMargins(0.5, 0.5, 0.5, 0.5);
 
$plotCollection = new MgMapPlotCollection();
 
$plot1 = new MgMapPlot($map, $plotSpec, $layout);
$plotCollection->Add($plot1);
 
// Create a second map for the second sheet in the DWF. This 
// second map uses the print layout
// to display a page title and legend.
 
$map2 = new MgMap();
$map2->Create($resourceService, $map->GetMapDefinition(), 
  'Sheet 2');
$layoutRes = new MgResourceIdentifier(
  "Library://Samples/Sheboygan/Layouts/SheboyganMap.PrintLayout");
$layout =  new MgLayout($layoutRes, "City of Sheboygan", 
  MgPageUnitsType::Inches);
$plot2 = new MgMapPlot($map2, 
  $map->GetViewCenter()->GetCoordinate(), $map->GetViewScale(), 
  $plotSpec, $layout);
$plotCollection->Add($plot2);
 
$byteReader = $mappingService->
  GenerateMultiPlot($plotCollection, $dwfVersion);
 
// Now output the resulting DWF.
 
$outputBuffer = '';
$buffer = '';
while ($byteReader->Read($buffer, 50000) != 0)
{
  $outputBuffer .= $buffer;
}
 
header('Content-Type: ' . $byteReader->GetMimeType());
header('Content-Length: ' . strlen($outputBuffer));
echo $outputBuffer;