The Eagle Eye Chart is a rough representation of the global map, with spatial reference and spatial scope to the global map. Some of the important geographic elements in the global map, such as major rivers, roads, etc., are also available for better spatial cues and navigation. With two Axmapcontrol controls, the main control Axmapcontrol 1 and the Eagle Eye Control Axmapcontrol 2. To achieve the Eagle eye function, the key technology has two points, one is how to make two controls use the data consistent, the other is how to draw the Eagle Eye Control in the display box.
One, data sharing, using the AxMapControl1 control's onmapreplaced event. Onmapreplace event occurs when the Mapcontrol map is replaced, that is, Imapcontrol2::map is replaced by another map (such as IMapControl2:: The event is triggered when the Loadmxfile method is invoked or when the Map property is explicitly replaced. Use this event to maintain synchronization with the current layer.
1 Private voidAxmapcontrol1_onmapreplaced (Objectsender, ESRI. ArcGIS.Controls.IMapControlEvents2_OnMapReplacedEvent e)2 {3 if(AxMapControl1.Map.LayerCount >0)4 {5 for(inti =0; I <= AxMapControl1.Map.LayerCount-1; i++)6 {7 Axmapcontrol2.addlayer (Axmapcontrol1.get_layer (i));8 }9Axmapcontrol2.extent=axmapcontrol1.extent;Ten Axmapcontrol2.refresh (); One } A}
Second, the Display box drawing. When you use the mouse to drag a view in the Hawkeye control AxMapControl2, a red rectangle appears in the axMapControl2 of the Eagle Eye control.
1) The Onextentupdated event for the AxMapControl1 control. The Onextentupdated event occurs after the visual range of the Mapcontrol has changed, which is triggered when the imapcontrol2::extent attribute changes. Ways to change the visibility of Mapcontrol include the precise setting of the range, scaling, roaming, or using the Imapcontrol2::centerat method.
1 Private voidAxmapcontrol1_onextentupdated (Objectsender, ESRI. ArcGIS.Controls.IMapControlEvents2_OnExtentUpdatedEvent e)2 {3 //get a new range4Ienvelope Penvelope =(Ienvelope) e.newenvelope;5Igraphicscontainer Pgrahicscontainer = Axmapcontrol2.map asIgraphicscontainer;6Iactiveview Pactiveview = Pgrahicscontainer asIactiveview;7 //clear all layers in axMapControl2 before drawing8 pgrahicscontainer.deleteallelements ();9Irectangleelement prectangleelement =NewRectangleelementclass ();TenIElement pelement = prectangleelement asielement; OnePelement.geometry =Penvelope; A //Set the red box in the Eagle Eye Chart -Irgbcolor Pcolor =NewRgbcolorclass (); -pcolor.red =255; thePcolor.green =0; -Pcolor.blue =0; -Pcolor.transparency =255; - //produces a line symbol object +Ilinesymbol Poutline =NewSimplelinesymbolclass (); -Poutline.width =3; +Poutline.color =Pcolor; A //set fill symbol color atPcolor =NewRgbcolorclass (); -pcolor.red =255; -Pcolor.green =0; -Pcolor.blue =0; -Pcolor.transparency =0; - //Set Fill Symbol inIfillsymbol Pfillsymbol =NewSimplefillsymbolclass (); -Pfillsymbol.color =Pcolor; toPfillsymbol.outline =Poutline; + -Ifillshapeelement Pfillshapeele = pelement asifillshapeelement; thePfillshapeele.symbol =Pfillsymbol; *Pgrahicscontainer.addelement (ielement) Pfillshapeele,0); $Pactiveview.partialrefresh (Esriviewdrawphase.esriviewgraphics,NULL,NULL);Panax Notoginseng -}
2) The OnMouseDown event for the AxMapControl2 control. The onmousedown event is triggered when any mouse button is clicked on the Mapcontrol.
1 Private voidAxmapcontrol2_onmousedown (Objectsender, ESRI. ArcGIS.Controls.IMapControlEvents2_OnMouseDownEvent e)2 {3 if(AxMapControl2.Map.LayerCount >0)4 {5 if(E.button = =1)6 {7IPoint PPoint =NewPointclass ();8 ppoint.putcoords (E.MAPX, e.mapy);9 Axmapcontrol1.centerat (ppoint);TenAxMapControl1.ActiveView.PartialRefresh (Esriviewdrawphase.esriviewgeography,NULL,NULL); One } A Else if(E.button = =2) - { -Ienvelope penv =Axmapcontrol2.trackrectangle (); theAxmapcontrol1.extent =penv; -AxMapControl1.ActiveView.PartialRefresh (Esriviewdrawphase.esriviewgeography,NULL,NULL); - } - } +}
3) The OnMouseMove event for the AxMapControl2 control. The onmousemove event is constantly triggered when the mouse is moved over the Mapcontrol.
1 Private voidAxmapcontrol2_onmousemove (Objectsender, ESRI. ArcGIS.Controls.IMapControlEvents2_OnMouseMoveEvent e)2 {3 if(E.button = =1)4 {5IPoint PPoint =NewPointclass ();6 ppoint.putcoords (E.MAPX, e.mapy);7 Axmapcontrol1.centerat (ppoint);8AxMapControl1.ActiveView.PartialRefresh (Esriviewdrawphase.esriviewgeography,NULL,NULL);9 }Ten}
Iii. Conclusion
When the data in the axMapControl1 is replaced, the data in axMapControl2 automatically loads all of the axMapControl1 's layers to unify the data for both. When you drag or move a map in the AxMapControl2 control, the map in AxMapControl1 changes at any time.
References: Map Eagle Eye function based on ArcGIS engine and c#.net South Peak
The ArcGIS Engine 10 development Manual
"Arcobjects Two-time development tutorial" Fu Zhongliang Editor
"ArcObjects Developer Help"
Eagle Eye Map Implementation based on Arcengine and C #