aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services
diff options
context:
space:
mode:
authorRobert Adams2013-12-28 06:58:15 -0800
committerRobert Adams2013-12-28 06:58:15 -0800
commit6869633d76b2a6664743a608e4284b8dd7df85a6 (patch)
treee976908cac58662ac37b0dfee8c748f314a259c7 /OpenSim/Services
parentMerge branch 'justincc-master' (diff)
downloadopensim-SC_OLD-6869633d76b2a6664743a608e4284b8dd7df85a6.zip
opensim-SC_OLD-6869633d76b2a6664743a608e4284b8dd7df85a6.tar.gz
opensim-SC_OLD-6869633d76b2a6664743a608e4284b8dd7df85a6.tar.bz2
opensim-SC_OLD-6869633d76b2a6664743a608e4284b8dd7df85a6.tar.xz
Add serialization/deserialization of region size to RegionInfo, GridRegion, and RegionData.
This does not modify interfaces or handling of variable sized regions. This only enables the loading and storing of the region size and the reporting of the region size in grid service responses. The database tables already have the code to load and store the region size.
Diffstat (limited to 'OpenSim/Services')
-rw-r--r--OpenSim/Services/GridService/GridService.cs14
-rw-r--r--OpenSim/Services/Interfaces/IGridService.cs25
2 files changed, 37 insertions, 2 deletions
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs
index e72b7f9..137ce04 100644
--- a/OpenSim/Services/GridService/GridService.cs
+++ b/OpenSim/Services/GridService/GridService.cs
@@ -313,8 +313,9 @@ namespace OpenSim.Services.GridService
313 if (region != null) 313 if (region != null)
314 { 314 {
315 // Not really? Maybe? 315 // Not really? Maybe?
316 List<RegionData> rdatas = m_Database.Get(region.posX - (int)Constants.RegionSize - 1, region.posY - (int)Constants.RegionSize - 1, 316 List<RegionData> rdatas = m_Database.Get(
317 region.posX + (int)Constants.RegionSize + 1, region.posY + (int)Constants.RegionSize + 1, scopeID); 317 region.posX - region.sizeX - 1, region.posY - region.sizeY - 1,
318 region.posX + region.sizeX + 1, region.posY + region.sizeY + 1, scopeID);
318 319
319 foreach (RegionData rdata in rdatas) 320 foreach (RegionData rdata in rdatas)
320 { 321 {
@@ -347,6 +348,11 @@ namespace OpenSim.Services.GridService
347 return null; 348 return null;
348 } 349 }
349 350
351 // Get a region given its base coordinates.
352 // NOTE: this is NOT 'get a region by some point in the region'. The coordinate MUST
353 // be the base coordinate of the region.
354 // The snapping is technically unnecessary but is harmless because regions are always
355 // multiples of the legacy region size (256).
350 public GridRegion GetRegionByPosition(UUID scopeID, int x, int y) 356 public GridRegion GetRegionByPosition(UUID scopeID, int x, int y)
351 { 357 {
352 int snapX = (int)(x / Constants.RegionSize) * (int)Constants.RegionSize; 358 int snapX = (int)(x / Constants.RegionSize) * (int)Constants.RegionSize;
@@ -441,6 +447,8 @@ namespace OpenSim.Services.GridService
441 RegionData rdata = new RegionData(); 447 RegionData rdata = new RegionData();
442 rdata.posX = (int)rinfo.RegionLocX; 448 rdata.posX = (int)rinfo.RegionLocX;
443 rdata.posY = (int)rinfo.RegionLocY; 449 rdata.posY = (int)rinfo.RegionLocY;
450 rdata.sizeX = rinfo.RegionSizeX;
451 rdata.sizeY = rinfo.RegionSizeY;
444 rdata.RegionID = rinfo.RegionID; 452 rdata.RegionID = rinfo.RegionID;
445 rdata.RegionName = rinfo.RegionName; 453 rdata.RegionName = rinfo.RegionName;
446 rdata.Data = rinfo.ToKeyValuePairs(); 454 rdata.Data = rinfo.ToKeyValuePairs();
@@ -454,6 +462,8 @@ namespace OpenSim.Services.GridService
454 GridRegion rinfo = new GridRegion(rdata.Data); 462 GridRegion rinfo = new GridRegion(rdata.Data);
455 rinfo.RegionLocX = rdata.posX; 463 rinfo.RegionLocX = rdata.posX;
456 rinfo.RegionLocY = rdata.posY; 464 rinfo.RegionLocY = rdata.posY;
465 rinfo.RegionSizeX = rdata.sizeX;
466 rinfo.RegionSizeY = rdata.sizeY;
457 rinfo.RegionID = rdata.RegionID; 467 rinfo.RegionID = rdata.RegionID;
458 rinfo.RegionName = rdata.RegionName; 468 rinfo.RegionName = rdata.RegionName;
459 rinfo.ScopeID = rdata.ScopeID; 469 rinfo.ScopeID = rdata.ScopeID;
diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs
index 88ac5b3..651bd97 100644
--- a/OpenSim/Services/Interfaces/IGridService.cs
+++ b/OpenSim/Services/Interfaces/IGridService.cs
@@ -177,6 +177,7 @@ namespace OpenSim.Services.Interfaces
177 177
178 /// <summary> 178 /// <summary>
179 /// The location of this region in meters. 179 /// The location of this region in meters.
180 /// DANGER DANGER! Note that this name means something different in RegionInfo.
180 /// </summary> 181 /// </summary>
181 public int RegionLocX 182 public int RegionLocX
182 { 183 {
@@ -185,8 +186,12 @@ namespace OpenSim.Services.Interfaces
185 } 186 }
186 protected int m_regionLocX; 187 protected int m_regionLocX;
187 188
189 public int RegionSizeX { get; set; }
190 public int RegionSizeY { get; set; }
191
188 /// <summary> 192 /// <summary>
189 /// The location of this region in meters. 193 /// The location of this region in meters.
194 /// DANGER DANGER! Note that this name means something different in RegionInfo.
190 /// </summary> 195 /// </summary>
191 public int RegionLocY 196 public int RegionLocY
192 { 197 {
@@ -218,10 +223,13 @@ namespace OpenSim.Services.Interfaces
218 m_serverURI = string.Empty; 223 m_serverURI = string.Empty;
219 } 224 }
220 225
226 /*
221 public GridRegion(int regionLocX, int regionLocY, IPEndPoint internalEndPoint, string externalUri) 227 public GridRegion(int regionLocX, int regionLocY, IPEndPoint internalEndPoint, string externalUri)
222 { 228 {
223 m_regionLocX = regionLocX; 229 m_regionLocX = regionLocX;
224 m_regionLocY = regionLocY; 230 m_regionLocY = regionLocY;
231 RegionSizeX = (int)Constants.RegionSize;
232 RegionSizeY = (int)Constants.RegionSize;
225 233
226 m_internalEndPoint = internalEndPoint; 234 m_internalEndPoint = internalEndPoint;
227 m_externalHostName = externalUri; 235 m_externalHostName = externalUri;
@@ -231,16 +239,21 @@ namespace OpenSim.Services.Interfaces
231 { 239 {
232 m_regionLocX = regionLocX; 240 m_regionLocX = regionLocX;
233 m_regionLocY = regionLocY; 241 m_regionLocY = regionLocY;
242 RegionSizeX = (int)Constants.RegionSize;
243 RegionSizeY = (int)Constants.RegionSize;
234 244
235 m_externalHostName = externalUri; 245 m_externalHostName = externalUri;
236 246
237 m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)port); 247 m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)port);
238 } 248 }
249 */
239 250
240 public GridRegion(uint xcell, uint ycell) 251 public GridRegion(uint xcell, uint ycell)
241 { 252 {
242 m_regionLocX = (int)(xcell * Constants.RegionSize); 253 m_regionLocX = (int)(xcell * Constants.RegionSize);
243 m_regionLocY = (int)(ycell * Constants.RegionSize); 254 m_regionLocY = (int)(ycell * Constants.RegionSize);
255 RegionSizeX = (int)Constants.RegionSize;
256 RegionSizeY = (int)Constants.RegionSize;
244 } 257 }
245 258
246 public GridRegion(RegionInfo ConvertFrom) 259 public GridRegion(RegionInfo ConvertFrom)
@@ -248,6 +261,8 @@ namespace OpenSim.Services.Interfaces
248 m_regionName = ConvertFrom.RegionName; 261 m_regionName = ConvertFrom.RegionName;
249 m_regionLocX = (int)(ConvertFrom.RegionLocX * Constants.RegionSize); 262 m_regionLocX = (int)(ConvertFrom.RegionLocX * Constants.RegionSize);
250 m_regionLocY = (int)(ConvertFrom.RegionLocY * Constants.RegionSize); 263 m_regionLocY = (int)(ConvertFrom.RegionLocY * Constants.RegionSize);
264 RegionSizeX = (int)ConvertFrom.RegionSizeX;
265 RegionSizeY = (int)ConvertFrom.RegionSizeY;
251 m_internalEndPoint = ConvertFrom.InternalEndPoint; 266 m_internalEndPoint = ConvertFrom.InternalEndPoint;
252 m_externalHostName = ConvertFrom.ExternalHostName; 267 m_externalHostName = ConvertFrom.ExternalHostName;
253 m_httpPort = ConvertFrom.HttpPort; 268 m_httpPort = ConvertFrom.HttpPort;
@@ -266,6 +281,8 @@ namespace OpenSim.Services.Interfaces
266 m_regionName = ConvertFrom.RegionName; 281 m_regionName = ConvertFrom.RegionName;
267 m_regionLocX = ConvertFrom.RegionLocX; 282 m_regionLocX = ConvertFrom.RegionLocX;
268 m_regionLocY = ConvertFrom.RegionLocY; 283 m_regionLocY = ConvertFrom.RegionLocY;
284 RegionSizeX = ConvertFrom.RegionSizeX;
285 RegionSizeY = ConvertFrom.RegionSizeY;
269 m_internalEndPoint = ConvertFrom.InternalEndPoint; 286 m_internalEndPoint = ConvertFrom.InternalEndPoint;
270 m_externalHostName = ConvertFrom.ExternalHostName; 287 m_externalHostName = ConvertFrom.ExternalHostName;
271 m_httpPort = ConvertFrom.HttpPort; 288 m_httpPort = ConvertFrom.HttpPort;
@@ -373,6 +390,8 @@ namespace OpenSim.Services.Interfaces
373 kvp["uuid"] = RegionID.ToString(); 390 kvp["uuid"] = RegionID.ToString();
374 kvp["locX"] = RegionLocX.ToString(); 391 kvp["locX"] = RegionLocX.ToString();
375 kvp["locY"] = RegionLocY.ToString(); 392 kvp["locY"] = RegionLocY.ToString();
393 kvp["sizeX"] = RegionSizeX.ToString();
394 kvp["sizeY"] = RegionSizeY.ToString();
376 kvp["regionName"] = RegionName; 395 kvp["regionName"] = RegionName;
377 kvp["serverIP"] = ExternalHostName; //ExternalEndPoint.Address.ToString(); 396 kvp["serverIP"] = ExternalHostName; //ExternalEndPoint.Address.ToString();
378 kvp["serverHttpPort"] = HttpPort.ToString(); 397 kvp["serverHttpPort"] = HttpPort.ToString();
@@ -399,6 +418,12 @@ namespace OpenSim.Services.Interfaces
399 if (kvp.ContainsKey("locY")) 418 if (kvp.ContainsKey("locY"))
400 RegionLocY = Convert.ToInt32((string)kvp["locY"]); 419 RegionLocY = Convert.ToInt32((string)kvp["locY"]);
401 420
421 if (kvp.ContainsKey("sizeX"))
422 RegionSizeX = Convert.ToInt32((string)kvp["sizeX"]);
423
424 if (kvp.ContainsKey("sizeY"))
425 RegionSizeY = Convert.ToInt32((string)kvp["sizeY"]);
426
402 if (kvp.ContainsKey("regionName")) 427 if (kvp.ContainsKey("regionName"))
403 RegionName = (string)kvp["regionName"]; 428 RegionName = (string)kvp["regionName"];
404 429