Chinaunix首页 | 论坛 | 博客
  • 博客访问: 160852
  • 博文数量: 13
  • 博客积分: 3084
  • 博客等级: 中校
  • 技术积分: 259
  • 用 户 组: 普通用户
  • 注册时间: 2006-02-15 11:57
文章分类

全部博文(13)

文章存档

2015年(2)

2014年(1)

2013年(7)

2012年(3)

我的朋友

分类: Web开发

2013-07-25 14:18:44

在引用中添加 Vishcious.ArcGIS.SLContrib.dll,该dll可以google搜索.

点击(此处)折叠或打开

  1. using System.Windows;
  2. using Vishcious.ArcGIS.SLContrib;

  3. private void InitShpFile()
  4.         {
  5.             StreamResourceInfo shpRes = Application.GetResourceStream(new Uri("shpres/县界.shp", UriKind.Relative));
  6.             StreamResourceInfo attrRes = Application.GetResourceStream(new Uri("shpres/县界.dbf", UriKind.Relative));

  7.             ShapeFile shapeFileReader = new ShapeFile();

  8.             shapeFileReader.ReadShapes(shpRes.Stream);
  9.             shapeFileReader.ReadAttributes(attrRes.Stream);

  10.             Graphic graphic = null;
  11.             for (int index = 0; index < shapeFileReader.Records.Count; index++)
  12.             {
  13.                 ShapeFileRecord shpRecord = shapeFileReader.Records[index];
  14.                 graphic = shpRecord.ToGraphic();

  15.                 graphic.MouseLeftButtonDown += new MouseButtonEventHandler(GraphicsLayer_MouseLeftButtonDown);
  16.                 graphic.MouseEnter += new MouseEventHandler(GraphicsLayer_MouseEnterEvent);
  17.                 graphic.MouseLeave += new MouseEventHandler(GraphicsLayer_MouseLeaveEvent);

  18.                 //采用地图中定义的样式
  19.                 graphic.Symbol = HighlightFillSymbolName;
  20.             }

  21.             if (graphic != null)
  22.             {
  23.                 //把图层添加到地图上
  24.                 graphicsLayer.Graphics.Add(graphic);
  25.             }
  26.         }

阅读(6147) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~