【发布时间】:2018-03-19 23:04:10
【问题描述】:
我正在编写一个小应用程序,它将接收一个国家代码(2 个 ISO 字母)和一个州代码(也是 2 个字母 ISO 代码)。
我想突出显示(和颜色)这 2 条信息指定的区域(假设“CA,QC”,将突出显示加拿大的魁北克州)
我不需要其他任何东西(嗯,也许是 FadeIn、FadeOut 动画,但我稍后会弄清楚这个)
所有缩放/点击/单击/其他操作都被阻止。
MapControl 声明非常简单:
<maps:MapControl Grid.Row="1" x:Name="myMap" ZoomLevel="0"/>
提前致谢
编辑:经过大量研究,在以下答案的帮助下,我很惊讶 BASIC 操作不是 Microsoft 平台的一部分。这太疯狂了。所有后端都在不到 30 分钟内完成编码(包括身份验证、列出属性、检查访问级别、设置 SignalR 回调),但在视觉方面,我们没有来自 UWP 平台的任何东西。这很可悲。 /再见UWP,我试过了。多次。
编辑 2:通过一些调整使其工作:
if (feature != null && (feature.Geometry.Type == GeoJSONObjectType.Polygon) || (feature.Geometry.Type == GeoJSONObjectType.MultiPolygon))
{
myMap.MapElements.Clear();
MapPolygon polygon = null;
if (feature.Geometry.Type == GeoJSONObjectType.Polygon)
{
var polygonGeometry = feature.Geometry as Polygon;
polygon = new MapPolygon
{
Path = new Geopath(polygonGeometry.Coordinates[0].Coordinates.Select(coord => new BasicGeoposition() { Latitude = coord.Latitude, Longitude = coord.Longitude })),
FillColor = Colors.DarkRed
};
myMap.MapElements.Add(polygon);
}
else
{
var ploy = (feature.Geometry as MultiPolygon);
foreach (var item in ploy.Coordinates)
{
var polygon1 = new MapPolygon
{
Path = new Geopath(item.Coordinates[0].Coordinates.Select(coord => new BasicGeoposition() { Latitude = coord.Latitude, Longitude = coord.Longitude })),
FillColor = Colors.DarkRed
};
myMap.MapElements.Add(polygon1);
}
}
}
【问题讨论】: