ArcGIS Engine-eagleeye (reduce flickering)

Source: Internet
Author: User
Tags ipoint

The code displayed on the internet is like this. After continuous debugging, you can achieve the unexpected effect. it is mainly in the "when the mouse is dragging", the online code's eagleeye effect, it feels like the potholes are dead, flashing super serious. the main reason is that the update is performed from time to time when the mouse is dragged.

On the "map of Heaven and Earth" page, it is updated only after the mouse is opened. Below is a slight change to the online code:

Main View:

# Region main view event. // synchronize the eagleeye view and master view. private void map_main_onmapreplaced (Object sender, ESRI. arcGIS. controls. imapcontrolevents2_onmapreplacedevent e) {mapctrl_view.clearlayers (); For (INT I = 0; I <mapctrl_main.layercount; I ++) mapctrl_view.addlayer (parts (I); mapctrl_view.extent = comment; comment ();} // draw the outline. private void map_main_onextentupdated (Object sender, ESRI. arcGIS. controls. imapcontrolevents2_onextentupdatedevent e) {drawsymbol (sender, (ESRI. arcGIS. geometry. ienvelope) E. newenvelope);} # endregion

Auxiliary methods:

1 // <summary> 2 // return color. 3 /// </Summary> 4 /// <Param name = "RGB"> RGB value </param> 5 /// <Param name = "Transparency"> Transparency [0,255] (0 is completely transparent) </param> 6 // <returns> color object. </returns> 7 ESRI. arcGIS. display. irgbcolor colorpaint (int rgb, byte transparency) {8 ESRI. arcGIS. display. irgbcolor rgbcolor = new ESRI. arcGIS. display. rgbcolorclass (); 9 rgbcolor. RGB = RGB; 10 rgbcolor. transparency = transparency; 11 return rgbcolor; 12} 13 14 // <summary> 15 // draw the outline. 16 /// </Summary> 17 /// <Param name = "sender"> </param> 18 /// <Param name = "E"> Based on the ienvelope object outline. </param> 19 void drawsymbol (Object sender, ESRI. arcGIS. geometry. ienvelope e) {20 ESRI. arcGIS. carto. igraphicscontainer hawkgc = (ESRI. arcGIS. carto. igraphicscontainer) mapctrl_view.map; 21 ESRI. arcGIS. carto. iactiveview aview = (ESRI. arcGIS. carto. iactiveview) hawkgc; 22 hawkgc. deleteallelements (); 23 24 ESRI. arcGIS. carto. ielement recele = (ESRI. arcGIS. carto. ielement) New ESRI. arcGIS. carto. rectangleelementclass (); 25 recele. geometry = E; 26 ESRI. arcGIS. display. isimplelinesymbol outline = new ESRI. arcGIS. display. simplelinesymbolclass (); 27 outline. color = colorpaint (255,255); 28 outline. width = 2; 29 30 // fill style. 31 ESRI. arcGIS. display. isimplefillsymbol fillsym = new ESRI. arcGIS. display. simplefillsymbolclass (); 32 fillsym. color = colorpaint (255, 0); 33 fillsym. outline = outline; 34 35 ESRI. arcGIS. carto. ifillshapeelement fillshape = (ESRI. arcGIS. carto. ifillshapeelement) recele; 36 fillshape. symbol = fillsym; 37 hawkgc. addelement (ESRI. arcGIS. carto. ielement) fillshape, 0); 38 aview. partialrefresh (ESRI. arcGIS. carto. esriviewdrawphase. esriviewgraphics, null, null); 39}

Eagleeye View:

1 # region eagleeye event. 2 Private void map_view_onmousedown (Object sender, ESRI. arcGIS. controls. imapcontrolevents2_onmousedownevent e) {3 if (mapctrl_main.layercount <0) return; 4 If (E. button = 1) {// click. 5 ESRI. arcGIS. geometry. ipoint ptnew = new ESRI. arcGIS. geometry. pointclass (); 6 ptnew. putcoords (E. mapX, E. mapy); 7} 8 else if (E. button = 2) // right-click and select. 9 {10 interenvelope = mapctrl_view.trackrectangle (); 11 // record the areas of interest. 12 mapctrl_main.extent = interenvelope; 13} 14 mapctrl_main.activeview.partialrefresh (ESRI. arcGIS. carto. esriviewdrawphase. esriviewgeography, null, null); 15} 16 17 private void map_view_onmousemove (Object sender, ESRI. arcGIS. controls. imapcontrolevents2_onmousemoveevent e) {18 if (E. button = 1 & interenvelope! = NULL) {19 // move the mouse, the outline changes, but the main view is not updated until the mouse is opened. 20 interenvelope. putcoords (E. mapX-interenvelope. width/2, E. mapy-interenvelope. height/2, E. mapX + interenvelope. width/2, E. mapy + interenvelope. height/2); 21 drawsymbol (sender, interenvelope); 22} 23} 24 25 private void map_view_onmouseup (Object sender, ESRI. arcGIS. controls. imapcontrolevents2_onmouseupevent e) {26 // The Master view is synchronously updated when the mouse is opened, and matched with map_view_onmousemove. 27 ESRI. arcGIS. geometry. ipoint ptnew = new ESRI. arcGIS. geometry. pointclass (); 28 ptnew. putcoords (E. mapX, E. mapy); 29 mapctrl_main.centerat (ptnew); 30 mapctrl_main.activeview.partialrefresh (ESRI. arcGIS. carto. esriviewdrawphase. esriviewgeography, null, null); 31} 32 # endregion

 

ArcGIS Engine-eagleeye (reduce flickering)

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.