The Layer object represents a map layer or a work layer of a theme. To access layer features, the Layer::OpenFeatureset method should be used. This method creates the Featureset object that is a set of layer features.
In order to create a new layer, the following steps should be performed:
Create a Layer object by the Map::CreateLayer method.
Create a feature type of the layer by the Layer::CreateFeatureType method.
Set properties of the created feature type.
Add the feature type to the Layer::FeatureTypes collection by the Append method.
Repeat steps 2–4 for every feature type of the layer.
Add the Layer object to the Map::Layers collection by the Append method.
In order to create a new work layer, the following steps should be performed:
Create a Layer object by the Theme::CreateLayer method.
Create a feature type of the layer by the Layer::CreateFeatureType method.
Set properties of the created feature type.
Add the feature type to the Layer::FeatureTypes collection by the Append method.
Repeat steps 2–4 for every feature type of the layer.
Add the Layer object to the Theme::Layers collection by the Append method.
An internal number is assigned to the layer If its addition to the Map::Layers or Theme::Layers collection is successful. Besides, the internal numbers are assigned to feature types in the layer as well. 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 layers in the Map::Layers and Theme::Layers collections, use the Item method. The argument of the method can be a string (the layer name) or an integer (the layer internal number).
To access feature types of the Layer::FeatureTypes collection, use the Item method. The argument of the method can be a string (the feature type name) or an integer (the feature type internal number). Access to feature types can be by name only until the Layer object is not added to the Map::Layers collection.
The work layers allow to organize an own set of features for a theme. The feature types of work layers cannot be linked with tables from GDB or external database.
Taking into account peculiarities of implementation for work layers in the given version of GIS kernel, it is not recommended to create work layers with the number of features comparable with the number of features in map layers. Because it may cause the GIS kernel to reduce performance. In the given version of GIS kernel, it is assumed that features of work layers are mainly used to implement spatial filter conditions in a theme.
Modification of work layer features as well as the structure of work layers is performed beyond GDB transactions. All changes made to features of a work layer and its structure are saved to GDB while a theme is cataloged in GDB by adding to the GeoDatabase::Themes collection or by updating the cataloged theme using the Theme::Update method.