aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/GridService
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services/GridService')
-rw-r--r--OpenSim/Services/GridService/GridService.cs68
1 files changed, 68 insertions, 0 deletions
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs
index eb44dcb..6f610f8 100644
--- a/OpenSim/Services/GridService/GridService.cs
+++ b/OpenSim/Services/GridService/GridService.cs
@@ -56,6 +56,8 @@ namespace OpenSim.Services.GridService
56 protected bool m_AllowDuplicateNames = false; 56 protected bool m_AllowDuplicateNames = false;
57 protected bool m_AllowHypergridMapSearch = false; 57 protected bool m_AllowHypergridMapSearch = false;
58 58
59 private static Dictionary<string, object> m_ExtraFeatures = new Dictionary<string, object>();
60
59 public GridService(IConfigSource config) 61 public GridService(IConfigSource config)
60 : base(config) 62 : base(config)
61 { 63 {
@@ -128,6 +130,50 @@ namespace OpenSim.Services.GridService
128 } 130 }
129 } 131 }
130 132
133 private void SetExtraServiceURLs(IConfigSource config)
134 {
135 IConfig loginConfig = config.Configs["LoginService"];
136 IConfig gridConfig = config.Configs["GridService"];
137
138 if (loginConfig == null || gridConfig == null)
139 return;
140
141 string configVal;
142
143 configVal = loginConfig.GetString("SearchURL", string.Empty);
144 if (!string.IsNullOrEmpty(configVal))
145 m_ExtraFeatures["search-server-url"] = configVal;
146
147 configVal = loginConfig.GetString("MapTileURL", string.Empty);
148 if (!string.IsNullOrEmpty(configVal))
149 {
150 // This URL must end with '/', the viewer doesn't check
151 configVal = configVal.Trim();
152 if (!configVal.EndsWith("/"))
153 configVal = configVal + "/";
154 m_ExtraFeatures["map-server-url"] = configVal;
155 }
156
157 configVal = loginConfig.GetString("DestinationGuide", string.Empty);
158 if (!string.IsNullOrEmpty(configVal))
159 m_ExtraFeatures["destination-guide-url"] = configVal;
160
161 configVal = Util.GetConfigVarFromSections<string>(
162 config, "GatekeeperURI", new string[] { "Startup", "Hypergrid" }, String.Empty);
163 if (!string.IsNullOrEmpty(configVal))
164 m_ExtraFeatures["GridURL"] = configVal;
165
166 configVal = Util.GetConfigVarFromSections<string>(
167 config, "GridName", new string[] { "Const", "Hypergrid" }, String.Empty);
168 if (string.IsNullOrEmpty(configVal))
169 configVal = Util.GetConfigVarFromSections<string>(
170 config, "gridname", new string[] { "GridInfo" }, String.Empty);
171 if (!string.IsNullOrEmpty(configVal))
172 m_ExtraFeatures["GridName"] = configVal;
173
174 m_ExtraFeatures["ExportSupported"] = gridConfig.GetString("ExportSupported", "true");
175 }
176
131 #region IGridService 177 #region IGridService
132 178
133 public string RegisterRegion(UUID scopeID, GridRegion regionInfos) 179 public string RegisterRegion(UUID scopeID, GridRegion regionInfos)
@@ -137,6 +183,8 @@ namespace OpenSim.Services.GridService
137 if (regionInfos.RegionID == UUID.Zero) 183 if (regionInfos.RegionID == UUID.Zero)
138 return "Invalid RegionID - cannot be zero UUID"; 184 return "Invalid RegionID - cannot be zero UUID";
139 185
186 // we should not need to check for overlaps
187
140 RegionData region = m_Database.Get(regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID); 188 RegionData region = m_Database.Get(regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID);
141 if ((region != null) && (region.RegionID != regionInfos.RegionID)) 189 if ((region != null) && (region.RegionID != regionInfos.RegionID))
142 { 190 {
@@ -312,9 +360,15 @@ namespace OpenSim.Services.GridService
312 if (region != null) 360 if (region != null)
313 { 361 {
314 // Not really? Maybe? 362 // Not really? Maybe?
363/* this fails wiht var regions. My_sql db should now handle var regions
315 List<RegionData> rdatas = m_Database.Get( 364 List<RegionData> rdatas = m_Database.Get(
316 region.posX - region.sizeX - 1, region.posY - region.sizeY - 1, 365 region.posX - region.sizeX - 1, region.posY - region.sizeY - 1,
317 region.posX + region.sizeX + 1, region.posY + region.sizeY + 1, scopeID); 366 region.posX + region.sizeX + 1, region.posY + region.sizeY + 1, scopeID);
367*/
368 // so send normal search area
369 List<RegionData> rdatas = m_Database.Get(
370 region.posX - 1, region.posY - 1,
371 region.posX + region.sizeX + 1, region.posY + region.sizeY + 1, scopeID);
318 372
319 foreach (RegionData rdata in rdatas) 373 foreach (RegionData rdata in rdatas)
320 { 374 {
@@ -352,6 +406,7 @@ namespace OpenSim.Services.GridService
352 // be the base coordinate of the region. 406 // be the base coordinate of the region.
353 // The snapping is technically unnecessary but is harmless because regions are always 407 // The snapping is technically unnecessary but is harmless because regions are always
354 // multiples of the legacy region size (256). 408 // multiples of the legacy region size (256).
409
355 public GridRegion GetRegionByPosition(UUID scopeID, int x, int y) 410 public GridRegion GetRegionByPosition(UUID scopeID, int x, int y)
356 { 411 {
357 int snapX = (int)(x / Constants.RegionSize) * (int)Constants.RegionSize; 412 int snapX = (int)(x / Constants.RegionSize) * (int)Constants.RegionSize;
@@ -773,5 +828,18 @@ namespace OpenSim.Services.GridService
773 m_Database.Store(r); 828 m_Database.Store(r);
774 } 829 }
775 } 830 }
831
832 /// <summary>
833 /// Gets the grid extra service URls we wish for the region to send in OpenSimExtras to dynamically refresh
834 /// parameters in the viewer used to access services like map, search and destination guides.
835 /// <para>see "SimulatorFeaturesModule" </para>
836 /// </summary>
837 /// <returns>
838 /// The grid extra service URls.
839 /// </returns>
840 public Dictionary<string,object> GetExtraFeatures()
841 {
842 return m_ExtraFeatures;
843 }
776 } 844 }
777} 845}