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.0.7.4.1
							parent
							
								
									824a3a114b
								
							
						
					
					
						commit
						5759313f7f
					
				|  | @ -391,36 +391,46 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
|                     xtw.WriteElementString("datetime", ((int)t.TotalSeconds).ToString()); | ||||
|                     xtw.WriteElementString("id", UUID.Random().ToString()); | ||||
|                     xtw.WriteEndElement(); | ||||
|          | ||||
|                     xtw.WriteElementString("assets_included", SaveAssets.ToString()); | ||||
|          | ||||
| 
 | ||||
|                     xtw.WriteStartElement("region_info"); | ||||
| 
 | ||||
|                     bool isMegaregion; | ||||
|                     Vector2 size; | ||||
|                     IRegionCombinerModule rcMod = null; | ||||
| 
 | ||||
|                     // FIXME: This is only here for regression test purposes since they do not supply a module.  Need to fix | ||||
|                     // this, possibly by doing control file creation somewhere else. | ||||
|                     if (m_module != null && m_module.RegionCombinerModule != null) | ||||
|                     { | ||||
|                         IRegionCombinerModule mod = m_module.RegionCombinerModule; | ||||
|                         isMegaregion = mod.IsRootForMegaregion(m_scene.RegionInfo.RegionID); | ||||
|                     } | ||||
|                     if (m_module != null) | ||||
|                         rcMod = m_module.RegionCombinerModule; | ||||
| 
 | ||||
|                     if (rcMod != null) | ||||
|                         isMegaregion = rcMod.IsRootForMegaregion(m_scene.RegionInfo.RegionID); | ||||
|                     else | ||||
|                     { | ||||
|                         isMegaregion = false; | ||||
|                     } | ||||
|          | ||||
| 
 | ||||
|                     if (isMegaregion) | ||||
|                         size = rcMod.GetSizeOfMegaregion(m_scene.RegionInfo.RegionID); | ||||
|                     else | ||||
|                         size = new Vector2((float)Constants.RegionSize, (float)Constants.RegionSize); | ||||
| 
 | ||||
|                     xtw.WriteElementString("is_megaregion", isMegaregion.ToString()); | ||||
|                     xtw.WriteElementString("size_in_meters", string.Format("{0},{1}", size.X, size.Y)); | ||||
| 
 | ||||
|                     xtw.WriteEndElement(); | ||||
|          | ||||
|                     xtw.WriteElementString("assets_included", SaveAssets.ToString()); | ||||
| 
 | ||||
|                     xtw.WriteEndElement(); | ||||
|          | ||||
|                     xtw.Flush(); | ||||
|                     xtw.Close(); | ||||
|                 } | ||||
| 
 | ||||
|                 s = sw.ToString(); | ||||
|             } | ||||
| 
 | ||||
| //            Console.WriteLine( | ||||
| //                "[ARCHIVE WRITE REQUEST PREPARATION]: Control file for {0} is: {1}", m_scene.RegionInfo.RegionName, s); | ||||
|             if (m_scene != null) | ||||
|                 Console.WriteLine( | ||||
|                     "[ARCHIVE WRITE REQUEST PREPARATION]: Control file for {0} is: {1}", m_scene.RegionInfo.RegionName, s); | ||||
| 
 | ||||
|             return s; | ||||
|         } | ||||
|  |  | |||
|  | @ -40,6 +40,20 @@ namespace OpenSim.Region.Framework.Interfaces | |||
|         /// <summary> | ||||
|         /// Does the given id belong to the root region of a megaregion? | ||||
|         /// </summary> | ||||
|         bool IsRootForMegaregion(UUID sceneId); | ||||
|         bool IsRootForMegaregion(UUID regionId); | ||||
| 
 | ||||
|         /// <summary> | ||||
|         /// Gets the size of megaregion. | ||||
|         /// </summary> | ||||
|         /// <remarks> | ||||
|         /// Returns size in meters. | ||||
|         /// Do not rely on this method remaining the same - this area is actively under development. | ||||
|         /// </remarks> | ||||
|         /// <param name="sceneId"> | ||||
|         /// The id of the root region for a megaregion. | ||||
|         /// This may change in the future to allow any region id that makes up a megaregion. | ||||
|         /// Currently, will throw an exception if this does not match a root region. | ||||
|         /// </param> | ||||
|         Vector2 GetSizeOfMegaregion(UUID regionId); | ||||
|     } | ||||
| } | ||||
|  | @ -113,10 +113,25 @@ namespace OpenSim.Region.RegionCombinerModule | |||
|             } | ||||
|         } | ||||
| 
 | ||||
|         public bool IsRootForMegaregion(UUID sceneId) | ||||
|         public bool IsRootForMegaregion(UUID regionId) | ||||
|         { | ||||
|             lock (m_regions) | ||||
|                 return m_regions.ContainsKey(sceneId); | ||||
|                 return m_regions.ContainsKey(regionId); | ||||
|         } | ||||
| 
 | ||||
|         public Vector2 GetSizeOfMegaregion(UUID regionId) | ||||
|         { | ||||
|             lock (m_regions) | ||||
|             { | ||||
|                 if (m_regions.ContainsKey(regionId)) | ||||
|                 { | ||||
|                     RegionConnections rootConn = m_regions[regionId]; | ||||
| 
 | ||||
|                     return new Vector2((float)rootConn.XEnd, (float)rootConn.YEnd); | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             throw new Exception(string.Format("Region with id {0} not found", regionId)); | ||||
|         } | ||||
| 
 | ||||
|         private void NewPresence(ScenePresence presence) | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 Justin Clark-Casey (justincc)
						Justin Clark-Casey (justincc)