I saw a lot of eagle eyes implemented with VC Mapx, which can be functional. I have seen the Qinghua's name << Developing geographic information systems with MAPX >> There is a hawk eye with VB, the function is not very Strong, but simple enough, I translated the eagle of the VC version. I hope to help the novice.
My basic achievement is that two CMAPX controls at the same view window, one called a main map, one called an eagle eye diagram.
CMAPX M_CTRLMAPX; /// Main map
CMAPX M_EAGLEMAPX; / / 眼 眼 图
Note: On the oncreate function in the view must want to create M_EAGLEMAPX, so you can see the eagle eye figure. Something:
M_eaglemapx.create (NULL, WS_VISIBLE, CRECT (0, 0, 120, 120), this, IDC_MAP_EAGLE); M_EAGLEMAPX.SETGEOSet;
M_ctrlmapx.create (NULL, WS_VISIBLE, CRECT (0, 0, 100, 100), this, IDC_MAP); m_ctrlmapx.setgeoset (NULL);
Next, you can pick a few layers in the main map to the eagle eye diagram (area layer)
Map several messages in the message:
ON_EVENT (CMTRSView, IDC_MAP_EAGLE, DISPID_MOUSEMOVE / * MouseMove * /, OnMouseMoveEagleMap, VTS_I2 VTS_I2 VTS_R4 VTS_R4) ON_EVENT (CMTRSView, IDC_MAP_EAGLE, DISPID_MOUSEDOWN / * MouseDown * /, OnMouseDownEagleMap, VTS_I2 VTS_I2 VTS_R4 VTS_R4) ON_EVENT (CMTRSView, IDC_MAP_EAGLE, DISPID_MOUSEUP / * MouseUp * /, Onmouseupeaglemap, VTS_I2 VTS_I2 VTS_R4 VTS_R4) Finally, these functions:
Void cmtrsview :: OnMouseuPeagleMap (Short Button, Shift, Float X, FLOAT Y) {/// User Click the processing IF on the navigation map (strmousestate == "begin") {Double DBLMAPX1, DBLMAPY1; /// the geographical coordinates of the point determined m_eagleMapX.ConvertCoord (& X, & Y, & dblMapX1, & dblMapY1, miScreenToMap); /// main image provided geographical coordinates m_ctrlMapX.SetCenterX (dblMapX1); m_ctrlMapX.SetCenterY (dblMapY1);} /// user The processing IF when the rectangular area is bloomed in the navigation map (STrmouState == "Move") {Single SNGXMAX, SNGXMIN, SNGYMAX, SNGYMIN; IF (Prex IF (prex double dblXMax, dblXMin, dblYMax, dblYMin; m_eagleMapX.ConvertCoord (& sngXMin, & sngYMin, & dblXMin, & dblYMin, miScreenToMap); m_eagleMapX.ConvertCoord (& sngXMax, & sngYMax, & dblXMax, & dblYMax, miScreenToMap); CMapXRectangle rect; rect.CreateDispatch (rect.GetClsid ( )); Rect.Set (DBLXMIN, DBLYMIN, DBLXMIN, DBLYMAX); m_ctrlmapx.setbounds (rect.m_lpdispatch);} strmousestate = "stop"; void CMTRSView :: OnMouseDownEagleMap (short Button, short Shift, float X, float Y) {CMapXFeatures ftrs = m_eagleMapX.GetLayers () Item ( "EagleLayer") AllFeatures ();.. for (int i = 1; i <= ftrs .Getcount (); i ) {m_eaglemapx.getlayers (). Item ("eaglelayer"). Deletefeature (fTRS.Item (i));} if (button == vbleftbutton) {strmousestate = "begin"; prex = x; PREY = Y;} } void CMTRSView :: OnMouseMoveEagleMap (short Button, short Shift, float X, float Y) {if (Button = vbLeftButton!) return; CMapXRectangle rctMap; CMapXPoints pntsMap; CMapXPoint pntMap1, pntMap2, pntMap3, pntMap4; CMapXStyle styLine; CMapXFeatures ftrs; CMapXFeature FTR; SINGLE SNGX, SNGY; /// get the geographical coordinates of the mouse click point sngX = PreX; sngY = PreY; double dblMapX1, dblMapY1; m_eagleMapX.ConvertCoord (& sngX, & sngY, & dblMapX1, & dblMapY1, miScreenToMap); /// obtain the geographical coordinates of the current mouse double points DBLMAPX2, DBLMAPY2; M_EAGLEMAPX.CONVERTCOORD (& X, & Y, & DBLMAPX2, & DBLMAPY2, MISCREENTOMAP); /// set the four corners of the rectangle pntMap1.CreateDispatch (pntMap1.GetClsid ()); pntMap2.CreateDispatch (pntMap2.GetClsid ()); pntMap3.CreateDispatch (pntMap3.GetClsid ()); pntMap4.CreateDispatch (pntMap4.GetClsid ()) ; Pntmap1.set (dblmapx1, dblmapy2); pntmap2.set (dblmapx2, dblmapy2); pntmap3.set (dblmapx2, dblmapy1); pntmap4.set (dblmapx1, dblmapy1); /// /// The rectangular four-angle added PNTSMap.created (PNTSMap.GetClsid ()); PNTSMap.Add (PNTMAP1); PNTSMap.Add (PNTMap2); PNTSMap.Add (PNTMAP3); PNTSMap.Add (PNTMAP4); PNTSMap.Add (PNTMAP1); Styline.setLineColor (microLorBlack); /// defines the style of the line color stYLINE.SETLINEWIDTH (1); // /// defining the line width styline.setLineStyle (3); /// Deni line /// will navigate the Eagle eye layer All objects empty ftrs = m_eaglemapx.getlayers (). Item ("eaglelayer"). Allfeatures (); for (int i = 1; i <= ftrs.getcount (); i ) {m_eaglemapx.getlayers (). Item (" EAGLELAYER "). Deletefeature (fTRS.Item (i));} /// In the navigation map eagle layer draws a dotted rectangular box, frame out the user pre-selected range cmapxfeature ftrMap; Colevariant PNTSVT, STYVT; PNTSVT.VT = vt_dispatch; pntsvt.pdispval = pntsmap.m_lpdispatch; pntsvt.pdispval-> addref (); styVt.vt = VT_DISPATCH; styLine.CreateDispatch (styLine.GetClsid ()); styVt.pdispVal = styLine.m_lpDispatch; styVt.pdispVal-> AddRef ();. ftrMap = m_eagleMapX.GetFeatureFactory () CreateLine (pntsVt, styVt); m_eagleMapX .Getlayers (). Item ("eaglelayer"). Addfeature (ftrMap); /// Set the mouse status "Move" strmousestate = "move"; Also, you can set the size of the eagle eye map in Onsize. What else can you contact me.