private void worldLayer_Imported(object sender, Infragistics.Controls.Maps.MapLayerImportEventArgs e)
{
if (e.Action == MapLayerImportAction.End)
{
// 図形のための点を保持するための線分群コレクション
MapPolylineCollection lines = new MapPolylineCollection();
List<Point> points = new List<Point>();
// 図形を作るための点
points.Add(new Point(-74.535 - 2, 40.246 - 1));
points.Add(new Point(-74.535 + 2, 40.246 - 1));
points.Add(new Point(-74.535 + 4, 40.246 + 1));
points.Add(new Point(-74.535 - 4, 40.246 + 1));
// 測地座標をデカルト座標に変換します
lines.Add(map1.MapProjection.ProjectToMap(points));
// 表面要素を作成して線分群を使用して図形を配置します
SurfaceElement surfaceElement = new SurfaceElement() { Polylines = lines, Fill = new SolidColorBrush(Colors.Brown) };
map1.Layers[0].Elements.Add(surfaceElement);
Rect worldRect = surfaceElement.WorldRect;
worldRect = lines.GetWorldRect();
surfaceElement.WorldRect = worldRect;
}
}