diff options
author | Sean Dague | 2008-09-03 18:04:37 +0000 |
---|---|---|
committer | Sean Dague | 2008-09-03 18:04:37 +0000 |
commit | 12beaccec79319186ae2a7bf3663510584117a63 (patch) | |
tree | 0dadf7a61269ae5215d1c007a2c8b7749e84e434 /OpenSim/Region/Environment/Modules/ContentManagementSystem/CMView.cs | |
parent | Update svn properties. (diff) | |
download | opensim-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/CMView.cs')
-rw-r--r-- | OpenSim/Region/Environment/Modules/ContentManagementSystem/CMView.cs | 156 |
1 files changed, 156 insertions, 0 deletions
diff --git a/OpenSim/Region/Environment/Modules/ContentManagementSystem/CMView.cs b/OpenSim/Region/Environment/Modules/ContentManagementSystem/CMView.cs new file mode 100644 index 0000000..f8b0ec9 --- /dev/null +++ b/OpenSim/Region/Environment/Modules/ContentManagementSystem/CMView.cs | |||
@@ -0,0 +1,156 @@ | |||
1 | // CMView.cs created with MonoDevelop | ||
2 | // User: bongiojp at 11:57 AMĀ 7/3/2008 | ||
3 | // | ||
4 | // To change standard headers go to Edit->Preferences->Coding->Standard Headers | ||
5 | // | ||
6 | |||
7 | using System; | ||
8 | using System.Collections.Generic; | ||
9 | using System.Collections; | ||
10 | using libsecondlife; | ||
11 | using OpenSim; | ||
12 | using OpenSim.Framework; | ||
13 | using OpenSim.Region.Environment.Interfaces; | ||
14 | using OpenSim.Region.Environment.Scenes; | ||
15 | using log4net; | ||
16 | using OpenSim.Region.Physics.Manager; | ||
17 | using Axiom.Math; | ||
18 | |||
19 | namespace OpenSim.Region.Environment.Modules.ContentManagement | ||
20 | { | ||
21 | |||
22 | public class CMView | ||
23 | { | ||
24 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | ||
25 | CMModel m_model = null; | ||
26 | |||
27 | public CMView() | ||
28 | {} | ||
29 | |||
30 | public void Initialise(CMModel model) | ||
31 | { | ||
32 | m_model = model; | ||
33 | } | ||
34 | |||
35 | public void SendMetaEntitiesToNewClient(IClientAPI client) | ||
36 | { | ||
37 | } | ||
38 | |||
39 | /// <summary> | ||
40 | /// update all clients of red/green/blue auras and meta entities that the model knows about. | ||
41 | /// </summary> | ||
42 | public void DisplayRecentChanges() | ||
43 | { | ||
44 | m_log.Debug("[CONTENT MANAGEMENT] Sending update to clients for " + m_model.MetaEntityCollection.Entities.Count + " objects."); | ||
45 | DisplayEntities(m_model.MetaEntityCollection); | ||
46 | DisplayAuras(m_model.MetaEntityCollection); | ||
47 | } | ||
48 | |||
49 | /// <summary> | ||
50 | /// Figures out if the part deleted was a new scene object part or a revisioned part that's been deleted. | ||
51 | /// If it's a new scene object, any green aura attached to it is deleted. | ||
52 | /// If a revisioned part is deleted, a new full update is sent to the environment of the meta entity, which will | ||
53 | /// figure out that there should be a red aura and not a blue aura/beam. | ||
54 | /// </summary> | ||
55 | public void RemoveOrUpdateDeletedEntity(SceneObjectGroup group) | ||
56 | { | ||
57 | // Deal with revisioned parts that have been deleted. | ||
58 | if (m_model.MetaEntityCollection.Entities.ContainsKey(group.UUID)) | ||
59 | ((ContentManagementEntity)m_model.MetaEntityCollection.Entities[group.UUID]).SendFullDiffUpdateToAll(); | ||
60 | |||
61 | // Deal with new parts not revisioned that have been deleted. | ||
62 | foreach(SceneObjectPart part in group.Children.Values) | ||
63 | if (m_model.MetaEntityCollection.Auras.ContainsKey(part.UUID)) | ||
64 | ((AuraMetaEntity)m_model.MetaEntityCollection.Auras[part.UUID]).HideFromAll(); | ||
65 | } | ||
66 | |||
67 | // Auras To | ||
68 | public void DisplayAuras(CMEntityCollection auraCollection) | ||
69 | { | ||
70 | foreach( Object ent in auraCollection.Auras.Values) | ||
71 | ((AuraMetaEntity)ent).SendFullUpdateToAll(); | ||
72 | } | ||
73 | |||
74 | // Entities to ALL | ||
75 | public void DisplayEntities(CMEntityCollection entityCollection) | ||
76 | { | ||
77 | foreach( Object ent in entityCollection.Entities.Values) | ||
78 | ((ContentManagementEntity)ent).SendFullDiffUpdateToAll(); | ||
79 | } | ||
80 | |||
81 | // Auras To Client | ||
82 | public void DisplayAuras(CMEntityCollection auraCollection, IClientAPI client) | ||
83 | { | ||
84 | foreach( Object ent in auraCollection.Auras.Values) | ||
85 | ((AuraMetaEntity)ent).SendFullUpdate(client); | ||
86 | } | ||
87 | |||
88 | // Entities to Client | ||
89 | public void DisplayEntities(CMEntityCollection entityCollection, IClientAPI client) | ||
90 | { | ||
91 | foreach( Object ent in entityCollection.Entities.Values) | ||
92 | ((ContentManagementEntity)ent).SendFullDiffUpdate(client); | ||
93 | } | ||
94 | |||
95 | // Entity to ALL | ||
96 | public void DisplayEntity(ContentManagementEntity ent) | ||
97 | { | ||
98 | ent.SendFullDiffUpdateToAll(); | ||
99 | } | ||
100 | |||
101 | public void DisplayMetaEntity(LLUUID uuid) | ||
102 | { | ||
103 | ContentManagementEntity group = m_model.GetMetaGroupByPrim(uuid); | ||
104 | if (group != null) | ||
105 | group.SendFullDiffUpdateToAll(); | ||
106 | } | ||
107 | |||
108 | // Auras from List To ALL | ||
109 | public void DisplayAuras(ArrayList list) | ||
110 | { | ||
111 | foreach( Object ent in list) | ||
112 | { | ||
113 | m_log.Debug("[CONTENT MANAGEMENT] displaying new aura riiiiiiiiiiiight NOW"); | ||
114 | ((AuraMetaEntity)ent).SendFullUpdateToAll(); | ||
115 | } | ||
116 | } | ||
117 | |||
118 | // Entities from List to ALL | ||
119 | public void DisplayEntities(ArrayList list) | ||
120 | { | ||
121 | foreach( Object ent in list) | ||
122 | ((ContentManagementEntity)ent).SendFullDiffUpdateToAll(); | ||
123 | } | ||
124 | |||
125 | public void DisplayHelpMenu(Scene scene) | ||
126 | { | ||
127 | string menu = "Menu:\n"; | ||
128 | menu += "commit (ci) - saves current state of the region to a database on the server\n"; | ||
129 | menu += "diff-mode (dm) - displays those aspects of region that have not been saved but changed since the very last revision. Will dynamically update as you change environment.\n"; | ||
130 | SendSimChatMessage(scene, menu); | ||
131 | } | ||
132 | |||
133 | public void SendSimChatMessage(Scene scene, string message) | ||
134 | { | ||
135 | scene.SimChat(Helpers.StringToField(message), | ||
136 | ChatTypeEnum.Broadcast, 0, new LLVector3(0,0,0), "Content Manager", LLUUID.Zero, false); | ||
137 | } | ||
138 | |||
139 | public void Hide(ContentManagementEntity ent) | ||
140 | { | ||
141 | ent.HideFromAll(); | ||
142 | } | ||
143 | |||
144 | public void HideAllMetaEntities() | ||
145 | { | ||
146 | foreach(Object obj in m_model.MetaEntityCollection.Entities.Values) | ||
147 | ((ContentManagementEntity)obj).HideFromAll(); | ||
148 | } | ||
149 | |||
150 | public void HideAllAuras() | ||
151 | { | ||
152 | foreach(Object obj in m_model.MetaEntityCollection.Auras.Values) | ||
153 | ((MetaEntity)obj).HideFromAll(); | ||
154 | } | ||
155 | } | ||
156 | } | ||