AttributeSet Class
A set of named values associated with a Feature.
NuGet/Assembly: Carmenta.Engine.5.16.2.nupkg (in the CECore assembly)
Syntax
public sealed class AttributeSet : EngineObject,
IDictionary< Atom, AttributeValue >
Remarks
An AttributeSet is a collection of key/value pairs where the key is an Atom and the value is an AttributeValue. An AttributeSet can be associated with a Feature and can then be accessed through the Feature.Attributes property.
When an AttributeSet is associated with a Feature it has an implicit Atom value called geoType that tells what kind of geometry the feature has. This attribute is often used in conditions in a Carmenta Engine map configuration to limit an operation to a specific type of feature.
The following table lists the possible values of the implicit geoType attribute:
geoType | Type of geometry |
---|---|
point | A point geometry. |
line | A line geometry. |
polygon | A polygon geometry. |
raster | A raster geometry. |
mesh | A mesh geometry. |
When these values are used in a condition, the expression syntax demands that they are preceded by a # character, since they are atoms. For example, a condition could be written
geoType = #line
Example
// Add and remove values from an AttributeSet
public static void ModifyAttributeSet(AttributeSet attributeSet)
{
// NOTE: If an AttributeSet is part of a Feature that has been
// inserted into a MemoryDataSet, GroupDataSet or CustomDataSet
// then the application must use a Guard to lock the DataSet
// while the AttributeSet is being modified (to prevent Carmenta
// Engine from accessing the AttributeSet at the same time).
// Add a boolean attribute
attributeSet["VISIBLE"] = true;
// Add a string attribute
attributeSet["COLOR"] = "rgb(255, 0, 255)";
// Remove an attribute if it exists
attributeSet.Remove("NAME");
}
Inheritance Hierarchy
System.Object (not available in C#)
EngineObject
AttributeSet
Platforms
Windows, Linux, Android
AttributeSet Members
The AttributeSet type has the following members.
Constructors
Name | Description |
---|---|
AttributeSet | Initializes a new instance of the AttributeSet class. |
Properties
Name | Description |
---|---|
Count | Gets the number of elements in the AttributeSet. |
IsDisposed | Gets a value that tells whether the current AttributeSet has been disposed. Inherited from EngineObject |
IsReadOnly | Gets a value that tells whether the AttributeSet is marked as read-only. |
Item | Gets or sets the value associated with the specified key. |
Keys | Gets a collection containing the names of all values in the AttributeSet. |
NativeHandle | Gets the native Carmenta Engine kernel object the current AttributeSet represents. Inherited from EngineObject |
Values | Gets a collection containing all values in the AttributeSet. |
Methods
Name | Description |
---|---|
Add | Overloaded. Adds a new element to the AttributeSet. |
AddRange | Overloaded. Adds the specified elements to the AttributeSet. |
Clear | Removes all values from the AttributeSet. |
Clone | Creates a copy of an object. Inherited from EngineObject |
Contains | Determines whether the AttributeSet contains the specified element. |
ContainsKey | Determines whether the AttributeSet contains the specified key. |
CopyTo | Copies all elements in the AttributeSet to a compatible one-dimensional array, starting at the specified index of the target array. |
Dispose | Releases the reference to the native Carmenta Engine kernel instance the EngineObject represents. Inherited from EngineObject |
Equals | Determines whether this instance is equal to another. Inherited from EngineObject |
GetEnumerator | Returns an enumerator that iterates through all elements in the AttributeSet. |
Merge | Merges values from the specified AttributeSet into this AttributeSet. |
Remove | Removes the specified key/value pair from the AttributeSet. |
TryGetValue | Get the value associated with the specified name. |