MapWindow Home
Search MapWindow.org


  • Home
    • Download
    • Why MW
    • FAQ
    • Contact
  • Products
    • MapWindow
    • ActiveX
    • Plug-ins
  • Software Dev
    • Sample Code
    • Scripts
    • Source
    • Bugs
    • Support
    • Languages
  • Site Tools
    • Forums
    • Tutorials
    • Mailing Lists
    • Team
    • Site Stats
    • Links
  • Get Stuff
    • Buy a CD
    • Buy a T-Shirt
    • MW Book
    • ActiveX Book
    • Donate
    • Buy Support
  • Documentation
    • MWGIS App. User Guide
    • GISTools User Guide
    • MW Plug-ins Dev. Guide
    • MWGIS ActiveX Dev. Guide
    • MWGeoProc Dev. Guide

Mapwingis

From MapWindow GIS

Jump to: navigation, search

Using the MapWindow ActiveX Control

The core MapWindow component is the ActiveX control, "MapWinGIS.ocx". This is an programming object that can be added to a form in Visual Basic, Delphi, or other languages that support ActiveX, providing a built-in GIS data map. We have tried to optimize it for use as a fully functional model interface, not just as a map viewer. This involved speeding up image and grid display, limiting the amount of redrawing that the user sees, and including application programmer interfaces (APIs) for low-level access to grid, shape, table and image data.

For more information about MapWinGIS, please look at the draft of several chapters of the new book by Dan Ames, "Getting Started with the MapWinGIS ActiveX Control".


Here is an example in Visual Basic 6 of the simplest MapWindow project you can build:


Image:screenshot-simplemap.gif


The code that adds this shape file to the map is:


Image:screenshot-simplemap-code.gif


With a shape file layer loaded in the map, the user can navigate the map using the left and right mouse buttons to zoom-in and zoom-out.

Note that although I said this is the simplest MapWindow project you can build, I lied. Actually the simplest project would be to just put the map on a form and compile with no code. Although the program would start with an empty white box, a user could grab any shape file or geo-referenced bitmap and drop it in the map, and the map will display it.

The MapWindow core component can be more interesting when you add a few layers of data to it and provide other means for navigation.

For example, with just a few lines of code, the project above can be extended to display this:


Image:screenshot-simplemap2.gif

The code for the above applicaton is:


Image:screenshot-simplemap2-code.gif


Granted, these are very basic demonstrations, but the idea is to let you get a taste for what the control can do and how it can be used.

Additional functions of the core component ActiveX control include:


Open, create, edit, and save geo-referenced image, grid, shapefile, triangulated irregular network (TIN), and dbf (shape attribute) data directly;

  • View, label, color, highlight, shape file data in the map;
  • Perform spatial queries on the data;
  • Search for features with specific attributes;
  • Dynamically edit the spatial data and immediately see the changes in the map;
  • Interact with the data through the map;
  • Build TINs from Grids, Images from Grids, Shape files from TINs and Grids, Grids from Shape files, etc.
  • Much, much, more...


Using the MapWinGIS ActiveX Component in Delphi

To Install the MapWinGIS.ocx ActiveX component in Delphi, you need to follow these steps:

  1. Click on the "Component" menu in Delphi, then select "Import ActiveX Control..."
  2. In the list of ActiveX components, find and select "MapWinGIS Components", then click the "Install" Button.
  3. It is recommended that you insert it into a new package by selecting the "Into New Package" tab.
  4. Enter the path where you wish to create this package. I used the same path as the default package, but changed the filename to be MapWinGIS.dpk.
  5. Give the package a description. I used "MapWinGIS ActiveX Control".
  6. Press "OK".
  7. Replace the MapWinGIS_TLB file in the "Imports" folder with the one supplied in this Delphi sample code zip file.
  8. In the package viewer, click on the MapWinGIS_TLB, then click the Install button. That should be all you have to do. A new icon should be available in the "ActiveX" component palette.
UPDATE: Paul Bailey from South Africa has built a good Delphi sample project that illustrates use of many MapWinGIS functions. You can download it here. Thanks, Paul!

Should you run into any problems, post a message on the forums in the "MapWinGIS ActiveX Control Programming" section.

Retrieved from "http://www.mapwindow.org/wiki/index.php/Mapwingis"
Views
  • Page
  • Discussion
  • View source
  • History
Personal tools
  • Log in / create account
  • What links here
  • Related changes
  • Upload file
  • Special pages
  • Printable version
  • Permanent link

Geospatial Software Lab

Copyright © 2008 - MapWindow Open Source Team
( last updated: November 12 2008.)
Home | Donate | Download | MapWindow GIS Desktop | MapWinGIS.ocx | Plug-ins | Contact | Lists | Bugs | Sample Code | Documentation
Code Repository | Open Source License | Discussion Forum | Wiki | Join the Team | Site Statistics | Links