我正试图在ArcGIS中创建一个覆盖层,该覆盖层具有移动的图形/符号,这些图形/符号由从移动设备接收的坐标更新。我最初可以显示一个简单的符号,但无法在地图上移动。我的测试代码是
GraphicsOverlay machineOverlay = new GraphicsOverlay();
MainMapView.GraphicsOverlays.Add(machineOverlay);
MapPointBuilder rdLocation = new MapPointBuilder(150.864119200149, -32.3478640837185, SpatialReferences.Wgs84);
SimpleMarkerSymbol sRD1234 = new SimpleMarkerSymbol()
{
Color = System.Drawing.Color.Red,
Size = 10,
Style = SimpleMarkerSymbolStyle.Circle
};
Graphic graphicWithSymbol = new Graphic(rdLocation.ToGeometry(), sRD1234);
machineOverlay.Graphics.Add(graphicWithSymbol);
// here the red circle is displayed correctly on the map
rdLocation.SetXY(150.887115, -32.357600);
rdLocation.ReplaceGeometry(rdLocation.ToGeometry());
// here I expect the red circle to move but it doesn't
我需要触发一个事件吗;重新渲染";或者刷新覆盖,或者我需要做什么才能让图形在地图上移动?
这里有一个类似的问题,答案是";只是更新几何图形";这就是我试图做的,但没有成功。
如果有一种完全不同或更好的方法来移动地图上的标记,请建议,我刚刚开始使用ArcGIS运行时。
感谢
经过大量搜索,我替换了一行代码和它现在正在工作的
//rdLocation.ReplaceGeometry(rdLocation.ToGeometry());
graphicWithSymbol.Geometry = rdLocation.ToGeometry();
我似乎误解了ReplaceGeometry()
的功能。对此作出任何澄清都将是有益的。