-
Notifications
You must be signed in to change notification settings - Fork 102
Expand file tree
/
Copy pathProjectionInfoModel.cs
More file actions
57 lines (47 loc) · 1.71 KB
/
Copy pathProjectionInfoModel.cs
File metadata and controls
57 lines (47 loc) · 1.71 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
// -------------------------------------------------------------------------------------------
// <copyright file="ProjectionInfoModel.cs" company="MapWindow OSS Team - www.mapwindow.org">
// MapWindow OSS Team - 2015
// </copyright>
// -------------------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using MW5.Api.Interfaces;
using MW5.Plugins.Interfaces.Projections;
using MW5.Projections.BL;
namespace MW5.Projections.Views
{
public class ProjectionInfoModel
{
private BindingList<ProjectionDialect> _dialects;
public ProjectionInfoModel(ISpatialReference sr)
{
if (sr == null) throw new ArgumentNullException("sr");
SpatialReference = sr;
}
public ProjectionInfoModel(ICoordinateSystem cs)
{
if (cs == null) throw new ArgumentNullException("cs");
CoordinateSystem = cs;
}
public ICoordinateSystem CoordinateSystem { get; private set; }
public IList<ProjectionDialect> Dialects
{
get { return _dialects; }
}
public ISpatialReference SpatialReference { get; private set; }
public bool LoadDialects(IProjectionDatabase db)
{
if (db == null) return false;
if (CoordinateSystem != null)
{
db.ReadDialects(CoordinateSystem);
var list = CoordinateSystem.Dialects.Select(d => new ProjectionDialect(d)).ToList();
_dialects = new BindingList<ProjectionDialect>(list);
return true;
}
return false;
}
}
}