Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/310.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在MapControl-uwp c上移动图像#_C#_Google Maps_Uwp_Uwp Maps - Fatal编程技术网

C# 在MapControl-uwp c上移动图像#

C# 在MapControl-uwp c上移动图像#,c#,google-maps,uwp,uwp-maps,C#,Google Maps,Uwp,Uwp Maps,我正在使用MapControl在地图上绘制路线(使用GMAPUSWPSDK)。它使用一组位置绘制路线。现在我想在这条路线上移动一辆车。为此,我做了如下工作 Image vehicleImg = new Image { Width = 40, Source = VehicleIconSource }; MyMap.Children.Add(vehicleImg); AddLocationsOfVehicle() //location of vehicle change when cal

我正在使用MapControl在地图上绘制路线(使用GMAPUSWPSDK)。它使用一组位置绘制路线。现在我想在这条路线上移动一辆车。为此,我做了如下工作

Image vehicleImg = new Image
{
Width = 40,
Source = VehicleIconSource    
}; 
MyMap.Children.Add(vehicleImg);

AddLocationsOfVehicle() //location of vehicle change when calling this function
{
BasicGeoposition geoposition = new BasicGeoposition();
geoposition.Latitude = AppGlobals._VehicleDetailsList[0].VLat;
geoposition.Longitude = AppGlobals._VehicleDetailsList[0].VLng;
Geopoint mypoint = new Geopoint(geoposition);
MapControl.SetLocation(vehicleImg , mypoint);
}
现在车辆正在从一个位置跳到另一个位置。取而代之的是,如何将车辆从一个点移动到另一个点?这是在路线上添加车辆的正确方法吗?是否存在实现此任务的有用链接?此外,现在车辆没有像谷歌地图那样正确地放置在路线上。图像被视为正好位于路线之外。到达转弯位置时,我如何旋转/转弯车辆?

您可以为此添加图钉(标记),并在 所有物 看

这是示例代码

public void AddSpaceNeedleIcon()
{
    var MyLandmarks = new List<MapElement>();

    BasicGeoposition snPosition = new BasicGeoposition { Latitude = 47.620, Longitude = -122.349 };
    Geopoint snPoint = new Geopoint(snPosition);

    var spaceNeedleIcon = new MapIcon
    {
        Location = snPoint,
        NormalizedAnchorPoint = new Point(0.5, 1.0),
        ZIndex = 0,
        Title = "Space Needle"
    };

    MyLandmarks.Add(spaceNeedleIcon);

    var LandmarksLayer = new MapElementsLayer
    {
        ZIndex = 1,
        MapElements = MyLandmarks
    };

    myMap.Layers.Add(LandmarksLayer);

    myMap.Center = snPoint;
    myMap.ZoomLevel = 14;

}
public void AddSpaceNeedleIcon()
{
var MyLandmarks=新列表();
基本地理位置snPosition=新的基本地理位置{纬度=47.620,经度=-122.349};
地质点snPoint=新的地质点(SNPOINTION);
var spaceNeedleIcon=新的MapIcon
{
位置=snPoint,
规格化点=新点(0.5,1.0),
ZIndex=0,
Title=“太空针”
};
MyLandmarks.Add(空格指针图标);
var LandmarksLayer=新的MapElementsLayer
{
ZIndex=1,
MapElements=MyLandmarks
};
myMap.Layers.Add(LandmarksLayer);
myMap.Center=snPoint;
myMap.ZoomLevel=14;
}

如何设置该图像的动画?我想以一定的间隔在指定的路线上移动它,以递增的顺序不断更改路线上标记的BasicGeoposition属性。这将为您提供动画效果。它显示:请求的Windows运行时类型“Windows.UI.Xaml.Controls.Maps.MapElementsLayer”未注册。较低版本的设备不支持MapElementsLayer。值得注意的是,在UWP地图控件中使用Google地图分幅违反了Google和Bing地图的使用条款