C # make Eagle Eye whole process (with annotation)
AxMapControl1 is the main control
To see the event response
1. Eagle Eye Map Resource Loading
private void Axmapcontrol1_onmapreplaced (object sender, Imapcontrolevents2_onmapreplacedevent e)
{
When the main map shows the control's map to be replaced, the map in the Eagle's eye follows the replacement
Axmapcontrol2.loadmxfile (Axmapcontrol1.documentfilename);
Axmapcontrol2.extent = axmapcontrol2.fullextent;
}
2. Draw the eagle eye rectangular frame
private void SetMap2 (Imapcontrolevents2_onextentupdatedevent e)
{
Get a new range
Ienvelope penv = (ienvelope) e.newenvelope;
Igraphicscontainer Pgra = Axmapcontrol2.map as Igraphicscontainer;
Iactiveview pAv = Pgra as Iactiveview;
Clears any graphic element in the AxMapControl2 before drawing
Pgra.deleteallelements ();
Irectangleelement Prectangleele = new Rectangleelementclass ();
IElement PEle = Prectangleele as ielement;
Pele.geometry = penv;
Set the Red Line box in the Eagle's eye chart
Irgbcolor Pcolor = new Rgbcolorclass ();
pcolor.red = 255;
Pcolor.green = 0;
Pcolor.blue = 0;
Pcolor.transparency = 255;
Produces a line symbol object
Ilinesymbol poutline = new Simplelinesymbolclass ();
Poutline.width = 2;
Poutline.color = Pcolor;
Set color Properties
Pcolor = new Rgbcolorclass ();
pcolor.red = 255;
Pcolor.green = 0;
Pcolor.blue = 0;
pcolor.transparency = 0;
Set the properties of a fill symbol
Ifillsymbol Pfillsymbol = new Simplefillsymbolclass ();
Pfillsymbol.color = Pcolor;
Pfillsymbol.outline = Poutline;
Ifillshapeelement Pfillshapeele = PEle as ifillshapeelement;
Pfillshapeele.symbol = Pfillsymbol;
Pgra.addelement ((ielement) pfillshapeele, 0);
Pav.partialrefresh (esriviewdrawphase.esriviewgraphics, NULL, NULL);
}
private void Axmapcontrol1_onextentupdated (object sender, Imapcontrolevents2_onextentupdatedevent e)
{
SETMAP2 (e);
}
3. Interactive
private void Axmapcontrol2_onmousedown (object sender, Imapcontrolevents2_onmousedownevent e)
{
by YL improved landgis@126.co
Irubberband Pband = new Rubberenvelopeclass ();
Igeometry pgeometry = pband.tracknew (AxMapControl2.ActiveView.ScreenDisplay, NULL);
if (pgeometry.isempty)
{
IPoint pPt = new Pointclass ();
Ppt.putcoords (E.MAPX, e.mapy);
Change the view scope of the main control
Axmapcontrol1.centerat (pPt);
}
Else
{
Axmapcontrol1.extent = Pgeometry.envelope;
AxMapControl1.ActiveView.Refresh ();
}
}
|
No money and ugly, rural hukou. Head can be broken, hairstyle must not be disorderly. [Recently in Nanchang busy GIS hard ... ing] Qq:14265545;83563956[10 year not last, or the forum message put] Msn:qq14265545@hotmail.com Come and see my blog sometime. http://gisempire.com/blog/blog.asp?name=cl991036 |