c# - 在 MapControl 上画一个圆圈
问题描述
我知道通过基本数学生成点然后使用这些点创建 MapPolygon 来绘制圆的技术。
还有其他方法吗?
例如,我看到有一个圆圈类:
public sealed class Geocircle : IGeocircle, IGeoshape
但我不知道如何使用它,似乎没有MapLayer
它。
解决方案
Geocircle
用于为给定的位置和半径创建地理圆对象。它经常用于制作地图Geofence
,但不用于在地图上显示循环。
有很多方法可以在地图上画一个圆圈
通过基础数学生成点
for (var i = 0; i < 360; i++)
{
//draw a cycle
BasicGeoposition point = new BasicGeoposition()
{ Latitude = centerLatitude + ri * Math.Cos(3.6 * i * 3.14 / 180), Longitude = centerLongitude + ri * Math.Sin(3.6 * i * 3.14 / 180) };
list.Add(point);
}
private void MyMap_Loaded(object sender, RoutedEventArgs e)
{
// Specify a known location.
BasicGeoposition snPosition = new BasicGeoposition { Latitude = 47.620, Longitude = -122.349 };
Geopoint snPoint = new Geopoint(snPosition);
// Create a XAML border.
var ellipse1 = new Ellipse();
ellipse1.Fill = new SolidColorBrush(Windows.UI.Colors.Coral);
ellipse1.Width = 200;
ellipse1.Height = 200;
// Center the map over the POI.
MyMap.Center = snPoint;
MyMap.ZoomLevel = 14;
// Add XAML to the map.
MyMap.Children.Add(ellipse1);
MapControl.SetLocation(ellipse1, snPoint);
MapControl.SetNormalizedAnchorPoint(ellipse1, new Point(0.5, 0.5));
}
推荐阅读
- flutter - Flutter - 如何对通知进行分组
- excel - VBA IE 下拉选择
- sympy - Sympy 求解的 ODE 不满足给定的初始条件
- javascript - 在 CSS 和 JS 中屏蔽 3D 旋转图像
- python - 模块“aioredis”没有属性“create_redis”
- java - 有没有办法让一个不在超类中的方法可以访问超类的实例变量?
- c++ - 将 IP 地址从字符串转换为 IPAddress (Arduino)
- android - Google Civics API:来自此客户端应用程序的请求
被封锁 - objective-c - 如何将数据从 tableview 控制器传递到 Objective-C 中的另一个视图控制器?
- html - 自定义输入类型=“文件”