当前位置: 代码迷 >> GIS >> arcgis engine 的鹰眼怎么改善
  详细解决方案

arcgis engine 的鹰眼怎么改善

热度:187   发布时间:2016-05-05 06:10:29.0
arcgis engine 的鹰眼如何改善?
我上下代码:
#region 主视图事件.
//同步鹰眼视图和主视图.
private void map_main_OnMapReplaced(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnMapReplacedEvent e)
{
    map_view.ClearLayers();
    for (int i = 0; i < map_main.LayerCount; i++) map_view.AddLayer(map_main.get_Layer(i));
    map_view.Extent = map_main.FullExtent;
    map_main.Refresh();
}
//画轮廓.
private void map_main_OnExtentUpdated(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnExtentUpdatedEvent e)
{
    ESRI.ArcGIS.Geometry.IEnvelope enNew = (ESRI.ArcGIS.Geometry.IEnvelope)e.newEnvelope;
    ESRI.ArcGIS.Carto.IGraphicsContainer hawkGC = (ESRI.ArcGIS.Carto.IGraphicsContainer)map_view.Map;
    ESRI.ArcGIS.Carto.IActiveView aView = (ESRI.ArcGIS.Carto.IActiveView)hawkGC;
    hawkGC.DeleteAllElements();

    ESRI.ArcGIS.Carto.IElement recEle = (ESRI.ArcGIS.Carto.IElement)new ESRI.ArcGIS.Carto.RectangleElementClass();
    recEle.Geometry = enNew;
    //轮廓线颜色.
    ESRI.ArcGIS.Display.IRgbColor rgbColor = new ESRI.ArcGIS.Display.RgbColorClass();
    rgbColor.RGB = 255;
    rgbColor.Transparency = 255;
    ESRI.ArcGIS.Display.ISimpleLineSymbol outLine = new ESRI.ArcGIS.Display.SimpleLineSymbolClass();
    outLine.Color = rgbColor;
    outLine.Width = 2;
    //填充颜色.
    rgbColor = new ESRI.ArcGIS.Display.RgbColorClass();
    rgbColor.RGB = 255;
    rgbColor.Transparency = 0;

    //填充样式.
    ESRI.ArcGIS.Display.ISimpleFillSymbol fillSym = new ESRI.ArcGIS.Display.SimpleFillSymbolClass();
    fillSym.Color = rgbColor;
    fillSym.Outline = outLine;

    ESRI.ArcGIS.Carto.IFillShapeElement fillShape = (ESRI.ArcGIS.Carto.IFillShapeElement)recEle;
    fillShape.Symbol = fillSym;
    hawkGC.AddElement((ESRI.ArcGIS.Carto.IElement)fillShape, 0);
    aView.PartialRefresh(ESRI.ArcGIS.Carto.esriViewDrawPhase.esriViewGraphics, null, null);
}

#endregion

#region 鹰眼事件.
private void map_view_OnMouseDown(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseDownEvent e)
{
    if (map_main.LayerCount < 0) return;
    if (e.button == 1)
    { //点选.
ESRI.ArcGIS.Geometry.IPoint ptNew = new ESRI.ArcGIS.Geometry.PointClass();
ptNew.PutCoords(e.mapX, e.mapY);
map_main.CenterAt(ptNew);
    }
    else if (e.button == 2) //右键框选.
    {   
map_main.Extent = map_view.TrackRectangle();
    }
    map_main.ActiveView.PartialRefresh(ESRI.ArcGIS.Carto.esriViewDrawPhase.esriViewGeography, null, null);
}

private void map_view_OnMouseMove(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseMoveEvent e)
{
    if (e.button == 1)
    {
ESRI.ArcGIS.Geometry.IPoint ptNew = new ESRI.ArcGIS.Geometry.PointClass();
ptNew.PutCoords(e.mapX, e.mapY);
map_main.CenterAt(ptNew);
map_main.ActiveView.PartialRefresh(ESRI.ArcGIS.Carto.esriViewDrawPhase.esriViewGeography, null, null);
    }
}
#endregion


这代码基本上都是copy的,网上的代码也都差不多,找不到不一样的.

我现在想实现的功能是,鼠标拖动的时候,不实时更新,鼠标方框的时候才更新.
但是问题是,拖动的过程,我想让我画的轮廓跟着鼠标. 这个实现不了...
------解决思路----------------------
请问下,您是怎么解决的,鼠标拖动地图时用到了哪个事件
  相关解决方案