Geocvpf Reference Manual |
---|
Vector Product Format (VPF) is a geo-relational format developed by the National Geospatial Intelligence Agency. It is specified by MIL-STD-600006. VPF is the format used in Digital Nautical Charts. Geocvpf provides a set of GObjects that facilitate drawing information from a VPF database onto the GeocCanvas widget.
The only GObject that is strictly required for rendering VPF isGeocvpfCanvasTheme. This object handles the querying, drawing, and management of a single library, coverage, feature class, and expression combination.
This example creates a simple theme.
/* The GeocvpfCanvasTheme is used to display all feature types - edge, face, * entity_node, connected_node, and text. * * library_path: location of the library. Use of directory path can be avoided * by using the GeocvpfDatabaseLookup object. * * coverage: a set of topologically related feature classes. Earth coverage in * in this case. * * feature_class: features that share a homogenous set of attributes. Earth * coverage areas in this case. * * expression: thematic information (a limited database query). * This example queries for land and island coverage. */ geoc_item_new(group, GEOCVPF_TYPE_THEME, "library-path", "/home/username/dnc/dnc17/a1707420", "coverage", "ecr", "feature-class", "ecrarea", "expression", "F_CODE=BA030 or F_CODE=DA010", "fill-color-rgba", 0xBDAF1Bff, NULL);
The VPF database structure looks something like this:
Database (e.g. DNC17) - Library (e.g. a1707420 approach chart) - coverage (e.g. ecr) - feature class (e.g. ecrarea) -expression (e.g. F_CODE, etc.)
To discover how to properly set up the coverage, feature class, and expression
properties of the theme, there is a program included in the geocvpf directory of
this package called geocvpfprint
. Use the -h option to see
the usage. This program can provide a detailed list of what is available in the
for the VPF databases being used.
The use of a directory path in the "library_path" property is not required if
the GeocvpfDatabasLookup is used. A
VPF database can consist of 100 or more libraries. In some cases it might be
necessary to browse through multiple databases. The
GeocvpfDatabaseLookup
object simplifies finding the
a library by building a hash table at construction time. It builds the has
table based on a pre-defined colon delimited directory search path. When the
GeocvpfDatabaseLookup
object has been initialized, it is
necessary only to specify the library_name to the theme.
Here is the example again using the GeocvpfDatabaseLookup
/* The database lookup is a singleton object. The directory search path is * is colon delimited. */ g_object_new(GEOCVPF_TYPE_DATABASE_LOOKUP, "search_path", "/home/username/dnc:/media/DNC17", NULL); geoc_item_new(group, GEOCVPF_TYPE_THEME, "library-path", "a1707420", "coverage", "ecr", "feature-class", "ecrarea", "expression", "F_CODE=BA030 or F_CODE=DA010", "fill-color-rgba", 0xBDAF1Bff, NULL);
To simplify things even further, it is possible to not use the "library_path"
property at all. The GeocvpfLibrarySelector and
GeocvpfCanvasView
objects can be used to partially
automate the selection of the appropriate library. The
GeocvpfLibrarySelector
can be used to determine the list
of libraries from the database search path that fit the current
GeocCanvas
viewport. It connects to the
GeocCanvas
viewport-changed signal. Whenever the
viewport changes, it searches the list of available libraries from the
GeocvpfDatabaseLookup
object and reports the subset that
is equal or larger in size and location to current viewport.
Each time the viewport changes, GeocvpfLibrarySelector
emits three signals. The first signal, the select-event,
indicates that a library is available for selection. This event is emitted once
for each of the available libraries until a listener returns a TRUE value. If a
TRUE value is returned, that library is marked to be selected, otherwise the
library at the head of the list is marked. The second signal is a notify on the
available_libraries property. The available _libraries is a linked list of all
libraries that fit the current viewport. Finally, a notify is issued on the
selected_library property if it is different than the proeviously selected
library.
The GeocvpfCanvasView object is a
simple canvas group that connects to the
GeocvpfCanvasSelector
. It has special logic to select an
appropriate library based on its library_pattern property and pass the
library_name into is child GeocvpfCanvasTheme
objects. A
GeocvpfCanvasView
can be thought of as a set of themes
that should be applied to specific type of library.
Here is an example of how to use the GeocvpfCanvasView
:
/* The library selector needs to be told which canvas to connect to. * After that, all views will look for a singleton instance unless the * view "library-selector" property is set explicitly. */ selector = g_object_new(GEOCVPF_TYPE_LIBRARY_SELECTOR, "geocanvas", canvas, NULL); /* This view will activate select any library that begins with "g". * DNC, this is a "general" library. */ general = geoc_item_new(group, GEOCVPF_TYPE_VIEW, "library_pattern", "g*", NULL); /* This item will draw water */ geoc_item_new(general, GEOCVPF_TYPE_THEME, "coverage", "ecr", "feature_class", "ecrarea", "expression", "F_CODE=BA040", "fill_color_rgba", 0xD1F4FFFF, NULL); /* This item will draw mainland and islands */ geoc_item_new(general, GEOCVPF_TYPE_THEME, "coverage", "ecr", "feature_class", "ecrarea", "expression", "F_CODE=BA030 or F_CODE=DA010", "fill_color_rgba", 0xBDAF1Bff, NULL); /* This item will draw text features. */ geoc_item_new(general, GEOCVPF_TYPE_THEME, "coverage", "ecr", "feature_class", "ecrtext", "fill_color_rgba", 0x000000FF, NULL);