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