Class MemoryProvider
Datasource for storing a limited set of geometries.
Inheritance
Implements
Inherited Members
Namespace: Mapsui.Providers
Assembly: Mapsui.dll
Syntax
public class MemoryProvider : IProvider
Remarks
The MemoryProvider doesn’t utilize performance optimizations of spatial indexing, and thus is primarily meant for rendering a limited set of Geometries.
A common use of the MemoryProvider is for highlighting a set of selected features.
List<Geometry> geometries = myMap.Layers[0].DataSource.GetGeometriesInView(myBox);
VectorLayer laySelected = new VectorLayer("Selected Features");
laySelected.DataSource = new MemoryProvider(geometries);
laySelected.Style.Outline = new Pen(Color.Magenta, 3f);
laySelected.Style.EnableOutline = true;
myMap.Layers.Add(laySelected);
List<Mapsui.Geometries.Geometry> geometries = new List<Mapsui.Geometries.Geometry>();
//Add two points
geometries.Add(new Mapsui.Geometries.Point(23.345,64.325));
geometries.Add(new Mapsui.Geometries.Point(23.879,64.194));
Mapsui.Layers.VectorLayer layerVehicles = new Mapsui.Layers.VectorLayer("Vechicles");
layerVehicles.DataSource = new Mapsui.Data.Providers.MemoryProvider(geometries);
layerVehicles.Style.Symbol = Bitmap.FromFile(@"C:\data\car.gif");
myMap.Layers.Add(layerVehicles);
Constructors
| Improve this Doc View SourceMemoryProvider()
Declaration
public MemoryProvider()
MemoryProvider(Geometry)
Initializes a new instance of the MemoryProvider
Declaration
public MemoryProvider(Geometry geometry)
Parameters
Type | Name | Description |
---|---|---|
Geometry | geometry | Geometry to be in this datasource |
MemoryProvider(IFeature)
Initializes a new instance of the MemoryProvider
Declaration
public MemoryProvider(IFeature feature)
Parameters
Type | Name | Description |
---|---|---|
IFeature | feature | Feature to be in this datasource |
MemoryProvider(Byte[])
Initializes a new instance of the MemoryProvider
Declaration
public MemoryProvider(byte[] wellKnownBinaryGeometry)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | wellKnownBinaryGeometry | Geometry as Well-known Binary to be included in this datasource |
MemoryProvider(IEnumerable<IGeometry>)
Initializes a new instance of the MemoryProvider
Declaration
public MemoryProvider(IEnumerable<IGeometry> geometries)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<IGeometry> | geometries | Set of geometries that this datasource should contain |
MemoryProvider(IEnumerable<IFeature>)
Initializes a new instance of the MemoryProvider
Declaration
public MemoryProvider(IEnumerable<IFeature> features)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<IFeature> | features | Features to be included in this datasource |
MemoryProvider(String)
Initializes a new instance of the MemoryProvider
Declaration
public MemoryProvider(string wellKnownTextGeometry)
Parameters
Type | Name | Description |
---|---|---|
System.String | wellKnownTextGeometry | Geometry as Well-known Text to be included in this datasource |
Properties
| Improve this Doc View SourceCRS
The spatial reference ID (CRS)
Declaration
public string CRS { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Features
Gets or sets the geometries this datasource contains
Declaration
public IReadOnlyList<IFeature> Features { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IReadOnlyList<IFeature> |
SymbolSize
Declaration
public double SymbolSize { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Methods
| Improve this Doc View SourceClear()
Declaration
public void Clear()
Find(Object, String)
Declaration
public IFeature Find(object value, string primaryKey)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | |
System.String | primaryKey |
Returns
Type | Description |
---|---|
IFeature |
GetExtents()
Boundingbox of dataset
Declaration
public BoundingBox GetExtents()
Returns
Type | Description |
---|---|
BoundingBox | boundingbox |
GetFeaturesInView(BoundingBox, Double)
Declaration
public virtual IEnumerable<IFeature> GetFeaturesInView(BoundingBox box, double resolution)
Parameters
Type | Name | Description |
---|---|---|
BoundingBox | box | |
System.Double | resolution |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IFeature> |
ReplaceFeatures(IEnumerable<IFeature>)
Declaration
public void ReplaceFeatures(IEnumerable<IFeature> features)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<IFeature> | features |