Theme Object

The Theme object represents a theme that is a user's view of a GDB map. To access map features contained in a theme, use the Theme::OpenFeatureset method. It creates the Featureset object that represents a featureset.

To create a new theme in GDB, the following steps should be performed:

Create the Theme object by one of the methods GeoDatabase::CreateTheme, Map::CreateTheme, Layer::CreateTheme, or FeatureType::CreateTheme.

Add layers (in required order) to the Theme::Layers collection by the Append method.

Create necessary work layers of the theme by the Theme::CreateLayer method.

Add created work layers to the Theme::Layers collection.

Add required feature types to the Layer::FeatureTypes collection for every layer of the Theme::Layers collection by the Append method.

The FeatureType::DataLinks collection for feature types added to the Layer::FeatureTypes collection in step 5 contains only link descriptors based on tables or queries of external databases. In order to get access through the theme being created to GDB tables linked with a feature type, you should add link descriptors based on GDB tables to the collection by the method Append. It is possible to add only descriptors based on GDB tables linked with a feature type at the map level. The feature types of work layers cannot be linked with tables of GDB or external databases.

Set the necessary properties for layers and feature types.

To catalog a theme, it is necessary to set its name up by the Theme::Name property and add the object to the GeoDatabase::Themes collection. If adding the theme to the GeoDatabase::Themes collection has succeeded, this theme gets an internal number. Continuity of internal numbers is not guaranteed. Assigned internal numbers do not change between GDB sessions. Internal numbers may change at GDB reorganization performed by the GDBEngine::CompactGDB method with the gdbCompactNoKeepISN mode.

To access cataloged themes in the GeoDatabase::Themes collection, use the Item method. The argument of the method can be a string (the theme name) or an integer (the theme internal number).

After completing the work with the theme, you should close it by the Theme::Close method if it contains work layers.