Pushpin事件C#?
如果我试图使用bing在c#上制作应用程序,地图API,是否有可能在上面的链接中进行推送事件?我发现一些示例代码可以让我放一个按下输入图像描述
这是该部分创建4个PushPins的代码(图片中只有2个可见)。
var r = new ImageryRequest()
{
CenterPoint = new Coordinate(coord1, coord2),
ZoomLevel = 5,
ImagerySet = ImageryType.RoadOnDemand,
Pushpins = new List<ImageryPushpin>(){
new ImageryPushpin(){
Location = new Coordinate(45, -120.01),
Label = "hi"
},
new ImageryPushpin(){
Location = new Coordinate(0, 1),
IconStyle = 3
},
new ImageryPushpin(){
Location = new Coordinate(coord1, coord2),
IconStyle = 20
},
new ImageryPushpin(){
Location = new Coordinate(33, -75),
IconStyle = 24
}
},
BingMapsKey = BingMapsKey,
};
If I'm trying to make an app on C# using Bing Maps API, is it possible to have pushpin events like in the link above? Some sample code I found lets me put a pushpin like thisenter image description here
This is the section of code that created 4 pushpins(only 2 visible in the picture).
var r = new ImageryRequest()
{
CenterPoint = new Coordinate(coord1, coord2),
ZoomLevel = 5,
ImagerySet = ImageryType.RoadOnDemand,
Pushpins = new List<ImageryPushpin>(){
new ImageryPushpin(){
Location = new Coordinate(45, -120.01),
Label = "hi"
},
new ImageryPushpin(){
Location = new Coordinate(0, 1),
IconStyle = 3
},
new ImageryPushpin(){
Location = new Coordinate(coord1, coord2),
IconStyle = 20
},
new ImageryPushpin(){
Location = new Coordinate(33, -75),
IconStyle = 24
}
},
BingMapsKey = BingMapsKey,
};
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来您正在使用Bingmapsresttoolkit,该BingmapsrestToolKit提供了用于访问Bing Maps REST服务的AC#API。特别是,您调用静态图像服务,该服务返回图像,而不是交互式地图。如果您想编写一些代码,以便某人可以单击图像中的Pushpin,并且您会知道的,那么涉及大量的数学数量。可以做到这一点,但是最好首先考虑使用应用程序中的交互式映射SDK,因为这将提供更多功能,使用户可以与地图进行交互。 Bing Maps具有两个交互式映射SDK,可以使用C#开发它们。
Windows UWP映射SDK可以在Windows应用程序中使用,以及通过XAML Island中的WPF应用中使用。这里有一些有用的资源:
还有一个较旧的WPF SDK,其功能少于UWP SDK。通常建议使用UWP地图控件,但是如果要使用此信息,请参见以下细节: https://learn.microsoft.com/en-us/previous-us/previous-vious-vious/previous/wpf-control/wpf-control/hh750210(v%3DMSDN.10 )
It looks like you are using the BingMapsRestToolkit that provides a c# API for accessing the Bing Maps REST services. In particular, you are calling the static imagery service which returns an image, not an interactive map. If you wanted to write some code so that someone could click on a pushpin in the image and you would know it, there would be a decent amount of math involved. It can be done, but you might be better to first consider using an interactive map SDK in your app instead as that would provide a lot more capabilities that would allow the user to interact with the map. Bing Maps has two interactive map SDKs that you can develop with using C#.
There is the Windows UWP map SDK that can be used in Windows apps, and in WPF apps via a XAML island. Here are some useful resources:
There is also an older WPF SDK that has fewer capabilities than the UWP SDK. It is generally recommended to use the UWP map control, but if you want to use this, here are the details: https://learn.microsoft.com/en-us/previous-versions/bing/wpf-control/hh750210(v%3dmsdn.10)