29 using System.Collections;
30 using System.Collections.Generic;
32 using OpenSim.Framework;
33 using OpenSim.Region.Framework.Scenes;
36 namespace OpenSim.
Region.OptionalModules.Scripting.Minimodule
39 internal class IObjEnum : System.MarshalByRefObject, IEnumerator<IObject>
41 private readonly
Scene m_scene;
42 private readonly IEnumerator<EntityBase> m_sogEnum;
43 private readonly ISecurityCredential m_security;
44 private readonly List<EntityBase> m_entities;
46 public IObjEnum(
Scene scene, ISecurityCredential security)
49 m_security = security;
50 m_entities =
new List<EntityBase>(m_scene.Entities.GetEntities());
51 m_sogEnum = m_entities.GetEnumerator();
59 public bool MoveNext()
61 return m_sogEnum.MoveNext();
69 public IObject Current
73 return new SOPObject(m_scene, m_sogEnum.Current.LocalId, m_security);
77 object IEnumerator.Current
79 get {
return Current; }
85 private readonly
Scene m_scene;
91 m_security = security;
98 return new SOPObject(m_scene, m_scene.Entities[(uint)index].LocalId, m_security);
102 public IObject this[uint index]
106 return new SOPObject(m_scene, m_scene.Entities[index].LocalId, m_security);
110 public IObject this[UUID index]
114 return new SOPObject(m_scene, m_scene.Entities[index].LocalId, m_security);
120 return Create(position, Quaternion.Identity);
130 PrimitiveBaseShape.CreateBox());
139 return new IObjEnum(m_scene, m_security);
142 IEnumerator IEnumerable.GetEnumerator()
144 return GetEnumerator();
149 throw new NotSupportedException(
"Collection is read-only. This is an API TODO FIX, creation of objects is presently impossible.");
154 throw new NotSupportedException(
"Collection is read-only. TODO FIX.");
159 return m_scene.Entities.ContainsKey(item.LocalID);
164 for (
int i = arrayIndex; i < Count + arrayIndex; i++)
166 array[i] =
this[i - arrayIndex];
172 throw new NotSupportedException(
"Collection is read-only. TODO FIX.");
177 get {
return m_scene.Entities.Count; }
180 public bool IsReadOnly
IObject Create(Vector3 position)
IObject Create(Vector3 position, Quaternion rotation)
A scene object group is conceptually an object in the scene. The object is constituted of SceneObject...
OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion rotation
bool Remove(IObject item)
ObjectAccessor(Scene scene, ISecurityCredential security)
System.Collections.IEnumerable IEnumerable
bool Contains(IObject item)
IEnumerator< IObject > GetEnumerator()
void CopyTo(IObject[] array, int arrayIndex)