Maptitude GISDK Help |
If COM Object results are written to a file on disk or returned as the result of a COM call, the client program can open, read, and make use of these results in any way it sees fit. If COM Object results are placed on the clipboard, the client program can make use of the information in any (or all) of these formats:
Windows bitmap
JPEG compressed file
PNG compressed file
Windows metafile
OLE object
The client program can also choose to use the OLE object, either in linked or embedded form. Here is a quick summary of the advantages and disadvantages of each approach:
Method |
Advantages |
Disadvantages |
Bitmap |
Fast and simple |
Map is not resizable by the client, and is unattractive when printed |
JPEG compressed file |
Much more compact than bitmap |
Lossy compression, meaning that the output image will not be identical to the original |
PNG compressed file |
More compact than JPEG |
Lossless compression, meaning that the output image will be identical to the original |
Metafile |
Map is fully resizable and printable |
Can require slightly more complex client-side programming; not available for editors |
Linked OLE Object |
Relatively simple client side programming; automatic updating is possible |
More complex than using metafiles or bitmaps |
Embedded OLE object |
Map information is stored in documents produced by the client program |
Requires substantially more complex client and server programming |
Here are some guidelines for which option to choose:
If your application uses maps that are of a fixed size on the screen, and these maps do not need to be printed, use a PNG or JPEG compressed file or a bitmap file.
If your application allows the map to be resized, or prints the maps, use a metafile or a linked OLE object.
If your application creates and stores documents to files, and you want to include maps as a part of these documents, use embedded OLE objects.
The code fragments shown below illustrate how a VBA application would use a map in an Image Control
' create the GISDK object
Set Gisdk = CreateObject("Maptitude.AutomationServer")
' YSave the current map to a file
Gisdk.RunMacro "SaveMapToImage", Null, file_name, "JPEG", Null
' Dispaly the image in a Picture Object. Set the Stretch property to True.
My_Picture_Object.Picture = LoadPicture(file_name)
When you place a map into a client program using an OLE link, you are actually putting in place a reference to a map file. When the contents of the map file changes, OLE detects that the link between your client program and the map needs to be updated. This update may occur automatically at the moment the file is changed, or only on the request of your client program, depending upon the properties of the link.
Normally, you specify automatic updates when using linked maps in a client program. Changes to the map file are made by the COM Object in response to a COM call to SaveMap(). When the COM Object saves the updated map, the update is detected by the client program and the link is refreshed automatically. This means that no special programming is required on the part of the client program to perform the update.
Note that changes to the map file can also be made by some process completely external to the client program and the server application. This can be useful in some cases, but problematic in others.
There is virtually no reason to specify manual updates when using linked maps in a client program. The metafile option produces essentially similar results, with faster updates and less programming.
When you embed an OLE map in a document that is created by a client program, you are storing the contents of a map file as part of your document. When the document is opened again at a later date, the map is displayed as part of the document.
The principle advantage of this approach is that documents created with the client program can be distributed to other users of the client program. Note that map files (and OLE embedded maps) do not contain the geographic or attribute databases necessary to use a map. In order for an embedded map to be useful, all users of the client program must have access to the server application and the databases used in the map.
If you elect to use OLE embedded maps in a client program, you have two options for processing edit and update operations:
Perform no special handling. In this case, when the user double-clicks on an embedded map in the client program, Maptitude runs with the standard interface and the embedded map is opened for editing. In other words, the server application is used only to create the map. Once created, the map is used like any other embedded map in a standard product.
Perform special handling. In this case, you create a custom GISDK application to intercept the request to edit the embedded object, and provide whatever special handling you require. To perform special handling, you must ensure that your custom application is running before allowing the user to double-click on the embedded map.
For more information, see...
Accessing Maptitude as a COM Object
©2025 Caliper Corporation | www.caliper.com |