using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ESRI.ArcGIS.Controls;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.Geodatabase;
using ESRI.ArcGIS.DataSourcesRaster;
using DevComponents.DotNetBar; using System.Runtime.InteropServices;
using ESRI.ArcGIS.ADF.BaseClasses;
using ESRI.ArcGIS.ADF.CATIDs;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Geometry;
using ESRI.ArcGIS.Output;
using ESRI.ArcGIS.SystemUI;
using ESRI.ArcGIS.Display;
  private void btAddMdb_Click_1(object sender, EventArgs e)     //添加mdb数据库打开数据
{
OpenFileDialog dlg = new OpenFileDialog();
dlg.Filter = " Personal Geodatabase(*.mdb)|*.mdb|All Files(*.*)|*.* ";
dlg.Title = " Open PersonGeodatabase file ";
if (dlg.ShowDialog() != DialogResult.OK) return;
commonfun.load_Mdb(dlg.FileName, axMap);
AddLayerToOverViewMap(); //加入地图到鹰眼里
axMap.Refresh();
}

  

 private void axMap_OnMapReplaced(object sender, IMapControlEvents2_OnMapReplacedEvent e)
{
#region 添加鹰眼 载入地图到鹰眼控件
AddLayerToOverViewMap();
#endregion
}
  #region 鹰眼功能
/// <summary>
/// 把地图加到鹰眼里的方法,
///该段代码摘自http://www.cnblogs.com/zya-gis/archive/2009/04/17/1438033.html,非常好用,解决了我鹰眼一直不能显示的问题
/// </summary>
private void AddLayerToOverViewMap()
{
axMapSmall.ClearLayers();
for (int i = ; i < axMap.LayerCount; i++)
{
IObjectCopy objectcopy = new ObjectCopyClass();
object toCopyLayer = axMap.get_Layer(i);
object copiedLayer = objectcopy.Copy(toCopyLayer);
ILayer C = (new FeatureLayerClass()) as ILayer;
object toOverwriteLayer = C;
objectcopy.Overwrite(copiedLayer, ref toOverwriteLayer);
axMapSmall.AddLayer(C, i);
}
}
private void axMap_OnExtentUpdated(object sender, IMapControlEvents2_OnExtentUpdatedEvent e) //绘制鹰眼矩形框
{
try
{
//得到范围
IEnvelope pEnv = e.newEnvelope as IEnvelope;
IGraphicsContainer pGraphicsContainer = axMapSmall.Map as IGraphicsContainer;
IActiveView pActiveView = pGraphicsContainer as IActiveView;
//在绘制新的矩形框前,清楚、清除Map对象中的任何图形元素
pGraphicsContainer.DeleteAllElements();
IRectangleElement pRectangleEle = new RectangleElementClass();
IElement pEle = pRectangleEle as IElement;
pEle.Geometry = pEnv;
IRgbColor pColor = new RgbColorClass();
pColor.RGB = ;
pColor.Transparency = ;
//产生一个线符号对象
ILineSymbol pOutLine = new SimpleLineSymbolClass();
pOutLine.Width = ;
pOutLine.Color = pColor;
//设置颜色属性
pColor.RGB = ; pColor.Transparency = ;
//设置填充符号的属性
IFillSymbol pFillsymbol = new SimpleFillSymbolClass();
pFillsymbol.Color = pColor;
pFillsymbol.Outline = pOutLine;
IFillShapeElement pFillshapEle;
pFillshapEle = pEle as IFillShapeElement;
pFillshapEle.Symbol = pFillsymbol;
pEle = pFillshapEle as IElement;
pGraphicsContainer.AddElement(pEle, );
pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
}
catch (Exception ey)
{ }
}
private void axMapSmall_OnMouseDown(object sender, AxESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseDownEvent e) //鹰眼与主 Map 控件互动
{
if (this.axMapSmall.Map.LayerCount != )
{
// 按下鼠标左键移动矩形框
if (e.button == )
{
IPoint pPoint = new PointClass();
pPoint.PutCoords(e.mapX, e.mapY);
IEnvelope pEnvelope = this.axMap.Extent;
pEnvelope.CenterAt(pPoint);
this.axMap.Extent = pEnvelope;
this.axMap.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
} // 按下鼠标右键绘制矩形框
else if (e.button == )
{
IEnvelope pEnvelop = this.axMapSmall.TrackRectangle();
this.axMap.Extent = pEnvelop;
this.axMap.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
} }
}
private void axMapSmall_OnMouseMove(object sender, AxESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseMoveEvent e) //按下鼠标左键的时候移动矩形框,同时也改变主的图控件的显示范围
{
// 如果不是左键按下就直接返回
if (e.button != ) return;
IPoint pPoint = new PointClass();
pPoint.PutCoords(e.mapX, e.mapY);
this.axMap.CenterAt(pPoint);
this.axMap.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
}
#endregion 鹰眼功能完结

放效果图一张:

C#+arcengine10.0+SP5实现鹰眼(加载的是mdb数据库中的数据)的更多相关文章

  1. [Asp.net mvc]实体更新异常:存储区更新、插入或删除语句影响到了意外的行数(0)。实体在加载后可能被修改或删除。

    学习asp.net mvc 时在更新实体进行SaveChanges()的时候出现了异常,异常如下: “/”应用程序中的服务器错误. 存储区更新.插入或删除语句影响到了意外的行数(0).实体在加载后可能 ...

  2. 存储区更新、插入或删除语句影响到了意外的行数(0)。实体在加载后可能被修改或删除。刷新 ObjectStateManager 项。

    在用asp.net MVC3 的MusicStore时候 Edit某个数据项时提示下面的错误: 存储区更新.插入或删除语句影响到了意外的行数(0).实体在加载后可能被修改或删除.刷新 ObjectSt ...

  3. HTTP 筛选器 DLL C:\Windows\Microsoft.Net\Framework\v4.0.30319\aspnet_filter.dll 加载失败。数据是错误。

    今天在一台win2003的云主机上,安装.net 4.0时,所有的网站都打不开了.打开事件查看器,发现以下错误: HTTP 筛选器 DLL C:\Windows\Microsoft.Net\Frame ...

  4. 使用自定义的item、Adapter和AsyncTask、第三方开源框架PullToRefresh联合使用实现自定义的下拉列表(从网络加载图片显示在item中的ImageView)

    AsyncTask使用方法详情:http://www.cnblogs.com/zzw1994/p/4959949.html 下拉开源框架PullToRefresh使用方法和下载详情:http://ww ...

  5. 用UBOOT自带loadb命令加载应用程序到SDRAM中运行的方法

    S3C44B0开发板中,用UBOOT自带loadb命令加载应用程序到SDRAM中运行的方法    1.开发板说明:  开发板上已有移植好的UBOOT运行.   2.交叉编译工具链为arm-linu-g ...

  6. MVC学习系列6--使用Ajax加载分部视图和Json格式的数据

    Ajax的应用在平时的工作中,很是常见,这篇文章,完全是为了,巩固复习. 我们先看看不使用json格式返回分部视图: 先说需求吧: 我有两个实体,一个是出版商[Publisher],一个是书[Book ...

  7. 无法为具有固定名称“MySql.Data.MySqlClient”的 ADO.NET 提供程序加载在应用程序配置文件中注册的实体框架提供程序类型“MySql.Data.MySqlClient.MySqlProviderServices,MySql.Data.Entity.EF6”

    "System.InvalidOperationException"类型的未经处理的异常在 mscorlib.dll 中发生 其他信息: 无法为具有固定名称"MySql. ...

  8. 无法为具有固定名称“System.Data.SqlClient”的 ADO.NET 提供程序加载在应用程序配置文件中注册的实体框架提供程序类型“System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer”。请确保使用限定程序集的名称且该程序集对运行的应用程序可用。有关详细信息,请参阅 http://go.m

    Windows服务中程序发布之后会如下错误: 无法为具有固定名称“System.Data.SqlClient”的 ADO.NET 提供程序加载在应用程序配置文件中注册的实体框架提供程序类型“Syste ...

  9. InnoDB缓冲池预加载在MySQL 5.7中的正确打开方式

    InnoDB缓冲池预加载在MySQL 5.7中的正确打开方式 https://mp.weixin.qq.com/s/HGa_90XvC22anabiBF8AbQ 在这篇文章里,我将讨论在MySQL 5 ...

随机推荐

  1. IDisposable的另类用法

    IDisposable是.Net中一个很重要的接口,一般用来释放非托管资源,我们知道在使用了IDisposable的对象之后一定要调用IDisposable.Dispose()方法,或者使用.Net提 ...

  2. Hadoop学习笔记—20.网站日志分析项目案例(一)项目介绍

    网站日志分析项目案例(一)项目介绍:当前页面 网站日志分析项目案例(二)数据清洗:http://www.cnblogs.com/edisonchou/p/4458219.html 网站日志分析项目案例 ...

  3. ASP.Net请求处理机制初步探索之旅 - Part 5 ASP.Net MVC请求处理流程

    好听的歌 我一直觉得看一篇文章再听一首好听的歌,真是种享受.于是,我在这里嵌入一首好听的歌,当然你觉得不想听的话可以点击停止,歌曲 from 王菲 <梦中人>: --> 开篇:上一篇 ...

  4. Microsoft Azure Web Sites应用与实践【2】—— 通过本地IIS 远程管理Microsoft Azure Web Site

    Microsoft Azure Web Sites应用与实践 系列: [1]—— 打造你的第一个Microsoft Azure Website [2]—— 通过本地IIS 远程管理Microsoft ...

  5. 几个毫无节操纯属恶搞的JavaScript插件

    fartscroll.js,为放屁而生 你知道么,有了这个js库,你的页面就可以——————————放屁勒! 打开下面的演示地址,然后滚动页面. 在线演示:http://theonion.github ...

  6. Nginx服务器之基础学习

    一.Nginx介绍 nginx:Nginx是一种软件服务器(轻量级),故它最主要的功能就是可以与服务器硬件结合,我们的应用程序可以放在nginx服务器上进行发布,已达到让网民浏览的效果.除此自外,Ng ...

  7. linux创建进程fork的方法步骤

    fork创建进程 函数原型如下 #include// 必须引入头文件,使用fork函数的时候,必须包含这个头文件,否则,系统找不到fork函数 pid_t fork(void); //void代表没有 ...

  8. distribution 中一直在运行 waitfor delay @strdelaytime 语句

    Replication 自动创建来一个 Job:Replication monitoring refresher for distribution,这个Agent执行一个sp: dbo.sp_repl ...

  9. NotSupportedException-无法将类型“System.DateTime”强制转换为类型“System.Object”

    几张图就可以说明一切 2015-03-29 21:54:09,206 [77] ERROR log - System.NotSupportedException: 无法将类型“System.DateT ...

  10. OpenCASCADE Linear Extrusion Surface

    OpenCASCADE Linear Extrusion Surface eryar@163.com Abstract. OpenCASCADE linear extrusion surface is ...