ArcGIS API for Silverlight之ElementLayer使用注意点

 <!--地图控件-->
        <esri:Map x:Name="myMap"  ExtentChanged="myMap_ExtentChanged" WrapAround="True" IsLogoVisible="False" Extent="114.289579051054,29.3907111115968,121.380372848428,33.7272787947227">
            <i:Interaction.Behaviors>
                <local:WheelZoom />
            </i:Interaction.Behaviors>
            <esri:Map.Layers>
                <esri:ArcGISTiledMapServiceLayer ID="BaseLayer" Url="http://192.168.2.188/arcgis/rest/services/AnHuiBase/MapServer"/>
                <!--<bing:TileLayer ID="BingLayer"></bing:TileLayer>-->
                <!--GraphicsLayer-->
                <esri:GraphicsLayer ID="MyGraphicsLayer">
                </esri:GraphicsLayer>
                <esri:GraphicsLayer ID="MyGraphicsLayer2">
                </esri:GraphicsLayer>
                <esri:GraphicsLayer ID="MapTipLayer">
                </esri:GraphicsLayer>
                <!---特征图层-->
                <!--<esri:FeatureLayer ID="MyFeatureLayer">
                </esri:FeatureLayer>-->
            </esri:Map.Layers>
        </esri:Map>


ElementLayer.SetEnvelope方法很重要,必须设置


                    Graphic grahpics = sender as Graphic;
                    ESRI.ArcGIS.Client.Projection.WebMercator mercator = new ESRI.ArcGIS.Client.Projection.WebMercator();
                    ESRI.ArcGIS.Client.Geometry.Envelope selected = mercator.ToGeographic(grahpics.Geometry).Extent;
                    ElementLayer.SetEnvelope(tip, new Envelope(new MapPoint(selected.XMin, selected.YMin), new MapPoint(selected.XMin, selected.YMin)));
                    if (elementLayer.Children.Count > 0)
                    {
                        elementLayer.Children.Clear();
                        elementLayer.Children.Add(tip);
                    }
                    else
                    {
                        elementLayer.Children.Add(tip);
                    }



上一篇:spring-boot统一包装返回体


下一篇:虚拟机安装ubuntu之后无法使用ssh连接