Extended .NET SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
MapDeviations.cs
Go to the documentation of this file.
1//------------------------------------------------------------------------------
2// <auto-generated />
3//
4// This file was automatically generated by SWIG (http://www.swig.org).
5// Version 4.0.2
6//
7// Do not make changes to this file unless you know what you are doing--modify
8// the SWIG interface file instead.
9//------------------------------------------------------------------------------
10
11namespace Teigha.Core {
12
13using System;
14using System.Runtime.InteropServices;
15
16public class MapDeviations : global::System.IDisposable
17 , global::System.Collections.Generic.IDictionary<OdDbStub, double>
18 {
19 private Object locker = new Object();
20 private HandleRef swigCPtr;
21 protected bool swigCMemOwn;
22 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
23 public MapDeviations(IntPtr cPtr, bool cMemoryOwn) {
24 swigCMemOwn = cMemoryOwn;
25 swigCPtr = new HandleRef(this, cPtr);
26 }
27 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
28 public static HandleRef getCPtr(MapDeviations obj) {
29 return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
30 }
31
33 Dispose(false);
34 }
35
36 public void Dispose() {
37 Dispose(true);
38 global::System.GC.SuppressFinalize(this);
39 }
40
41 protected virtual void Dispose(bool disposing) {
42 lock(this) {
43 if (swigCPtr.Handle != global::System.IntPtr.Zero) {
44 if (swigCMemOwn) {
45 swigCMemOwn = false;
47 }
48 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
49 }
50 }
51 }
52
53
54 public double this[OdDbStub key] {
55 get {
56 return getitem(key);
57 }
58
59 set {
60 setitem(key, value);
61 }
62 }
63
64 public bool TryGetValue(OdDbStub key, out double value) {
65 if (this.ContainsKey(key)) {
66 value = this[key];
67 return true;
68 }
69 value = default(double);
70 return false;
71 }
72
73 public int Count {
74 get {
75 return (int)size();
76 }
77 }
78
79 public bool IsReadOnly {
80 get {
81 return false;
82 }
83 }
84
85 public global::System.Collections.Generic.ICollection<OdDbStub> Keys {
86 get {
87 global::System.Collections.Generic.ICollection<OdDbStub> keys = new global::System.Collections.Generic.List<OdDbStub>();
88 int size = this.Count;
89 if (size > 0) {
90 global::System.IntPtr iter = create_iterator_begin();
91 for (int i = 0; i < size; i++) {
92 keys.Add(get_next_key(iter));
93 }
94 destroy_iterator(iter);
95 }
96 return keys;
97 }
98 }
99
100 public global::System.Collections.Generic.ICollection<double> Values {
101 get {
102 global::System.Collections.Generic.ICollection<double> vals = new global::System.Collections.Generic.List<double>();
103 foreach (global::System.Collections.Generic.KeyValuePair<OdDbStub, double> pair in this) {
104 vals.Add(pair.Value);
105 }
106 return vals;
107 }
108 }
109
110 public void Add(global::System.Collections.Generic.KeyValuePair<OdDbStub, double> item) {
111 Add(item.Key, item.Value);
112 }
113
114 public bool Remove(global::System.Collections.Generic.KeyValuePair<OdDbStub, double> item) {
115 if (Contains(item)) {
116 return Remove(item.Key);
117 } else {
118 return false;
119 }
120 }
121
122 public bool Contains(global::System.Collections.Generic.KeyValuePair<OdDbStub, double> item) {
123 if (this[item.Key] == item.Value) {
124 return true;
125 } else {
126 return false;
127 }
128 }
129
130 public void CopyTo(global::System.Collections.Generic.KeyValuePair<OdDbStub, double>[] array) {
131 CopyTo(array, 0);
132 }
133
134 public void CopyTo(global::System.Collections.Generic.KeyValuePair<OdDbStub, double>[] array, int arrayIndex) {
135 if (array == null)
136 throw new global::System.ArgumentNullException("array");
137 if (arrayIndex < 0)
138 throw new global::System.ArgumentOutOfRangeException("arrayIndex", "Value is less than zero");
139 if (array.Rank > 1)
140 throw new global::System.ArgumentException("Multi dimensional array.", "array");
141 if (arrayIndex+this.Count > array.Length)
142 throw new global::System.ArgumentException("Number of elements to copy is too large.");
143
144 global::System.Collections.Generic.IList<OdDbStub> keyList = new global::System.Collections.Generic.List<OdDbStub>(this.Keys);
145 for (int i = 0; i < keyList.Count; i++) {
146 OdDbStub currentKey = keyList[i];
147 array.SetValue(new global::System.Collections.Generic.KeyValuePair<OdDbStub, double>(currentKey, this[currentKey]), arrayIndex+i);
148 }
149 }
150
151 global::System.Collections.Generic.IEnumerator<global::System.Collections.Generic.KeyValuePair<OdDbStub, double>> global::System.Collections.Generic.IEnumerable<global::System.Collections.Generic.KeyValuePair<OdDbStub, double>>.GetEnumerator() {
152 return new MapDeviationsEnumerator(this);
153 }
154
155 global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() {
156 return new MapDeviationsEnumerator(this);
157 }
158
160 return new MapDeviationsEnumerator(this);
161 }
162
163 // Type-safe enumerator
168 public class MapDeviationsEnumerator : global::System.Collections.IEnumerator,
169 global::System.Collections.Generic.IEnumerator<global::System.Collections.Generic.KeyValuePair<OdDbStub, double>>
170 {
171 private MapDeviations collectionRef;
172 private global::System.Collections.Generic.IList<OdDbStub> keyCollection;
173 private int currentIndex;
174 private object currentObject;
175 private int currentSize;
176
178 collectionRef = collection;
179 keyCollection = new global::System.Collections.Generic.List<OdDbStub>(collection.Keys);
180 currentIndex = -1;
181 currentObject = null;
182 currentSize = collectionRef.Count;
183 }
184
185 // Type-safe iterator Current
186 public global::System.Collections.Generic.KeyValuePair<OdDbStub, double> Current {
187 get {
188 if (currentIndex == -1)
189 throw new global::System.InvalidOperationException("Enumeration not started.");
190 if (currentIndex > currentSize - 1)
191 throw new global::System.InvalidOperationException("Enumeration finished.");
192 if (currentObject == null)
193 throw new global::System.InvalidOperationException("Collection modified.");
194 return (global::System.Collections.Generic.KeyValuePair<OdDbStub, double>)currentObject;
195 }
196 }
197
198 // Type-unsafe IEnumerator.Current
199 object global::System.Collections.IEnumerator.Current {
200 get {
201 return Current;
202 }
203 }
204
205 public bool MoveNext() {
206 int size = collectionRef.Count;
207 bool moveOkay = (currentIndex+1 < size) && (size == currentSize);
208 if (moveOkay) {
209 currentIndex++;
210 OdDbStub currentKey = keyCollection[currentIndex];
211 currentObject = new global::System.Collections.Generic.KeyValuePair<OdDbStub, double>(currentKey, collectionRef[currentKey]);
212 } else {
213 currentObject = null;
214 }
215 return moveOkay;
216 }
217
218 public void Reset() {
219 currentIndex = -1;
220 currentObject = null;
221 if (collectionRef.Count != currentSize) {
222 throw new global::System.InvalidOperationException("Collection modified.");
223 }
224 }
225
226 public void Dispose() {
227 currentIndex = -1;
228 currentObject = null;
229 }
230 }
231
232
233 public MapDeviations() : this(GlobalsPINVOKE.new_MapDeviations__SWIG_0(), true) {
235 }
236
237 public MapDeviations(MapDeviations other) : this(GlobalsPINVOKE.new_MapDeviations__SWIG_1(MapDeviations.getCPtr(other)), true) {
239 }
240
241 private uint size() {
242 uint ret = GlobalsPINVOKE.MapDeviations_size(swigCPtr);
244 return ret;
245 }
246
247 public bool empty() {
248 bool ret = GlobalsPINVOKE.MapDeviations_empty(swigCPtr);
250 return ret;
251 }
252
253 public void Clear() {
256 }
257
258 private double getitem(OdDbStub key) {
259 double ret = GlobalsPINVOKE.MapDeviations_getitem(swigCPtr, OdDbStub.getCPtr(key).Handle);
261 return ret;
262 }
263
264 private void setitem(OdDbStub key, double x) {
265 GlobalsPINVOKE.MapDeviations_setitem(swigCPtr, OdDbStub.getCPtr(key).Handle, x);
266 if (GlobalsPINVOKE.SWIGPendingException.Pending) throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
267 }
268
269 public bool ContainsKey(OdDbStub key) {
270 bool ret = GlobalsPINVOKE.MapDeviations_ContainsKey(swigCPtr, OdDbStub.getCPtr(key).Handle);
272 return ret;
273 }
274
275 public void Add(OdDbStub key, double value) {
276 GlobalsPINVOKE.MapDeviations_Add(swigCPtr, OdDbStub.getCPtr(key).Handle, value);
278 }
279
280 public bool Remove(OdDbStub key) {
281 bool ret = GlobalsPINVOKE.MapDeviations_Remove(swigCPtr, OdDbStub.getCPtr(key).Handle);
283 return ret;
284 }
285
286 private global::System.IntPtr create_iterator_begin() {
287 global::System.IntPtr ret = GlobalsPINVOKE.MapDeviations_create_iterator_begin(swigCPtr);
289 return ret;
290 }
291
292 private OdDbStub get_next_key(global::System.IntPtr swigiterator) {
293 global::System.IntPtr cPtr = GlobalsPINVOKE.MapDeviations_get_next_key(swigCPtr, swigiterator);
294 OdDbStub ret = (cPtr == global::System.IntPtr.Zero) ? null : new OdDbStub(cPtr, false);
295 if (GlobalsPINVOKE.SWIGPendingException.Pending) throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
296 return ret;
297 }
298
299 private void destroy_iterator(global::System.IntPtr swigiterator) {
300 GlobalsPINVOKE.MapDeviations_destroy_iterator(swigCPtr, swigiterator);
301 if (GlobalsPINVOKE.SWIGPendingException.Pending) throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
302 }
303
304}
305
306}
static global::System.Exception Retrieve()
static global::System.IntPtr MapDeviations_create_iterator_begin(global::System.Runtime.InteropServices.HandleRef jarg1)
static bool MapDeviations_empty(global::System.Runtime.InteropServices.HandleRef jarg1)
static void delete_MapDeviations(global::System.Runtime.InteropServices.HandleRef jarg1)
static void MapDeviations_Clear(global::System.Runtime.InteropServices.HandleRef jarg1)
static double MapDeviations_getitem(global::System.Runtime.InteropServices.HandleRef jarg1, IntPtr jarg2)
static bool MapDeviations_Remove(global::System.Runtime.InteropServices.HandleRef jarg1, IntPtr jarg2)
static uint MapDeviations_size(global::System.Runtime.InteropServices.HandleRef jarg1)
static bool MapDeviations_ContainsKey(global::System.Runtime.InteropServices.HandleRef jarg1, IntPtr jarg2)
static void MapDeviations_Add(global::System.Runtime.InteropServices.HandleRef jarg1, IntPtr jarg2, double jarg3)
global::System.Collections.Generic.KeyValuePair< OdDbStub, double > Current
MapDeviations(MapDeviations other)
bool Contains(global::System.Collections.Generic.KeyValuePair< OdDbStub, double > item)
MapDeviationsEnumerator GetEnumerator()
void Add(OdDbStub key, double value)
bool Remove(OdDbStub key)
static HandleRef getCPtr(MapDeviations obj)
virtual void Dispose(bool disposing)
global::System.Collections.Generic.ICollection< OdDbStub > Keys
bool Remove(global::System.Collections.Generic.KeyValuePair< OdDbStub, double > item)
void CopyTo(global::System.Collections.Generic.KeyValuePair< OdDbStub, double >[] array, int arrayIndex)
void Add(global::System.Collections.Generic.KeyValuePair< OdDbStub, double > item)
bool TryGetValue(OdDbStub key, out double value)
global::System.Collections.Generic.ICollection< double > Values
MapDeviations(IntPtr cPtr, bool cMemoryOwn)
void CopyTo(global::System.Collections.Generic.KeyValuePair< OdDbStub, double >[] array)
bool ContainsKey(OdDbStub key)
static HandleRef getCPtr(OdDbStub obj)
Definition: OdDbStub.cs:26