-
Notifications
You must be signed in to change notification settings - Fork 305
Expand file tree
/
Copy pathIProviderConfiguration.cs
More file actions
122 lines (111 loc) · 4.03 KB
/
IProviderConfiguration.cs
File metadata and controls
122 lines (111 loc) · 4.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
using System;
namespace SharpMap.Data.Providers
{
/// <summary>
/// Interface for all classes that create a provider
/// </summary>
public interface IProviderConfiguration
{
/// <summary>
/// Create the provider provider
/// </summary>
/// <returns>The created provider</returns>
IProvider Create();
}
/// <summary>
/// Shapefile provider configuration class
/// </summary>
[Serializable]
public class ShapeFileProviderConfiguration : IProviderConfiguration
{
/// <summary>
/// Gets or sets the filename of the ShapeFile
/// </summary>
public string Filename { get; set; }
/// <summary>
/// Gets or sets a value indicating whether a spatial index should be reused
/// </summary>
public bool UseFilebasedIndex { get; set; }
/// <summary>
/// Gets or sets a value if the shapefile should be used as a <see cref="System.IO.MemoryMappedFiles.MemoryMappedFile"/>
/// </summary>
public bool UseMemoryCache { get; set; }
/// <summary>
/// Gets or sets a value indicating how to create
/// </summary>
public ShapeFile.SpatialIndexCreation SpatialIndexCreationOption { get; set; }
/// <summary>
/// Creates a Shapefile provider
/// </summary>
/// <returns></returns>
public IProvider Create()
{
#pragma warning disable 618
ShapeFile.SpatialIndexCreationOption = SpatialIndexCreationOption;
#pragma warning restore 618
return new ShapeFile(Filename, UseFilebasedIndex, UseMemoryCache);
}
}
/// <summary>
/// Configuration class for SqlServer 2008 providers
/// </summary>
[Serializable]
public class SqlServer2008Configuration : IProviderConfiguration
{
/// <summary>
/// Gets or sets the connection string for the database
/// </summary>
public string ConnectionString { get; set; }
/// <summary>
/// Gets or sets the schema name
/// </summary>
public string SchemaName { get; set; }
/// <summary>
/// Gets or sets the TableName
/// </summary>
public string TableName { get; set; }
/// <summary>
/// Gets or sets the ObjectIdColumn
/// </summary>
public string ObjectIdColumnName { get; set; }
/// <summary>
/// Gets or sets the Geometry column name
/// </summary>
public string GeometryColumnName { get; set; }
/// <summary>
/// Gets or sets the spatial object type
/// </summary>
public SqlServerSpatialObjectType SpatialObjectType { get; set; }
/// <summary>
/// Gets or sets a value indicating whether or not to use the spatial index
/// </summary>
[Obsolete("Use ExtentsMode")]
public bool UseSpatialIndexForEnvelope
{
get => ExtentsMode == SqlServer2008ExtentsMode.SpatialIndex;
set
{
ExtentsMode = value
? SqlServer2008ExtentsMode.SpatialIndex
: SqlServer2008ExtentsMode.QueryIndividualFeatures;
}
}
/// <summary>
/// Gets or sets a value indicating the spatial reference id
/// </summary>
public int SRID { get; set; }
/// <summary>
/// Gets or sets the way the spatial extent of the data source is evaluated
/// </summary>
public SqlServer2008ExtentsMode ExtentsMode { get; set; }
/// <summary>
/// Create the provider provider
/// </summary>
/// <returns>The created provider</returns>
public IProvider Create()
{
return new SqlServer2008(ConnectionString, TableName, GeometryColumnName, ObjectIdColumnName,
SpatialObjectType, SRID, ExtentsMode);
}
}
}