Chinaunix首页 | 论坛 | 博客
  • 博客访问: 7240
  • 博文数量: 3
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 10
  • 用 户 组: 普通用户
  • 注册时间: 2013-08-21 16:23
文章分类
文章存档

2014年(2)

2013年(1)

我的朋友

分类: Web开发

2014-08-01 16:41:13

在引用中添加 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.         }

阅读(1933) | 评论(0) | 转发(0) |
0

上一篇:VS2012 发布到IIS Express 外网访问

下一篇:没有了

给主人留下些什么吧!~~