29 using System.Collections.Generic;
32 using OpenSim.Region.Framework.Scenes;
52 public SortedDictionary<uint, SortedDictionary<uint, Scene>> Regions {
get; set; }
62 public Rectangle Rect {
get; set; }
67 Regions =
new SortedDictionary<uint, SortedDictionary<uint, Scene>>();
68 m_regionDirs =
new Dictionary<UUID, string>();
69 Rect =
new Rectangle(0, 0, 0, 0);
74 uint x = scene.RegionInfo.RegionLocX;
75 uint y = scene.RegionInfo.RegionLocY;
77 SortedDictionary<uint, Scene> row;
78 if (!Regions.TryGetValue(y, out row))
80 row =
new SortedDictionary<uint, Scene>();
93 if (Regions.Count == 0)
98 uint firstY = Regions.First().Key;
99 uint lastY = Regions.Last().Key;
104 foreach (SortedDictionary<uint, Scene> row
in Regions.Values)
106 uint curFirstX = row.First().Key;
107 uint curLastX = row.Last().Key;
109 firstX = (firstX == null) ? curFirstX : (firstX < curFirstX) ? firstX : curFirstX;
110 lastX = (lastX == null) ? curLastX : (lastX > curLastX) ? lastX : curLastX;
113 Rect =
new Rectangle((
int)firstX, (
int)firstY, (
int)(lastX - firstX + 1), (
int)(lastY - firstY + 1));
118 m_regionDirs.Clear();
119 ForEachScene(delegate(
Scene scene)
122 string path = string.Format(
"{0}_{1}_{2}",
123 scene.RegionInfo.RegionLocX - Rect.X + 1,
124 scene.RegionInfo.RegionLocY - Rect.Y + 1,
125 scene.RegionInfo.RegionName.Replace(
' ',
'_'));
126 m_regionDirs[scene.RegionInfo.RegionID] = path;
137 return m_regionDirs[regionID];
147 foreach (SortedDictionary<uint, Scene> row
in Regions.Values)
149 foreach (
Scene scene
in row.Values)
164 SortedDictionary<uint, Scene> row;
165 if (Regions.TryGetValue((uint)location.Y, out row))
167 if (row.TryGetValue((uint)location.X, out scene))
void CalcSceneLocations()
Called after all the scenes have been added. Performs calculations that require knowledge of all the ...
void AddScene(Scene scene)
A group of regions arranged in a rectangle, possibly with holes.
string GetRegionDir(UUID regionID)
Returns the subdirectory where the region is stored.
bool TryGetScene(Point location, out Scene scene)
Returns the scene at position 'location'.
Dictionary< UUID, string > m_regionDirs
The subdirectory where each region is stored in the archive.
void ForEachScene(Action< Scene > action)
Performs an action on all the scenes in this order: rows from South to North, and within each row Wes...