[UWP] [MapControl] probelm锚定xaml孩子来映射 [英] [UWP][MapControl]probelm anchoring xaml children to map

查看:48
本文介绍了[UWP] [MapControl] probelm锚定xaml孩子来映射的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我目前是UWP MapControl的新手。将XAML子项添加到地图(而不是常规地图元素)时,我遇到一个简单的问题。

I'm new to UWP MapControl currently. I have a simple problem when adding XAML children to map (instead of the regular map elements).


MapStyle设置为Terrian。

MapStyle is set to Terrian.


这是我的代码:

this is my code:

    private void MapRightTapped(MapControl sender, MapRightTappedEventArgs args)
    {
        Ellipse circle = new Ellipse() { Height = 20, Width = 20, Fill = new SolidColorBrush(Colors.Black)};
        sender.Children.Add(circle);

        Geopoint position = new Geopoint(new BasicGeoposition()
        {
            Latitude = args.Location.Position.Latitude,
            Longitude = args.Location.Position.Longitude,
            Altitude = 5000,

        });
        MapControl.SetLocation(circle, position);
        MapControl.SetNormalizedAnchorPoint(circle, new Point(0.5, 0.5));
     }



首先,地图上显示的点正确。  但在缩放或
倾斜地图后,圆圈似乎锚定在地面高度而不是海拔5000

推荐答案

嗨gammal315,

你在创建Geopoint时错过了一个参数。你最好添加Altitude Reference System.Ellipsoid
以确保高度参考系统基于椭圆体,这是形状的数学近似地球。有关详细信息,请参阅

高度参考系统枚举

您可以参考以下代码作为参考:


Geopoint position = new Geopoint(new BasicGeoposition()
            {
                Latitude =args.Location.Position.Latitude,
                Longitude =args.Location.Position.Longitude,
                Altitude = 100,
            }, AltitudeReferenceSystem.Ellipsoid);




最好的问候

Roy Li


这篇关于[UWP] [MapControl] probelm锚定xaml孩子来映射的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆