aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs138
1 files changed, 69 insertions, 69 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
index 771fdd2..857f919 100644
--- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
@@ -69,11 +69,11 @@ namespace OpenSim.Region.CoreModules.World.Land
69 /// For now, a simple simwide taint to get this up. Later parcel based 69 /// For now, a simple simwide taint to get this up. Later parcel based
70 /// taint to allow recounting a parcel if only ownership has changed 70 /// taint to allow recounting a parcel if only ownership has changed
71 /// without recounting the whole sim. 71 /// without recounting the whole sim.
72 /// 72 ///
73 /// We start out tainted so that the first get call resets the various prim counts. 73 /// We start out tainted so that the first get call resets the various prim counts.
74 /// </value> 74 /// </value>
75 private bool m_Tainted = true; 75 private bool m_Tainted = true;
76 76
77 private Object m_TaintLock = new Object(); 77 private Object m_TaintLock = new Object();
78 78
79 public Type ReplaceableInterface 79 public Type ReplaceableInterface
@@ -88,10 +88,10 @@ namespace OpenSim.Region.CoreModules.World.Land
88 public void AddRegion(Scene scene) 88 public void AddRegion(Scene scene)
89 { 89 {
90 m_Scene = scene; 90 m_Scene = scene;
91 91
92 m_Scene.RegisterModuleInterface<IPrimCountModule>(this); 92 m_Scene.RegisterModuleInterface<IPrimCountModule>(this);
93 93
94 m_Scene.EventManager.OnObjectAddedToScene += OnParcelPrimCountAdd; 94 m_Scene.EventManager.OnObjectAddedToScene += OnParcelPrimCountAdd;
95 m_Scene.EventManager.OnObjectBeingRemovedFromScene += 95 m_Scene.EventManager.OnObjectBeingRemovedFromScene +=
96 OnObjectBeingRemovedFromScene; 96 OnObjectBeingRemovedFromScene;
97 m_Scene.EventManager.OnParcelPrimCountTainted += 97 m_Scene.EventManager.OnParcelPrimCountTainted +=
@@ -104,7 +104,7 @@ namespace OpenSim.Region.CoreModules.World.Land
104 } 104 }
105 105
106 public void RemoveRegion(Scene scene) 106 public void RemoveRegion(Scene scene)
107 { 107 {
108 } 108 }
109 109
110 public void Close() 110 public void Close()
@@ -126,7 +126,7 @@ namespace OpenSim.Region.CoreModules.World.Land
126 AddObject(obj); 126 AddObject(obj);
127// else 127// else
128// m_log.DebugFormat( 128// m_log.DebugFormat(
129// "[PRIM COUNT MODULE]: Ignoring OnParcelPrimCountAdd() for {0} on {1} since count is tainted", 129// "[PRIM COUNT MODULE]: Ignoring OnParcelPrimCountAdd() for {0} on {1} since count is tainted",
130// obj.Name, m_Scene.RegionInfo.RegionName); 130// obj.Name, m_Scene.RegionInfo.RegionName);
131 } 131 }
132 } 132 }
@@ -140,16 +140,16 @@ namespace OpenSim.Region.CoreModules.World.Land
140 RemoveObject(obj); 140 RemoveObject(obj);
141// else 141// else
142// m_log.DebugFormat( 142// m_log.DebugFormat(
143// "[PRIM COUNT MODULE]: Ignoring OnObjectBeingRemovedFromScene() for {0} on {1} since count is tainted", 143// "[PRIM COUNT MODULE]: Ignoring OnObjectBeingRemovedFromScene() for {0} on {1} since count is tainted",
144// obj.Name, m_Scene.RegionInfo.RegionName); 144// obj.Name, m_Scene.RegionInfo.RegionName);
145 } 145 }
146 } 146 }
147 147
148 private void OnParcelPrimCountTainted() 148 private void OnParcelPrimCountTainted()
149 { 149 {
150// m_log.DebugFormat( 150// m_log.DebugFormat(
151// "[PRIM COUNT MODULE]: OnParcelPrimCountTainted() called on {0}", m_Scene.RegionInfo.RegionName); 151// "[PRIM COUNT MODULE]: OnParcelPrimCountTainted() called on {0}", m_Scene.RegionInfo.RegionName);
152 152
153 lock (m_TaintLock) 153 lock (m_TaintLock)
154 m_Tainted = true; 154 m_Tainted = true;
155 } 155 }
@@ -174,33 +174,33 @@ namespace OpenSim.Region.CoreModules.World.Land
174 174
175 // NOTE: Call under Taint Lock 175 // NOTE: Call under Taint Lock
176 private void AddObject(SceneObjectGroup obj) 176 private void AddObject(SceneObjectGroup obj)
177 { 177 {
178 if (obj.IsAttachment) 178 if (obj.IsAttachment)
179 return; 179 return;
180 if (((obj.RootPart.Flags & PrimFlags.TemporaryOnRez) != 0)) 180 if (((obj.RootPart.Flags & PrimFlags.TemporaryOnRez) != 0))
181 return; 181 return;
182 182
183 Vector3 pos = obj.AbsolutePosition; 183 Vector3 pos = obj.AbsolutePosition;
184 ILandObject landObject = m_Scene.LandChannel.GetLandObject(pos.X, pos.Y); 184 ILandObject landObject = m_Scene.LandChannel.GetLandObject(pos.X, pos.Y);
185 185
186 // If for some reason there is no land object (perhaps the object is out of bounds) then we can't count it 186 // If for some reason there is no land object (perhaps the object is out of bounds) then we can't count it
187 if (landObject == null) 187 if (landObject == null)
188 { 188 {
189// m_log.WarnFormat( 189// m_log.WarnFormat(
190// "[PRIM COUNT MODULE]: Found no land object for {0} at position ({1}, {2}) on {3}", 190// "[PRIM COUNT MODULE]: Found no land object for {0} at position ({1}, {2}) on {3}",
191// obj.Name, pos.X, pos.Y, m_Scene.RegionInfo.RegionName); 191// obj.Name, pos.X, pos.Y, m_Scene.RegionInfo.RegionName);
192 192
193 return; 193 return;
194 } 194 }
195 195
196 LandData landData = landObject.LandData; 196 LandData landData = landObject.LandData;
197 197
198// m_log.DebugFormat( 198// m_log.DebugFormat(
199// "[PRIM COUNT MODULE]: Adding object {0} with {1} parts to prim count for parcel {2} on {3}", 199// "[PRIM COUNT MODULE]: Adding object {0} with {1} parts to prim count for parcel {2} on {3}",
200// obj.Name, obj.Parts.Length, landData.Name, m_Scene.RegionInfo.RegionName); 200// obj.Name, obj.Parts.Length, landData.Name, m_Scene.RegionInfo.RegionName);
201 201
202// m_log.DebugFormat( 202// m_log.DebugFormat(
203// "[PRIM COUNT MODULE]: Object {0} is owned by {1} over land owned by {2}", 203// "[PRIM COUNT MODULE]: Object {0} is owned by {1} over land owned by {2}",
204// obj.Name, obj.OwnerID, landData.OwnerID); 204// obj.Name, obj.OwnerID, landData.OwnerID);
205 205
206 ParcelCounts parcelCounts; 206 ParcelCounts parcelCounts;
@@ -217,7 +217,7 @@ namespace OpenSim.Region.CoreModules.World.Land
217 217
218 if (obj.IsSelected) 218 if (obj.IsSelected)
219 { 219 {
220 parcelCounts.Selected += partCount; 220 parcelCounts.Selected += partCount;
221 } 221 }
222 else 222 else
223 { 223 {
@@ -244,8 +244,8 @@ namespace OpenSim.Region.CoreModules.World.Land
244 // NOTE: Call under Taint Lock 244 // NOTE: Call under Taint Lock
245 private void RemoveObject(SceneObjectGroup obj) 245 private void RemoveObject(SceneObjectGroup obj)
246 { 246 {
247// m_log.DebugFormat("[PRIM COUNT MODULE]: Removing object {0} {1} from prim count", obj.Name, obj.UUID); 247// m_log.DebugFormat("[PRIM COUNT MODULE]: Removing object {0} {1} from prim count", obj.Name, obj.UUID);
248 248
249 // Currently this is being done by tainting the count instead. 249 // Currently this is being done by tainting the count instead.
250 } 250 }
251 251
@@ -253,7 +253,7 @@ namespace OpenSim.Region.CoreModules.World.Land
253 { 253 {
254// m_log.DebugFormat( 254// m_log.DebugFormat(
255// "[PRIM COUNT MODULE]: GetPrimCounts for parcel {0} in {1}", parcelID, m_Scene.RegionInfo.RegionName); 255// "[PRIM COUNT MODULE]: GetPrimCounts for parcel {0} in {1}", parcelID, m_Scene.RegionInfo.RegionName);
256 256
257 PrimCounts primCounts; 257 PrimCounts primCounts;
258 258
259 lock (m_PrimCounts) 259 lock (m_PrimCounts)
@@ -267,7 +267,7 @@ namespace OpenSim.Region.CoreModules.World.Land
267 return primCounts; 267 return primCounts;
268 } 268 }
269 269
270 270
271 /// <summary> 271 /// <summary>
272 /// Get the number of prims on the parcel that are owned by the parcel owner. 272 /// Get the number of prims on the parcel that are owned by the parcel owner.
273 /// </summary> 273 /// </summary>
@@ -276,7 +276,7 @@ namespace OpenSim.Region.CoreModules.World.Land
276 public int GetOwnerCount(UUID parcelID) 276 public int GetOwnerCount(UUID parcelID)
277 { 277 {
278 int count = 0; 278 int count = 0;
279 279
280 lock (m_TaintLock) 280 lock (m_TaintLock)
281 { 281 {
282 if (m_Tainted) 282 if (m_Tainted)
@@ -286,11 +286,11 @@ namespace OpenSim.Region.CoreModules.World.Land
286 if (m_ParcelCounts.TryGetValue(parcelID, out counts)) 286 if (m_ParcelCounts.TryGetValue(parcelID, out counts))
287 count = counts.Owner; 287 count = counts.Owner;
288 } 288 }
289 289
290// m_log.DebugFormat( 290// m_log.DebugFormat(
291// "[PRIM COUNT MODULE]: GetOwnerCount for parcel {0} in {1} returning {2}", 291// "[PRIM COUNT MODULE]: GetOwnerCount for parcel {0} in {1} returning {2}",
292// parcelID, m_Scene.RegionInfo.RegionName, count); 292// parcelID, m_Scene.RegionInfo.RegionName, count);
293 293
294 return count; 294 return count;
295 } 295 }
296 296
@@ -298,11 +298,11 @@ namespace OpenSim.Region.CoreModules.World.Land
298 /// Get the number of prims on the parcel that have been set to the group that owns the parcel. 298 /// Get the number of prims on the parcel that have been set to the group that owns the parcel.
299 /// </summary> 299 /// </summary>
300 /// <param name="parcelID"></param> 300 /// <param name="parcelID"></param>
301 /// <returns></returns> 301 /// <returns></returns>
302 public int GetGroupCount(UUID parcelID) 302 public int GetGroupCount(UUID parcelID)
303 { 303 {
304 int count = 0; 304 int count = 0;
305 305
306 lock (m_TaintLock) 306 lock (m_TaintLock)
307 { 307 {
308 if (m_Tainted) 308 if (m_Tainted)
@@ -312,11 +312,11 @@ namespace OpenSim.Region.CoreModules.World.Land
312 if (m_ParcelCounts.TryGetValue(parcelID, out counts)) 312 if (m_ParcelCounts.TryGetValue(parcelID, out counts))
313 count = counts.Group; 313 count = counts.Group;
314 } 314 }
315 315
316// m_log.DebugFormat( 316// m_log.DebugFormat(
317// "[PRIM COUNT MODULE]: GetGroupCount for parcel {0} in {1} returning {2}", 317// "[PRIM COUNT MODULE]: GetGroupCount for parcel {0} in {1} returning {2}",
318// parcelID, m_Scene.RegionInfo.RegionName, count); 318// parcelID, m_Scene.RegionInfo.RegionName, count);
319 319
320 return count; 320 return count;
321 } 321 }
322 322
@@ -324,11 +324,11 @@ namespace OpenSim.Region.CoreModules.World.Land
324 /// Get the number of prims on the parcel that are not owned by the parcel owner or set to the parcel group. 324 /// Get the number of prims on the parcel that are not owned by the parcel owner or set to the parcel group.
325 /// </summary> 325 /// </summary>
326 /// <param name="parcelID"></param> 326 /// <param name="parcelID"></param>
327 /// <returns></returns> 327 /// <returns></returns>
328 public int GetOthersCount(UUID parcelID) 328 public int GetOthersCount(UUID parcelID)
329 { 329 {
330 int count = 0; 330 int count = 0;
331 331
332 lock (m_TaintLock) 332 lock (m_TaintLock)
333 { 333 {
334 if (m_Tainted) 334 if (m_Tainted)
@@ -338,23 +338,23 @@ namespace OpenSim.Region.CoreModules.World.Land
338 if (m_ParcelCounts.TryGetValue(parcelID, out counts)) 338 if (m_ParcelCounts.TryGetValue(parcelID, out counts))
339 count = counts.Others; 339 count = counts.Others;
340 } 340 }
341 341
342// m_log.DebugFormat( 342// m_log.DebugFormat(
343// "[PRIM COUNT MODULE]: GetOthersCount for parcel {0} in {1} returning {2}", 343// "[PRIM COUNT MODULE]: GetOthersCount for parcel {0} in {1} returning {2}",
344// parcelID, m_Scene.RegionInfo.RegionName, count); 344// parcelID, m_Scene.RegionInfo.RegionName, count);
345 345
346 return count; 346 return count;
347 } 347 }
348 348
349 /// <summary> 349 /// <summary>
350 /// Get the number of selected prims. 350 /// Get the number of selected prims.
351 /// </summary> 351 /// </summary>
352 /// <param name="parcelID"></param> 352 /// <param name="parcelID"></param>
353 /// <returns></returns> 353 /// <returns></returns>
354 public int GetSelectedCount(UUID parcelID) 354 public int GetSelectedCount(UUID parcelID)
355 { 355 {
356 int count = 0; 356 int count = 0;
357 357
358 lock (m_TaintLock) 358 lock (m_TaintLock)
359 { 359 {
360 if (m_Tainted) 360 if (m_Tainted)
@@ -364,24 +364,24 @@ namespace OpenSim.Region.CoreModules.World.Land
364 if (m_ParcelCounts.TryGetValue(parcelID, out counts)) 364 if (m_ParcelCounts.TryGetValue(parcelID, out counts))
365 count = counts.Selected; 365 count = counts.Selected;
366 } 366 }
367 367
368// m_log.DebugFormat( 368// m_log.DebugFormat(
369// "[PRIM COUNT MODULE]: GetSelectedCount for parcel {0} in {1} returning {2}", 369// "[PRIM COUNT MODULE]: GetSelectedCount for parcel {0} in {1} returning {2}",
370// parcelID, m_Scene.RegionInfo.RegionName, count); 370// parcelID, m_Scene.RegionInfo.RegionName, count);
371 371
372 return count; 372 return count;
373 } 373 }
374 374
375 /// <summary> 375 /// <summary>
376 /// Get the total count of owner, group and others prims on the parcel. 376 /// Get the total count of owner, group and others prims on the parcel.
377 /// FIXME: Need to do selected prims once this is reimplemented. 377 /// FIXME: Need to do selected prims once this is reimplemented.
378 /// </summary> 378 /// </summary>
379 /// <param name="parcelID"></param> 379 /// <param name="parcelID"></param>
380 /// <returns></returns> 380 /// <returns></returns>
381 public int GetTotalCount(UUID parcelID) 381 public int GetTotalCount(UUID parcelID)
382 { 382 {
383 int count = 0; 383 int count = 0;
384 384
385 lock (m_TaintLock) 385 lock (m_TaintLock)
386 { 386 {
387 if (m_Tainted) 387 if (m_Tainted)
@@ -396,28 +396,28 @@ namespace OpenSim.Region.CoreModules.World.Land
396 count += counts.Selected; 396 count += counts.Selected;
397 } 397 }
398 } 398 }
399 399
400// m_log.DebugFormat( 400// m_log.DebugFormat(
401// "[PRIM COUNT MODULE]: GetTotalCount for parcel {0} in {1} returning {2}", 401// "[PRIM COUNT MODULE]: GetTotalCount for parcel {0} in {1} returning {2}",
402// parcelID, m_Scene.RegionInfo.RegionName, count); 402// parcelID, m_Scene.RegionInfo.RegionName, count);
403 403
404 return count; 404 return count;
405 } 405 }
406 406
407 /// <summary> 407 /// <summary>
408 /// Get the number of prims that are in the entire simulator for the owner of this parcel. 408 /// Get the number of prims that are in the entire simulator for the owner of this parcel.
409 /// </summary> 409 /// </summary>
410 /// <param name="parcelID"></param> 410 /// <param name="parcelID"></param>
411 /// <returns></returns> 411 /// <returns></returns>
412 public int GetSimulatorCount(UUID parcelID) 412 public int GetSimulatorCount(UUID parcelID)
413 { 413 {
414 int count = 0; 414 int count = 0;
415 415
416 lock (m_TaintLock) 416 lock (m_TaintLock)
417 { 417 {
418 if (m_Tainted) 418 if (m_Tainted)
419 Recount(); 419 Recount();
420 420
421 UUID owner; 421 UUID owner;
422 if (m_OwnerMap.TryGetValue(parcelID, out owner)) 422 if (m_OwnerMap.TryGetValue(parcelID, out owner))
423 { 423 {
@@ -426,11 +426,11 @@ namespace OpenSim.Region.CoreModules.World.Land
426 count = val; 426 count = val;
427 } 427 }
428 } 428 }
429 429
430// m_log.DebugFormat( 430// m_log.DebugFormat(
431// "[PRIM COUNT MODULE]: GetOthersCount for parcel {0} in {1} returning {2}", 431// "[PRIM COUNT MODULE]: GetOthersCount for parcel {0} in {1} returning {2}",
432// parcelID, m_Scene.RegionInfo.RegionName, count); 432// parcelID, m_Scene.RegionInfo.RegionName, count);
433 433
434 return count; 434 return count;
435 } 435 }
436 436
@@ -439,11 +439,11 @@ namespace OpenSim.Region.CoreModules.World.Land
439 /// </summary> 439 /// </summary>
440 /// <param name="parcelID"></param> 440 /// <param name="parcelID"></param>
441 /// <param name="userID"></param> 441 /// <param name="userID"></param>
442 /// <returns></returns> 442 /// <returns></returns>
443 public int GetUserCount(UUID parcelID, UUID userID) 443 public int GetUserCount(UUID parcelID, UUID userID)
444 { 444 {
445 int count = 0; 445 int count = 0;
446 446
447 lock (m_TaintLock) 447 lock (m_TaintLock)
448 { 448 {
449 if (m_Tainted) 449 if (m_Tainted)
@@ -459,9 +459,9 @@ namespace OpenSim.Region.CoreModules.World.Land
459 } 459 }
460 460
461// m_log.DebugFormat( 461// m_log.DebugFormat(
462// "[PRIM COUNT MODULE]: GetUserCount for user {0} in parcel {1} in region {2} returning {3}", 462// "[PRIM COUNT MODULE]: GetUserCount for user {0} in parcel {1} in region {2} returning {3}",
463// userID, parcelID, m_Scene.RegionInfo.RegionName, count); 463// userID, parcelID, m_Scene.RegionInfo.RegionName, count);
464 464
465 return count; 465 return count;
466 } 466 }
467 467
@@ -469,13 +469,13 @@ namespace OpenSim.Region.CoreModules.World.Land
469 private void Recount() 469 private void Recount()
470 { 470 {
471// m_log.DebugFormat("[PRIM COUNT MODULE]: Recounting prims on {0}", m_Scene.RegionInfo.RegionName); 471// m_log.DebugFormat("[PRIM COUNT MODULE]: Recounting prims on {0}", m_Scene.RegionInfo.RegionName);
472 472
473 m_OwnerMap.Clear(); 473 m_OwnerMap.Clear();
474 m_SimwideCounts.Clear(); 474 m_SimwideCounts.Clear();
475 m_ParcelCounts.Clear(); 475 m_ParcelCounts.Clear();
476 476
477 List<ILandObject> land = m_Scene.LandChannel.AllParcels(); 477 List<ILandObject> land = m_Scene.LandChannel.AllParcels();
478 478
479 foreach (ILandObject l in land) 479 foreach (ILandObject l in land)
480 { 480 {
481 LandData landData = l.LandData; 481 LandData landData = l.LandData;
@@ -483,7 +483,7 @@ namespace OpenSim.Region.CoreModules.World.Land
483 m_OwnerMap[landData.GlobalID] = landData.OwnerID; 483 m_OwnerMap[landData.GlobalID] = landData.OwnerID;
484 m_SimwideCounts[landData.OwnerID] = 0; 484 m_SimwideCounts[landData.OwnerID] = 0;
485// m_log.DebugFormat( 485// m_log.DebugFormat(
486// "[PRIM COUNT MODULE]: Initializing parcel count for {0} on {1}", 486// "[PRIM COUNT MODULE]: Initializing parcel count for {0} on {1}",
487// landData.Name, m_Scene.RegionInfo.RegionName); 487// landData.Name, m_Scene.RegionInfo.RegionName);
488 m_ParcelCounts[landData.GlobalID] = new ParcelCounts(); 488 m_ParcelCounts[landData.GlobalID] = new ParcelCounts();
489 } 489 }
@@ -499,7 +499,7 @@ namespace OpenSim.Region.CoreModules.World.Land
499 m_PrimCounts.Remove(k); 499 m_PrimCounts.Remove(k);
500 } 500 }
501 } 501 }
502 502
503 m_Tainted = false; 503 m_Tainted = false;
504 } 504 }
505 } 505 }
@@ -541,7 +541,7 @@ namespace OpenSim.Region.CoreModules.World.Land
541 return m_Parent.GetOthersCount(m_ParcelID); 541 return m_Parent.GetOthersCount(m_ParcelID);
542 } 542 }
543 } 543 }
544 544
545 public int Selected 545 public int Selected
546 { 546 {
547 get 547 get
@@ -549,7 +549,7 @@ namespace OpenSim.Region.CoreModules.World.Land
549 return m_Parent.GetSelectedCount(m_ParcelID); 549 return m_Parent.GetSelectedCount(m_ParcelID);
550 } 550 }
551 } 551 }
552 552
553 public int Total 553 public int Total
554 { 554 {
555 get 555 get