MemoryDataSet Class
Represents a writable dataset that an application can insert features into.
NuGet/Assembly: Carmenta.Engine.5.16.2.nupkg (in the CECore assembly)
Syntax
public class MemoryDataSet : DataSet,
ILockable
Remarks
A MemoryDataSet is a dataset that holds Feature instances created by the application. Carmenta Engine 5 reads, processes and renders features from a MemoryDataSet in the same way as from any of the other predefined data sets.
Carmenta Engine 5 can use background threads to read from a MemoryDataSet. For this reason the application must lock the dataset, by using an instance of the Guard class, before it or any feature it contains are modified.
To lock a MemoryDataSet instantiate a Guard with the MemoryDataSet as an argument.
More information can be found in Threading Model, datasets and features.
Example
// Insert a new feature into a MemoryDataSet
public static void InsertFeature(Feature feature, MemoryDataSet dataSet)
{
// Take the dataset lock before inserting the feature
using (Guard guard = new Guard(dataSet))
{
dataSet.Insert(feature);
}
}
// Move a point feature that has been inserted into a MemoryDataSet
public static void UpdatePosition(Feature feature, Point delta,
MemoryDataSet dataSet)
{
// Take the dataset lock before modifying the feature
using (Guard guard = new Guard(dataSet))
{
PointGeometry p = feature.Geometry as PointGeometry;
if (p != null)
p.Point = p.Point + delta;
}
}
// Remove a feature from a MemoryDataSet
public static void RemoveFeature(Feature feature, MemoryDataSet dataSet)
{
// Take the dataset lock before modifying the dataset
using (Guard guard = new Guard(dataSet))
{
dataSet.Remove(feature.Id);
}
}
// Clear a MemoryDataSet
public static void Clear(MemoryDataSet dataSet)
{
// The Clear method is thread-safe
dataSet.Clear();
}
Inheritance Hierarchy
System.Object (not available in C#)
EngineObject
ResourceObject
DataSet
MemoryDataSet
GroupDataSet
Platforms
Windows, Linux, Android
MemoryDataSet Members
The MemoryDataSet type has the following members.
Constructors
Name | Description |
---|---|
MemoryDataSet | Initializes a new instance of the MemoryDataSet class. |
Properties
Name | Description |
---|---|
Bounds | Gets or sets the bounding rectangle of the dataset. Inherited from DataSet |
Crs | Gets or sets the coordinate reference system of the MemoryDataSet. Inherited from DataSet |
Description | Gets or sets a short description of the dataset. Inherited from DataSet |
DisplayName | Gets or sets a display name for the dataset. Inherited from DataSet |
EnableEvents | Gets or sets a value that determines whether the MemoryDataSet fires events. |
FeatureCount | Gets the number of features in the MemoryDataSet. |
Id | Gets a unique identifier for this dataset instance. Inherited from DataSet |
IsDisposed | Gets a value that tells whether the current MemoryDataSet has been disposed. Inherited from EngineObject |
IsoMetadataDocument | Gets or sets the path to an ISO 19139 metadata document for the dataset. Inherited from DataSet |
Name | Gets or sets the name of the MemoryDataSet. Inherited from ResourceObject |
NativeHandle | Gets the native Carmenta Engine kernel object the current MemoryDataSet represents. Inherited from EngineObject |
SuppressInitializationErrors | Gets or sets a flag indicating how errors during dataset initialization are handled. Inherited from DataSet |
Time | Gets or sets the MemoryDataSet time value. |
TimeFactor | Gets or sets a value specifying how fast the Time property changes. |
IUserProperties.UserProperties | Gets the AttributeSet that contains the user properties. Inherited from IUserProperties |
Methods
Name | Description |
---|---|
Clear | Removes all features from the MemoryDataSet. |
Clone | Creates a copy of an object. Inherited from EngineObject |
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 |
FindChildObject | Overloaded. Finds the child object with the specified name. Inherited from DataSet |
FireFeatureChanged | Fires the FeatureChanged event for the specified Feature. |
FlushCache | Frees any information the dataset may have cached, including all cached features. Inherited from DataSet |
Constructs a MemoryDataSet from the specified file. | |
GetChildObjects | Overloaded. Gets the child objects of the current object. Inherited from DataSet |
GetDataCoverage | Gets coverage information for this dataset in a given area. Inherited from DataSet |
Looks up an existing dataset instance from a dataset identity. Inherited from DataSet | |
GetDataSetInfo | Returns a dataset info that describes the contents of this dataset. Inherited from DataSet |
GetDataSetInfoAsync | Makes an asynchronous call to GetDataSetInfo. Inherited from DataSet |
GetFeature | Gets the feature with the specified identity. Inherited from DataSet |
GetFeatures | Overloaded. Gets features from the dataset. Inherited from DataSet |
GetFloatValueAt | Overloaded. Gets the float raster value from a cell at the specified position. Inherited from DataSet |
GetFloatValuesAt | Overloaded. Gets a number of float raster values. Inherited from DataSet |
GetLocalizedDescription | Gets a localized version of the dataset description in a specific language. Inherited from DataSet |
GetLocalizedDisplayName | Gets a localized version of the dataset display name in a specific language. Inherited from DataSet |
GetLocalizedIsoMetadataDocument | Gets the path to an ISO 19139 metadata document for a specific language. Inherited from DataSet |
GetNormalizedFloatValueAt | Overloaded. Gets the raster value from a cell at the specified position, normalized by Scale and Offset. Inherited from DataSet |
GetNormalizedFloatValuesAt | Overloaded. Gets a number of raster values, normalized by Scale and Offset. Inherited from DataSet |
GetValueAt | Overloaded. Gets the integer value from a raster cell at the specified position. Inherited from DataSet |
GetValuesAt | Overloaded. Gets a number of raster values. Inherited from DataSet |
HasLocalizedDescription | Checks if a localized version of the dataset description is available in a specific language. Inherited from DataSet |
HasLocalizedDisplayName | Checks if a localized version of the dataset display name is available in a specific language. Inherited from DataSet |
HasLocalizedIsoMetadataDocument | Checks if an ISO 19139 metadata document is available for a specific language. Inherited from DataSet |
HighestRasterValue | Finds the highest raster value inside the given polygon. Inherited from DataSet |
Initialize | Initializes the dataset. Inherited from DataSet |
Insert | Inserts a feature into the MemoryDataSet. |
Load | Loads all features from the specified file. |
RefreshAllFeaturePresentation | Informs the dataset and the containing layer that all of the features have been modified and any cached presentation needs to be updated. |
RefreshFeaturePresentation | Informs the dataset and the containing layer that the feature has been modified and any cached presentation needs to be updated. |
Remove | Removes a feature from the MemoryDataSet. |
RestartVisualizationAnimation | Restarts visualization animations for a feature. |
Save | Overloaded. Saves features to a file that Load can read. |
SetLocalizedDescription | Sets a dataset description in a specific language. Inherited from DataSet |
SetLocalizedDisplayName | Sets a dataset display name in a specific language. Inherited from DataSet |
SetLocalizedIsoMetadataDocument | Sets the path to an ISO 19139 metadata document for the dataset, for a specific language. Inherited from DataSet |
StartFeatureAnimation | Overloaded. Starts a feature animation. |
StopFeatureAnimation | Stops an ongoing feature animation. |
TryGetFloatValueAt | Overloaded. Gets the float value from a raster cell at the specified position. Inherited from DataSet |
TryGetNormalizedFloatValueAt | Overloaded. Gets the float value from a raster cell at the specified position, normalized by Scale and Offset. Inherited from DataSet |
TryGetValueAt | Overloaded. Gets the integer value from a raster cell at the specified position. Inherited from DataSet |
Events
Name | Description |
---|---|
FeatureChanged | Occurs when FireFeatureChanged is called with a Feature that belongs in the MemoryDataSet. |
FeatureInserted | Occurs when a Feature is inserted into the MemoryDataSet. |
FeatureRemoved | Occurs when a Feature is removed from the MemoryDataSet. |