本文整理汇总了C#中MapIcon.AddData方法的典型用法代码示例。如果您正苦于以下问题:C# MapIcon.AddData方法的具体用法?C# MapIcon.AddData怎么用?C# MapIcon.AddData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MapIcon
的用法示例。
在下文中一共展示了MapIcon.AddData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawPoints
// -------------------- DRAWING STUFF ON THE MAP -----------------------
private async void DrawPoints(object sender, RoutedEventArgs e)
{
// How to draw a new MapIcon with a label, anchorpoint and custom icon.
// Icon comes from project assets
var anchorPoint = new Point(0.5, 0.5);
var image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/wplogo.png"));
// Helper extension method
try
{
var area = MyMap.GetViewArea();
// PointList is just a helper class that gives 'some data'
var points = PointList.GetRandomPoints(
new Geopoint(area.NorthwestCorner), new Geopoint(area.SoutheastCorner),
50);
foreach (var dataObject in points)
{
var shape = new MapIcon
{
Title = dataObject.Name,
Location = new Geopoint(dataObject.Points.First()),
NormalizedAnchorPoint = anchorPoint,
Image = image,
CollisionBehaviorDesired =
onCollisionShow? MapElementCollisionBehavior.RemainVisible :
MapElementCollisionBehavior.Hide,
ZIndex = 3,
};
shape.AddData(dataObject);
MyMap.MapElements.Add(shape);
}
}
catch (Exception)
{
var dialog = new MessageDialog("GetViewArea error");
await dialog.ShowAsync();
}
}
示例2: DrawPoints
private void DrawPoints(object sender, RoutedEventArgs e)
{
// How to draw a new MapIcon with a label, anchorpoint and custom icon.
// Icon comes from shared project assets
var anchorPoint = new Point(0.5, 0.5);
var image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/wplogo.png"));
// Helper extension method
var area = MyMap.GetViewArea();
// GeoboundingBox countains two BasicGeopositions....
// PointList is just a helper class that gives 'some data'
var points = PointList.GetRandomPoints(new Geopoint(area.NorthwestCorner), new Geopoint(area.SoutheastCorner), 50);
foreach (var dataObject in points)
{
///////////////////////////////////////////////////
// Creating the MapIcon
// (text, image, location, anchor point)
var shape = new MapIcon
{
Title = dataObject.Name,
Location = dataObject.Points.First(),
NormalizedAnchorPoint = anchorPoint,
Image = image,
ZIndex = 5
};
shape.AddData(dataObject);
MyMap.MapElements.Add(shape);
}
}