aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-05-19 04:56:47 +0100
committerJustin Clark-Casey (justincc)2012-05-19 04:56:47 +0100
commit5759313f7f3ff121d20e5eb44013e2bbb4bc2eee (patch)
treebf0cf144375c811944fbc805c6d19ac00946df9b /OpenSim
parentrefactor: Add RegionConnection.PosX and PosY to return position in meters rat... (diff)
downloadopensim-SC_OLD-5759313f7f3ff121d20e5eb44013e2bbb4bc2eee.zip
opensim-SC_OLD-5759313f7f3ff121d20e5eb44013e2bbb4bc2eee.tar.gz
opensim-SC_OLD-5759313f7f3ff121d20e5eb44013e2bbb4bc2eee.tar.bz2
opensim-SC_OLD-5759313f7f3ff121d20e5eb44013e2bbb4bc2eee.tar.xz
Add size of region to OAR control file. Megaregions (sw root OARs when saved) will have a size larger than 256x256
Not yet read. Do not rely on this information yet, it may change.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs38
-rw-r--r--OpenSim/Region/Framework/Interfaces/IRegionCombinerModule.cs16
-rw-r--r--OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs19
3 files changed, 56 insertions, 17 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
index e54774b..504f09b 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
@@ -391,36 +391,46 @@ namespace OpenSim.Region.CoreModules.World.Archiver
391 xtw.WriteElementString("datetime", ((int)t.TotalSeconds).ToString()); 391 xtw.WriteElementString("datetime", ((int)t.TotalSeconds).ToString());
392 xtw.WriteElementString("id", UUID.Random().ToString()); 392 xtw.WriteElementString("id", UUID.Random().ToString());
393 xtw.WriteEndElement(); 393 xtw.WriteEndElement();
394 394
395 xtw.WriteElementString("assets_included", SaveAssets.ToString()); 395 xtw.WriteStartElement("region_info");
396 396
397 bool isMegaregion; 397 bool isMegaregion;
398 Vector2 size;
399 IRegionCombinerModule rcMod = null;
398 400
399 // FIXME: This is only here for regression test purposes since they do not supply a module. Need to fix 401 // FIXME: This is only here for regression test purposes since they do not supply a module. Need to fix
400 // this, possibly by doing control file creation somewhere else. 402 // this, possibly by doing control file creation somewhere else.
401 if (m_module != null && m_module.RegionCombinerModule != null) 403 if (m_module != null)
402 { 404 rcMod = m_module.RegionCombinerModule;
403 IRegionCombinerModule mod = m_module.RegionCombinerModule; 405
404 isMegaregion = mod.IsRootForMegaregion(m_scene.RegionInfo.RegionID); 406 if (rcMod != null)
405 } 407 isMegaregion = rcMod.IsRootForMegaregion(m_scene.RegionInfo.RegionID);
406 else 408 else
407 {
408 isMegaregion = false; 409 isMegaregion = false;
409 } 410
410 411 if (isMegaregion)
412 size = rcMod.GetSizeOfMegaregion(m_scene.RegionInfo.RegionID);
413 else
414 size = new Vector2((float)Constants.RegionSize, (float)Constants.RegionSize);
415
411 xtw.WriteElementString("is_megaregion", isMegaregion.ToString()); 416 xtw.WriteElementString("is_megaregion", isMegaregion.ToString());
417 xtw.WriteElementString("size_in_meters", string.Format("{0},{1}", size.X, size.Y));
418
419 xtw.WriteEndElement();
412 420
421 xtw.WriteElementString("assets_included", SaveAssets.ToString());
422
413 xtw.WriteEndElement(); 423 xtw.WriteEndElement();
414 424
415 xtw.Flush(); 425 xtw.Flush();
416 xtw.Close();
417 } 426 }
418 427
419 s = sw.ToString(); 428 s = sw.ToString();
420 } 429 }
421 430
422// Console.WriteLine( 431 if (m_scene != null)
423// "[ARCHIVE WRITE REQUEST PREPARATION]: Control file for {0} is: {1}", m_scene.RegionInfo.RegionName, s); 432 Console.WriteLine(
433 "[ARCHIVE WRITE REQUEST PREPARATION]: Control file for {0} is: {1}", m_scene.RegionInfo.RegionName, s);
424 434
425 return s; 435 return s;
426 } 436 }
diff --git a/OpenSim/Region/Framework/Interfaces/IRegionCombinerModule.cs b/OpenSim/Region/Framework/Interfaces/IRegionCombinerModule.cs
index ca4ed5c..e03ac5a 100644
--- a/OpenSim/Region/Framework/Interfaces/IRegionCombinerModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IRegionCombinerModule.cs
@@ -40,6 +40,20 @@ namespace OpenSim.Region.Framework.Interfaces
40 /// <summary> 40 /// <summary>
41 /// Does the given id belong to the root region of a megaregion? 41 /// Does the given id belong to the root region of a megaregion?
42 /// </summary> 42 /// </summary>
43 bool IsRootForMegaregion(UUID sceneId); 43 bool IsRootForMegaregion(UUID regionId);
44
45 /// <summary>
46 /// Gets the size of megaregion.
47 /// </summary>
48 /// <remarks>
49 /// Returns size in meters.
50 /// Do not rely on this method remaining the same - this area is actively under development.
51 /// </remarks>
52 /// <param name="sceneId">
53 /// The id of the root region for a megaregion.
54 /// This may change in the future to allow any region id that makes up a megaregion.
55 /// Currently, will throw an exception if this does not match a root region.
56 /// </param>
57 Vector2 GetSizeOfMegaregion(UUID regionId);
44 } 58 }
45} \ No newline at end of file 59} \ No newline at end of file
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
index 81ed339..98becce 100644
--- a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
+++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
@@ -113,10 +113,25 @@ namespace OpenSim.Region.RegionCombinerModule
113 } 113 }
114 } 114 }
115 115
116 public bool IsRootForMegaregion(UUID sceneId) 116 public bool IsRootForMegaregion(UUID regionId)
117 { 117 {
118 lock (m_regions) 118 lock (m_regions)
119 return m_regions.ContainsKey(sceneId); 119 return m_regions.ContainsKey(regionId);
120 }
121
122 public Vector2 GetSizeOfMegaregion(UUID regionId)
123 {
124 lock (m_regions)
125 {
126 if (m_regions.ContainsKey(regionId))
127 {
128 RegionConnections rootConn = m_regions[regionId];
129
130 return new Vector2((float)rootConn.XEnd, (float)rootConn.YEnd);
131 }
132 }
133
134 throw new Exception(string.Format("Region with id {0} not found", regionId));
120 } 135 }
121 136
122 private void NewPresence(ScenePresence presence) 137 private void NewPresence(ScenePresence presence)