diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/World/WorldMap')
-rw-r--r-- | OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs | 74 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | 371 |
2 files changed, 5 insertions, 440 deletions
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs index 553d057..e08bdc0 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs | |||
@@ -141,12 +141,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
141 | 141 | ||
142 | private void OnMapNameRequest(IClientAPI remoteClient, string mapName, uint flags) | 142 | private void OnMapNameRequest(IClientAPI remoteClient, string mapName, uint flags) |
143 | { | 143 | { |
144 | <<<<<<< HEAD | ||
145 | List<MapBlockData> blocks = new List<MapBlockData>(); | ||
146 | if (mapName.Length < 3 || (mapName.EndsWith("#") && mapName.Length < 4)) | ||
147 | ======= | ||
148 | Util.FireAndForget(x => | 144 | Util.FireAndForget(x => |
149 | >>>>>>> avn/ubitvar | ||
150 | { | 145 | { |
151 | List<MapBlockData> blocks = new List<MapBlockData>(); | 146 | List<MapBlockData> blocks = new List<MapBlockData>(); |
152 | if (mapName.Length < 3 || (mapName.EndsWith("#") && mapName.Length < 4)) | 147 | if (mapName.Length < 3 || (mapName.EndsWith("#") && mapName.Length < 4)) |
@@ -232,74 +227,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
232 | // they have different values depending on different viewers, apparently | 227 | // they have different values depending on different viewers, apparently |
233 | remoteClient.SendMapBlock(blocks, flags); | 228 | remoteClient.SendMapBlock(blocks, flags); |
234 | 229 | ||
235 | <<<<<<< HEAD | ||
236 | List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20); | ||
237 | |||
238 | string mapNameOrig = mapName; | ||
239 | if (regionInfos.Count == 0) | ||
240 | { | ||
241 | // Hack to get around the fact that ll V3 now drops the port from the | ||
242 | // map name. See https://jira.secondlife.com/browse/VWR-28570 | ||
243 | // | ||
244 | // Caller, use this magic form instead: | ||
245 | // secondlife://http|!!mygrid.com|8002|Region+Name/128/128 | ||
246 | // or url encode if possible. | ||
247 | // the hacks we do with this viewer... | ||
248 | // | ||
249 | if (mapName.Contains("|")) | ||
250 | mapName = mapName.Replace('|', ':'); | ||
251 | if (mapName.Contains("+")) | ||
252 | mapName = mapName.Replace('+', ' '); | ||
253 | if (mapName.Contains("!")) | ||
254 | mapName = mapName.Replace('!', '/'); | ||
255 | |||
256 | if (mapName != mapNameOrig) | ||
257 | regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20); | ||
258 | } | ||
259 | |||
260 | m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions. Flags={2}", mapName, regionInfos.Count, flags); | ||
261 | |||
262 | if (regionInfos.Count > 0) | ||
263 | { | ||
264 | foreach (GridRegion info in regionInfos) | ||
265 | { | ||
266 | if ((flags & 2) == 2) // V2 sends this | ||
267 | { | ||
268 | List<MapBlockData> datas = WorldMap.Map2BlockFromGridRegion(info, flags); | ||
269 | // ugh! V2-3 is very sensitive about the result being | ||
270 | // exactly the same as the requested name | ||
271 | if (regionInfos.Count == 1 && (mapName != mapNameOrig)) | ||
272 | datas.ForEach(d => d.Name = mapNameOrig); | ||
273 | |||
274 | blocks.AddRange(datas); | ||
275 | } | ||
276 | else | ||
277 | { | ||
278 | MapBlockData data = WorldMap.MapBlockFromGridRegion(info, flags); | ||
279 | blocks.Add(data); | ||
280 | } | ||
281 | } | ||
282 | } | ||
283 | |||
284 | // final block, closing the search result | ||
285 | AddFinalBlock(blocks); | ||
286 | |||
287 | // flags are agent flags sent from the viewer. | ||
288 | // they have different values depending on different viewers, apparently | ||
289 | remoteClient.SendMapBlock(blocks, flags); | ||
290 | |||
291 | // send extra user messages for V3 | ||
292 | // because the UI is very confusing | ||
293 | // while we don't fix the hard-coded urls | ||
294 | if (flags == 2) | ||
295 | { | ||
296 | if (regionInfos.Count == 0) | ||
297 | remoteClient.SendAlertMessage("No regions found with that name."); | ||
298 | // this seems unnecessary because found regions will show up in the search results | ||
299 | //else if (regionInfos.Count == 1) | ||
300 | // remoteClient.SendAlertMessage("Region found!"); | ||
301 | } | ||
302 | ======= | ||
303 | // send extra user messages for V3 | 230 | // send extra user messages for V3 |
304 | // because the UI is very confusing | 231 | // because the UI is very confusing |
305 | // while we don't fix the hard-coded urls | 232 | // while we don't fix the hard-coded urls |
@@ -311,7 +238,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
311 | // remoteClient.SendAgentAlertMessage("Region found!", false); | 238 | // remoteClient.SendAgentAlertMessage("Region found!", false); |
312 | } | 239 | } |
313 | }); | 240 | }); |
314 | >>>>>>> avn/ubitvar | ||
315 | } | 241 | } |
316 | 242 | ||
317 | private void AddFinalBlock(List<MapBlockData> blocks) | 243 | private void AddFinalBlock(List<MapBlockData> blocks) |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 2fbd017..b6d96ac 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | |||
@@ -68,12 +68,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
68 | private static readonly UUID STOP_UUID = UUID.Random(); | 68 | private static readonly UUID STOP_UUID = UUID.Random(); |
69 | private static readonly string m_mapLayerPath = "0001/"; | 69 | private static readonly string m_mapLayerPath = "0001/"; |
70 | 70 | ||
71 | <<<<<<< HEAD | ||
72 | private IMapImageGenerator m_mapImageGenerator; | ||
73 | private IMapImageUploadModule m_mapImageServiceModule; | ||
74 | |||
75 | private OpenSim.Framework.BlockingQueue<MapRequestState> requests = new OpenSim.Framework.BlockingQueue<MapRequestState>(); | ||
76 | ======= | ||
77 | private ManualResetEvent queueEvent = new ManualResetEvent(false); | 71 | private ManualResetEvent queueEvent = new ManualResetEvent(false); |
78 | private Queue<MapRequestState> requests = new Queue<MapRequestState>(); | 72 | private Queue<MapRequestState> requests = new Queue<MapRequestState>(); |
79 | 73 | ||
@@ -82,7 +76,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
82 | 76 | ||
83 | private IMapImageGenerator m_mapImageGenerator; | 77 | private IMapImageGenerator m_mapImageGenerator; |
84 | private IMapImageUploadModule m_mapImageServiceModule; | 78 | private IMapImageUploadModule m_mapImageServiceModule; |
85 | >>>>>>> avn/ubitvar | ||
86 | 79 | ||
87 | protected Scene m_scene; | 80 | protected Scene m_scene; |
88 | private List<MapBlockData> cachedMapBlocks = new List<MapBlockData>(); | 81 | private List<MapBlockData> cachedMapBlocks = new List<MapBlockData>(); |
@@ -154,14 +147,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
154 | if (!m_Enabled) | 147 | if (!m_Enabled) |
155 | return; | 148 | return; |
156 | 149 | ||
157 | <<<<<<< HEAD | ||
158 | m_ServiceThrottle = scene.RequestModuleInterface<IServiceThrottleModule>(); | ||
159 | ======= | ||
160 | m_mapImageGenerator = m_scene.RequestModuleInterface<IMapImageGenerator>(); | ||
161 | m_mapImageServiceModule = m_scene.RequestModuleInterface<IMapImageUploadModule>(); | ||
162 | } | ||
163 | >>>>>>> avn/ubitvar | ||
164 | |||
165 | m_mapImageGenerator = m_scene.RequestModuleInterface<IMapImageGenerator>(); | 150 | m_mapImageGenerator = m_scene.RequestModuleInterface<IMapImageGenerator>(); |
166 | m_mapImageServiceModule = m_scene.RequestModuleInterface<IMapImageUploadModule>(); | 151 | m_mapImageServiceModule = m_scene.RequestModuleInterface<IMapImageUploadModule>(); |
167 | } | 152 | } |
@@ -275,56 +260,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
275 | // 6/8/2011 -- I'm adding an explicit 2048 check, so that we never forget that there is | 260 | // 6/8/2011 -- I'm adding an explicit 2048 check, so that we never forget that there is |
276 | // a hack here, and so that regions below 4096 don't get spammed with unnecessary map blocks. | 261 | // a hack here, and so that regions below 4096 don't get spammed with unnecessary map blocks. |
277 | 262 | ||
278 | <<<<<<< HEAD | ||
279 | if (m_scene.RegionInfo.RegionLocX >= 2048 || m_scene.RegionInfo.RegionLocY >= 2048) | ||
280 | { | ||
281 | ScenePresence avatarPresence = null; | ||
282 | |||
283 | m_scene.TryGetScenePresence(agentID, out avatarPresence); | ||
284 | |||
285 | if (avatarPresence != null) | ||
286 | { | ||
287 | bool lookup = false; | ||
288 | |||
289 | lock (cachedMapBlocks) | ||
290 | { | ||
291 | if (cachedMapBlocks.Count > 0 && ((cachedTime + 1800) > Util.UnixTimeSinceEpoch())) | ||
292 | { | ||
293 | List<MapBlockData> mapBlocks; | ||
294 | |||
295 | mapBlocks = cachedMapBlocks; | ||
296 | avatarPresence.ControllingClient.SendMapBlock(mapBlocks, 0); | ||
297 | } | ||
298 | else | ||
299 | { | ||
300 | lookup = true; | ||
301 | } | ||
302 | } | ||
303 | if (lookup) | ||
304 | { | ||
305 | List<MapBlockData> mapBlocks = new List<MapBlockData>(); ; | ||
306 | |||
307 | // Get regions that are within 8 regions of here | ||
308 | List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, | ||
309 | (int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocX - 8), | ||
310 | (int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocX + 8), | ||
311 | (int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocY - 8), | ||
312 | (int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocY + 8) ); | ||
313 | foreach (GridRegion r in regions) | ||
314 | { | ||
315 | MapBlockData block = MapBlockFromGridRegion(r, 0); | ||
316 | mapBlocks.Add(block); | ||
317 | } | ||
318 | avatarPresence.ControllingClient.SendMapBlock(mapBlocks, 0); | ||
319 | |||
320 | lock (cachedMapBlocks) | ||
321 | cachedMapBlocks = mapBlocks; | ||
322 | |||
323 | cachedTime = Util.UnixTimeSinceEpoch(); | ||
324 | } | ||
325 | } | ||
326 | } | ||
327 | ======= | ||
328 | //if (m_scene.RegionInfo.RegionLocX >= 2048 || m_scene.RegionInfo.RegionLocY >= 2048) | 263 | //if (m_scene.RegionInfo.RegionLocX >= 2048 || m_scene.RegionInfo.RegionLocY >= 2048) |
329 | //{ | 264 | //{ |
330 | // ScenePresence avatarPresence = null; | 265 | // ScenePresence avatarPresence = null; |
@@ -373,7 +308,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
373 | // } | 308 | // } |
374 | // } | 309 | // } |
375 | //} | 310 | //} |
376 | >>>>>>> avn/ubitvar | ||
377 | 311 | ||
378 | LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse(); | 312 | LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse(); |
379 | mapResponse.LayerData.Array.Add(GetOSDMapLayerResponse()); | 313 | mapResponse.LayerData.Array.Add(GetOSDMapLayerResponse()); |
@@ -459,7 +393,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
459 | ThreadPriority.BelowNormal, | 393 | ThreadPriority.BelowNormal, |
460 | true, | 394 | true, |
461 | true); | 395 | true); |
462 | Watchdog.StartThread( | 396 | WorkManager.StartThread( |
463 | MapBlockSendThread, | 397 | MapBlockSendThread, |
464 | string.Format("MapBlockSendThread ({0})", m_scene.RegionInfo.RegionName), | 398 | string.Format("MapBlockSendThread ({0})", m_scene.RegionInfo.RegionName), |
465 | ThreadPriority.BelowNormal, | 399 | ThreadPriority.BelowNormal, |
@@ -516,12 +450,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
516 | uint xstart = 0; | 450 | uint xstart = 0; |
517 | uint ystart = 0; | 451 | uint ystart = 0; |
518 | Util.RegionHandleToWorldLoc(m_scene.RegionInfo.RegionHandle, out xstart, out ystart); | 452 | Util.RegionHandleToWorldLoc(m_scene.RegionInfo.RegionHandle, out xstart, out ystart); |
519 | <<<<<<< HEAD | ||
520 | if (itemtype == (int)GridItemType.AgentLocations) | ||
521 | ======= | ||
522 | 453 | ||
523 | if (itemtype == 6) // Service 6 right now (MAP_ITEM_AGENTS_LOCATION; green dots) | 454 | if (itemtype == (int)GridItemType.AgentLocations) // Service 6 right now (MAP_ITEM_AGENTS_LOCATION; green dots) |
524 | >>>>>>> avn/ubitvar | ||
525 | { | 455 | { |
526 | if (regionhandle == 0 || regionhandle == m_scene.RegionInfo.RegionHandle) | 456 | if (regionhandle == 0 || regionhandle == m_scene.RegionInfo.RegionHandle) |
527 | { | 457 | { |
@@ -531,22 +461,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
531 | mapItemReply mapitem = new mapItemReply(); | 461 | mapItemReply mapitem = new mapItemReply(); |
532 | if (m_scene.GetRootAgentCount() <= 1) | 462 | if (m_scene.GetRootAgentCount() <= 1) |
533 | { | 463 | { |
534 | <<<<<<< HEAD | ||
535 | mapitem = new mapItemReply( | 464 | mapitem = new mapItemReply( |
536 | xstart + 1, | 465 | xstart + 1, |
537 | ystart + 1, | 466 | ystart + 1, |
538 | UUID.Zero, | 467 | UUID.Zero, |
539 | Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()), | 468 | Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()), |
540 | 0, 0); | 469 | 0, 0); |
541 | ======= | ||
542 | mapitem = new mapItemReply(); | ||
543 | mapitem.x = xstart + 1; | ||
544 | mapitem.y = ystart + 1; | ||
545 | mapitem.id = UUID.Zero; | ||
546 | mapitem.name = Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()); | ||
547 | mapitem.Extra = 0; | ||
548 | mapitem.Extra2 = 0; | ||
549 | >>>>>>> avn/ubitvar | ||
550 | mapitems.Add(mapitem); | 470 | mapitems.Add(mapitem); |
551 | } | 471 | } |
552 | else | 472 | else |
@@ -556,22 +476,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
556 | // Don't send a green dot for yourself | 476 | // Don't send a green dot for yourself |
557 | if (sp.UUID != remoteClient.AgentId) | 477 | if (sp.UUID != remoteClient.AgentId) |
558 | { | 478 | { |
559 | <<<<<<< HEAD | ||
560 | mapitem = new mapItemReply( | 479 | mapitem = new mapItemReply( |
561 | xstart + (uint)sp.AbsolutePosition.X, | 480 | xstart + (uint)sp.AbsolutePosition.X, |
562 | ystart + (uint)sp.AbsolutePosition.Y, | 481 | ystart + (uint)sp.AbsolutePosition.Y, |
563 | UUID.Zero, | 482 | UUID.Zero, |
564 | Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()), | 483 | Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()), |
565 | 1, 0); | 484 | 1, 0); |
566 | ======= | ||
567 | mapitem = new mapItemReply(); | ||
568 | mapitem.x = xstart + (uint)sp.AbsolutePosition.X; | ||
569 | mapitem.y = ystart + (uint)sp.AbsolutePosition.Y; | ||
570 | mapitem.id = UUID.Zero; | ||
571 | mapitem.name = Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()); | ||
572 | mapitem.Extra = 1; | ||
573 | mapitem.Extra2 = 0; | ||
574 | >>>>>>> avn/ubitvar | ||
575 | mapitems.Add(mapitem); | 485 | mapitems.Add(mapitem); |
576 | } | 486 | } |
577 | }); | 487 | }); |
@@ -615,8 +525,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
615 | Vector3 max = parcel.AABBMax; | 525 | Vector3 max = parcel.AABBMax; |
616 | float x = (min.X+max.X)/2; | 526 | float x = (min.X+max.X)/2; |
617 | float y = (min.Y+max.Y)/2; | 527 | float y = (min.Y+max.Y)/2; |
618 | |||
619 | <<<<<<< HEAD | ||
620 | mapitem = new mapItemReply( | 528 | mapitem = new mapItemReply( |
621 | xstart + (uint)x, | 529 | xstart + (uint)x, |
622 | ystart + (uint)y, | 530 | ystart + (uint)y, |
@@ -625,16 +533,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
625 | parcel.Area, | 533 | parcel.Area, |
626 | parcel.SalePrice | 534 | parcel.SalePrice |
627 | ); | 535 | ); |
628 | ======= | ||
629 | mapitem = new mapItemReply(); | ||
630 | mapitem.x = xstart + (uint)x; | ||
631 | mapitem.y = ystart +(uint)y; | ||
632 | // mapitem.z = (uint)m_scene.GetGroundHeight(x,y); | ||
633 | mapitem.id = parcel.GlobalID; | ||
634 | mapitem.name = parcel.Name; | ||
635 | mapitem.Extra = parcel.Area; | ||
636 | mapitem.Extra2 = parcel.SalePrice; | ||
637 | >>>>>>> avn/ubitvar | ||
638 | mapitems.Add(mapitem); | 536 | mapitems.Add(mapitem); |
639 | } | 537 | } |
640 | } | 538 | } |
@@ -659,7 +557,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
659 | SceneObjectGroup sog = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject); | 557 | SceneObjectGroup sog = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject); |
660 | if (sog != null) | 558 | if (sog != null) |
661 | { | 559 | { |
662 | <<<<<<< HEAD | ||
663 | mapitem = new mapItemReply( | 560 | mapitem = new mapItemReply( |
664 | xstart + (uint)sog.AbsolutePosition.X, | 561 | xstart + (uint)sog.AbsolutePosition.X, |
665 | ystart + (uint)sog.AbsolutePosition.Y, | 562 | ystart + (uint)sog.AbsolutePosition.Y, |
@@ -668,15 +565,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
668 | 0, // color (not used) | 565 | 0, // color (not used) |
669 | 0 // 0 = telehub / 1 = infohub | 566 | 0 // 0 = telehub / 1 = infohub |
670 | ); | 567 | ); |
671 | ======= | ||
672 | mapitem = new mapItemReply(); | ||
673 | mapitem.x = xstart + (uint)sog.AbsolutePosition.X; | ||
674 | mapitem.y = ystart + (uint)sog.AbsolutePosition.Y; | ||
675 | mapitem.id = UUID.Zero; | ||
676 | mapitem.name = sog.Name; | ||
677 | mapitem.Extra = 0; // color (not used) | ||
678 | mapitem.Extra2 = 0; // 0 = telehub / 1 = infohub | ||
679 | >>>>>>> avn/ubitvar | ||
680 | mapitems.Add(mapitem); | 568 | mapitems.Add(mapitem); |
681 | 569 | ||
682 | remoteClient.SendMapItemReply(mapitems.ToArray(), itemtype, flags); | 570 | remoteClient.SendMapItemReply(mapitems.ToArray(), itemtype, flags); |
@@ -763,126 +651,9 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
763 | { | 651 | { |
764 | lock (requests) | 652 | lock (requests) |
765 | { | 653 | { |
766 | <<<<<<< HEAD | ||
767 | if (st.agentID != UUID.Zero) | ||
768 | { | ||
769 | bool dorequest = true; | ||
770 | lock (m_rootAgents) | ||
771 | { | ||
772 | if (!m_rootAgents.Contains(st.agentID)) | ||
773 | dorequest = false; | ||
774 | } | ||
775 | |||
776 | if (dorequest && !m_blacklistedregions.ContainsKey(st.regionhandle)) | ||
777 | { | ||
778 | if (nAsyncRequests >= MAX_ASYNC_REQUESTS) // hit the break | ||
779 | { | ||
780 | // AH!!! Recursive ! | ||
781 | // Put this request back in the queue and return | ||
782 | EnqueueMapItemRequest(st); | ||
783 | return; | ||
784 | } | ||
785 | |||
786 | RequestMapItemsDelegate d = RequestMapItemsAsync; | ||
787 | d.BeginInvoke(st.agentID, st.flags, st.EstateID, st.godlike, st.itemtype, st.regionhandle, RequestMapItemsCompleted, null); | ||
788 | //OSDMap response = RequestMapItemsAsync(st.agentID, st.flags, st.EstateID, st.godlike, st.itemtype, st.regionhandle); | ||
789 | //RequestMapItemsCompleted(response); | ||
790 | Interlocked.Increment(ref nAsyncRequests); | ||
791 | } | ||
792 | } | ||
793 | }); | ||
794 | } | ||
795 | |||
796 | /// <summary> | ||
797 | /// Sends the mapitem response to the IClientAPI | ||
798 | /// </summary> | ||
799 | /// <param name="response">The OSDMap Response for the mapitem</param> | ||
800 | private void RequestMapItemsCompleted(IAsyncResult iar) | ||
801 | { | ||
802 | AsyncResult result = (AsyncResult)iar; | ||
803 | RequestMapItemsDelegate icon = (RequestMapItemsDelegate)result.AsyncDelegate; | ||
804 | |||
805 | OSDMap response = (OSDMap)icon.EndInvoke(iar); | ||
806 | |||
807 | Interlocked.Decrement(ref nAsyncRequests); | ||
808 | |||
809 | if (!response.ContainsKey("requestID")) | ||
810 | return; | ||
811 | |||
812 | UUID requestID = response["requestID"].AsUUID(); | ||
813 | |||
814 | if (requestID != UUID.Zero) | ||
815 | { | ||
816 | MapRequestState mrs = new MapRequestState(); | ||
817 | mrs.agentID = UUID.Zero; | ||
818 | lock (m_openRequests) | ||
819 | { | ||
820 | if (m_openRequests.ContainsKey(requestID)) | ||
821 | { | ||
822 | mrs = m_openRequests[requestID]; | ||
823 | m_openRequests.Remove(requestID); | ||
824 | } | ||
825 | } | ||
826 | |||
827 | if (mrs.agentID != UUID.Zero) | ||
828 | { | ||
829 | ScenePresence av = null; | ||
830 | m_scene.TryGetScenePresence(mrs.agentID, out av); | ||
831 | if (av != null) | ||
832 | { | ||
833 | if (response.ContainsKey(mrs.itemtype.ToString())) | ||
834 | { | ||
835 | List<mapItemReply> returnitems = new List<mapItemReply>(); | ||
836 | OSDArray itemarray = (OSDArray)response[mrs.itemtype.ToString()]; | ||
837 | for (int i = 0; i < itemarray.Count; i++) | ||
838 | { | ||
839 | OSDMap mapitem = (OSDMap)itemarray[i]; | ||
840 | mapItemReply mi = new mapItemReply(); | ||
841 | mi.FromOSD(mapitem); | ||
842 | returnitems.Add(mi); | ||
843 | } | ||
844 | av.ControllingClient.SendMapItemReply(returnitems.ToArray(), mrs.itemtype, mrs.flags); | ||
845 | } | ||
846 | |||
847 | // Service 7 (MAP_ITEM_LAND_FOR_SALE) | ||
848 | uint itemtype = (uint)GridItemType.LandForSale; | ||
849 | |||
850 | if (response.ContainsKey(itemtype.ToString())) | ||
851 | { | ||
852 | List<mapItemReply> returnitems = new List<mapItemReply>(); | ||
853 | OSDArray itemarray = (OSDArray)response[itemtype.ToString()]; | ||
854 | for (int i = 0; i < itemarray.Count; i++) | ||
855 | { | ||
856 | OSDMap mapitem = (OSDMap)itemarray[i]; | ||
857 | mapItemReply mi = new mapItemReply(); | ||
858 | mi.FromOSD(mapitem); | ||
859 | returnitems.Add(mi); | ||
860 | } | ||
861 | av.ControllingClient.SendMapItemReply(returnitems.ToArray(), itemtype, mrs.flags); | ||
862 | } | ||
863 | |||
864 | // Service 1 (MAP_ITEM_TELEHUB) | ||
865 | itemtype = (uint)GridItemType.Telehub; | ||
866 | |||
867 | if (response.ContainsKey(itemtype.ToString())) | ||
868 | { | ||
869 | List<mapItemReply> returnitems = new List<mapItemReply>(); | ||
870 | OSDArray itemarray = (OSDArray)response[itemtype.ToString()]; | ||
871 | for (int i = 0; i < itemarray.Count; i++) | ||
872 | { | ||
873 | OSDMap mapitem = (OSDMap)itemarray[i]; | ||
874 | mapItemReply mi = new mapItemReply(); | ||
875 | mi.FromOSD(mapitem); | ||
876 | returnitems.Add(mi); | ||
877 | } | ||
878 | av.ControllingClient.SendMapItemReply(returnitems.ToArray(), itemtype, mrs.flags); | ||
879 | } | ||
880 | } | ||
881 | } | ||
882 | ======= | ||
883 | queueEvent.Set(); | 654 | queueEvent.Set(); |
884 | requests.Enqueue(state); | 655 | requests.Enqueue(state); |
885 | >>>>>>> avn/ubitvar | 656 | |
886 | } | 657 | } |
887 | } | 658 | } |
888 | 659 | ||
@@ -1228,11 +999,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1228 | /// <param name="maxY"></param> | 999 | /// <param name="maxY"></param> |
1229 | public void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag) | 1000 | public void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag) |
1230 | { | 1001 | { |
1231 | <<<<<<< HEAD | ||
1232 | ======= | ||
1233 | m_log.DebugFormat("[WoldMapModule] RequestMapBlocks {0}={1}={2}={3} {4}", minX, minY, maxX, maxY, flag); | 1002 | m_log.DebugFormat("[WoldMapModule] RequestMapBlocks {0}={1}={2}={3} {4}", minX, minY, maxX, maxY, flag); |
1234 | /* this flag does not seem to mean what his says | 1003 | /* this flag does not seem to mean what his says |
1235 | >>>>>>> avn/ubitvar | ||
1236 | if ((flag & 0x10000) != 0) // user clicked on qthe map a tile that isn't visible | 1004 | if ((flag & 0x10000) != 0) // user clicked on qthe map a tile that isn't visible |
1237 | { | 1005 | { |
1238 | List<MapBlockData> response = new List<MapBlockData>(); | 1006 | List<MapBlockData> response = new List<MapBlockData>(); |
@@ -1241,34 +1009,15 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1241 | // on an unloaded square. | 1009 | // on an unloaded square. |
1242 | // But make sure: Look whether the one we requested is in there | 1010 | // But make sure: Look whether the one we requested is in there |
1243 | List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, | 1011 | List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, |
1244 | <<<<<<< HEAD | ||
1245 | (int)Util.RegionToWorldLoc((uint)minX), (int)Util.RegionToWorldLoc((uint)maxX), | ||
1246 | (int)Util.RegionToWorldLoc((uint)minY), (int)Util.RegionToWorldLoc((uint)maxY) ); | ||
1247 | |||
1248 | m_log.DebugFormat("[WORLD MAP MODULE] RequestMapBlocks min=<{0},{1}>, max=<{2},{3}>, flag={4}, cntFound={5}", | ||
1249 | minX, minY, maxX, maxY, flag.ToString("X"), regions.Count); | ||
1250 | ======= | ||
1251 | (int)Util.RegionToWorldLoc((uint)minX), | 1012 | (int)Util.RegionToWorldLoc((uint)minX), |
1252 | (int)Util.RegionToWorldLoc((uint)maxX), | 1013 | (int)Util.RegionToWorldLoc((uint)maxX), |
1253 | (int)Util.RegionToWorldLoc((uint)minY), | 1014 | (int)Util.RegionToWorldLoc((uint)minY), |
1254 | (int)Util.RegionToWorldLoc((uint)maxY) ); | 1015 | (int)Util.RegionToWorldLoc((uint)maxY) ); |
1255 | 1016 | ||
1256 | >>>>>>> avn/ubitvar | ||
1257 | if (regions != null) | 1017 | if (regions != null) |
1258 | { | 1018 | { |
1259 | foreach (GridRegion r in regions) | 1019 | foreach (GridRegion r in regions) |
1260 | { | 1020 | { |
1261 | <<<<<<< HEAD | ||
1262 | if (r.RegionLocX == Util.RegionToWorldLoc((uint)minX) | ||
1263 | && r.RegionLocY == Util.RegionToWorldLoc((uint)minY) ) | ||
1264 | { | ||
1265 | // found it => add it to response | ||
1266 | // Version 2 viewers can handle the larger regions | ||
1267 | if ((flag & 2) == 2) | ||
1268 | response.AddRange(Map2BlockFromGridRegion(r, flag)); | ||
1269 | else | ||
1270 | response.Add(MapBlockFromGridRegion(r, flag)); | ||
1271 | ======= | ||
1272 | if (r.RegionLocX == Util.RegionToWorldLoc((uint)minX) && | 1021 | if (r.RegionLocX == Util.RegionToWorldLoc((uint)minX) && |
1273 | r.RegionLocY == Util.RegionToWorldLoc((uint)minY)) | 1022 | r.RegionLocY == Util.RegionToWorldLoc((uint)minY)) |
1274 | { | 1023 | { |
@@ -1281,7 +1030,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1281 | MapBlockFromGridRegion(block, r, flag); | 1030 | MapBlockFromGridRegion(block, r, flag); |
1282 | response.Add(block); | 1031 | response.Add(block); |
1283 | } | 1032 | } |
1284 | >>>>>>> avn/ubitvar | ||
1285 | break; | 1033 | break; |
1286 | } | 1034 | } |
1287 | } | 1035 | } |
@@ -1373,19 +1121,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1373 | List<MapBlockData> allBlocks = new List<MapBlockData>(); | 1121 | List<MapBlockData> allBlocks = new List<MapBlockData>(); |
1374 | List<MapBlockData> mapBlocks = new List<MapBlockData>(); | 1122 | List<MapBlockData> mapBlocks = new List<MapBlockData>(); |
1375 | List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, | 1123 | List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, |
1376 | <<<<<<< HEAD | ||
1377 | (int)Util.RegionToWorldLoc((uint)(minX - 4)), (int)Util.RegionToWorldLoc((uint)(maxX + 4)), | ||
1378 | (int)Util.RegionToWorldLoc((uint)(minY - 4)), (int)Util.RegionToWorldLoc((uint)(maxY + 4)) ); | ||
1379 | //m_log.DebugFormat("{0} GetAndSendBlocks. min=<{1},{2}>, max=<{3},{4}>, cntFound={5}", | ||
1380 | // LogHeader, minX, minY, maxX, maxY, regions.Count); | ||
1381 | foreach (GridRegion r in regions) | ||
1382 | { | ||
1383 | // Version 2 viewers can handle the larger regions | ||
1384 | if ((flag & 2) == 2) | ||
1385 | mapBlocks.AddRange(Map2BlockFromGridRegion(r, flag)); | ||
1386 | else | ||
1387 | mapBlocks.Add(MapBlockFromGridRegion(r, flag)); | ||
1388 | ======= | ||
1389 | minX * (int)Constants.RegionSize, | 1124 | minX * (int)Constants.RegionSize, |
1390 | maxX * (int)Constants.RegionSize, | 1125 | maxX * (int)Constants.RegionSize, |
1391 | minY * (int)Constants.RegionSize, | 1126 | minY * (int)Constants.RegionSize, |
@@ -1407,7 +1142,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1407 | mapBlocks.Add(block); | 1142 | mapBlocks.Add(block); |
1408 | remoteClient.SendMapBlock(mapBlocks, flag & 0xffff); | 1143 | remoteClient.SendMapBlock(mapBlocks, flag & 0xffff); |
1409 | return allBlocks; | 1144 | return allBlocks; |
1410 | >>>>>>> avn/ubitvar | ||
1411 | } | 1145 | } |
1412 | 1146 | ||
1413 | foreach (GridRegion r in regions) | 1147 | foreach (GridRegion r in regions) |
@@ -1438,15 +1172,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1438 | return allBlocks; | 1172 | return allBlocks; |
1439 | } | 1173 | } |
1440 | 1174 | ||
1441 | <<<<<<< HEAD | ||
1442 | // Fill a passed MapBlockData from a GridRegion | ||
1443 | public MapBlockData MapBlockFromGridRegion(GridRegion r, uint flag) | ||
1444 | ======= | ||
1445 | public void MapBlockFromGridRegion(MapBlockData block, GridRegion r, uint flag) | 1175 | public void MapBlockFromGridRegion(MapBlockData block, GridRegion r, uint flag) |
1446 | >>>>>>> avn/ubitvar | ||
1447 | { | 1176 | { |
1448 | MapBlockData block = new MapBlockData(); | ||
1449 | |||
1450 | block.Access = r.Access; | 1177 | block.Access = r.Access; |
1451 | switch (flag & 0xffff) | 1178 | switch (flag & 0xffff) |
1452 | { | 1179 | { |
@@ -1461,14 +1188,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1461 | break; | 1188 | break; |
1462 | } | 1189 | } |
1463 | block.Name = r.RegionName; | 1190 | block.Name = r.RegionName; |
1464 | <<<<<<< HEAD | ||
1465 | block.X = (ushort)Util.WorldToRegionLoc((uint)r.RegionLocX); | ||
1466 | block.Y = (ushort)Util.WorldToRegionLoc((uint)r.RegionLocY); | ||
1467 | block.SizeX = (ushort) r.RegionSizeX; | ||
1468 | block.SizeY = (ushort) r.RegionSizeY; | ||
1469 | |||
1470 | return block; | ||
1471 | ======= | ||
1472 | block.X = (ushort)(r.RegionLocX / Constants.RegionSize); | 1191 | block.X = (ushort)(r.RegionLocX / Constants.RegionSize); |
1473 | block.Y = (ushort)(r.RegionLocY / Constants.RegionSize); | 1192 | block.Y = (ushort)(r.RegionLocY / Constants.RegionSize); |
1474 | block.SizeX = (ushort)r.RegionSizeX; | 1193 | block.SizeX = (ushort)r.RegionSizeX; |
@@ -1508,45 +1227,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1508 | blocks.Add(block); | 1227 | blocks.Add(block); |
1509 | } | 1228 | } |
1510 | return blocks; | 1229 | return blocks; |
1511 | >>>>>>> avn/ubitvar | ||
1512 | } | 1230 | } |
1513 | 1231 | ||
1514 | public List<MapBlockData> Map2BlockFromGridRegion(GridRegion r, uint flag) | ||
1515 | { | ||
1516 | List<MapBlockData> blocks = new List<MapBlockData>(); | ||
1517 | MapBlockData block = new MapBlockData(); | ||
1518 | if (r == null) | ||
1519 | { | ||
1520 | block.Access = (byte)SimAccess.Down; | ||
1521 | block.MapImageId = UUID.Zero; | ||
1522 | blocks.Add(block); | ||
1523 | } | ||
1524 | else | ||
1525 | { | ||
1526 | block.Access = r.Access; | ||
1527 | switch (flag & 0xffff) | ||
1528 | { | ||
1529 | case 0: | ||
1530 | block.MapImageId = r.TerrainImage; | ||
1531 | break; | ||
1532 | case 2: | ||
1533 | block.MapImageId = r.ParcelImage; | ||
1534 | break; | ||
1535 | default: | ||
1536 | block.MapImageId = UUID.Zero; | ||
1537 | break; | ||
1538 | } | ||
1539 | block.Name = r.RegionName; | ||
1540 | block.X = (ushort)(r.RegionLocX / Constants.RegionSize); | ||
1541 | block.Y = (ushort)(r.RegionLocY / Constants.RegionSize); | ||
1542 | block.SizeX = (ushort)r.RegionSizeX; | ||
1543 | block.SizeY = (ushort)r.RegionSizeY; | ||
1544 | blocks.Add(block); | ||
1545 | } | ||
1546 | return blocks; | ||
1547 | } | ||
1548 | |||
1549 | |||
1550 | public Hashtable OnHTTPThrottled(Hashtable keysvals) | 1232 | public Hashtable OnHTTPThrottled(Hashtable keysvals) |
1551 | { | 1233 | { |
1552 | Hashtable reply = new Hashtable(); | 1234 | Hashtable reply = new Hashtable(); |
@@ -1681,7 +1363,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1681 | 1363 | ||
1682 | foreach (GridRegion r in regions) | 1364 | foreach (GridRegion r in regions) |
1683 | { | 1365 | { |
1684 | MapBlockData mapBlock = MapBlockFromGridRegion(r, 0); | 1366 | MapBlockData mapBlock = new MapBlockData(); |
1367 | MapBlockFromGridRegion(mapBlock, r , 0); | ||
1685 | AssetBase texAsset = m_scene.AssetService.Get(mapBlock.MapImageId.ToString()); | 1368 | AssetBase texAsset = m_scene.AssetService.Get(mapBlock.MapImageId.ToString()); |
1686 | 1369 | ||
1687 | if (texAsset != null) | 1370 | if (texAsset != null) |
@@ -1752,13 +1435,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1752 | uint xstart = 0; | 1435 | uint xstart = 0; |
1753 | uint ystart = 0; | 1436 | uint ystart = 0; |
1754 | 1437 | ||
1755 | <<<<<<< HEAD | ||
1756 | Util.RegionHandleToWorldLoc(m_scene.RegionInfo.RegionHandle,out xstart,out ystart); | ||
1757 | // m_log.DebugFormat("{0} HandleRemoteMapItemRequest. loc=<{1},{2}>", | ||
1758 | // LogHeader, Util.WorldToRegionLoc(xstart), Util.WorldToRegionLoc(ystart)); | ||
1759 | ======= | ||
1760 | Util.RegionHandleToWorldLoc(m_scene.RegionInfo.RegionHandle, out xstart, out ystart); | 1438 | Util.RegionHandleToWorldLoc(m_scene.RegionInfo.RegionHandle, out xstart, out ystart); |
1761 | >>>>>>> avn/ubitvar | ||
1762 | 1439 | ||
1763 | // Service 6 (MAP_ITEM_AGENTS_LOCATION; green dots) | 1440 | // Service 6 (MAP_ITEM_AGENTS_LOCATION; green dots) |
1764 | 1441 | ||
@@ -1878,7 +1555,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1878 | return; | 1555 | return; |
1879 | 1556 | ||
1880 | m_log.DebugFormat("[WORLD MAP]: Generating map image for {0}", m_scene.Name); | 1557 | m_log.DebugFormat("[WORLD MAP]: Generating map image for {0}", m_scene.Name); |
1881 | <<<<<<< HEAD | ||
1882 | 1558 | ||
1883 | using (Bitmap mapbmp = m_mapImageGenerator.CreateMapTile()) | 1559 | using (Bitmap mapbmp = m_mapImageGenerator.CreateMapTile()) |
1884 | { | 1560 | { |
@@ -1894,23 +1570,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1894 | { | 1570 | { |
1895 | byte[] data; | 1571 | byte[] data; |
1896 | 1572 | ||
1897 | ======= | ||
1898 | |||
1899 | using (Bitmap mapbmp = m_mapImageGenerator.CreateMapTile()) | ||
1900 | { | ||
1901 | // V1 (This Module) | ||
1902 | GenerateMaptile(mapbmp); | ||
1903 | |||
1904 | // v2/3 (MapImageServiceModule) | ||
1905 | m_mapImageServiceModule.UploadMapTile(m_scene, mapbmp); | ||
1906 | } | ||
1907 | } | ||
1908 | |||
1909 | private void GenerateMaptile(Bitmap mapbmp) | ||
1910 | { | ||
1911 | byte[] data; | ||
1912 | |||
1913 | >>>>>>> avn/ubitvar | ||
1914 | try | 1573 | try |
1915 | { | 1574 | { |
1916 | data = OpenJPEG.EncodeFromImage(mapbmp, true); | 1575 | data = OpenJPEG.EncodeFromImage(mapbmp, true); |
@@ -2027,11 +1686,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
2027 | int regionSizeX = (int)m_scene.RegionInfo.RegionSizeX; | 1686 | int regionSizeX = (int)m_scene.RegionInfo.RegionSizeX; |
2028 | int regionSizeY = (int)m_scene.RegionInfo.RegionSizeY; | 1687 | int regionSizeY = (int)m_scene.RegionInfo.RegionSizeY; |
2029 | 1688 | ||
2030 | <<<<<<< HEAD | ||
2031 | int landTileSize = LandManagementModule.LandUnit; | 1689 | int landTileSize = LandManagementModule.LandUnit; |
2032 | ======= | ||
2033 | int landTileSize = LandManagementModule.landUnit; | ||
2034 | >>>>>>> avn/ubitvar | ||
2035 | int regionLandTilesX = regionSizeX / landTileSize; | 1690 | int regionLandTilesX = regionSizeX / landTileSize; |
2036 | int regionLandTilesY = regionSizeY / landTileSize; | 1691 | int regionLandTilesY = regionSizeY / landTileSize; |
2037 | 1692 | ||
@@ -2054,10 +1709,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
2054 | { | 1709 | { |
2055 | using (SolidBrush transparent = new SolidBrush(background)) | 1710 | using (SolidBrush transparent = new SolidBrush(background)) |
2056 | g.FillRectangle(transparent, 0, 0, regionSizeX, regionSizeY); | 1711 | g.FillRectangle(transparent, 0, 0, regionSizeX, regionSizeY); |
2057 | <<<<<<< HEAD | ||
2058 | ======= | ||
2059 | |||
2060 | >>>>>>> avn/ubitvar | ||
2061 | 1712 | ||
2062 | foreach (ILandObject land in parcels) | 1713 | foreach (ILandObject land in parcels) |
2063 | { | 1714 | { |
@@ -2080,17 +1731,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
2080 | 1731 | ||
2081 | using (SolidBrush yellow = new SolidBrush(Color.FromArgb(255, 249, 223, 9))) | 1732 | using (SolidBrush yellow = new SolidBrush(Color.FromArgb(255, 249, 223, 9))) |
2082 | { | 1733 | { |
2083 | <<<<<<< HEAD | ||
2084 | for (int x = 0 ; x < regionLandTilesX ; x++) | ||
2085 | { | ||
2086 | for (int y = 0 ; y < regionLandTilesY ; y++) | ||
2087 | { | ||
2088 | if (saleBitmap[x, y]) | ||
2089 | g.FillRectangle( | ||
2090 | yellow, x * landTileSize, | ||
2091 | regionSizeX - landTileSize - (y * landTileSize), | ||
2092 | landTileSize, | ||
2093 | ======= | ||
2094 | for (int x = 0; x < regionLandTilesX ; x++) | 1734 | for (int x = 0; x < regionLandTilesX ; x++) |
2095 | { | 1735 | { |
2096 | for (int y = 0; y < regionLandTilesY ; y++) | 1736 | for (int y = 0; y < regionLandTilesY ; y++) |
@@ -2101,7 +1741,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
2101 | x * landTileSize, | 1741 | x * landTileSize, |
2102 | regionSizeX - landTileSize - (y * landTileSize), | 1742 | regionSizeX - landTileSize - (y * landTileSize), |
2103 | landTileSize, | 1743 | landTileSize, |
2104 | >>>>>>> avn/ubitvar | ||
2105 | landTileSize); | 1744 | landTileSize); |
2106 | } | 1745 | } |
2107 | } | 1746 | } |