aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/Interfaces/IGridService.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Services/Interfaces/IGridService.cs53
1 files changed, 47 insertions, 6 deletions
diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs
index 88ac5b3..8e6279e 100644
--- a/OpenSim/Services/Interfaces/IGridService.cs
+++ b/OpenSim/Services/Interfaces/IGridService.cs
@@ -29,9 +29,13 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Net; 30using System.Net;
31using System.Net.Sockets; 31using System.Net.Sockets;
32using System.Reflection;
33
32using OpenSim.Framework; 34using OpenSim.Framework;
33using OpenMetaverse; 35using OpenMetaverse;
34 36
37using log4net;
38
35namespace OpenSim.Services.Interfaces 39namespace OpenSim.Services.Interfaces
36{ 40{
37 public interface IGridService 41 public interface IGridService
@@ -119,6 +123,9 @@ namespace OpenSim.Services.Interfaces
119 123
120 public class GridRegion 124 public class GridRegion
121 { 125 {
126 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
127 private static readonly string LogHeader = "[GRID REGION]";
128
122 /// <summary> 129 /// <summary>
123 /// The port by which http communication occurs with the region 130 /// The port by which http communication occurs with the region
124 /// </summary> 131 /// </summary>
@@ -168,15 +175,16 @@ namespace OpenSim.Services.Interfaces
168 /// <summary> 175 /// <summary>
169 /// The co-ordinate of this region. 176 /// The co-ordinate of this region.
170 /// </summary> 177 /// </summary>
171 public int RegionCoordX { get { return RegionLocX / (int)Constants.RegionSize; } } 178 public int RegionCoordX { get { return (int)Util.WorldToRegionLoc((uint)RegionLocX); } }
172 179
173 /// <summary> 180 /// <summary>
174 /// The co-ordinate of this region 181 /// The co-ordinate of this region
175 /// </summary> 182 /// </summary>
176 public int RegionCoordY { get { return RegionLocY / (int)Constants.RegionSize; } } 183 public int RegionCoordY { get { return (int)Util.WorldToRegionLoc((uint)RegionLocY); } }
177 184
178 /// <summary> 185 /// <summary>
179 /// The location of this region in meters. 186 /// The location of this region in meters.
187 /// DANGER DANGER! Note that this name means something different in RegionInfo.
180 /// </summary> 188 /// </summary>
181 public int RegionLocX 189 public int RegionLocX
182 { 190 {
@@ -185,8 +193,12 @@ namespace OpenSim.Services.Interfaces
185 } 193 }
186 protected int m_regionLocX; 194 protected int m_regionLocX;
187 195
196 public int RegionSizeX { get; set; }
197 public int RegionSizeY { get; set; }
198
188 /// <summary> 199 /// <summary>
189 /// The location of this region in meters. 200 /// The location of this region in meters.
201 /// DANGER DANGER! Note that this name means something different in RegionInfo.
190 /// </summary> 202 /// </summary>
191 public int RegionLocY 203 public int RegionLocY
192 { 204 {
@@ -215,13 +227,18 @@ namespace OpenSim.Services.Interfaces
215 227
216 public GridRegion() 228 public GridRegion()
217 { 229 {
230 RegionSizeX = (int)Constants.RegionSize;
231 RegionSizeY = (int)Constants.RegionSize;
218 m_serverURI = string.Empty; 232 m_serverURI = string.Empty;
219 } 233 }
220 234
235 /*
221 public GridRegion(int regionLocX, int regionLocY, IPEndPoint internalEndPoint, string externalUri) 236 public GridRegion(int regionLocX, int regionLocY, IPEndPoint internalEndPoint, string externalUri)
222 { 237 {
223 m_regionLocX = regionLocX; 238 m_regionLocX = regionLocX;
224 m_regionLocY = regionLocY; 239 m_regionLocY = regionLocY;
240 RegionSizeX = (int)Constants.RegionSize;
241 RegionSizeY = (int)Constants.RegionSize;
225 242
226 m_internalEndPoint = internalEndPoint; 243 m_internalEndPoint = internalEndPoint;
227 m_externalHostName = externalUri; 244 m_externalHostName = externalUri;
@@ -231,23 +248,30 @@ namespace OpenSim.Services.Interfaces
231 { 248 {
232 m_regionLocX = regionLocX; 249 m_regionLocX = regionLocX;
233 m_regionLocY = regionLocY; 250 m_regionLocY = regionLocY;
251 RegionSizeX = (int)Constants.RegionSize;
252 RegionSizeY = (int)Constants.RegionSize;
234 253
235 m_externalHostName = externalUri; 254 m_externalHostName = externalUri;
236 255
237 m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)port); 256 m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)port);
238 } 257 }
258 */
239 259
240 public GridRegion(uint xcell, uint ycell) 260 public GridRegion(uint xcell, uint ycell)
241 { 261 {
242 m_regionLocX = (int)(xcell * Constants.RegionSize); 262 m_regionLocX = (int)Util.RegionToWorldLoc(xcell);
243 m_regionLocY = (int)(ycell * Constants.RegionSize); 263 m_regionLocY = (int)Util.RegionToWorldLoc(ycell);
264 RegionSizeX = (int)Constants.RegionSize;
265 RegionSizeY = (int)Constants.RegionSize;
244 } 266 }
245 267
246 public GridRegion(RegionInfo ConvertFrom) 268 public GridRegion(RegionInfo ConvertFrom)
247 { 269 {
248 m_regionName = ConvertFrom.RegionName; 270 m_regionName = ConvertFrom.RegionName;
249 m_regionLocX = (int)(ConvertFrom.RegionLocX * Constants.RegionSize); 271 m_regionLocX = (int)(ConvertFrom.WorldLocX);
250 m_regionLocY = (int)(ConvertFrom.RegionLocY * Constants.RegionSize); 272 m_regionLocY = (int)(ConvertFrom.WorldLocY);
273 RegionSizeX = (int)ConvertFrom.RegionSizeX;
274 RegionSizeY = (int)ConvertFrom.RegionSizeY;
251 m_internalEndPoint = ConvertFrom.InternalEndPoint; 275 m_internalEndPoint = ConvertFrom.InternalEndPoint;
252 m_externalHostName = ConvertFrom.ExternalHostName; 276 m_externalHostName = ConvertFrom.ExternalHostName;
253 m_httpPort = ConvertFrom.HttpPort; 277 m_httpPort = ConvertFrom.HttpPort;
@@ -266,6 +290,8 @@ namespace OpenSim.Services.Interfaces
266 m_regionName = ConvertFrom.RegionName; 290 m_regionName = ConvertFrom.RegionName;
267 m_regionLocX = ConvertFrom.RegionLocX; 291 m_regionLocX = ConvertFrom.RegionLocX;
268 m_regionLocY = ConvertFrom.RegionLocY; 292 m_regionLocY = ConvertFrom.RegionLocY;
293 RegionSizeX = ConvertFrom.RegionSizeX;
294 RegionSizeY = ConvertFrom.RegionSizeY;
269 m_internalEndPoint = ConvertFrom.InternalEndPoint; 295 m_internalEndPoint = ConvertFrom.InternalEndPoint;
270 m_externalHostName = ConvertFrom.ExternalHostName; 296 m_externalHostName = ConvertFrom.ExternalHostName;
271 m_httpPort = ConvertFrom.HttpPort; 297 m_httpPort = ConvertFrom.HttpPort;
@@ -373,6 +399,8 @@ namespace OpenSim.Services.Interfaces
373 kvp["uuid"] = RegionID.ToString(); 399 kvp["uuid"] = RegionID.ToString();
374 kvp["locX"] = RegionLocX.ToString(); 400 kvp["locX"] = RegionLocX.ToString();
375 kvp["locY"] = RegionLocY.ToString(); 401 kvp["locY"] = RegionLocY.ToString();
402 kvp["sizeX"] = RegionSizeX.ToString();
403 kvp["sizeY"] = RegionSizeY.ToString();
376 kvp["regionName"] = RegionName; 404 kvp["regionName"] = RegionName;
377 kvp["serverIP"] = ExternalHostName; //ExternalEndPoint.Address.ToString(); 405 kvp["serverIP"] = ExternalHostName; //ExternalEndPoint.Address.ToString();
378 kvp["serverHttpPort"] = HttpPort.ToString(); 406 kvp["serverHttpPort"] = HttpPort.ToString();
@@ -399,6 +427,16 @@ namespace OpenSim.Services.Interfaces
399 if (kvp.ContainsKey("locY")) 427 if (kvp.ContainsKey("locY"))
400 RegionLocY = Convert.ToInt32((string)kvp["locY"]); 428 RegionLocY = Convert.ToInt32((string)kvp["locY"]);
401 429
430 if (kvp.ContainsKey("sizeX"))
431 RegionSizeX = Convert.ToInt32((string)kvp["sizeX"]);
432 else
433 RegionSizeX = (int)Constants.RegionSize;
434
435 if (kvp.ContainsKey("sizeY"))
436 RegionSizeY = Convert.ToInt32((string)kvp["sizeY"]);
437 else
438 RegionSizeX = (int)Constants.RegionSize;
439
402 if (kvp.ContainsKey("regionName")) 440 if (kvp.ContainsKey("regionName"))
403 RegionName = (string)kvp["regionName"]; 441 RegionName = (string)kvp["regionName"];
404 442
@@ -446,6 +484,9 @@ namespace OpenSim.Services.Interfaces
446 484
447 if (kvp.ContainsKey("Token")) 485 if (kvp.ContainsKey("Token"))
448 Token = kvp["Token"].ToString(); 486 Token = kvp["Token"].ToString();
487
488 // m_log.DebugFormat("{0} New GridRegion. id={1}, loc=<{2},{3}>, size=<{4},{5}>",
489 // LogHeader, RegionID, RegionLocX, RegionLocY, RegionSizeX, RegionSizeY);
449 } 490 }
450 } 491 }
451} 492}