Real-time display of vector map background using VC ++
Source: Internet
Author: User
Abstract: This article introduces the programming method of embedding MapInfo vector map in the real-time display system implemented by VC ++ in OLE mode, and briefly describes its implementation process.
I. Preface
As a new discipline, electronic map applications are not limited to map production. This article uses VC ++ and OLE (Object Linking and Embedding, object connection and embedding) Programming Technology to display real-time information on the vector map background.
The program is applied to display and processing terminals. The parts that receive and process network information have different requirements in different systems.
MapInfo vector maps are stored and managed using layers. Each layer corresponds to a type of elements (such as residents, water systems, railways, highways, etc.) on the maps. For each layer containing graphic information, 4 files (. dat ,. tab ,. map ,. ID.
A MapInfo Map allows you to embed a map window into any application that can accept OLE objects. Insert an OLE object from a server (such as Mapinfo) to a container application (such as Microsoft Word) and process the object in the application. The embedded object is a copy of the object from the server application. Once an object is in a container, it is no longer linked to the source object.
The MapInfo process is embedded in the VC ++ Application Using OLE. A MapInfo object (dmapinfo class) must be defined. The dmapinfo class is defined in the Mapinfo class library (mapinfow. TLB. The MapInfo software provides its own programming language MapBasic. VC ++ operates map processes mainly by sending MapBasic commands.
2. Create a program framework
The program framework is implemented using MFC. The MFC Application Wizard (Appwizard) generates most of the code and then joins the Mapinfo process. The procedure is as follows:
1. Create a new project. Select MFC Appwizard (exe) as the project type, set the project name to mapapp, and set other items as prompted. The Application Wizard automatically generates three classes: cmapappapp application class
Cmapappdoc document class
Cmapappview View class
Cmainframe main framework class
2. Add a MapInfo Library
Run the Class Wizard and click Add Class ...), Select "from a Type Library", find the "mapinfow. TLB" file, open it, select the "dmapinfo" class in "Confirm classes", and click OK to confirm the input and close the dialog box. Now the dmapinfo class has been added to the mapapp, and two source files,/"mapinfow. h/" and/"mapinfow. CPP/", are added.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service