-
Notifications
You must be signed in to change notification settings - Fork 304
Expand file tree
/
Copy pathSession.cs
More file actions
103 lines (92 loc) · 3.38 KB
/
Session.cs
File metadata and controls
103 lines (92 loc) · 3.38 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
using System;
using Common.Logging;
using GeoAPI;
namespace SharpMap
{
/// <summary>
/// A SharpMap Session class
/// </summary>
public class Session : ISession
{
private static ICoordinateSystemRepository _repository;
private ICoordinateSystemServices _coordinateSystemServices;
/// <summary>
/// Static constructor
/// </summary>
static Session()
{
Instance = new Session();
}
/// <summary>
/// Gets a value indicating the current instance
/// </summary>
public static ISession Instance { get; private set; }
/// <summary>
/// The geometry services instance
/// </summary>
public IGeometryServices GeometryServices { get; set; }
/// <summary>
/// Gets the coordinate system services instance
/// </summary>
public ICoordinateSystemServices CoordinateSystemServices
{
get
{
if (_coordinateSystemServices == null)
throw new InvalidOperationException("Must declare a coordinate system services object!");
return _coordinateSystemServices;
}
set { _coordinateSystemServices = value; }
}
/// <summary>
/// Gets the coordinate system repository
/// </summary>
public ICoordinateSystemRepository CoordinateSystemRepository
{
get { return _repository ?? CoordinateSystemServices as ICoordinateSystemRepository; }
set { _repository = value; }
}
#region Fluent
/// <summary>
/// Method to set the geometry services class
/// </summary>
/// <param name="geometryServices">The geometry services class</param>
/// <returns>A reference to this session</returns>
public ISession SetGeometryServices(IGeometryServices geometryServices)
{
GeometryServices = geometryServices;
return this;
}
/// <summary>
/// Method to set the coordinate system services class
/// </summary>
/// <param name="coordinateSystemServices">The coordinate system services class</param>
/// <returns>A reference to this session</returns>
public ISession SetCoordinateSystemServices(ICoordinateSystemServices coordinateSystemServices)
{
CoordinateSystemServices = coordinateSystemServices;
return this;
}
/// <summary>
/// Method to set the coordinate system repository class
/// </summary>
/// <param name="coordinateSystemRepository">The coordinate system repository class</param>
/// <returns>A reference to this session</returns>
public ISession SetCoordinateSystemRepository(ICoordinateSystemRepository coordinateSystemRepository)
{
CoordinateSystemRepository = coordinateSystemRepository;
return this;
}
/// <summary>
/// Method to read the configuration
/// </summary>
/// <returns>A reference to this session</returns>
public ISession ReadConfiguration()
{
var log = LogManager.GetLogger<ISession>();
log.Warn(f => f("Configuring SharpMap session via ReadConfiguration currently not supported"));
return this;
}
#endregion
}
}