¿Cómo utilizar Mapx para el desarrollo de sistemas GIS en VC++6.0 o proporcionar el código fuente de un proyecto pequeño?
Primero debe descargar el control mapx y luego agregarlo a su entorno VC. Por supuesto, puede insertar el control mapx directamente en el cuadro de diálogo y usarlo como control, o puede insertar el control en la vista del documento y agregar allí el archivo de clase correspondiente, que contiene el archivo mapx.h, y luego Puede definir las variables correspondientes, crear variables en OnCreate y hacer otras cosas. Se pueden hacer otras cosas, aquí hay un fragmento de código solo como referencia.
// GeoExpertView.h: interfaz de clase CGeoExpertView
//
////////////////// //////////////////////////////////////// ////////// / //////////
#if ! definido(AFX_GEOEXPERTVIEW_H__3456F63F_3DC9_493F_8817_DAA44E0779AE__INCLUDED_)
#define AFX_ GEOEXPERTVIEW_H__3456F63F_3DC9_493F_8817_DAA44E0779AE__INCLUDED_
# si _MSC _VER >1000
#pragma once
#endif // _MSC_ VER > 1000
#include "MapX.h"
clase CGeoExpertView: CView público
{
protegido: // solo de secuencia Crear
CGeoExpertView();
DECLARE_DYNCREATE(CGeoExpertView)
// Atributos
público:
CGeoExpertDoc * GetDocument();
// Operaciones
public:
// Override
// Cobertura de función virtual generada por ClassWizard
//{{AFX_VIRTUAL( CGeoExpertView)
public:
virtual void OnDraw(CDC* pDC); // Anular para dibujar esta vista
virtual BOOL PreCreateWindow( CREATESTRUCT& cs);
protegido:
virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
virtual void OnBeginPrinting(CDC* pDC , CPrintInfo* pInfo);
virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
//}}AFX_VIRTUAL
// Implementación
público:
CString m_strFilePath;
CMapX m_ctrlMapX;
virtual ~CGeoExpertView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protegido:
// Función de mapeo de mensajes generados
Protegido:
//{{AFX_MSG(CGeoExpertView)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct
);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnSetFocus(CWnd* pOldWnd);
afx_msg void OnFileOpen();
afx_msg vacío OnMapToolArrow();
afx_msg vacío OnMapToolZoomin();
afx_msg vacío OnMapToolZoomout(); OnMapToolPan();
afx_msg void OnMapToolSelect();
afx_msg void OnMapToolRectangleselect()
afx_msg void OnMapToolRadiusselect(); afx_msg void OnViewLayercontrol();
afx_msg void OnMapToolEntire();
afx_msg void OnUpdateMapToolZoomin(CCmdUI* pCmdUI); ;
afx_msg void OnUpdateMapToolPan(CCmdUI* pCmdUI);
afx_msg void OnUpdateMapToolArrow(CCmdUI* pCmdUI);
afx_msg void OnUpdateMapToolSelect(CCmdUI* pCmdUI);
afx_msg void OnUpdateMapToolRectangleselect(CCmdUI* pCmdUI);
afx_msg void OnUpdateMapToolRadiusselect(CCmdUI* pCmdUI);
afx_msg void OnMapToolCenter();
afx_msg void OnUpdateMapToolCenter(CCmdUI* pCmdUI);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
#ifndef _DEBUG // versión de depuración en GeoExpertView.cpp
CGeoExpertDoc* en línea CGeoExpertView::GetDocument()
{ return ( CGeoExpertDoc*)m_pDocument }
#endif;
//////////////////////////////////////////// // ////////////////////////////////////
//{{AFX_INSERT_LOCATION}} p>
// Microsoft Visual C++ insertará declaraciones adicionales antes de la línea anterior.
#endif
# endif // !definido(AFX_GEOEXPERTVIEW_H__3456F63F_3DC9_493F_8817_DAA44E0779AE__INCLUDED_)
// GeoExpertView.cpp: Implementación de la clase CGeoExpertView
/ /
#include "stdafx.h"
#include "GeoExpert.h"
#include "GeoExpertDoc.h"
#include "GeoExpertView.h"
#ifdef _DEBUG
#definir nuevo DEBUG_NEW
#undef ESTE_FILE
carácter estático ESTE_FILE[ ] = __FILE__;
# endif
/////////////////////////////// // ///////////////////////////////////////////////// /
// CGeoExpertView
IMPLEMENT_ DYNCREATE(CGeoExpertView, CView)
BEGIN_MESSAGE_MAP(CGeoExpertView, CView)
//{{AFX_MSG_MAP (CGeoExpertView)
p>ON_WM_ CREATE()
ON_WM_SIZE()
ON_WM_SETFOCUS()
ON_COMMAND(ID_FILE_OPEN, OnFileOpen)
ON_COMMAND (ID_MAP_TOOL_ARROW.OnMapToolArrow)
ON_COMMAND(ID_MAP_TOOL_ZOOMIN, OnMapToolZoomin)
ON_COMMAND(ID_MAP_TOOL_ZOOMOUT, OnMapToolZoomout)
ON_COMMAND(ID_MAP_TOOL_PAN, OnMapToolPan )
ON_COMMAND(ID_MAP_TOOL_SELECT, OnMapToolSelect)
ON_COMMAND(ID_MAP_TOOL_ RECTANGLESELECT, OnMapToolRectangleselect)
ON_COMMAND(ID_MAP_TOOL_RADIUSSELECT, OnMapToolRadiusselect)
ON_COMMAND( ID_ VIEW_LAYERCONTROL, OnViewLayercontrol) p>
ON_COMMAND(ID_MAP_TOOL_ENTIRE, OnMapToolEntire)
ON_UPDATE_COMMAND_UI(ID_MAP_TOOL_ ZOOMIN, OnUpdateMapToolZoomin)
ON_UPDATE_COMMAND_UI(ID_MAP_TOOL_ZOOMOUT, OnUpdateMapToolZoom fuera)
_COMMAND_UI(ID _MAP_TOOL_PAN, OnUpdateMapToolPan)
ON_UPDATE_COMMAND_UI(ID_MAP_TOOL_ARROW, OnUpdateMapToolArrow)
ON_UPDATE_COMMAND_UI(ID_MAP_TOOL_SELECT, OnUpdateMapToolSelect)
ON_UPDATE_COMMAND_UI(ID_MAP_TOOL_RECTANGLESELECT, OnUpdateMapToolRectangles elect)
ON_UPDATE_COMMAND_UI( ID_MAP_TOOL_RADIUSSELECT , OnUpdateMapToolRadiusselect)
ON_COMMAND(ID_MAP_TOOL_CENTER, OnMapToolCenter)
ON_UPDATE_COMMAND_UI(ID_MAP_TOOL_CENTER, OnUpdateMapToolCenter)
//}}AFX_MSG_MAP
/ / Comandos de impresión estándar
ON_COMMAND(ID_FILE_PRINT, CView:CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW)
p>ON_COMMAND(ID_FILE_ PRINT_PREVIEW, CView::OnFilePrintPreview)
CView::OnFilePrintPreview, CView::OnFilePrintPreview)