-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathMaps.cs
136 lines (116 loc) · 2.96 KB
/
Maps.cs
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
// Copyright 2010 ESRI
//
// All rights reserved under the copyright laws of the United States
// and applicable international laws, treaties, and conventions.
//
// You may freely redistribute and use this sample code, with or
// without modification, provided you include the original copyright
// notice and use restrictions.
//
// See the use restrictions at <your ArcGIS install location>/DeveloperKit10.0/userestrictions.txt.
//
using System;
using System.Data;
using System.Collections;
using System.Runtime.InteropServices;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.Geometry;
using ESRI.ArcGIS.Carto;
namespace EngineApplication
{
/// <summary>
/// Implementation of interface IMaps which is eventually a collection of Maps
/// </summary>
public class Maps : IMaps, IDisposable
{
//class member - using internally an ArrayList to manage the Maps collection
private ArrayList pArray = null;
#region class constructor
public Maps()
{
pArray = new ArrayList();
}
#endregion
#region IDisposable Members
/// <summary>
/// Dispose the collection
/// </summary>
public void Dispose()
{
if (pArray != null)
{
pArray.Clear();
pArray = null;
}
}
#endregion
#region IMaps Members
/// <summary>
/// Remove the Map at the given index
/// </summary>
/// <param name="Index"></param>
public void RemoveAt(int Index)
{
if (Index > pArray.Count || Index < 0)
throw new Exception("Maps::RemoveAt:\r\nIndex is out of range!");
pArray.RemoveAt(Index);
}
/// <summary>
/// Reset the Maps array
/// </summary>
public void Reset()
{
pArray.Clear();
}
/// <summary>
/// Get the number of Maps in the collection
/// </summary>
public int Count
{
get
{
return pArray.Count;
}
}
/// <summary>
/// Return the Map at the given index
/// </summary>
/// <param name="Index"></param>
/// <returns></returns>
public IMap get_Item(int Index)
{
if (Index > pArray.Count || Index < 0)
throw new Exception("Maps::get_Item:\r\nIndex is out of range!");
return pArray[Index] as IMap;
}
/// <summary>
/// Remove the instance of the given Map
/// </summary>
/// <param name="Map"></param>
public void Remove(IMap Map)
{
pArray.Remove(Map);
}
/// <summary>
/// Create a new Map, add it to the collection and return it to the caller
/// </summary>
/// <returns></returns>
public IMap Create()
{
IMap newMap = new MapClass();
pArray.Add(newMap);
return newMap;
}
/// <summary>
/// Add the given Map to the collection
/// </summary>
/// <param name="Map"></param>
public void Add(IMap Map)
{
if (Map == null)
throw new Exception("Maps::Add:\r\nNew Map is mot initialized!");
pArray.Add(Map);
}
#endregion
}
}