Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/271.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# 如何使用ArcGis API创建图钉并将其附加到地图?_C#_Windows Phone 7 - Fatal编程技术网

C# 如何使用ArcGis API创建图钉并将其附加到地图?

C# 如何使用ArcGis API创建图钉并将其附加到地图?,c#,windows-phone-7,C#,Windows Phone 7,大家好,我想用ArcGis API在地图中创建一个图钉,经过长时间的研究,唯一可行的选择似乎是在地图层的顶部添加一个图形层并在其上绘制符号 但是在我尝试了以下代码并在WP7模拟器上运行之后。当我点击地图时,似乎没有生成图钉。非常感谢您的帮助。真的,提前很多时间 *注意:代码示例中的map1指的是ArcGis地图对象 代码示例: private void map1_MapGesture(object sender, Map.MapGestureEventArgs e) { SimpleFi

大家好,我想用ArcGis API在地图中创建一个图钉,经过长时间的研究,唯一可行的选择似乎是在地图层的顶部添加一个图形层并在其上绘制符号

但是在我尝试了以下代码并在WP7模拟器上运行之后。当我点击地图时,似乎没有生成图钉。非常感谢您的帮助。真的,提前很多时间

*注意:代码示例中的map1指的是ArcGis地图对象

代码示例:

private void map1_MapGesture(object sender, Map.MapGestureEventArgs e)
{
    SimpleFillSymbol fillSymbol = new SimpleFillSymbol()
    {
        BorderBrush = new SolidColorBrush(Color.FromArgb(0, 255, 0, 0)),
        BorderThickness = 2,
        Fill = new SolidColorBrush(Color.FromArgb(255, 12, 12, 255))
    };

    GraphicsLayer layer = map1.Layers["PushpinLayer"] as GraphicsLayer;
    Graphic g = new Graphic();
    g.Symbol = fillSymbol;
    g.Geometry = e.MapPoint;
    layer.Graphics.Add(g);
}

我使用下一个代码在地图上绘制图钉:

<Maps:Map>
    <Maps:MapItemsControl ItemsSource={Binding Pushpins} ItemTemplate={StaticResource CustomTemplate} />
</Maps:Map>

也可考虑使用<代码> VistabeCelpEng/<代码>作为您的PuxPin集合类型

Hythx,供所有查看我帖子的人使用: 尤其是当回答=P时

无论如何,我发现问题出在我的xaml中,我将图形层放在贴图层之前,因此图形不会被渲染

无论如何,这应该是对元素进行排序的正确方法=p

非常感谢您的帮助:)



ArcGis是否提供了图钉类?我想您可以从ArcGis获得一些对象的坐标,然后需要绘制它们。我是对的?如果需要在地图上放置一些几何体,请查看
MapPolygon
类。在我的实现中,
Pushpin
是一个自定义类,里面有
Location
。因为我正在使用ArcGis API来显示地图。所以我需要把图钉放在地图里面,我想知道我的做法是否正确
Pushpins.Add(new Pushpin(...));
<esri:Map Background="White" HorizontalAlignment="Left" Name="map1" VerticalAlignment="Top" WrapAround="True" Height="607" Width="468" MapGesture="map1_MapGesture">
            <esri:Map.Layers>
                <esri:LayerCollection>
                    <esri:ArcGISTiledMapServiceLayer Url="http://www.onemap.sg/ArcGIS/rest/services/BASEMAP/MapServer" />
                    <esri:GraphicsLayer Visible="True" ID="PushpinLayer" />
                </esri:LayerCollection>
            </esri:Map.Layers>
        </esri:Map>