MapBasic DLL |
Top Previous Next |
The rwnet4.dll is aimed for use with MapInfo / MapBasic.
Since MapInfo is a single user application, we have made several changes to make development easier.
Rather than doing Create/Free methods, we use pre-allocated objects. Objects are referenced either indirectly (single instance) or by their index (multi instance).
Classes referenced indirectly:
•TCalc / TRouteCalc •TTSP
Classes / types referenced by index (handle):
If null-element is true, you can pass 0 as index / handle, when you want to pass nil as parameter.
Function naming convention TImport.Execute becomes TImport_Execute. TCalc.IsoCost becomes TCalc_IsoCost. etc.
Some method names have been shortened due to max length = 31 characters. TCalc and TRouteCalc are both referenced as TCalc.
All definitions can be seen in the rwnet4.def file along with a sample application, covering key areas.
Two versions exists: •rwnet4_32.def for MapInfo 10.0-15.0 •rwnet4.def for MapInfo 15.2.2 and up.
Password initialization Call method "InitPassword".
Codepage Since RW Net 4 is Unicode enabled and Mapbasic isn't, it is required to do an internal conversion in all function calls involving strings. This is handled automatically through a global variable, which sets the codepage you are using in MapBasic. Default is the system codepage. Methods: GetCodepage / SetCodepage.
GIS output format There is a global variable for output format, which is gfMITAB by default. This means it is skipped from all function calls having a gisformat parameter. Methods: GetGISformat / SetGISformat.
CharacterSet You can get the current codepage for your table by calling function CharSet2CP, where you pass the return value from TableInfo(tableid,TAB_INFO_CHARSET). Then call TNetwork_SetCodepage to define which codepage is used in all output - also from TDrivingDirections etc.
Colours Colours are read/set directly in MapInfo colour format (RGB <> BGR), while the .NET and VCL versions uses windows colour scheme.
Error handling If an error happens when calling a method, you can use one of these 2 functions to test it: GetLastExceptionClass GetLastExceptionMessage The messages are cleared after each successful method call.
Progress Events These can all be turned on/off by calling ShowProgress with 0/1 as parameter. The progress is then shown with a built-in dialog.
Turnmode You enable/disable turnmode by calling TCalc_SetTurnMode. This works by freeing and creating a new TCalc instance, so do it as the first thing, before any other properties are set.
Missing functionality compared with VCL / .NET version •GISarray output as format •Direct access to TPolyGeneration
|