Maptitude GISDK Help |
As a Maptitude user, you know that a table is a file on disk that contains information organized into rows and columns. By now you are used to the idea of opening a table and seeing the data displayed in a dataview.
GISDK introduces an additional object: a view. A view is a virtual table that contains information in rows and columns. The information contained in a view may come from a single table file, from a geographic file, or from several different sources that have been joined together (in a joined view). You use views to read, write, or display information from tables and geographic files. If you are a programmer, you could think of a view as a "handle" to a table, geographic file, or joined view.
When you call a GISDK function that creates a view, you assign a name to the view. From then on, all access to the data table is via the view name. If the view name you assign is already in use, a suffix (:1, :2, :3, etc.) is appended to the view name to make it unique.
The following GISDK functions create views, and return the name of the view that was created:
GISDK Function |
Summary |
Adds a layer from a compact geographic file to a map |
|
Adds a layer from a geographic file to a map |
|
Adds a layer to an application without it appearing in a map or dataview |
|
Groups records in a view and computes summary statistics |
|
Computes attribute values for a view using information from an overlay table |
|
Creates an empty table and opens it as a view |
|
Creates a joined view by linking fields in two existing views |
|
Creates a joined view by linking multiple fields in two existing views |
|
Opens a table from a file on disk and creates a view |
|
Creates districts by merging areas from a geographic file, based on the value of a field |
|
Groups the records in a view, based on a field, to create an aggregate view |
Many of these and other GISDK functions use the following abbreviations for file types:
File Type |
Abbreviation |
Comma- or tab-delimited text |
CSV |
dBASE |
dBASE |
Fixed-format text (ASCII) |
FFA |
Fixed-format binary |
FFB |
You can use GISDK functions to create any number of views. Views can be visible (displayed in editor windows) or hidden from the user. The latter option is useful if your GISDK application needs to look up some information in the background by referring to a database or other table. GISDK lets you designate one view as the current view. Many GISDK functions work only on the current view, and many others allow you to omit the view_name argument if you want to use the current view.
Maptitude keeps close track of all views that are open in an application, as well as the source files on which the view depends. If you try to open a table that has already been opened using OpenTable(), GISDK detects that there is already a view of the table, and returns the name of the existing view.
The following GISDK functions help you manage views:
GISDK Function |
Summary |
Gets a list of codes and values for a coded field |
|
Gets the name of the current view |
|
Gets the join information for a view |
|
Gets the name of a layer that corresponds to a view |
|
Gets a list of all views |
|
Gets the parentage of a view |
|
Gets information about a table |
|
Gets information on the views in the system or on the views associated with a layer |
|
Retrieves a listing and description of the fields in a view |
|
Sets the current view (and the current layer) |
When you are finished with a view, you remove it from the system by calling one of the following GISDK functions:
GISDK Function |
Summary |
Drops a view from the system |
|
Removes a layer from a map |
|
Removes a layer from an application |
Before a view is removed from the system, Maptitude checks to see if the view is currently in use. A view is in use if any of the following are true:
The view is a component in one or more joined views
The view is displayed in an editor window
The view is of a layer that is part of an open map
If the view is in use it cannot be dropped from the system, and the above GISDK functions signal an error.
Here is some sample code that creates two views and performs some simple operations on them:
// Open a sales rep table, creating a view named "Sales Reps"
reps = OpenTable("Sales Reps", "DBASE", "c:\\dbf\\salesrep.dbf", )
// Open a customer table, creating a view named "Customers"
custs = OpenTable("Customers", "DBASE", "c:\\dbf\\customer.dbf", )
// Get a list of views...
view_list = GetViewNames() // view_list = {"Sales Reps", "Customers"}
// Switch to the Sales Reps view
SetView(reps)
ShowMessage("The current view is " + GetView())
// Switch to the Customers view
SetView(custs)
ShowMessage("The current view is " + GetView())
// Now close both views...
CloseView(reps)
CloseView(custs)
©2025 Caliper Corporation | www.caliper.com |