GeocvpfDatabaseLookup

GeocvpfDatabaseLookup — A cached table of available databases and libraries.

Synopsis




                    GeocvpfDatabaseLookupPrivate;
                    GeocvpfDatabaseLookup;
                    GeocvpfDatabaseLookupClass;
void                geocvpf_database_lookup_set_search_path
                                                        (GeocvpfDatabaseLookup *database,
                                                         const char *search_path);
GeocvpfLibrary*     geocvpf_database_lookup_library     (const char *name);
GList*              geocvpf_database_lookup_databases   ();
GeocvpfDatabaseLookup* geocvpf_database_lookup_get_system
                                                        (void);

Object Hierarchy


  GObject
   +----GeocvpfDatabaseLookup

Properties


  "search-path"              gchararray            : Read / Write

Description

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 an example:

/\* 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:/mnt/cdrom", NULL);


foo_canvas_item_new(group, GEOCVPF_TYPE_CANVAS_THEME,
        "library_path", "a1707420",
        "coverage", "ecr",
        "feature_class", "ecrarea",
        "expression", "F_CODE=BA030 or F_CODE=DA010",
        "fill_color_rgba", 0xBDAF1Bff,
        NULL);

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 an example:

/* 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:/mnt/cdrom", NULL);

foo_canvas_item_new(group, GEOCVPF_TYPE_CANVAS_THEME,
        "library_path", "a1707420",
        "coverage", "ecr",
        "feature_class", "ecrarea",
        "expression", "F_CODE=BA030 or F_CODE=DA010",
        "fill_color_rgba", 0xBDAF1Bff,
        NULL);

Details

GeocvpfDatabaseLookupPrivate

typedef struct _GeocvpfDatabaseLookupPrivate GeocvpfDatabaseLookupPrivate;


GeocvpfDatabaseLookup

typedef struct _GeocvpfDatabaseLookup GeocvpfDatabaseLookup;


GeocvpfDatabaseLookupClass

typedef struct {
        GObjectClass parent_class;
} GeocvpfDatabaseLookupClass;


geocvpf_database_lookup_set_search_path ()

void                geocvpf_database_lookup_set_search_path
                                                        (GeocvpfDatabaseLookup *database,
                                                         const char *search_path);

This method causes the database object to initialize itself by setting up a lookup table for all of the database libraries found on the given search path. It should only be called once per GeocvpfDatabaseLookup object instance. The search path can also be given as a property during object construction. If it is necessary to change the search path during the execution of the program, then the a new GeocvpfDatabaseLookup object should be created. For very large datasets or datasets that are on the cdrom, calling this function may take a long time.

database :
search_path : A colon delimited list of paths from which to search for VPF database.

geocvpf_database_lookup_library ()

GeocvpfLibrary*     geocvpf_database_lookup_library     (const char *name);

This routine searches the database for a library of the given name.

name : The VPF library name, e.g., 'a1707420'.
Returns : A pointer to the library_type structure defined in vpfview.h.

geocvpf_database_lookup_databases ()

GList*              geocvpf_database_lookup_databases   ();

All of the available databases. Note, it is allowable to have a database list in the database header table (the 'dht' file) that doesn't exist in the file structure. These will simply be ignored.

Returns : A GList of database_type structs as defined in vpfview.h

geocvpf_database_lookup_get_system ()

GeocvpfDatabaseLookup* geocvpf_database_lookup_get_system
                                                        (void);

Creates a singleton instance if none exists, else will increase the reference count on the singleton by one. Use g_object_unref when finished. Note also that the first g_object_new for this object type will create the singleton instance. The first database lookup object created becomes the systen object.

Returns : A singleton instance of the database lookup object.

Property Details

The "search-path" property

  "search-path"              gchararray            : Read / Write

Setting this property causes the database object to initialize itself by setting up a lookup table for all of the database libraries found on the given search path. It should only be called once per GeocvpfDatabaseLookup object instance. If it is necessary to change the search path during the execution of the program, then the a new GeocvpfDatabaseLookup object should be created. For very large datasets or datasets that are on the cdrom, setting this property may take a long time.

Default value: ""