Develop MAPGIS browser using Visual C ++ 6.0

zhaozj2021-02-11  185

Use Visual C 6.0 development MAPGIS browser Author: Guo Yongbin Published: 2001/04/09

Thesis:

Geographic Information System (GIS) is an emerging marginal discipline integrating computer science, geography, surveying and mapping, environmental science, urban science, spatial science, information science and management science. The current development is quite mature, domestic and international high level software There are ARC / INFO, MAPINFO, MAPGIS, etc. An example of a secondary development in MAPGIS is described below.

text:

Developing a Mapgis browser using Visual C 6.0 Recently, the author has been developing MAPGIS secondary development, slightly giving. Participation has been organized and shared with you. I. MapGIS profile information as a emerging industry is increasingly attached to people, the wave of information revolution is impacting human society. In this revolution, the Geographic Information System (GIS) is used as a set of computer science, geography, and mapping. The emerging marginal disciplines integrating remote induction, environmental science, urban science, space science, information science and management science have rapidly rise and develop. Geographic Information System Research on Computer Technology and Spatial Geographic Distribution Data, through a series of spatial operations and analysis methods, providing information on plans, management and decision-making, and answers users The relevant issues raised. The current development of the geographic information system is quite mature, and the high-level software in foreign countries has ARC / INFO, MAPINFO, etc., While the domestic high level software is also more, especially the most advanced MAPGIS developed by China University of Geosciences (Wuhan), and has even exceeded The level of similar software abroad, and is a pure Chinese software developed and independent copyright to my country. The geographic information system platform used by this software is a Mapgis platform. On the basis of more than ten years of digital drawing software development, the platform has developed into GIS software and the GIS application system. The geographic information system has reached the international advanced level. In 1997, in 1998, in 1999, the first year in 2000. At present, a series of application systems such as pipe network system, police electronic map system, combat command system, urban planning construction system, and tourism system, etc. are completed on the basis of this prototype system. MapGIS geographic information systems are suitable for geological, minerals, geography, mapping, water conservancy, oil, coal, railway, transportation, urban construction, planning, and land management. Mapgis is a complete geographic information system with an international advanced level. It is divided into "input", "graphic editing", "library management", "space analysis", "output", and "practical services" six parts, total Subsystem. It is very powerful, and it is easy to use, friendly interface, compatibility. Therefore, this GIS browser uses MAPGIS secondary development for the Mapgis browser. Second, Mapgis browser development destination Mapgis has so much benefits, the function is so powerful, then why do you want to develop what MAPGIS browser is developed? First, economic problems. The functionality of Mapgis itself is very powerful, and the application is very broad, but the price of this professional software is also very considerable. Not everyone can buy the software. Second, use aspects of use. Said so much money to buy functions such a powerful software to do what, can you use all of the features or most of the features. Obviously, most units or individuals can only use some of the functions, and even some units use only one of them. Recently, the author's secondary development of MapGIS is a very similar problem with the above. The software is only responsible for browsing maps drawn by MapGIS, so it does not require MapGIS to support, only one MapGIS browser is needed. That's why you want to develop a Mapgis browser. Third, the system browser constitutes this system browser as the underlying graphics library as the underlying support, mainly consisting of file input, graphical browsing, query, tool, and other modules. The following will be described below. (1), file input This part of the function is to enter browsers in the form of each piece, such as points, line, and face.

The file input is driven by a menu event. When you click on the menu corresponding to each graph, that is, the corresponding project file is transferred, and all of the graphic components contained in the project file are read into the computer, display it immediately. Each project file format is: such as xxx.prj project file content: 1. Graphic library composed of files: N 2, zone map file: xxx.wp 3, line chart file: xxx.wl = n 4, point map element Document: XXX.WT format China area, line, point element files, all points, total number is N. District, line, point chamber files are not complete, for example, only zone line chair files can be included. The convenience of this format is that the gallery changes simply modify the project file, no need to re-modify the software code. (2), graphical browsing graph browsing on the one hand, browsing graphics, on the other hand, browsing the properties information of the graph. This section features the ability to browse the single-point element file point chair file point element file one or more attributes, and select graphics workspace and graph roaming. The graphical browsing menu is under: 1, the browsing attributes When you click on this menu, all the primitive files will be popped up, and you can choose the graphics you need to browse, and its properties. After selecting a property form, you will pop up a property form, and each sub-element in the form is linked. One, one item in the property form is selected, the corresponding graph is immediately blinking, selecting graphics can also be linked, very convenient to browse all graphics With attributes. 2. Browse a single attribute to browse the properties of a single graphic, first select a single work area, double-click the graphic you want, and the selected person is displayed, and the properties are popped up. 3. Stop flashing click When you click, the lines, districts, or all of the displayed graphics are being displayed. 4. After the graph is roaming, the mobile mouse graphics can be moved, and the roaming status is displayed. 5. Select the work area, the selection point, line or zone is displayed, and you can highlight individual graphics. (3) Query the partial, line, surface query capability, and can query the point line according to its attribute, extract save, very convenient for professional applications; simultaneous query results can be associated with the database, from the database More abundant information in query. The query menu item includes point line query and extraction, both through the dialog box input condition for query and extraction. (4) The tool tool part is mainly a graphic display operation. This tool operates on the graphics window, such as zooming, narrowing, moving a window, and the like. The upper window is in the form of the previous window; the reset window automatically exactfully displayed in the window; the update window is used to refresh the window to display the window; the window makes all the window content clear. (5) Other part of this part is an auxiliary function, which can be individually input, line, surface file, and area, perimeter, length statistics. Enter points, lines, and surface files: Used to enter other points, lines, surface graphics files, easy to browse other graphics files while using other features of the browser. Area, circumference, length statistics: This statistical function is suitable for rapid calculation of regional area, perimeter, and line segments such as rivers, roads, etc.).

Fourth, the program list part of the system implemented // CGisView_Demo1View.cpp: implementation of the CCGisView_Demo1View class // # include "stdafx.h" #include "CGisView_Demo1.h" #include "ddeobj.h" #include "CGisView_Demo1Doc.h" # include "CGisView_Demo1View.h" #include "dialog2.h" #include "Win_area.h" #ifdef _DEBUG # define new DEBUG_NEW # undef THIS_FILEstatic char THIS_FILE [] = __FILE __; # endif #include "childfrm.h" /// CCGisView_Demo1View IMPLEMENT_DYNCREATE (CCGisView_Demo1View, CGisView) BEGIN_MESSAGE_MAP (CCGisView_Demo1View, CGisView) ...... END_MESSAGE_MAP () /// CCGisView_Demo1View construction / destructionextern HDDEDATA CALLBACK EXPORT DdeCallback (UINT iType, UINT iFmt, HCONV hCconv, HSZ hsz1, HSZ hsz2, HDDEDATA hData, DWORD dwData1, DWORD DWDATA2; CDDEOBJ THEDDE; HWND HWND; Char * DWARFS [] = {"Sleepy", "Sleepy", "Sneezy", "Bashful", "Dopey", "Happy", "DOC"}; char * reeser [ ] = {"Dasher", "Dancer", "Prance", "Vixen", "COMET", "CUPID", "Donner", "Blitzen"}}}; ccgisview_demo1view :: ccgisview_demo1view () {bmp1.loadbitmap (idb_bitmap1); Lbuttonpos = (0,0); gotoanywhere _flage = false; querybore_flage = false; flashtype = -1; connectToDbs = false; curview_area = -1; curview_type = -1; // DDE Initialize DdeInitialize (& (theDDE.idInst), DdeCallback, APPCLASS_STANDARD | CBF_FAIL_ADVISES | CBF_FAIL_EXECUTES | CBF_FAIL_POKES | CBF_SKIP_REGISTRATIONS | CBF_SKIP_UNREGISTRATIONS, 0L); HSZ hszService; theDDE.AppName = "MyDDEApp"; hszService = DdeCreateStringHandle (theDDE.idInst, theDDE.AppName, 0); DdeNameService (theDDE.idInst, hszService, NULL, DNS_REGISTER);

// DDE end} HDDEDATA CALLBACK EXPORT DdeCallback (UINT iType, UINT iFmt, HCONV hCconv, HSZ hsz1, HSZ hsz2, HDDEDATA hData, DWORD dwData1, DWORD dwData2) {// Topic = hsz1 Item = hsz2.char szBuffer [32]; switch (iType) {case XTYP_CONNECT: // GET the application nameDdeQueryString ((theDDE.fakeThis) -> idInst, hsz2, szBuffer, sizeof (szBuffer), 0); if (! (theDDE.fakeThis) -> AppName = szBuffer) Return False; DdeQueryString ((these DDE.FAKETHIS) -> Idinst, HSZ1, SZBuffer, SizeOf (Szbuffer), 0); IF (SZBuffer, "DWARFS") && strCMP (SZBuffer, "Reindeer") Return False; Return (HDDEDATA) TRUE; Break; Case Xtyp_Request: DdeQueryString ((THEDDE.FAKETHIS) -> IdInst, HSZ1, SZBuffer, SizeOf (Szbuffer), 0); IF (Strcmp (SZBuffer, "Dwarfs") == 0) {// get the item nameDdeQueryString ((theDDE.fakeThis) -> idInst, hsz2, szBuffer, sizeof (szBuffer), 0); int dwarfcode = atoi (szBuffer); // SendMessage (hwnd, WM_COMMAND, ID_TRY2,0L); if (( DWarfCode <0) || (dwarfcode> 6)) Return False; Return DdecreatedDataHandle (4FAKETHIS) -> iDINST, (LPBYTE) DWARFS [DWARFCODE], Strlen (dwarfs [dwarfcode]) 1,0, h sz2, CF_TEXT, 0);}} return NULL;} CCGisView_Demo1View :: ~ CCGisView_Demo1View () {} BOOL CCGisView_Demo1View :: PreCreateWindow (CREATESTRUCT & cs) {// TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs // ptai = NULL; // selection display area return CGisView :: PreCreateWindow (cs);} /// CCGisView_Demo1View drawing void CCGisView_Demo1View :: OnDraw (CDC * pDC) {CCGisView_Demo1Doc * pDoc = GetDocument (); ASSERT_VALID (pDoc); HWnd = m_hwnd; // Todo: Add Draw code for native data herecisview :: overdraw (pdc);} void ccgisview_demo1view :: _ OwnerDraw (mydc mydc) {Short Ti, i, j, k; short * plst; short type; bool FLAGE = false; ccgisview_demo1doc * pdoc = getDocument ();

Assert_Valid (PDOC); _ getarealist (& plst); if (plst == null) return; for (Ti = 0; Ti <4; Ti ) // 4 times, sequentially display area, line, point, network {switch (Ti ) {case 0: type = reg; break; case 1: type = net; break; case 2: type = lin; break; case 3: type = Pnt; Break;} if (PDOC-> PTAI == NULL) / / Select the display area) {for (i = 1; i <= plst [0]; i ) {if (Type! = _ Getareatype (PLST [i])) Continue; switch (type) {copy PNT: _disppntarea (MyDC, PLST [I]); Break; Case Lin: _displinaarea (MyDC, PLST [I]); Break; Case Reg: _dispregarea (MYDC, PLST [I]); Break; Case Net: _Displinarea (MYDC, PLST [i]) (default: Break;}}} else for (i = 1; i <= pdoc-> ptai [0]; i ) {if! = _ getareatype (PDOC-> PTAI [i]) Continue; for (k = 1; k <= plst [0]; k ) {IF (PLST [K] == PDOC-> PTAI [i]) {flage = true; Break;} flage = false;} }witch (TYPNTAREA (MYDC, PDOC-> PTAI [I]); Break; Case Lin: _displinaarea (MyDC, PDOC-> PTAI [i]); Break; Case Reg: _dispregarea (MyDC, PDOC-> ptai [i]); break; case NET: _DispLinArea (myDC, pDoc-> ptai [i]); break; default: break;}}}} /// CCGisView_Demo1View diagnostics #ifdef _DEBUGvoid CCGisView_Demo1View :: AssertV alid () const {CGisView :: AssertValid ();} void CCGisView_Demo1View :: Dump (CDumpContext & dc) const {CGisView :: Dump (dc);} CCGisView_Demo1Doc * CCGisView_Demo1View :: GetDocument () // non-debug version is inline { ASSERT (m_pDocument-> IsKindOf (RUNTIME_CLASS (CCGisView_Demo1Doc))); return (CCGisView_Demo1Doc *) m_pDocument;} # endif // _ DEBUG /// CCGisView_Demo1View message handlers void CCGisView_Demo1View :: LoadAFile (short fType) {CCGisView_Demo1App * ptApp; short ai, I; short * Poldlst; short * pnewlst; ptapp = (ccgisview_demo1app *) AFXGetApp (); // Take the current application object address AI = _openarea (ptapp->

m_ahinst, ftype); // Open an air work area IF (Ai <= 0) // of a fType type, returns return; if (! _ _ loadfile (ai)) // load file to the AI ​​workspace, if it fails Turn off the workspace and return {_closerea (ai); return;} _ getarealist (& Poldlst); // Take the work area corresponding to the current view window. If not, Poldlst returns Nullif (Poldlst) // Poldlst! = Null, indicates the current The window already has a corresponding work area, saving the original work area {pNewlst = new short [Poldlst [0] 2]; // pnewlst [0] = POLDLST [0] 1; for (i = 1; i <= POLDLST [0]; i ) PNewlst [i] = Poldlst [i];} else {pNewlst = New Short [2]; pnewlst [0] = 1; i = 1;} PNewLST [i] = AI; / / Add new workspace _SetareAlist (PNEWLST); // Reset to the workspace delete corresponding from the current view window [] pnewlst; _restoreWindow (); // Reset the current view Return;} void ccgisview_demo1view :: onlinepnt () { Loadafile (PNT); // Loading point file} void ccgisview_demo1view :: onloadlin () {loadafile (lin); // load line file} void ccgisview_demo1view :: onlinereg () {loadingafile (reg); // Load area File} void ccgisview_demo1view :: onStartFlash () {// char _willget (char yesorno); // Whether to take the left mouse button to hold down the moving rectangle range, the function must be called back backend behind _SetCommandflag.

_SetCommandFlag (ID_START_FLASH); _ WillGetRect (1); return;} void CCGisView_Demo1View :: OnLButtonUp (UINT nFlags, CPoint point) {// TODO: Add your message handler code here and / or call defaultRECT rc; F_RECT frc; long * ptLst; Short * ptailst; short i; cgisview :: ONLBUTTONUP (NFLAGS, POINT); long cmd = _getcommandflag (); switch (cmd) {copy IDMN_ENLARGE: // Enlarge window _EnlarGewIndowlxy (Point.x, point.y); Break; Case IDMN_REDUCE: / / Reduced window _reduceWindowlxy (Point.x, point.y); break; case IDMN_MOVE: // Mobile window _MoveWindowlxy (lbuttonpos.x-point.x, lbuttonpos.y-point.y); Break; Case IDMN_LASTWIN: // superior window _PrevWindow (); break; // case idmn_restore: // Reset window // _RESTOREWINDOW (); break; // case IDMN_UPDATE: // Update window //_UpdateWindow (); Break; // Case IDMN_CLEAR: / / Clear Window //_CleanWindow (); Break; Case ID_Start_Flash: // Scintillation Chart IF (_GetRect (& RC)) {_ WPTOLP (Rc.xmin), & (FRC.XMIN), & ( frc.ymax); _ wptolp (rc.Right, rc.bottom, & (frc.xmax), & (frc.ymin)); if (_getareAlist (& PTAILST)) {for (i = 1; i <= 1 / * ptailst [0] * /; i ) {switch (_ATYPE (ptailst [i])) {case PNT: PTLST = _RECTASKPNTT Olist (ptailst [i], & frc, null; if (ptlst) {_flashpnt (ptailst [i], ptlst 1, ptlst [0]); _ viewarcd (GetsafehWnd (), PTailst [i], pnt, * (PTLST 1), "Zhangzhou District Zhunhe Management Information System - Browsing Information");} Break; Case Lin: PTLST = _Rectasklintolist (PTailst [i], & frc, null); if (PTLST && QueryBore_Flage == false) {_flashlin (PTailst [I], PTLST 1, 1); // PTLST [0]); _ viewarcd (getsafehwnd (), ptailst [i], lin, * (PTLST 1), "Zhangzhou District Lihe Management Information System - - Browsing Information ");} Break; Case REG: PTLST = _RECTASKREGTOLIST (PTailst [I], & FRC, NULL); if (PTLST && QueryBore_FLAGE == false) {_flashreg (ptailst [i], ptlst 1, PTLST [0 ]); _VIEWARCD (GetsafehWnd (), PTailst [i], reg, * (PTLST 1), "Zhangzhou Zhurong Management Information System - Browsing Information");} Break;

default: break;}}}} break; default: break;}} void CCGisView_Demo1View :: OnStopFlashPnt () {_StopFlash (PNT); // stops blinking dot} void CCGisView_Demo1View :: OnStopFlashLin () {_StopFlash (LIN); // stops flashing lines} void CCGisView_Demo1View :: OnStopFlashReg () {_StopFlash (REG); // stops blinking region} void CCGisView_Demo1View :: OnEnlarge () {// MessageBox ( "sdsdsd", "vfsfsfs", MB_OK); _ SetCommandFlag (IDMN_ENLARGE) ;} void CCGisView_Demo1View :: OnReduce () {_SetCommandFlag (IDMN_REDUCE);} void CCGisView_Demo1View :: OnMove () {_SetCommandFlag (IDMN_MOVE);} void CCGisView_Demo1View :: OnRestore () {_RestoreWindow (); // reset window} void CCGisView_Demo1View: : OnUpdate () {_UpdateWindow (); // update window} void CCGisView_Demo1View :: OnLastwin () {_PrevWindow (); // the upper window} void CCGisView_Demo1View :: OnClear () {_CleanWindow (); //} void CCGisView_Demo1View clear window :: OnLButtonDown (UINT nFlags, CPoint point) {LButtonPos = point; CGisView :: OnLButtonDown (nFlags, point);} void CCGisView_Demo1View :: OnRButtonDown (UINT nFlags, CPoint point) {// TODO: Add your message handler code here and / or Call Defaultif gotoanywhere_flage) CheckMenuItem (m_hGisViewPopMn, ID_GOTOANYWHERE, MF_CHECKED); else CheckMenuItem (m_hGisViewPopMn, ID_GOTOANYWHERE, MF_UNCHECKED); _SetCommandFlag (0); CGisView :: OnRButtonDown (nFlags, point);} int CCGisView_Demo1View :: OnCreate (LPCREATESTRUCT lpCreateStruct) {if (CGisView :: OnCreate (lpCreateStruct) == -1) return -1; // TODO: Add your specialized creation code hereID_BMPAppendMenu (m_hGisViewPopMn, MF_SEPARATOR, NULL, NULL); // AppendMenu (m_hGisViewPopMn, MF_BITMAP, ID_BMP, (LPCSTR) bmp1. GetSafeHandle ()); // (CBitmap :: FromHandle (bmp1))); // MAKEINTRESOURCE (IDB_BITMAP1)); AppendMenu (m_hGisViewPopMn, MF_STRING, ID_TRY, "Browse properties"); AppendMenu (m_hGisViewPopMn, MF_SEPARATOR, NULL, NULL) ;

AppendMenu (m_hGisViewPopMn, MF_STRING, ID_START_FLASH, "browse individual property"); AppendMenu (m_hGisViewPopMn, MF_SEPARATOR, NULL, NULL); AppendMenu (m_hGisViewPopMn, MF_STRING, IDMN_STOP_FLASH_PNT, "stops flashing point"); AppendMenu (m_hGisViewPopMn, MF_STRING, IDMN_STOP_FLASH_LIN, " stops flashing lines "); AppendMenu (m_hGisViewPopMn, MF_STRING, IDMN_STOP_FLASH_REG," stops flashing zone "); AppendMenu (m_hGisViewPopMn, MF_STRING, ID_STOPALL_FLASH," stop all flashing "); AppendMenu (m_hGisViewPopMn, MF_SEPARATOR, NULL, NULL); AppendMenu (m_hGisViewPopMn , MF_UNCHECKED, ID_GOTOANYWHERE, "graphics roaming"); return 0;} BOOL CCGisView_Demo1View :: OnCommand (WPARAM wParam, LPARAM lParam) {// TODO: Add your specialized code here and / or call the base classswitch (wParam) {case ID_BMP : // MessageBox ( "vvvvvv"); dialog2 dlg; dlg.DoModal (); break;} return CGisView :: OnCommand (wParam, lParam);} void CCGisView_Demo1View :: OnTry () {CCGisView_Demo1App * ptApp; // AREA_HINST hinst = Getareainst (); ptapp = (ccgisview_demo1app *) AFXGetApp (); // Take the current application object address // ai = _openarea (ptapp-> m_ahinstatthwnd = _Viewatt (getsafehwnd (), PTAPP-> m_ AHInst, WS_CAPTION); // if (_ViewAtt (GetSafeHwnd (), ptApp-> m_AHInst, WS_CAPTION) == NULL) // MessageBox ( "error", "", MB_OK);} LRESULT CCGisView_Demo1View :: OnMyMessage (WPARAM wParam, LPARAM LPARAM) {Lin_info Lin_info; Reg_info REG_INFO; PNT_INFO PNT_INFO; / * SPRINTF (STR, "Area =% D Type =% D Element =% D / N", ((Mgmsg *) LParam) -> AI, (((MGMSG) *) LPARAM -> TYPE, ((mgmsg *) lparam) -> ELMI); * / // messagebox (STR, ",", ",", ",,,,,,,,,,,, (Mgmsg *) LPARAM -> type; switch ((mgmsg *) lparam) -> type) {case PNT: _GetPntinfo (((mgmsg *) lparam) -> AI, ((mgmsg *) lparam) -> Elmi , & PNT_INFO);

_GotownDowFXY (0.5 * (PNT_INFO.RECT.XMIN PNT_INFO.RECT.XMAX), 0.5 * (PNT_INFO.RECT.YMIN PNT_INFO.RECT.YMAX); _ flashpnt (((mgmsg *) lparam) -> Ai, & ( ((Mgmsg *) lParam -> ELMI), 1); FlashType = Pnt; Break; Case Lin: _GetlinInfo ((mgmsg *) lparam) -> Ai, ((mgmsg *) lparam) -> Elmi, & lin_info) _GotownDowFXY (0.5 * (Lin_info.rect.xmin Lin_info.Rect.xmax), 0.5 * (Lin_info.Rect.ymin Lin_info.rect.ymax); _ flashlin (((mgmsg *) lparam) -> ai, & & ((Mgmsg *) lParam -> ELMI), 1); FlashType = Lin; // MessageBox ("Flash Lin", "MSG", MB_OK; Break; Case Reg: _GetRegInfo (((mgmsg *) lparam) -> AI, ((mgmsg *) lparam) -> ELMI, & reg_info; _ gotowindowfxy (0.5 * (reg_info.rect.xmin reg_info.rect.xmax), 0.5 * (reg_info.rect.ymin reg_info.rect.ymax ); _ Flashreg ((mgmsg *) LParam) -> AI, & (((mgmsg *) lparam) -> ELMI), 1); flashType = reg; break; default: Break;} return1View :: OnDestroyAttWnd (WPARAM wParam, LPARAM lParam) {if (! lParam == 0 && attHwnd = NULL) {attHwnd = NULL; curview_area = -1; curview_type = -1; _StopFlash (LIN); _ StopFlash (PNT); _ StopFlash ( REG); urn 0;} void CCGisView_Demo1View :: OnLButtonDblClk (UINT nFlags, CPoint point) {RECT rc; F_RECT frc; long * ptLst; short * ptAiLst; short i; ATT_STRU * stru; char * att; char ptStr [256]; long cmd = _GETCOMMANDFLAG (); if (cmd == id_start_flash || atthwnd! = NULL) // Flashing chammetric {rc.left = Point.x-10; rc.bittom = Point.y 10; r.right = point. X 10; rc.top = Point.y-10; {_ wptolp (rc.xmin), & (frc.xmin), & (frc.ymax)); _ wptolp (rc.right, rc.bottom, & (frc.xmax), & (frc.ymin)); if (_getareAlist (& ptailst)) {for (i = 1; i <= ptailst [0]; i

) {switch (ptailst [i])) {case pnt: ptlst = _RECTASKPNTTOLIST (ptailst [i], & frc, null); if (ptlst) {if (atthwnd == null && curview_area == - 1) {_flashpnt ( PTailst [I], PTLST 1, 1); // PTLST [0]); if (connectTodbs) {_getatt (PTailst [i], PNT, * (PTLST 1), & STRU, & ATT); if (_cvtfldtostring1) STRU, ATT, "Drilling No.", PTSTR, 256, NULL, NULL) {// MessageBox (PTSTR, PTSTR, MB_OK); Pb.ExcuteServiceCMD (PTSTR);} else_viewarcd (GetsafehWnd (), PTailst [i], PNT, * (PTLST 1), "Zhangzhou Zihe Management Information System - Browsing Information");} else _Viewarcd (GetsafehWND (), PTailst [i], PNT, * (PTLST 1), "Zhangzhou area River Management Information System - Browsing Information ");} else if (FlashType == PNT) {// _ flashpnt (ptailst [i], ptlst 1, 1); // PTLST [0]); :: SendMessage (atthwnd) , Wm_command, goto_att, * (ptlst 1));} Break;} case lin: ptlst = _Rectasklintolist (ptailst [i], & frc, null); if (ptlst && querybore_flage == false) {if (atthwnd == null&& Curview_area == - 1) {_flashlin (ptailst [i], ptlst 1, 1); // PTLST [0]); _VIEWARCD (), PTailst [i], lin, * (PTLST 1), "忻 州 滹 滹 管理 理 理 理 理 理 理 理 资; 资 资 资 资 i 资;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; SendMessage (A TthWnd, WM_COMMAND, GOTO_ATT, * (PTLST 1)); // MessageBox ("Flash Lin", ", MB_OK);} Break;} Case Reg: PTLST = _RectskRegtolist (PTailst [i], & frc, null; IF (PTLST && QueryBore_FLAGE == false) {if (atthwnd == null && curview_Area == - 1) {_flashreg (ptailst [i], ptlst 1, 1); // PTLST [0]); _VIEWARCD (GetsafehWnd () , PTailst [I], REG, * (PTLST 1), "Zhangzhou District Zhuhe Management Information System - Browsing Information");} else if (flashType == REG) {// _ flashlin (ptailst [i], ptlst 1, 1); // ptlst [0]); :: SendMessage (atthwnd, wm_command, goto_att, * (ptlst 1)); // MessageBox ("

flash reg "," regg ", MB_OK);} break;} default: break;}}}}} CGisView :: OnLButtonDblClk (nFlags, point);} void CCGisView_Demo1View :: OnDestroy () {short * ptAiLst; int i; IF (_GetareAlist (& ptailst)) {for (i = 1; i <= ptailst [0]; i ) {// _ savefile (ptailst [i]); _ closerea (ptailst [i]);}} cgisview :: ONDESTROY ); // MessageBox ("Close Child Frame View", ", MB_OK);} void ccgisview_demo1view :: onmousemove (uint nflags, cpoint point) {f_dot xy1; // f_Rect FRC; Rect frc; long dx, dy; cpoint Point2; getClientRect (& frc); if (gotoanywhere_flage) {if (Point.x <= frc.LRT 50) DX = 50; if (Point.x> = frc.right-50) DX = -50; if (POINT .y <= frc.top 50) DY = 50; if (point.y> = frc.bottom-50) DY = -50; if (Point.x <= frc.left 50 || Point.x> = frc.right-50 || Point.y <= frc.top 50 || Point.y> = frc.bottom-50) {getCursorpos (& Point2); Point2.x = DX; Point2.y = Dy; _WPTOLP (& Point, & XY1); _ GotowindowFXY (XY1.X, XY1.Y); SetCursorpos (Point2.x, Point2.y); // 0.5 * (FRC.LREFT FRIGHT), 0.5 * (frc.top frc .bottom);}} cgisview :: onmousemove (nflags, point);} void ccgisview_demo1view :: overgotoanywhere () {goto ! Anywhere_flage = gotoanywhere_flage;} void CCGisView_Demo1View :: OnUpdateGotoanywhere (CCmdUI * pCmdUI) {pCmdUI-> SetCheck (gotoanywhere_flage); // TODO: Add your command update UI handler code here} void CCGisView_Demo1View :: OnStopallFlash () {_StopFlash (LIN) _StopFlash (PNT); _ Stopflash (reg);} / * void ccgisview_demo1view :: Ontry2 () {// MessageBox ("I am Trying Dde Connection", "Dde ONTRY2", MB_OK); // OnStartFlash (); long * p; short * Poldlst; INT I, AI; LPTSTR PSTR; CSTRING NAME; CHAR C [2]; C [0] = '"; c [1] =' / 0 '; _GetareAlist (&

Poldlst); // Take the work area corresponding to the current view window. If no, Poldlst returns Nullif (Poldlst) // Poldlst! = NULL, indicating that the current window has a corresponding work area, saving the original work area {for (i = 1; i <= Poldlst [0]; i ) {ai = Poldlst [i]; name.empty (); Name = "Drilling No.! ="; Name = Name C; Name = Name "001 "; Name = Name C; pstr = name.getbuffer (name.getLength ()); MessageBox (PSTR, PSTR, MB_OK); P = _ttasktolist0 (AI, PNT, PSTR); // _ _Ttasktolist (Ai, PNT) ; if (p! = null) {_flashpnt (ai, p 1, p [0]);}}}} * / bool ccgisview_demo1view :: OpenMap (char * prj) {ccgisview_demo1app * ptapp; short ai, i; short * Poldlst; short * fp; short ftype; cstract name; cstract name; cstract path; int J, num_file; lptstr p; ptapp = (ccgisview_demo1app *) AFXGetApp (); // Take the current application object address char DIR [256 ]; // GetCurrentDirectory (200, dir); TCHAR szFullPath [256]; TCHAR szDir [256]; TCHAR szDrive [256]; :: GetModuleFileName (NULL, szFullPath, 256); _ splitpath (szFullPath, szDrive, szDir, NULL, NAME = szdrive; // Dir; // name = name.left (2); name = name "// MapGis32 // xzhmap"; Path = Name; Name = PATH "//" prj; // MessageBox (Name, Name, MB_OK); if ((fp = fopen (Name, "R"))))! = Null) {fscanf (fp, "% d / n", & number; for (j = 1 J <= Num_File; J ) {FSCANF (FP, "% S / N", DIR); Name = DIR; Name.makeUpper (); ftype = -1; if (name.find (". wl")! = -1) fTYPE = Lin; IF (name.find (". Wt")! = - 1) fTYPE = Pnt; if (name.find (". Wp")! = - 1) ftype = reg; IF ( fTYPE == - 1) Continue; Name = Path Name; P = Name.getBuffer (Name.getLength ()); AI = _openarea (ptapp-> m_ahinst, ftype); // Open a fType type empty workshop IF (AI <= 0) // Failback Return Return False; if (! _ loadingafile (p / * "f: //mapgis32//yqmap//china.wl"

* /, AI, NULL, NULL, NULL)) / / _ loadFile (ai)) // Load file to the AI ​​workspace, if the failure is closed, then returns {messagebox (name, "file does not exist !!! ", MB_OK); _ Closerea (AI); // Return False; Continue;} _ getarealist (& PoldLst); // Take the work area corresponding to the current view window, if not, Poldlst returns Nullif (Poldlst) // Poldlst! = Null Describe the current view window already has a corresponding work area, saves the original work area {pNewlst = New short [Poldlst [0] 2]; // pnewlst [0] = POLDLST [0] 1; for (i = 1; i <= Poldlst [0]; i ) PNewLST [i] = PNEWLST [I];} else {pNewlst = New Short [2]; PNewlst [0] = 1; i = 1;} PNewLST [i] = Ai; // Add new workspace _SetareAlist (PNEWLST); // Reset to the work area corresponding to the current view window DELETE [] PNewlst;}} else {MessageBox (Name, "file does not exist !!!", MB_OK Return False;} _ restoreWindow (); // Reset the current view window Fclose (fp); Return True;} void ccgisview_demo1view :: ONQUERYPNT () {long * p; short * Poldlst; Int i, j, ai; lptstr PSTR ; ATT_STRU * STRU; char C [2]; PNT_INFO PNT_INFO; C [0] = '"; c [1] =' / 0 '; _GetareAlist (& Poldlst); // Take the current view window If there is no, Poldlst returns Nullif (Poldlst) // Poldlst! = NULL, indicating that the current view has a corresponding work area, saving the original work area {for (i = 1; i <= Poldlst [0]; i ) {ai = Poldlst [I]; if (_Type (AI) == PNT) {IF (_getattstru (AI, PNT, & STRU) IF (_InputExPRESION (HWnd, STRU , expstr, 256, "point attribute query", null) {// messagebox (expstr, expstr, mb_ok); p = _ttasktolist0 (AI, PNT, EXPSTR); // _ _Ttasktolist (Ai, PNT); if (p) ! = Null) {for (j = 1; j <= p [0]; j ) {_flashpnt (Ai, P J, 1 / * P [0] * /); _ getPntinfo (ai, * (p j ), & PNT_INFO); _ GotowindowFXY (0.5 * (PNT_INFO.RECT.XMIN PNT_INFO.RECT.XMAX), 0.5 * (pnt_info.rect.ymin PNT_INFO.RECT.YMAX); // _ viewarcd (null / * getsafehwnd () * /, AI, PNT, * (P J), "Zhangzhou Zhihe Management Information System - Browsing Information"); _ ViewCuratt (Ai, PNT, * (P J), "Zhangzhou District Lihe Management Information System - Browsing Information

}}}}}}}} void ccgisview_demo1view :: ONQUERYLIN () {long * p; short * Poldlst; INT i, J, AI; LPTSTR PSTR; ATT_STRU * STRU; Char ExpStr [256]; Lin_Info Lin_info; char C [2 ]; C [0] = '"; c [1] =' / 0 '; _GetareAlist (& Poldlst); // Take the work area corresponding to the current view window, if not, Poldlst returns Nullif (Poldlst) // Poldlst ! = NULL, indicating that the current view has a corresponding work area, saving the original work area {for (i = 1; i <= Poldlst [0]; i ) {ai = Poldlst [i]; if (_atype) AI) == Lin) {IF (_Getattstru (AI, LIN, & STRU)) IF (_InputExpresion (HWND, STRU, EXPSTR, 256, "Line Properties Query", NULL) {// MessageBox (expstr, expstr, mb_ok) p = _ttasktolist0 (ai, lin, express); // _ _ _Ttasktolist (AI, PNT); if (p! = null) {for (j = 1; j <= p [0]; J ) {_flashlin (Ai , P J, 1 /*P [0]*/ );_getlininfo (Ai, * (P J) ,undo_info );_GotownDowFXy (0.5 (LIN_INFO.RECT.XMIN LIN_INFO.RECT.XMAX), 0.5* (Lin_Info.rect.ymin Lin_info.rect.ymax)); // _ viewarcd (null / * getsafehwnd () * /, AI, PNT, * (P J), "Zhangzhou District Lihe Management Information System - Browse Information "); _ viewcuratt (ai, lin, * (p j)," Zhangzhou area of ​​Zhuhe Management Information System - Browsing Information ");}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} Short * Poldlst; INT I, J, AI; LPTSTSTSTSTSTSTT_STR; ATT_STRU * STRU; Char Expstr [256]; REG_INFO REG_IN fo; char C [2]; C [0] = '"; c [1] =' / 0 '; _GetareAlist (& Poldlst); // Take the work area corresponding to the current view window, if not, Poldlst returns nullif (Poldlst) // Poldlst! = NULL, indicating that the current view has already had a corresponding work area, saving the original work area {for (i = 1; i <= Poldlst [0]; i ) {ai = Poldlst [i ]; IF (_Type (AI) == REG) {IF (_Getattstru (AI, REG, & STRU)) IF (_InputExPRESION) IF (_InputExPRESION (Hwnd, STRU, EXPSTR, 256, "District Properties Query", NULL) {// MessageBox ( EXPSTR, EXPSTR, MB_OK; P = _ttasktolist0 (AI, REG, EXPST); // _ __Ttasktolist (AI, PNT); if (p! = null) {for (j = 1; j <= p [0]; J ) {_flashreg (Ai, P J, 1 / * P [0] * /);

_Getreginfo (ai, * (p j), & reg_info); _ gotowindowfxy (0.5 * (REG_INFO.RECT.XMIN REG_INFO.RECT.XMAX), 0.5 * (REG_INFO.RECT.YMIN REG_INFO.RECT.YMAX); / / _VIEWARCD (NULL / * GetsafehWnd () * /, AI, PNT, * (P J), "Zhangzhou District Zhuhe Management Information System - Browse Information"); _ ViewCuratt (Ai, Reg, * (P J) "Xinzhou Hutuohe management information system - View Profile");}}}}}}} / * void CCGisView_Demo1View :: OnTry3 () {TCHAR szFullPath [256]; TCHAR szDir [256]; TCHAR szDrive [256] ; :: GetModuleFileName (NULL, szFullPath, 256); _ splitpath (szFullPath, szDrive, szDir, NULL, NULL); MessageBox (szFullPath, szDrive, MB_OK); MessageBox (szFullPath, szDir, MB_OK); :: GetShortPathName (szFullPath, szDrive , 256); MessageBox (szFullPath, szDrive, MB_OK); return;} * / void CCGisView_Demo1View :: OnExtractPnt () {short * pOldLst; short * pNewLst; int i, j, ai, ai2, oldlist; CCGisView_Demo1App * ptApp; ptApp = (Ccgisview_demo1app *) AFXGetApp (); // Take the current application object address _GetareAlist (& Poldlst); // Take the work area corresponding to the current view window, if not, Poldlst returns nullif (Poldlst) // Poldlst! = Null Describe the current view window already has a corresponding work area, saves the original work area {oldList = Poldlst [0]; for (i = 1; i <= OldList; i ) {// messagebox ("gdjfgdjgdj", "Daddad ", MB_OK); _ getare AliST (& Poldlst); Ai = Poldlst [I]; if (_atype (AI) == PNT) {ai2 = _openArea (PTAPP-> M_AHINST, PNT); // Open a fTYPE type air work area IF (Ai2 <= 0) // Returns {// MessageBox ("1111111", "DADDAD", MB_OK);}}} {Poldlst) // Poldlst! = NULL, indicating that the current window has a corresponding work area, save the original Corresponding work area {pNewlst = new short [Poldlst [0] 2]; // PNewlst [0] = POLDLST [0] 1; for (j = 1; j <= Poldlst [0]; J ) PNEWLST [ J] = Poldlst [J];} / * else {PNewlst = New Short [2]; pnewlst [0] = 1; i = 1;} * / pnewlst [j] = ai2; // Add new workspace _SetareAlist (PNEWLST); // Reset the workspace IF corresponding to the current view window (_ttasktoarea (ai, pnt, ai2)) {// _ savefile (Ai2); _ Closearea (Ai2);

} // MessageBox ("adsasasas", "daddad", mb_ok); delete [] pnewlst;}} _RESTOREWINDOW (); // reset the current view window} return;} void ccgisview_demo1view :: onextractlin () {Short * Poldlst; Short; * PNewlst; INT i, J, AI, AI2, OLDList; // LPTSTR PSTR; // att_stru * stru; // char expstr [256]; ccgisview_demo1app * ptapp; ptapp = (ccgisview_demo1app *) AFXGetApp (); // The current application object address _GetareAlist (& Poldlst); // Take the work area corresponding to the current view window. If no, Poldlst returns Nullif (Poldlst) // Poldlst! = NULL, indicating that the current window has a corresponding work area, Save the original work area {// sprintf (expstr, "area ==% d / n", Poldlst [0]); // MessageBox (expstr, expstr, mb_ok); Oldlist = Poldlst [0]; for (i = 1; i <= OldList; i ) {// MessageBox ("gdjfgdjgdj", "daddad", mb_ok); _ getarealist (& Poldlst); Ai = Poldlst [i]; if (_atype (ai) == lin) {ai2 = _Openarea (ptapp-> m_ahinst, lin); // Open an air work area IF (Ai2 <= 0) // of a fType type, returned {// MessageBox ("1111111", "DADDAD", MB_OK); Return } if (Poldlst) // Poldlst! = NULL, indicating that the current view has a corresponding work area, saving the original work area {pNewlst = New Short [Poldlst [0] 2]; // pnewlst [0] = POLDLST [0] 1; for (j = 1; j <= PNEWLST [J]; J ) PNewlst [J] = Poldlst [J];} / * else {PNewlst = New Short [2]; PNEWLST [0 ] = 1; i = 1; } * / pnewlst [j] = ai2; // Add new workspace _SetareAlist (PNEWLST); // Reset the work area IF corresponding to the current view window (_ttasktoarea (ai, ai, ai2)) {// _ savefile (Ai2); _ Closearea (AI2);} // MessageBox ("Adsasasas", "Daddad", MB_OK; delete [] pnewlst;}} _restoreWindow (); // Reset the current view window} return;} void ccgisview_demo1view :: OnExtractReg () {short * pOldLst; short * pNewLst; int i, j, ai, ai2, oldlist; CCGisView_Demo1App * ptApp; ptApp = (CCGisView_Demo1App *) AfxGetApp (); // get the current application object address _GetAreaList (& pOldLst) // Take the work area corresponding to the current view window. If not, Poldlst returns nullif (Poldlst) // Poldlst! =

NULL, indicating that the current view has a corresponding work area, saving the original work area {oldlist = Poldlst [0]; // Save the working area for (i = 1; i <= OldList; i ) {// messageBox ("gdjfgdjgdj", "daddad", mb_ok); _ getarealist (& Poldlst); AI = Poldlst [i]; if (_atype (ai) == reg) {ai2 = _openatea (PTAPP-> m_ahinst, reg); // Open A fType type empty work area IF (Ai2 <= 0) / / Failback Returns {// MessageBox ("111111", "DADDAD", MB_OK); return;}}}}} // Poldlst! = NULL, Description The current view window already has a corresponding work area, saving the original work area {pnewlst = new short [Poldlst [0] 2]; // pnewlst [0] = POLDLST [0] 1; for (j = 1; J <= POLDLST [0]; J ) PNewlst [J] = Poldlst [J];} / * else {PNewlst = New Short [2]; PNewlst [0] = 1; i = 1;} * / pnewlst [J ] = ai2; // Add new workspace _SetareAlist (PNEWLST); // Reset the workspace IF corresponding to the current view window (_ttasktoarea (Ai, Ai2)) {// _ savefile (ai2); _ Closearea ai2);} // MessageBox ( "adsasasas", "daddad", MB_OK); delete [] pNewLst;}} _RestoreWindow (); // reset the current viewport window} return;} void CCGisView_Demo1View :: OnSelectarea () {CCGisView_Demo1App * ptApp; int i, j; short * tai; CCGisView_Demo1Doc * pDoc = GetDocument (); ASSERT_VALID (pDoc); ptApp = (CCGisView_Demo1App *) AfxGetApp (); // get the current application object address if (tai = _SelectAreaList (ptApp- > m_ahinst, hwn D, -1, "Select Display")) {if (PDOC-> PTAI! = null) delete pdoc-> ptai; pdoc-> ptai = new short [tai [0] 1]; for (i = 0; i <= tai [0]; i ) PDOC-> PTAI [i] = tai [i]; _ updateWindow ();}} void ccgisview_demo1view :: onmapchina () {=} ("China.prj")) GetParentFrame () -> SetwindowText ("China Map"); "Geography Basemap");} void ccgisview_demo1view :: ounce {= = ("cHannel.prj"

) // Canal status map .PRJ ")) getParentFrame () -> setWindowText (" Channel Status Diagram ");} Void Ccgisview_Demo1View :: OnYQMapwaterQuality () {IF (OpenMap (" BuryDep.PRJ ")) getParentFrame ) -> setWindowText ("Diving Buried Diagram");} void ccgisview_demo1view :: {on ("level.prj")) getParentFrame () -> setwindowtext void CCGisView_Demo1View :: OnYqmapGeology () {if (OpenMap ( "borehole.prj")) GetParentFrame () -> SetWindowText ( "hole layout");} void CCGisView_Demo1View :: OnYqmapEnvhydrogeo () {if (OpenMap ( "soilsalt. PRJ ")) GetParentFrame () -> setWindowText (" Soil Salt Data Distribution Map ");} Void CcGisview_Demo1View :: OnYQMAppRofile () {ionMap (" Yanzitu.prj ")) getParentFrame () -> setWindowText (" salt Drawing of stains ");} void ccgisview_demo1view :: {onq (" tuzi.prj ")) // Submatical distribution map.PRJ") getParentFrame () -> setWindowText } void ccgisview_demo1view :: ounce ("Hydrog.PRJ")) // hydrological geological map .PRJ ") getParentFrame () -> setWindowText (" Hydrological Geology);} void ccgisview_demo1view :: OnyqmapkkarstwaterLevel () {IF (OpenMap ("Karst.PRJ")) // Rock water level line map.PRJ ")) getParentFrame () -> se TWindowText ("Rock Water Sevel Lines");} void ccgisview_demo1view :: {on ("t_hard.prj")) // Total hardness mineralization graph .PRJ ")) getParentFrame () -> SetWindowText ( "total hardness salinity FIG.");} / * void CCGisView_Demo1View :: OnExecute () {pb.ExcuteServiceCmd ( "YQ0009");} * / void CCGisView_Demo1View :: OnConnectToDbs () {if (connectToDbs == false) {Pb.cmdcad = "mypbapp"; pb.LinkToService (); if (pb.hconv == 0L) {MessageBox ("Database System is not ready / n to try again after ...", "Data Transfer Information", MB_OK); Return;}} // else pb.unlinktoservice (); connecttodbs =! Connection;

} Void CCGisView_Demo1View :: OnUpdateConnectToDbs (CCmdUI * pCmdUI) {pCmdUI-> SetCheck (connectToDbs);} / * void CCGisView_Demo1View :: OnTry () {// TODO: Add your command handler code here} * / void CCGisView_Demo1View :: OnAreaSum ( ) {Short * Poldlst; INT I, J, AI; LPTSTSTSTSTSTSTSTSTR PSTR; Long * P; Double Area_Sum = 0.0; att_stru * stru; char * att; char msg [200]; cstract exp = "area> 0.0"; ccgisview_demo1app * PTAPP; PTAPP = (ccgisview_demo1app *) AFXGetApp (); // Take the current application object address _GetareAlist (& Poldlst); // Take the work area corresponding to the current view window, if not, Poldlst returns Nullif (Poldlst) // Poldlst ! = NULL, indicating that the current view has a corresponding work area, saving the original work area {for (i = 1; i <= Poldlst [0]; i ) {ai = Poldlst [i]; if (_atype) AI) == REG) {PSTR = Exp.getBuffer (Exp.GetLength ()); p = _ttasktolist0 (AI, REG, PSTR); if (p) for (j = 1; j <= p [0]; J ) {IF (_Getatt (AI, _ATYPE (AI), P [J], & stru, & attt) == 1) Area_sum = _ getfld (ATT, STRU, "Area", NULL, NULL);}}} Sprintf (MSG, "Total area =%. 3F / n", area_sum); MessageBox (MSG, "total area statistics", MB_OK);} return;} void ccgisview_demo1view :: onARCSUM () {Short * Poldlst; Int i, j, AI; LPTSTR PSTR; long * p; double area_sum = 0.0; att_stru * stru; char * AT T; CHAR MSG [200]; cstract exp = "area> 0.0"; ccgisview_demo1app * ptapp; ptapp = (ccgisview_demo1app *) AFXGetApp (); // Take the current application object address _GetareAlist (& Poldlst); // Take the current view If the window corresponds to the work area, if no, Poldlst returns Nullif (Poldlst) // Poldlst! = NULL, indicating that the current view has a corresponding work area, saving the original work area {for (i = 1; i <= Poldlst [0]; i ) {ai = Poldlst [i]; if (_atype (AI) == reg) {pstr = exp.getbuffer (exp.getlength ()); p = _ttasktolist0 (Ai, REG, PSTR); IF (p) for (j = 1; j <= p [0]; j ) {if (_getatt (ai, _atype (ai), p [j], & struct) == 1) Area_sum =

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

New Post(0)