C#+mapx实现鹰眼功能源代码
来源:互联网 发布:java中对象是什么 编辑:程序博客网 时间:2024/05/22 08:02
————————————————————————————
先添加两个mapx地图控件,一个做主视图Map1,另一个做鹰眼地图MapEye。
1.
/// <summary>
/// 在鹰眼地图中添加矩形框
/// </summary>
private void DrawRect() //在鹰眼地图中添加矩形框函数
{
if (MapEye.Layers._Item("Eyelay").AllFeatures.Count == 0)
{
MapXLib.Feature fea = new MapXLib.FeatureClass();
MapXLib.Style sty = new MapXLib.StyleClass();
try
{
sty.RegionPattern = MapXLib.FillPatternConstants.miPatternNoFill;
sty.RegionColor = 155;
sty.RegionBorderWidth = 1;
MapXLib.Points pts = new MapXLib.PointsClass();
pts.AddXY(axMap1.CtlBounds.XMin, axMap1.CtlBounds.YMin, 1);
pts.AddXY(axMap1.CtlBounds.XMax, axMap1.CtlBounds.YMin, 2);
pts.AddXY(axMap1.CtlBounds.XMax, axMap1.CtlBounds.YMax, 3);
pts.AddXY(axMap1.CtlBounds.XMin, axMap1.CtlBounds.YMax, 4);
fea = MapEye.FeatureFactory.CreateRegion(pts,sty);
FeaEye = MapEye.Layers._Item("Eyelay").AddFeature(fea,new MapXLib.RowValuesClass());
FeaEye.Update(FeaEye,new MapXLib.RowValuesClass());
}
catch (Exception ea)
{ MessageBox.Show(ea.Message.ToString() + "/n没有矩形图元"); }
}
else
{
try
{
FeaEye.Parts._Item(1).RemoveAll();
FeaEye.Parts._Item(1).AddXY(axMap1.CtlBounds.XMin, axMap1.CtlBounds.YMin, 1);
FeaEye.Parts._Item(1).AddXY(axMap1.CtlBounds.XMax, axMap1.CtlBounds.YMin, 2);
FeaEye.Parts._Item(1).AddXY(axMap1.CtlBounds.XMax, axMap1.CtlBounds.YMax, 3);
FeaEye.Parts._Item(1).AddXY(axMap1.CtlBounds.XMin, axMap1.CtlBounds.YMax, 4);
FeaEye.Update(FeaEye, new MapXLib.RowValuesClass());
}
catch (Exception en)
{ MessageBox.Show(en.Message.ToString() + "/n更新图元"); }
}
1.
/// <summary>
/// 在鹰眼地图中添加矩形框
/// </summary>
private void DrawRect() //在鹰眼地图中添加矩形框函数
{
if (MapEye.Layers._Item("Eyelay").AllFeatures.Count == 0)
{
MapXLib.Feature fea = new MapXLib.FeatureClass();
MapXLib.Style sty = new MapXLib.StyleClass();
try
{
sty.RegionPattern = MapXLib.FillPatternConstants.miPatternNoFill;
sty.RegionColor = 155;
sty.RegionBorderWidth = 1;
MapXLib.Points pts = new MapXLib.PointsClass();
pts.AddXY(axMap1.CtlBounds.XMin, axMap1.CtlBounds.YMin, 1);
pts.AddXY(axMap1.CtlBounds.XMax, axMap1.CtlBounds.YMin, 2);
pts.AddXY(axMap1.CtlBounds.XMax, axMap1.CtlBounds.YMax, 3);
pts.AddXY(axMap1.CtlBounds.XMin, axMap1.CtlBounds.YMax, 4);
fea = MapEye.FeatureFactory.CreateRegion(pts,sty);
FeaEye = MapEye.Layers._Item("Eyelay").AddFeature(fea,new MapXLib.RowValuesClass());
FeaEye.Update(FeaEye,new MapXLib.RowValuesClass());
}
catch (Exception ea)
{ MessageBox.Show(ea.Message.ToString() + "/n没有矩形图元"); }
}
else
{
try
{
FeaEye.Parts._Item(1).RemoveAll();
FeaEye.Parts._Item(1).AddXY(axMap1.CtlBounds.XMin, axMap1.CtlBounds.YMin, 1);
FeaEye.Parts._Item(1).AddXY(axMap1.CtlBounds.XMax, axMap1.CtlBounds.YMin, 2);
FeaEye.Parts._Item(1).AddXY(axMap1.CtlBounds.XMax, axMap1.CtlBounds.YMax, 3);
FeaEye.Parts._Item(1).AddXY(axMap1.CtlBounds.XMin, axMap1.CtlBounds.YMax, 4);
FeaEye.Update(FeaEye, new MapXLib.RowValuesClass());
}
catch (Exception en)
{ MessageBox.Show(en.Message.ToString() + "/n更新图元"); }
}
}
——————————————————————————————————————————————————
2.
private void Map_Emulate_Load(object sender, EventArgs e) //窗口初始化
{
——————————————————————————————————————————————————
2.
private void Map_Emulate_Load(object sender, EventArgs e) //窗口初始化
{
//鹰眼
try //创建临时图层
{
MapXLib.LayerInfo lay=new MapXLib.LayerInfoClass();
MapXLib.Fields fld = new MapXLib.FieldsClass();
fld.AddStringField("ID", 20, false);
fld.AddStringField("Name", 100, false);
lay.Type = MapXLib.LayerInfoTypeConstants.miLayerInfoTypeTemp;
lay.AddParameter("Name", "Eyelay");
lay.AddParameter("Fields", fld);
LayEye= MapEye.Layers.Add(lay, 1);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
//在鹰眼地图中添加矩形框
DrawRect();
————————————————————————————————————————————————
3.当视图改变时,鹰眼相应改变实现代码
private void MapEye_MouseDownEvent(object sender, AxMapXLib.CMapXEvents_MouseDownEvent e)// 鹰眼。绑定主图的中兴坐标
{
MapEye.MousePointer = MapXLib.CursorConstants.miPanCursor;
if (e.button == 1)
{
MapEye.MousePointer = MapXLib.CursorConstants.miPanCursor;
eyemove = true;
double mapx = 0.0;
double mapy = 0.0;
MapEye.ConvertCoord(ref e.x, ref e.y, ref mapx, ref mapy, MapXLib.ConversionConstants.miScreenToMap);
axMap1.CenterX = mapx;
axMap1.CenterY = mapy;
}
}
try //创建临时图层
{
MapXLib.LayerInfo lay=new MapXLib.LayerInfoClass();
MapXLib.Fields fld = new MapXLib.FieldsClass();
fld.AddStringField("ID", 20, false);
fld.AddStringField("Name", 100, false);
lay.Type = MapXLib.LayerInfoTypeConstants.miLayerInfoTypeTemp;
lay.AddParameter("Name", "Eyelay");
lay.AddParameter("Fields", fld);
LayEye= MapEye.Layers.Add(lay, 1);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
//在鹰眼地图中添加矩形框
DrawRect();
————————————————————————————————————————————————
3.当视图改变时,鹰眼相应改变实现代码
private void MapEye_MouseDownEvent(object sender, AxMapXLib.CMapXEvents_MouseDownEvent e)// 鹰眼。绑定主图的中兴坐标
{
MapEye.MousePointer = MapXLib.CursorConstants.miPanCursor;
if (e.button == 1)
{
MapEye.MousePointer = MapXLib.CursorConstants.miPanCursor;
eyemove = true;
double mapx = 0.0;
double mapy = 0.0;
MapEye.ConvertCoord(ref e.x, ref e.y, ref mapx, ref mapy, MapXLib.ConversionConstants.miScreenToMap);
axMap1.CenterX = mapx;
axMap1.CenterY = mapy;
}
}
private void axMap1_SizeChanged(object sender, EventArgs e) //主视图改变时,重绘鹰眼地图中的矩形框
{
DrawRect();
}
{
DrawRect();
}
private void axMap1_MapViewChanged(object sender, EventArgs e)//地图变化时,重绘鹰眼地图中的矩形框
{
DrawRect();
}
{
DrawRect();
}
- C#+mapx实现鹰眼功能源代码
- C# + MapX 鹰眼功能的实现
- VC+MapX鹰眼实现
- VC+MapX鹰眼实现
- VC+MapX鹰眼实现
- VC+MapX鹰眼实现
- 基于MAPX控件的鹰眼图实现
- AE实现鹰眼功能
- MapX系列-- 鹰眼
- ArcGIS 鹰眼地图功能实现
- ArcEngine 鹰眼功能C#实现
- 实现鹰眼图C#+AE
- 鹰眼功能
- Arcgis Engine鹰眼功能的实现
- ArcGIS API forJavaScript实现鹰眼功能
- 实现MapX的移屏测距功能
- 使用MapX开发实现若干小功能
- 使用MapX开发实现若干小功能
- 07.01.12
- discuz 经典php加密解密函数 authcode 解析
- 常用的40个网站制作技巧
- 批处理命令大全
- 基于PCI9054和LTC4240的CPCI总线接口设计
- C#+mapx实现鹰眼功能源代码
- 儒豹手机搜索:全新软件和游戏搜索频道
- LINUX驱动IOCTL函数相关知识
- 340 jQuery Plugins And Examples (340个jQuery插件)
- 专家预计在今年(2009)年底前将正式推出USB 3.0产品
- 2008年国外最佳Web设计/开发技巧、脚本及资源总结
- Topcoder_154
- plan translating "applied software project managerment"
- 报表[SQL语句]