arcgis for silverlight 中使用pictureFillSymbol不显示图片 5
只显示周围的框框,不显示中间的图片;<esri:Mapx:Name="MyMap"><esri:Map.Layers><esri:ArcGISTiledMapServic...
只显示周围的框框,不显示中间的图片;
<esri:Map x:Name="MyMap">
<esri:Map.Layers>
<esri:ArcGISTiledMapServiceLayer ID="StreetMapLayer" Url="http://services.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer"/>
<esri:GraphicsLayer ID="MyGraphicsLayer" />
</esri:Map.Layers>
</esri:Map>
//多边形的四个点
MapPoint point1 = new MapPoint(110.11, 30.81);
MapPoint point2 = new MapPoint(110.11, 34.82);
MapPoint point3 = new MapPoint(116.13, 34.82);
MapPoint point4 = new MapPoint(116.13, 30.81);
List<MapPoint> pointList = new List<MapPoint>();
pointList.Add(point1);
pointList.Add(point2);
pointList.Add(point3);
pointList.Add(point4);
pointList.Add(point1);
ESRI.ArcGIS.Client.Geometry.PointCollection points = new ESRI.ArcGIS.Client.Geometry.PointCollection(pointList);
ESRI.ArcGIS.Client.Geometry.Polygon pPolygon = new ESRI.ArcGIS.Client.Geometry.Polygon();
pPolygon.Rings.Add(points);
Graphic tupian = new Graphic()
{
//Geometry = mercator.FromGeographic(pPolygon), //图形
Geometry = pPolygon, //图形
Symbol = new PictureFillSymbol() //符号
{Source = new BitmapImage(new Uri("http://resources.esri.com/help/9.3/arcgisserver/apis/flex/samples/assets/warningsmall.gif", UriKind.RelativeOrAbsolute)),
} };
graphicsLayer.Graphics.Add(tupian); 展开
<esri:Map x:Name="MyMap">
<esri:Map.Layers>
<esri:ArcGISTiledMapServiceLayer ID="StreetMapLayer" Url="http://services.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer"/>
<esri:GraphicsLayer ID="MyGraphicsLayer" />
</esri:Map.Layers>
</esri:Map>
//多边形的四个点
MapPoint point1 = new MapPoint(110.11, 30.81);
MapPoint point2 = new MapPoint(110.11, 34.82);
MapPoint point3 = new MapPoint(116.13, 34.82);
MapPoint point4 = new MapPoint(116.13, 30.81);
List<MapPoint> pointList = new List<MapPoint>();
pointList.Add(point1);
pointList.Add(point2);
pointList.Add(point3);
pointList.Add(point4);
pointList.Add(point1);
ESRI.ArcGIS.Client.Geometry.PointCollection points = new ESRI.ArcGIS.Client.Geometry.PointCollection(pointList);
ESRI.ArcGIS.Client.Geometry.Polygon pPolygon = new ESRI.ArcGIS.Client.Geometry.Polygon();
pPolygon.Rings.Add(points);
Graphic tupian = new Graphic()
{
//Geometry = mercator.FromGeographic(pPolygon), //图形
Geometry = pPolygon, //图形
Symbol = new PictureFillSymbol() //符号
{Source = new BitmapImage(new Uri("http://resources.esri.com/help/9.3/arcgisserver/apis/flex/samples/assets/warningsmall.gif", UriKind.RelativeOrAbsolute)),
} };
graphicsLayer.Graphics.Add(tupian); 展开
1个回答
展开全部
是把图片放到MyGraphicsLayer图层中,后台没有获得。如下
GraphicsLayer myTempGL = Map.Layers["myGraphicsLayer"] as GraphicsLayer;
比如添加一个点的代码 myTempGL代替graphicsLayer
ESRI.ArcGIS.Client.Projection.WebMercator mercator=new ESRI.ArcGIS.Client.Projection.WebMercator();
GraphicsLayer myTempGL = Map.Layers["myGraphicsLayer"] as GraphicsLayer;
Graphic myTempGraphic = new Graphic()
{
Geometry = mercator.FromGeographic(new MapPoint(111, 22)),
Symbol = LayoutRoot.Resources["RedMakerSymbol"] as Symbol
};
myTempGL.Graphics.Add(myTempGraphic);
GraphicsLayer myTempGL = Map.Layers["myGraphicsLayer"] as GraphicsLayer;
比如添加一个点的代码 myTempGL代替graphicsLayer
ESRI.ArcGIS.Client.Projection.WebMercator mercator=new ESRI.ArcGIS.Client.Projection.WebMercator();
GraphicsLayer myTempGL = Map.Layers["myGraphicsLayer"] as GraphicsLayer;
Graphic myTempGraphic = new Graphic()
{
Geometry = mercator.FromGeographic(new MapPoint(111, 22)),
Symbol = LayoutRoot.Resources["RedMakerSymbol"] as Symbol
};
myTempGL.Graphics.Add(myTempGraphic);
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询