当前位置: 首页>>代码示例>>C#>>正文


C# MapIcon.AddData方法代码示例

本文整理汇总了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();
      }
    }
开发者ID:LocalJoost,项目名称:Manipulation_Drawing,代码行数:43,代码来源:MainPage.xaml.cs

示例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);
      }
    }
开发者ID:MuffPotter,项目名称:201505-MVA,代码行数:31,代码来源:MainPage.xaml.cs


注:本文中的MapIcon.AddData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。