gpt4 book ai didi

uwp-maps - UWP map ,添加 3D 对象

转载 作者:行者123 更新时间:2023-12-01 01:58:35 24 4
gpt4 key购买 nike

我想在 Windows 10 UWP map 控件中添加 3D 对象。

该对象将是“具有高度的多边形”,例如房子的简单表示 - 长方体或立方体。

插图图片:

Illustration

我知道我可以添加 Xaml 控件(并在其中添加 3D 对象,例如 Cube),但是这个 Cube 不是“ map 对象”,只是固定到某个纬度/经度。

知道如何实现吗?

最佳答案

微软已添加 MapElement3D in Windows 10 Insider Preview v10.0.16257.0. - 这是瀑布创作者更新。它允许您添加对象、转动它们、控制它们的大小和方向。你也可以让他们动起来!

例子

Example

如何

Represents a 3D element displayed on a MapControl.



它的用法似乎与其他 MapElements 非常相似,例如 MapIconsMapBillboards .
map3dSphereStreamReference = RandomAccessStreamReference.CreateFromUri
(new Uri("ms-appx:///Assets/trainengine.3mf"));

var myModel = await MapModel3D.CreateFrom3MFAsync(map3dSphereStreamReference,
MapModel3DShadingOption.Smooth);

var my3DElement = new MapElement3D();
my3DElement.Location = myMap.Center;
my3DElement.Model = myModel;

myMap.MapElements.Add(my3DElement);

当心两个未记录的问题:
  • 尝试将相同的 3DMapElement 添加到两个不同的 MapControl 将导致 System.AccessViolationException。如果您缓存了 3D 模型而不是带有 map 控件的页面,则可能会发生这种情况。

  • HResult=-2147467261 Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.


  • 尝试调用 MapModel3D.CreateFrom3MFAsync()来自非 Ui 线程将导致崩溃。这必须从 UI 线程调用。
  • 关于uwp-maps - UWP map ,添加 3D 对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38504472/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com