英文:
Highlight buildings in a map
问题
我有一个需求,需要在地图上突出显示我当前位置周围的建筑物。我正在使用Xamarin,并想知道是否有人可以指向一个正确的库或控件,可以满足我的需求。
我目前正在使用Xamarin的Mapsui,但我不认为它具备我正在寻找的功能。
英文:
I have a requirement where I need to highlight the buildings around my current location on a map. I am using Xamarin and was wondering if anyone can point me to a correct library or control that can fulfill my requirement.
I am currently using Mapsui for Xamarin but I don't think it has the feature I am looking for.
答案1
得分: 1
如果您可以访问建筑物的几何信息,有多种方法可以实现高亮显示。
一种方法是创建一个位于背景图层之上的图层,其几何与数据源相同。使用ThemeStyle来仅显示选定的几何图形。ThemeStyle类是使用回调方法创建的,该方法确定样式。在该方法中,除非要素ID与选定要素ID相同,否则应返回无样式。
您可以查看ThemeStyle示例以了解主题的更一般用途(无高亮显示)。
此外,您可以查看Mapsui.Sample.Wpf.Editing。以下是该示例的屏幕截图:
英文:
If you have access to the geometries of the buildings there are many ways you could implement highlighting.
One way that comes to mind. Create a layer on top of your background layer with the same geometries as data source. Use a ThemeStyle to show only the selected geometry. The ThemeStyle class is created with a callback method which determines the style. In that method you should return no style unless the feature id is the same as selected feature id.
You can take a look at the ThemeStyle sample for a more general use of themes (no highlighting).
Also you could look at Mapsui.Sample.Wpf.Editing. Here is a screenshot of that sample:
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论