Mapx VC Set Non-Earth Coordinate System

zhaozj2021-02-16  59

[Function]: MAPX VC Set Non-Earth Coordinate System [Environment]: VC6 MAPX4.5 Win2k SP3 [Tip]: Coordsys.set Settings When the non-Earth coordinate system, the coordinate range must be defined [source]: www.51gis .com

int CMyGIsView :: OnCreate (LPCREATESTRUCT lpCreateStruct) {if (CView :: OnCreate (lpCreateStruct) == -1) return -1; // create map with default size // resize message will cause it to be // size to the client Area of ​​the viewm_ctrlmapx.create (NULL, WS_VISIBLE, CRECT (0, 0, 100, 100), this, IDC_MAP); m_ctrlmapx.setgeoset ("mygst.gst"); // ------- The following code setting nonearth (meters) coordinate system ------------- CMapXRectangle Rect; CMapXCoordSys CurrentCoordsys; COptionalVariant vEmpty; VARIANT MapUnit, MapBounds; if {TRACE0 ( "Could not Create (Rect.CreateDispatch (Rect.GetClsid ())!) Object ");} if (! currentcoordsys.created)) {trage0 (" Could Not Create Object ");} Try {mapUnit.vt = vt_i4; mapUnit.lval = miunitmeter; // Set the coordinate range . Rect.Set (-2165.540090678837, 9841.99939777,46782.41871417205,41026.85331473999); MapBounds.vt = VT_DISPATCH; MapBounds.pdispVal = Rect.m_lpDispatch; MapBounds.pdispVal-> AddRef (); CurrentCoordsys.Set (0, vEmpty, MapUnit, vEmpty, vEmpty , vEmpty, vEmpty, vEmpty, vEmpty, vEmpty, vEmpty, vEmpty, MapBounds, vEmpty); m_ctrlMapX.SetNumericCoordSys (CurrentCoordsys.m_lpDispatch); m_ctrlMapX.SetDisplayCoordSys (m_ctrlMapX.GetNumericCoordSys () m_lpDispatch);.} catch (COleDispatchException * e) { E-> ReportError (); e-> delete ();} catch (ColeException * e) {e-> replacerror (); e-> delete ();} // ----------- ------------------------------------- Return 0;

转载请注明原文地址:https://www.9cbs.com/read-21854.html

New Post(0)