鹰眼图实际上是在导航图上,显示一个主窗体显示的区域!在导航图上添加一个临时层,在上面添加一个矩形的图元!
private void InitEagleReigon()
{
MapXLib.Feature TempFea;
MapXLib.StyleClass tempStyle;
try
{
if (this.m_eagleLayer.AllFeatures.Count == 0)//判断该图元是否存在
{
tempStyle = new MapXLib.StyleClass();
//设置矩形边框样式
tempStyle.RegionPattern = MapXLib.FillPatternConstants.miPatternNoFill;
tempStyle.RegionBorderColor = 255;
tempStyle.RegionBorderWidth = 2;
//在临时图层添加大小为mymap的边界的Rectangle对象
MapXLib.Points pnts = new MapXLib.Points();
pnts.AddXY(axMap_Full.CtlBounds.XMin,axMap_Full.CtlBounds.YMin,1);
pnts.AddXY(axMap_Full.CtlBounds.XMax,2);
pnts.AddXY(axMap_Full.CtlBounds.XMax,axMap_Full.CtlBounds.YMax,3);
pnts.AddXY(axMap_Full.CtlBounds.XMin,4);
TempFea = this.axMap_Eagle.FeatureFactory.CreateRegion(pnts,tempStyle);
m_fea = m_eagleLayer.AddFeature(TempFea,nullObject);
m_fea.Update(true,nullObject);
}
else
{
m_fea.Parts._Item(1).RemoveAll();
m_fea.Parts._Item(1).AddXY(axMap_Full.CtlBounds.XMin,1);
m_fea.Parts._Item(1).AddXY(axMap_Full.CtlBounds.XMax,2);
m_fea.Parts._Item(1).AddXY(axMap_Full.CtlBounds.XMax,3);
m_fea.Parts._Item(1).AddXY(axMap_Full.CtlBounds.XMin,4);
m_fea.Update(true,nullObject);
}
}
catch (Exception ex)
{
MessageBox.Show("InitEagleReigon:" + ex.Message);
}
}
private void axMap_Eagle_MouseDownEvent(object sender,AxMapXLib.CMapXEvents_MouseDownEvent e)
{
double MapX=0.0;
double MapY=0.0;
IsMouseDown = true;
axMap_Eagle.ConvertCoord(ref e.x,ref e.y,ref MapX,ref MapY,MapXLib.ConversionConstants.miScreenToMap);
this.axMap_Full.CenterX = MapX;
this.axMap_Full.CenterY = MapY;
}
{
if (IsMouseDown)
{
double MapX = 0.0;
double MapY = 0.0;
axMap_Eagle.ConvertCoord(ref e.x,MapXLib.ConversionConstants.miScreenToMap);
this.axMap_Full.CenterX = MapX;
this.axMap_Full.CenterY = MapY;
}
}
{
IsMouseDown = false;
}