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