1- using System ;
2- using Common . Logging ;
3- using GeoAPI ;
4-
5- namespace SharpMap . CoordinateSystems
6- {
7- /// <summary>
8- /// A SharpMap Session class
9- /// </summary>
10- public class Session : ISession
11- {
12- private static ICoordinateSystemRepository _repository ;
13- private ICoordinateSystemServices _coordinateSystemServices ;
14-
15- /// <summary>
16- /// Static constructor
17- /// </summary>
18- static Session ( )
19- {
20- Instance = new Session ( ) ;
21- }
22-
23- /// <summary>
24- /// Gets a value indicating the current instance
25- /// </summary>
26- public static ISession Instance { get ; private set ; }
27-
28- /// <summary>
29- /// The geometry services instance
30- /// </summary>
31- public IGeometryServices GeometryServices { get ; set ; }
32-
33- /// <summary>
34- /// Gets the coordinate system services instance
35- /// </summary>
36- public ICoordinateSystemServices CoordinateSystemServices
37- {
38- get
39- {
40- if ( _coordinateSystemServices == null )
41- throw new InvalidOperationException ( "Must declare a coordinate system services object!" ) ;
42- return _coordinateSystemServices ;
43- }
44- set { _coordinateSystemServices = value ; }
45- }
46-
47- /// <summary>
48- /// Gets the coordinate system repository
49- /// </summary>
50- public ICoordinateSystemRepository CoordinateSystemRepository
51- {
52- get { return _repository ?? CoordinateSystemServices as ICoordinateSystemRepository ; }
53- set { _repository = value ; }
54- }
55-
56- #region Fluent
57-
58- /// <summary>
59- /// Method to set the geometry services class
60- /// </summary>
61- /// <param name="geometryServices">The geometry services class</param>
62- /// <returns>A reference to this session</returns>
63- public ISession SetGeometryServices ( IGeometryServices geometryServices )
64- {
65- GeometryServices = geometryServices ;
66- return this ;
67- }
68-
69- /// <summary>
70- /// Method to set the coordinate system services class
71- /// </summary>
72- /// <param name="coordinateSystemServices">The coordinate system services class</param>
73- /// <returns>A reference to this session</returns>
74- public ISession SetCoordinateSystemServices ( ICoordinateSystemServices coordinateSystemServices )
75- {
76- CoordinateSystemServices = coordinateSystemServices ;
77- return this ;
78- }
79-
80- /// <summary>
81- /// Method to set the coordinate system repository class
82- /// </summary>
83- /// <param name="coordinateSystemRepository">The coordinate system repository class</param>
84- /// <returns>A reference to this session</returns>
85- public ISession SetCoordinateSystemRepository ( ICoordinateSystemRepository coordinateSystemRepository )
86- {
87- CoordinateSystemRepository = coordinateSystemRepository ;
88- return this ;
89- }
90-
91- /// <summary>
92- /// Method to read the configuration
93- /// </summary>
94- /// <returns>A reference to this session</returns>
95- public ISession ReadConfiguration ( )
96- {
97- var log = LogManager . GetLogger < ISession > ( ) ;
98- log . Warn ( f => f ( "Configuring SharpMap session via ReadConfiguration currently not supported" ) ) ;
99- return this ;
100- }
101- #endregion
102- }
1+ using System ;
2+ using Common . Logging ;
3+ using GeoAPI ;
4+
5+ namespace SharpMap
6+ {
7+ /// <summary>
8+ /// A SharpMap Session class
9+ /// </summary>
10+ public class Session : ISession
11+ {
12+ private static ICoordinateSystemRepository _repository ;
13+ private ICoordinateSystemServices _coordinateSystemServices ;
14+
15+ /// <summary>
16+ /// Static constructor
17+ /// </summary>
18+ static Session ( )
19+ {
20+ Instance = new Session ( ) ;
21+ }
22+
23+ /// <summary>
24+ /// Gets a value indicating the current instance
25+ /// </summary>
26+ public static ISession Instance { get ; private set ; }
27+
28+ /// <summary>
29+ /// The geometry services instance
30+ /// </summary>
31+ public IGeometryServices GeometryServices { get ; set ; }
32+
33+ /// <summary>
34+ /// Gets the coordinate system services instance
35+ /// </summary>
36+ public ICoordinateSystemServices CoordinateSystemServices
37+ {
38+ get
39+ {
40+ if ( _coordinateSystemServices == null )
41+ throw new InvalidOperationException ( "Must declare a coordinate system services object!" ) ;
42+ return _coordinateSystemServices ;
43+ }
44+ set { _coordinateSystemServices = value ; }
45+ }
46+
47+ /// <summary>
48+ /// Gets the coordinate system repository
49+ /// </summary>
50+ public ICoordinateSystemRepository CoordinateSystemRepository
51+ {
52+ get { return _repository ?? CoordinateSystemServices as ICoordinateSystemRepository ; }
53+ set { _repository = value ; }
54+ }
55+
56+ #region Fluent
57+
58+ /// <summary>
59+ /// Method to set the geometry services class
60+ /// </summary>
61+ /// <param name="geometryServices">The geometry services class</param>
62+ /// <returns>A reference to this session</returns>
63+ public ISession SetGeometryServices ( IGeometryServices geometryServices )
64+ {
65+ GeometryServices = geometryServices ;
66+ return this ;
67+ }
68+
69+ /// <summary>
70+ /// Method to set the coordinate system services class
71+ /// </summary>
72+ /// <param name="coordinateSystemServices">The coordinate system services class</param>
73+ /// <returns>A reference to this session</returns>
74+ public ISession SetCoordinateSystemServices ( ICoordinateSystemServices coordinateSystemServices )
75+ {
76+ CoordinateSystemServices = coordinateSystemServices ;
77+ return this ;
78+ }
79+
80+ /// <summary>
81+ /// Method to set the coordinate system repository class
82+ /// </summary>
83+ /// <param name="coordinateSystemRepository">The coordinate system repository class</param>
84+ /// <returns>A reference to this session</returns>
85+ public ISession SetCoordinateSystemRepository ( ICoordinateSystemRepository coordinateSystemRepository )
86+ {
87+ CoordinateSystemRepository = coordinateSystemRepository ;
88+ return this ;
89+ }
90+
91+ /// <summary>
92+ /// Method to read the configuration
93+ /// </summary>
94+ /// <returns>A reference to this session</returns>
95+ public ISession ReadConfiguration ( )
96+ {
97+ var log = LogManager . GetLogger < ISession > ( ) ;
98+ log . Warn ( f => f ( "Configuring SharpMap session via ReadConfiguration currently not supported" ) ) ;
99+ return this ;
100+ }
101+ #endregion
102+ }
103103}
0 commit comments