Arcengine Eagle Eye Function C # implementation

Source: Internet
Author: User
Tags ipoint

Arcengine Development of Eagle Eye function C # implementation

As a basic function of AE system, Eagle Eye is often seen in AE development. The online Eagle Eye function is similar, the example written in this paper is only for reference and record.

One

Ii. Description of the control

Basic AE frame, including menu (MenuStrip), toolbar (axtoolbarcontrol), layer Catalog (Axtoccontrol), Data View (AXMAPCONTROL1), Hawkeye View (axMapControl2).

Layout The small details of the above frame:

1, in the blank form to add MenuStrip first;

2, add Axtoolbarcontrol,dock property set to top;

3, add splitcontainer1,dock automatically to fill;

4. Add SplitContainer2 container in Splitcontainer1.panel1 (left panel) and modify its Orientation property to "horizontal";

5, add AxMapControl1 control in Splitcontainer1.panel2 (right panel), dock property is set to fill, used as Data view;

6, add Axtoccontrol control in Splitcontainer2.panel1, add AxMapControl2 control in Splitcontainer2.panel2, Dock property is set to fill, used as Eagle eye view;

Iii. Key steps

The Eagle Eye function is implemented mainly in the corresponding response events of the AxMapControl1 (main view) and AxMapControl2 (Eagle Eye), mainly axMapControl1 onextentupdated, onmapreplaced events, AxMapControl2 onmousedown, onmousemove events. The key code is as follows:

private void Axmapcontrol1_onextentupdated (object sender, ESRI. ArcGIS.Controls.IMapControlEvents2_OnExtentUpdatedEvent e) {ienvelope penvelope = (ienvelope) e.newenvel            Ope            Igraphicscontainer Pgraphicscontainer = Axmapcontrol2.map as Igraphicscontainer;            Iactiveview Pactiveview = Pgraphicscontainer as Iactiveview;            Pgraphicscontainer.deleteallelements ();            Irectangleelement Prectangleele = new Rectangleelementclass ();            IElement pelement = Prectangleele as ielement;            Pelement.geometry = Penvelope;            Irgbcolor Pcolor = new Rgbcolorclass ();            pcolor.red = 255;            Pcolor.green = 0;            Pcolor.blue = 0;             Pcolor.transparency = 255;            Ilinesymbol poutline = new Simplelinesymbolclass ();            Poutline.width = 3;            Poutline.color = Pcolor;            Pcolor = new Rgbcolorclass ();            pcolor.red = 255;            Pcolor.green = 0; PcoloR.blue = 0;            pcolor.transparency = 0;            Ifillsymbol Pfillsymbol = new Simplefillsymbolclass ();            Pfillsymbol.color = Pcolor;            Pfillsymbol.outline = Poutline;            Ifillshapeelement Pfillshapeele = pelement as ifillshapeelement;            Pfillshapeele.symbol = Pfillsymbol;            Pgraphicscontainer.addelement ((ielement) pfillshapeele, 0);        Pactiveview.partialrefresh (esriviewdrawphase.esriviewgraphics, NULL, NULL); } private void Axmapcontrol1_onmapreplaced (object sender, ESRI.            ArcGIS.Controls.IMapControlEvents2_OnMapReplacedEvent e) {axmapcontrol2.map = new Mapclass ();                if (Axmapcontrol1.layercount > 0) {for (int i=0;i<=axmapcontrol1.map.layercount-1;++i)                {Axmapcontrol2.addlayer (Axmapcontrol1.get_layer (i));            } axmapcontrol2.extent = Axmapcontrol1.extent; }} Private VoID Axmapcontrol2_onmousedown (object sender, Imapcontrolevents2_onmousedownevent e) {if (axmapcontrol2.m Ap. LayerCount > 0) {if (E.button = = 1) {IPoint ppoint = new                    Pointclass ();                    Ppoint.putcoords (E.MAPX, e.mapy);                    Axmapcontrol1.centerat (PPoint);                AxMapControl1.ActiveView.PartialRefresh (esriviewdrawphase.esriviewgraphics, NULL, NULL); } else if (E.button = = 2) {Ienvelope penv = Axmapcontrol2.trackrectangle                    ();                    Axmapcontrol1.extent = penv;                AxMapControl1.ActiveView.PartialRefresh (esriviewdrawphase.esriviewgraphics, NULL, NULL); }}} private void Axmapcontrol2_onmousemove (object sender, Imapcontrolevents2_onmousemoveevent E {if (E.button = = 1) {IPoint ppoint = new PoinTclass ();                Ppoint.putcoords (E.MAPX, e.mapy);                Axmapcontrol1.centerat (PPoint);            AxMapControl1.ActiveView.PartialRefresh (esriviewdrawphase.esriviewgraphics, NULL, NULL); }        }
Iv. Other Notes

1, Eagle Eye on-demand display and hide

Now you want the Eagle eye control to be hidden by default and displayed only when you click the Eagle Eye feature. Implementation ideas: Set the splitcontainer2.panel2collapsed default property to True to change this property when responding to an eagle eye click event. (Tip: Due to the axMapControl2 of the Eagle eye function, it is recommended that the property be modified after the corresponding response to the event.)

2. Axtoccontrol control layer does not display problems

Even though the Axmapcontrol control is bound in the control by Axtoccontrol, the layer catalog does not appear when it is actually run, and the workaround is to add the bindings manually in the program.

Axtoccontrol1.setbuddycontrol (AXMAPCONTROL1);

Complete sample source code, interested can be consulted. Sample Source: http://download.csdn.net/detail/sean4m/9513918



Arcengine Eagle Eye Function C # implementation

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.