aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/ContentManagementSystem/CMEntityCollection.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Modules/ContentManagementSystem/CMEntityCollection.cs')
-rw-r--r--OpenSim/Region/Environment/Modules/ContentManagementSystem/CMEntityCollection.cs277
1 files changed, 149 insertions, 128 deletions
diff --git a/OpenSim/Region/Environment/Modules/ContentManagementSystem/CMEntityCollection.cs b/OpenSim/Region/Environment/Modules/ContentManagementSystem/CMEntityCollection.cs
index 9f50e23..2383a6d 100644
--- a/OpenSim/Region/Environment/Modules/ContentManagementSystem/CMEntityCollection.cs
+++ b/OpenSim/Region/Environment/Modules/ContentManagementSystem/CMEntityCollection.cs
@@ -1,148 +1,169 @@
1#region Header
2
1// CMEntityCollection.cs created with MonoDevelop 3// CMEntityCollection.cs created with MonoDevelop
2// User: bongiojp at 10:09 AM 7/7/2008 4// User: bongiojp at 10:09 AM 7/7/2008
3// 5//
4// Creates, Deletes, Stores ContentManagementEntities 6// Creates, Deletes, Stores ContentManagementEntities
5// 7//
6 8
9#endregion Header
7 10
8using System; 11using System;
9using System.Collections.Generic;
10using System.Collections; 12using System.Collections;
13using System.Collections.Generic;
14using System.Threading;
15
11using libsecondlife; 16using libsecondlife;
17
12using Nini.Config; 18using Nini.Config;
19
13using OpenSim; 20using OpenSim;
14using OpenSim.Framework; 21using OpenSim.Framework;
15using OpenSim.Region.Environment.Interfaces; 22using OpenSim.Region.Environment.Interfaces;
16using OpenSim.Region.Environment.Scenes; 23using OpenSim.Region.Environment.Scenes;
17using log4net;
18using OpenSim.Region.Physics.Manager; 24using OpenSim.Region.Physics.Manager;
25
26using log4net;
27
19using Axiom.Math; 28using Axiom.Math;
20using System.Threading;
21 29
22namespace OpenSim.Region.Environment.Modules.ContentManagement 30namespace OpenSim.Region.Environment.Modules.ContentManagement
23{ 31{
24 32 public class CMEntityCollection
25 public class CMEntityCollection 33 {
26 { 34 #region Fields
27 // private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 35
28 36 // private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
29 // Any ContentManagementEntities that represent old versions of current SceneObjectGroups or 37 // Any ContentManagementEntities that represent old versions of current SceneObjectGroups or
30 // old versions of deleted SceneObjectGroups will be stored in this hash table. 38 // old versions of deleted SceneObjectGroups will be stored in this hash table.
31 // The LLUUID keys are from the SceneObjectGroup RootPart UUIDs 39 // The LLUUID keys are from the SceneObjectGroup RootPart UUIDs
32 protected Hashtable m_CMEntityHash = Hashtable.Synchronized(new Hashtable()); //LLUUID to ContentManagementEntity 40 protected Hashtable m_CMEntityHash = Hashtable.Synchronized(new Hashtable()); //LLUUID to ContentManagementEntity
33 41
34 // SceneObjectParts that have not been revisioned will be given green auras stored in this hashtable 42 // SceneObjectParts that have not been revisioned will be given green auras stored in this hashtable
35 // The LLUUID keys are from the SceneObjectPart that they are supposed to be on. 43 // The LLUUID keys are from the SceneObjectPart that they are supposed to be on.
36 protected Hashtable m_NewlyCreatedEntityAura = Hashtable.Synchronized(new Hashtable()); //LLUUID to AuraMetaEntity 44 protected Hashtable m_NewlyCreatedEntityAura = Hashtable.Synchronized(new Hashtable()); //LLUUID to AuraMetaEntity
37 45
38 public Hashtable Entities 46 #endregion Fields
39 { 47
40 get { return m_CMEntityHash; } 48 #region Constructors
41 } 49
42 50 public CMEntityCollection()
43 public Hashtable Auras 51 {
44 { 52 }
45 get {return m_NewlyCreatedEntityAura; } 53
46 } 54 #endregion Constructors
47 55
48 public CMEntityCollection() 56 #region Public Properties
49 {} 57
50 58 public Hashtable Auras
51 public bool AddAura(ContentManagementEntity aura) 59 {
52 { 60 get {return m_NewlyCreatedEntityAura; }
53 if (m_NewlyCreatedEntityAura.ContainsKey(aura.UUID)) 61 }
54 return false; 62
55 m_NewlyCreatedEntityAura.Add(aura.UUID, aura); 63 public Hashtable Entities
56 return true; 64 {
57 } 65 get { return m_CMEntityHash; }
58 66 }
59 public bool AddEntity(ContentManagementEntity ent) 67
60 { 68 #endregion Public Properties
61 if (m_CMEntityHash.ContainsKey(ent.UUID)) 69
62 return false; 70 #region Public Methods
63 m_CMEntityHash.Add(ent.UUID, ent); 71
64 return true; 72 public bool AddAura(ContentManagementEntity aura)
65 } 73 {
66 74 if (m_NewlyCreatedEntityAura.ContainsKey(aura.UUID))
67 public bool RemoveNewlyCreatedEntityAura(LLUUID uuid) 75 return false;
68 { 76 m_NewlyCreatedEntityAura.Add(aura.UUID, aura);
69 if (!m_NewlyCreatedEntityAura.ContainsKey(uuid)) 77 return true;
70 return false; 78 }
71 m_NewlyCreatedEntityAura.Remove(uuid); 79
72 return true; 80 public bool AddEntity(ContentManagementEntity ent)
73 } 81 {
74 82 if (m_CMEntityHash.ContainsKey(ent.UUID))
75 public bool RemoveEntity(LLUUID uuid) 83 return false;
76 { 84 m_CMEntityHash.Add(ent.UUID, ent);
77 if (!m_CMEntityHash.ContainsKey(uuid)) 85 return true;
78 return false; 86 }
79 m_CMEntityHash.Remove(uuid); 87
80 return true; 88 // Check if there are SceneObjectGroups in the list that do not have corresponding ContentManagementGroups in the CMEntityHash
81 } 89 public System.Collections.ArrayList CheckForMissingEntities(System.Collections.Generic.List<EntityBase> currList)
82 90 {
83 public void ClearAll() 91 System.Collections.ArrayList missingList = new System.Collections.ArrayList();
84 { 92 SceneObjectGroup temp = null;
85 m_CMEntityHash.Clear(); 93 foreach( EntityBase currObj in currList )
86 m_NewlyCreatedEntityAura.Clear(); 94 {
87 } 95 if (! (currObj is SceneObjectGroup))
88 96 continue;
89 97 temp = (SceneObjectGroup) currObj;
90 98
91 // Old uuid and new sceneobjectgroup 99 if (m_CMEntityHash.ContainsKey(temp.UUID))
92 public AuraMetaEntity CreateAuraForNewlyCreatedEntity(SceneObjectPart part) 100 {
93 { 101 foreach(SceneObjectPart part in temp.Children.Values)
94 AuraMetaEntity ent = new AuraMetaEntity(part.ParentGroup.Scene, 102 if (!((ContentManagementEntity)m_CMEntityHash[temp.UUID]).HasChildPrim(part.UUID))
95 part.ParentGroup.Scene.PrimIDAllocate(), 103 missingList.Add(part);
96 part.GetWorldPosition(), 104 }
97 MetaEntity.TRANSLUCENT, 105 else //Entire group is missing from revision. (and is a new part in region)
98 new LLVector3(0,254,0), 106 {
99 part.Scale 107 foreach(SceneObjectPart part in temp.Children.Values)
100 ); 108 missingList.Add(part);
101 m_NewlyCreatedEntityAura.Add(part.UUID, ent); 109 }
102 return ent; 110 }
103 } 111 return missingList;
104 112 }
105 // Old uuid and new sceneobjectgroup 113
106 public ContentManagementEntity CreateNewEntity(SceneObjectGroup group) 114 public void ClearAll()
107 { 115 {
108 ContentManagementEntity ent = new ContentManagementEntity(group, false); 116 m_CMEntityHash.Clear();
109 m_CMEntityHash.Add(group.UUID, ent); 117 m_NewlyCreatedEntityAura.Clear();
110 return ent; 118 }
111 } 119
112 120 // Old uuid and new sceneobjectgroup
113 public ContentManagementEntity CreateNewEntity(String xml, Scene scene) 121 public AuraMetaEntity CreateAuraForNewlyCreatedEntity(SceneObjectPart part)
114 { 122 {
115 ContentManagementEntity ent = new ContentManagementEntity(xml, scene, false); 123 AuraMetaEntity ent = new AuraMetaEntity(part.ParentGroup.Scene,
116 if (ent == null) 124 part.ParentGroup.Scene.PrimIDAllocate(),
117 return null; 125 part.GetWorldPosition(),
118 m_CMEntityHash.Add(ent.UnchangedEntity.UUID, ent); 126 MetaEntity.TRANSLUCENT,
119 return ent; 127 new LLVector3(0,254,0),
120 } 128 part.Scale
121 129 );
122 // Check if there are SceneObjectGroups in the list that do not have corresponding ContentManagementGroups in the CMEntityHash 130 m_NewlyCreatedEntityAura.Add(part.UUID, ent);
123 public System.Collections.ArrayList CheckForMissingEntities(System.Collections.Generic.List<EntityBase> currList) 131 return ent;
124 { 132 }
125 System.Collections.ArrayList missingList = new System.Collections.ArrayList(); 133
126 SceneObjectGroup temp = null; 134 // Old uuid and new sceneobjectgroup
127 foreach( EntityBase currObj in currList ) 135 public ContentManagementEntity CreateNewEntity(SceneObjectGroup group)
128 { 136 {
129 if (! (currObj is SceneObjectGroup)) 137 ContentManagementEntity ent = new ContentManagementEntity(group, false);
130 continue; 138 m_CMEntityHash.Add(group.UUID, ent);
131 temp = (SceneObjectGroup) currObj; 139 return ent;
132 140 }
133 if (m_CMEntityHash.ContainsKey(temp.UUID)) 141
134 { 142 public ContentManagementEntity CreateNewEntity(String xml, Scene scene)
135 foreach(SceneObjectPart part in temp.Children.Values) 143 {
136 if (!((ContentManagementEntity)m_CMEntityHash[temp.UUID]).HasChildPrim(part.UUID)) 144 ContentManagementEntity ent = new ContentManagementEntity(xml, scene, false);
137 missingList.Add(part); 145 if (ent == null)
138 } 146 return null;
139 else //Entire group is missing from revision. (and is a new part in region) 147 m_CMEntityHash.Add(ent.UnchangedEntity.UUID, ent);
140 { 148 return ent;
141 foreach(SceneObjectPart part in temp.Children.Values) 149 }
142 missingList.Add(part); 150
143 } 151 public bool RemoveEntity(LLUUID uuid)
144 } 152 {
145 return missingList; 153 if (!m_CMEntityHash.ContainsKey(uuid))
146 } 154 return false;
147 } 155 m_CMEntityHash.Remove(uuid);
148} 156 return true;
157 }
158
159 public bool RemoveNewlyCreatedEntityAura(LLUUID uuid)
160 {
161 if (!m_NewlyCreatedEntityAura.ContainsKey(uuid))
162 return false;
163 m_NewlyCreatedEntityAura.Remove(uuid);
164 return true;
165 }
166
167 #endregion Public Methods
168 }
169} \ No newline at end of file