Add to Layers for the use of the MapObject control
Author: Beijing Zhangsong Wei
Zswzwy@163.com
The MapObject control is a set of powerful GIS geographic information system controls developed by ArcInfo. The control is very powerful. It has a wide range of coverage in the software development industry because it is very complex in the VC, helps document pair A programs that have just been introduced are not easy to understand, and the sample code is based on VB, all I wrote this series of articles for your reference, there is a problem, you are welcome.
MapObject (hereinafter referred to as Mo) has its own layer file, is .SHP is an extension, first introduced the MO control into our program, and send some header files. Ok, let's get started.
1. New single document procedures, setting the window to maximize the window when the fourth step is set. Click Project-> Add to Project-> Components and .... For the registered control, select MapObjects 2.2 Map Control, select the class, join the project.
2, newly built a folder in the engineering directory, name Common, copy mapHelper.h, maphelper.cpp, copy to it, and the above file can be found in the Mo installation directory or VC routine directory.
3, open Stdafx.h, join the #include "common / mapobjects2.h" and #include "commit / maphelper.h" sentence, and let all files in the CommON directory letter into the project.
4. Add a member variable CMAP1 M_MAP to CMYVIEW and create it in the OnInitialUpdate () function.
GetClientRect (& RECT);
M_Map.create ("WeatherGIS", WS_CHILD | WS_VISIBLE, RECT, THIS, ID_GISMAP);
Intercept the WM_SIZE message, add the following code to make the MO control account for full view.
IF (m_map.m_hwnd)
m_map.setwindowPOS (0, 0, 0, CX, CY, SWP_NOZORDER);
5, put the layer file (.shp) file you found into the project directory, and you join the MO.
Addlayer (M_Map, Text ("SHP // Country.SHP"), MopaleEllow;
Addlayer (M_Map, Text ("SHP // City.SHP"), MORED);
.......
6, okay, run, watch a map has been present in front of you, is it very accomplishment? In the next next time, I will explain how to zoom in to the layer, change the mouse style, etc., I'm going to this.