diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/World/WorldMap')
-rw-r--r-- | OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs | 30 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | 98 |
2 files changed, 90 insertions, 38 deletions
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs index 4783b35..436f332 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs | |||
@@ -33,6 +33,8 @@ using OpenSim.Framework; | |||
33 | using OpenSim.Region.Framework.Interfaces; | 33 | using OpenSim.Region.Framework.Interfaces; |
34 | using OpenSim.Region.Framework.Scenes; | 34 | using OpenSim.Region.Framework.Scenes; |
35 | using OpenSim.Region.Framework.Scenes.Hypergrid; | 35 | using OpenSim.Region.Framework.Scenes.Hypergrid; |
36 | using OpenSim.Services.Interfaces; | ||
37 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
36 | 38 | ||
37 | namespace OpenSim.Region.CoreModules.World.WorldMap | 39 | namespace OpenSim.Region.CoreModules.World.WorldMap |
38 | { | 40 | { |
@@ -92,13 +94,13 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
92 | } | 94 | } |
93 | 95 | ||
94 | // try to fetch from GridServer | 96 | // try to fetch from GridServer |
95 | List<RegionInfo> regionInfos = m_scene.SceneGridService.RequestNamedRegions(mapName, 20); | 97 | List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(UUID.Zero, mapName, 20); |
96 | if (regionInfos == null) | 98 | if (regionInfos == null) |
97 | { | 99 | { |
98 | m_log.Warn("[MAPSEARCHMODULE]: RequestNamedRegions returned null. Old gridserver?"); | 100 | m_log.Warn("[MAPSEARCHMODULE]: RequestNamedRegions returned null. Old gridserver?"); |
99 | // service wasn't available; maybe still an old GridServer. Try the old API, though it will return only one region | 101 | // service wasn't available; maybe still an old GridServer. Try the old API, though it will return only one region |
100 | regionInfos = new List<RegionInfo>(); | 102 | regionInfos = new List<GridRegion>(); |
101 | RegionInfo info = m_scene.SceneGridService.RequestClosestRegion(mapName); | 103 | GridRegion info = m_scene.GridService.GetRegionByName(UUID.Zero, mapName); |
102 | if (info != null) regionInfos.Add(info); | 104 | if (info != null) regionInfos.Add(info); |
103 | } | 105 | } |
104 | 106 | ||
@@ -109,11 +111,15 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
109 | if (mapName.Contains(".") && mapName.Contains(":")) | 111 | if (mapName.Contains(".") && mapName.Contains(":")) |
110 | { | 112 | { |
111 | // It probably is a domain name. Try to link to it. | 113 | // It probably is a domain name. Try to link to it. |
112 | RegionInfo regInfo; | 114 | GridRegion regInfo; |
113 | Scene cScene = GetClientScene(remoteClient); | 115 | Scene cScene = GetClientScene(remoteClient); |
114 | regInfo = HGHyperlink.TryLinkRegion(cScene, remoteClient, mapName); | 116 | IHyperlinkService hyperService = cScene.RequestModuleInterface<IHyperlinkService>(); |
115 | if (regInfo != null) | 117 | if (hyperService != null) |
116 | regionInfos.Add(regInfo); | 118 | { |
119 | regInfo = hyperService.TryLinkRegion(remoteClient, mapName); | ||
120 | if (regInfo != null) | ||
121 | regionInfos.Add(regInfo); | ||
122 | } | ||
117 | } | 123 | } |
118 | } | 124 | } |
119 | 125 | ||
@@ -122,17 +128,17 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
122 | MapBlockData data; | 128 | MapBlockData data; |
123 | if (regionInfos.Count > 0) | 129 | if (regionInfos.Count > 0) |
124 | { | 130 | { |
125 | foreach (RegionInfo info in regionInfos) | 131 | foreach (GridRegion info in regionInfos) |
126 | { | 132 | { |
127 | data = new MapBlockData(); | 133 | data = new MapBlockData(); |
128 | data.Agents = 0; | 134 | data.Agents = 0; |
129 | data.Access = info.AccessLevel; | 135 | data.Access = info.Access; |
130 | data.MapImageId = info.RegionSettings.TerrainImageID; | 136 | data.MapImageId = info.TerrainImage; |
131 | data.Name = info.RegionName; | 137 | data.Name = info.RegionName; |
132 | data.RegionFlags = 0; // TODO not used? | 138 | data.RegionFlags = 0; // TODO not used? |
133 | data.WaterHeight = 0; // not used | 139 | data.WaterHeight = 0; // not used |
134 | data.X = (ushort)info.RegionLocX; | 140 | data.X = (ushort)(info.RegionLocX / Constants.RegionSize); |
135 | data.Y = (ushort)info.RegionLocY; | 141 | data.Y = (ushort)(info.RegionLocY / Constants.RegionSize); |
136 | blocks.Add(data); | 142 | blocks.Add(data); |
137 | } | 143 | } |
138 | } | 144 | } |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 1f25f28..05ed70a 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | |||
@@ -48,6 +48,7 @@ using OpenSim.Region.Framework.Scenes; | |||
48 | using Caps=OpenSim.Framework.Capabilities.Caps; | 48 | using Caps=OpenSim.Framework.Capabilities.Caps; |
49 | using OSDArray=OpenMetaverse.StructuredData.OSDArray; | 49 | using OSDArray=OpenMetaverse.StructuredData.OSDArray; |
50 | using OSDMap=OpenMetaverse.StructuredData.OSDMap; | 50 | using OSDMap=OpenMetaverse.StructuredData.OSDMap; |
51 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
51 | 52 | ||
52 | namespace OpenSim.Region.CoreModules.World.WorldMap | 53 | namespace OpenSim.Region.CoreModules.World.WorldMap |
53 | { | 54 | { |
@@ -232,10 +233,20 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
232 | } | 233 | } |
233 | if (lookup) | 234 | if (lookup) |
234 | { | 235 | { |
235 | List<MapBlockData> mapBlocks; | 236 | List<MapBlockData> mapBlocks = new List<MapBlockData>(); ; |
236 | 237 | ||
237 | mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks((int)m_scene.RegionInfo.RegionLocX - 8, (int)m_scene.RegionInfo.RegionLocY - 8, (int)m_scene.RegionInfo.RegionLocX + 8, (int)m_scene.RegionInfo.RegionLocY + 8); | 238 | List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, |
238 | avatarPresence.ControllingClient.SendMapBlock(mapBlocks,0); | 239 | (int)(m_scene.RegionInfo.RegionLocX - 8) * (int)Constants.RegionSize, |
240 | (int)(m_scene.RegionInfo.RegionLocX + 8) * (int)Constants.RegionSize, | ||
241 | (int)(m_scene.RegionInfo.RegionLocY - 8) * (int)Constants.RegionSize, | ||
242 | (int)(m_scene.RegionInfo.RegionLocY + 8) * (int)Constants.RegionSize); | ||
243 | foreach (GridRegion r in regions) | ||
244 | { | ||
245 | MapBlockData block = new MapBlockData(); | ||
246 | MapBlockFromGridRegion(block, r); | ||
247 | mapBlocks.Add(block); | ||
248 | } | ||
249 | avatarPresence.ControllingClient.SendMapBlock(mapBlocks, 0); | ||
239 | 250 | ||
240 | lock (cachedMapBlocks) | 251 | lock (cachedMapBlocks) |
241 | cachedMapBlocks = mapBlocks; | 252 | cachedMapBlocks = mapBlocks; |
@@ -579,7 +590,9 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
579 | } | 590 | } |
580 | if (httpserver.Length == 0) | 591 | if (httpserver.Length == 0) |
581 | { | 592 | { |
582 | RegionInfo mreg = m_scene.SceneGridService.RequestNeighbouringRegionInfo(regionhandle); | 593 | uint x = 0, y = 0; |
594 | Utils.LongToUInts(regionhandle, out x, out y); | ||
595 | GridRegion mreg = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, (int)x, (int)y); | ||
583 | 596 | ||
584 | if (mreg != null) | 597 | if (mreg != null) |
585 | { | 598 | { |
@@ -719,15 +732,25 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
719 | { | 732 | { |
720 | List<MapBlockData> response = new List<MapBlockData>(); | 733 | List<MapBlockData> response = new List<MapBlockData>(); |
721 | 734 | ||
722 | // this should return one mapblock at most. But make sure: Look whether the one we requested is in there | 735 | // this should return one mapblock at most. |
723 | List<MapBlockData> mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks(minX, minY, maxX, maxY); | 736 | // (diva note: why?? in that case we should GetRegionByPosition) |
724 | if (mapBlocks != null) | 737 | // But make sure: Look whether the one we requested is in there |
738 | List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, | ||
739 | minX * (int)Constants.RegionSize, | ||
740 | maxX * (int)Constants.RegionSize, | ||
741 | minY * (int)Constants.RegionSize, | ||
742 | maxY * (int)Constants.RegionSize); | ||
743 | |||
744 | if (regions != null) | ||
725 | { | 745 | { |
726 | foreach (MapBlockData block in mapBlocks) | 746 | foreach (GridRegion r in regions) |
727 | { | 747 | { |
728 | if (block.X == minX && block.Y == minY) | 748 | if ((r.RegionLocX == minX * (int)Constants.RegionSize) && |
749 | (r.RegionLocY == minY * (int)Constants.RegionSize)) | ||
729 | { | 750 | { |
730 | // found it => add it to response | 751 | // found it => add it to response |
752 | MapBlockData block = new MapBlockData(); | ||
753 | MapBlockFromGridRegion(block, r); | ||
731 | response.Add(block); | 754 | response.Add(block); |
732 | break; | 755 | break; |
733 | } | 756 | } |
@@ -754,10 +777,30 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
754 | 777 | ||
755 | protected virtual void GetAndSendBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag) | 778 | protected virtual void GetAndSendBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag) |
756 | { | 779 | { |
757 | List<MapBlockData> mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks(minX - 4, minY - 4, maxX + 4, maxY + 4); | 780 | List<MapBlockData> mapBlocks = new List<MapBlockData>(); |
781 | List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, | ||
782 | (minX - 4) * (int)Constants.RegionSize, | ||
783 | (maxX + 4) * (int)Constants.RegionSize, | ||
784 | (minY - 4) * (int)Constants.RegionSize, | ||
785 | (maxY + 4) * (int)Constants.RegionSize); | ||
786 | foreach (GridRegion r in regions) | ||
787 | { | ||
788 | MapBlockData block = new MapBlockData(); | ||
789 | MapBlockFromGridRegion(block, r); | ||
790 | mapBlocks.Add(block); | ||
791 | } | ||
758 | remoteClient.SendMapBlock(mapBlocks, flag); | 792 | remoteClient.SendMapBlock(mapBlocks, flag); |
759 | } | 793 | } |
760 | 794 | ||
795 | protected void MapBlockFromGridRegion(MapBlockData block, GridRegion r) | ||
796 | { | ||
797 | block.Access = r.Access; | ||
798 | block.MapImageId = r.TerrainImage; | ||
799 | block.Name = r.RegionName; | ||
800 | block.X = (ushort)(r.RegionLocX / Constants.RegionSize); | ||
801 | block.Y = (ushort)(r.RegionLocY / Constants.RegionSize); | ||
802 | } | ||
803 | |||
761 | public Hashtable OnHTTPGetMapImage(Hashtable keysvals) | 804 | public Hashtable OnHTTPGetMapImage(Hashtable keysvals) |
762 | { | 805 | { |
763 | m_log.Debug("[WORLD MAP]: Sending map image jpeg"); | 806 | m_log.Debug("[WORLD MAP]: Sending map image jpeg"); |
@@ -874,31 +917,34 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
874 | m_log.InfoFormat( | 917 | m_log.InfoFormat( |
875 | "[WORLD MAP]: Exporting world map for {0} to {1}", m_scene.RegionInfo.RegionName, exportPath); | 918 | "[WORLD MAP]: Exporting world map for {0} to {1}", m_scene.RegionInfo.RegionName, exportPath); |
876 | 919 | ||
877 | List<MapBlockData> mapBlocks = | 920 | List<MapBlockData> mapBlocks = new List<MapBlockData>(); |
878 | m_scene.CommsManager.GridService.RequestNeighbourMapBlocks( | 921 | List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, |
879 | (int)(m_scene.RegionInfo.RegionLocX - 9), | 922 | (int)(m_scene.RegionInfo.RegionLocX - 9) * (int)Constants.RegionSize, |
880 | (int)(m_scene.RegionInfo.RegionLocY - 9), | 923 | (int)(m_scene.RegionInfo.RegionLocX + 9) * (int)Constants.RegionSize, |
881 | (int)(m_scene.RegionInfo.RegionLocX + 9), | 924 | (int)(m_scene.RegionInfo.RegionLocY - 9) * (int)Constants.RegionSize, |
882 | (int)(m_scene.RegionInfo.RegionLocY + 9)); | 925 | (int)(m_scene.RegionInfo.RegionLocY + 9) * (int)Constants.RegionSize); |
883 | List<AssetBase> textures = new List<AssetBase>(); | 926 | List<AssetBase> textures = new List<AssetBase>(); |
884 | List<Image> bitImages = new List<Image>(); | 927 | List<Image> bitImages = new List<Image>(); |
885 | 928 | ||
886 | foreach (MapBlockData mapBlock in mapBlocks) | 929 | foreach (GridRegion r in regions) |
887 | { | 930 | { |
931 | MapBlockData mapBlock = new MapBlockData(); | ||
932 | MapBlockFromGridRegion(mapBlock, r); | ||
888 | AssetBase texAsset = m_scene.AssetService.Get(mapBlock.MapImageId.ToString()); | 933 | AssetBase texAsset = m_scene.AssetService.Get(mapBlock.MapImageId.ToString()); |
889 | 934 | ||
890 | if (texAsset != null) | 935 | if (texAsset != null) |
891 | { | 936 | { |
892 | textures.Add(texAsset); | 937 | textures.Add(texAsset); |
893 | } | 938 | } |
894 | else | 939 | //else |
895 | { | 940 | //{ |
896 | texAsset = m_scene.AssetService.Get(mapBlock.MapImageId.ToString()); | 941 | // // WHAT?!? This doesn't seem right. Commenting (diva) |
897 | if (texAsset != null) | 942 | // texAsset = m_scene.AssetService.Get(mapBlock.MapImageId.ToString()); |
898 | { | 943 | // if (texAsset != null) |
899 | textures.Add(texAsset); | 944 | // { |
900 | } | 945 | // textures.Add(texAsset); |
901 | } | 946 | // } |
947 | //} | ||
902 | } | 948 | } |
903 | 949 | ||
904 | foreach (AssetBase asset in textures) | 950 | foreach (AssetBase asset in textures) |