diff options
-rw-r--r-- | OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs | 35 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | 138 |
2 files changed, 124 insertions, 49 deletions
diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs b/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs index e895178..15533ba 100644 --- a/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs +++ b/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs | |||
@@ -34,6 +34,8 @@ using Nini.Config; | |||
34 | using OpenMetaverse; | 34 | using OpenMetaverse; |
35 | using OpenMetaverse.Imaging; | 35 | using OpenMetaverse.Imaging; |
36 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
37 | using OpenSim.Region.Framework; | ||
38 | using OpenSim.Region.Framework.Interfaces; | ||
37 | using OpenSim.Region.Framework.Scenes; | 39 | using OpenSim.Region.Framework.Scenes; |
38 | 40 | ||
39 | namespace OpenSim.Region.CoreModules.World.LegacyMap | 41 | namespace OpenSim.Region.CoreModules.World.LegacyMap |
@@ -271,7 +273,8 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
271 | 273 | ||
272 | // the heigthfield might have some jumps in values. Rendered land is smooth, though, | 274 | // the heigthfield might have some jumps in values. Rendered land is smooth, though, |
273 | // as a slope is rendered at that place. So average 4 neighbour values to emulate that. | 275 | // as a slope is rendered at that place. So average 4 neighbour values to emulate that. |
274 | private float getHeight(double[,] hm, int x, int y) { | 276 | private float getHeight(ITerrainChannel hm, int x, int y) |
277 | { | ||
275 | if (x < ((int)Constants.RegionSize - 1) && y < ((int)Constants.RegionSize - 1)) | 278 | if (x < ((int)Constants.RegionSize - 1) && y < ((int)Constants.RegionSize - 1)) |
276 | return (float)(hm[x, y] * .444 + (hm[x + 1, y] + hm[x, y + 1]) * .222 + hm[x + 1, y +1] * .112); | 279 | return (float)(hm[x, y] * .444 + (hm[x + 1, y] + hm[x, y + 1]) * .222 + hm[x + 1, y +1] * .112); |
277 | else | 280 | else |
@@ -284,6 +287,14 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
284 | int tc = Environment.TickCount; | 287 | int tc = Environment.TickCount; |
285 | m_log.Debug("[TEXTURED MAP TILE RENDERER]: Generating Maptile Step 1: Terrain"); | 288 | m_log.Debug("[TEXTURED MAP TILE RENDERER]: Generating Maptile Step 1: Terrain"); |
286 | 289 | ||
290 | ITerrainChannel hm = m_scene.Heightmap; | ||
291 | |||
292 | if (mapbmp.Width != hm.Width || mapbmp.Height != hm.Height) | ||
293 | { | ||
294 | m_log.ErrorFormat("{0} TerrainToBitmap. Passed bitmap wrong dimensions. passed=<{1},{2}>, size=<{3},{4}>", | ||
295 | "[TEXTURED MAP TILE RENDERER]", mapbmp.Width, mapbmp.Height, hm.Width, hm.Height); | ||
296 | } | ||
297 | |||
287 | // These textures should be in the AssetCache anyway, as every client conneting to this | 298 | // These textures should be in the AssetCache anyway, as every client conneting to this |
288 | // region needs them. Except on start, when the map is recreated (before anyone connected), | 299 | // region needs them. Except on start, when the map is recreated (before anyone connected), |
289 | // and on change of the estate settings (textures and terrain values), when the map should | 300 | // and on change of the estate settings (textures and terrain values), when the map should |
@@ -310,19 +321,17 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
310 | 321 | ||
311 | float waterHeight = (float)settings.WaterHeight; | 322 | float waterHeight = (float)settings.WaterHeight; |
312 | 323 | ||
313 | double[,] hm = m_scene.Heightmap.GetDoubles(); | 324 | for (int x = 0; x < hm.Width; x++) |
314 | |||
315 | for (int x = 0; x < (int)Constants.RegionSize; x++) | ||
316 | { | 325 | { |
317 | float columnRatio = x / ((float)Constants.RegionSize - 1); // 0 - 1, for interpolation | 326 | float columnRatio = x / (hm.Width - 1); // 0 - 1, for interpolation |
318 | for (int y = 0; y < (int)Constants.RegionSize; y++) | 327 | for (int y = 0; y < hm.Height; y++) |
319 | { | 328 | { |
320 | float rowRatio = y / ((float)Constants.RegionSize - 1); // 0 - 1, for interpolation | 329 | float rowRatio = y / (hm.Height - 1); // 0 - 1, for interpolation |
321 | 330 | ||
322 | // Y flip the cordinates for the bitmap: hf origin is lower left, bm origin is upper left | 331 | // Y flip the cordinates for the bitmap: hf origin is lower left, bm origin is upper left |
323 | int yr = ((int)Constants.RegionSize - 1) - y; | 332 | int yr = (hm.Height - 1) - y; |
324 | 333 | ||
325 | float heightvalue = getHeight(hm, x, y); | 334 | float heightvalue = getHeight(m_scene.Heightmap, x, y); |
326 | if (Single.IsInfinity(heightvalue) || Single.IsNaN(heightvalue)) | 335 | if (Single.IsInfinity(heightvalue) || Single.IsNaN(heightvalue)) |
327 | heightvalue = 0; | 336 | heightvalue = 0; |
328 | 337 | ||
@@ -366,15 +375,15 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
366 | // first, rescale h to 0.0 - 1.0 | 375 | // first, rescale h to 0.0 - 1.0 |
367 | hmod = (hmod - low) / (high - low); | 376 | hmod = (hmod - low) / (high - low); |
368 | // now we have to split: 0.00 => color1, 0.33 => color2, 0.67 => color3, 1.00 => color4 | 377 | // now we have to split: 0.00 => color1, 0.33 => color2, 0.67 => color3, 1.00 => color4 |
369 | if (hmod < 1f/3f) hsv = interpolateHSV(ref hsv1, ref hsv2, hmod * 3f); | 378 | if (hmod < 1f / 3f) hsv = interpolateHSV(ref hsv1, ref hsv2, hmod * 3f); |
370 | else if (hmod < 2f/3f) hsv = interpolateHSV(ref hsv2, ref hsv3, (hmod * 3f) - 1f); | 379 | else if (hmod < 2f / 3f) hsv = interpolateHSV(ref hsv2, ref hsv3, (hmod * 3f) - 1f); |
371 | else hsv = interpolateHSV(ref hsv3, ref hsv4, (hmod * 3f) - 2f); | 380 | else hsv = interpolateHSV(ref hsv3, ref hsv4, (hmod * 3f) - 2f); |
372 | } | 381 | } |
373 | 382 | ||
374 | // Shade the terrain for shadows | 383 | // Shade the terrain for shadows |
375 | if (x < ((int)Constants.RegionSize - 1) && y < ((int)Constants.RegionSize - 1)) | 384 | if (x < (hm.Width - 1) && y < (hm.Height - 1)) |
376 | { | 385 | { |
377 | float hfvaluecompare = getHeight(hm, x + 1, y + 1); // light from north-east => look at land height there | 386 | float hfvaluecompare = getHeight(m_scene.Heightmap, x + 1, y + 1); // light from north-east => look at land height there |
378 | if (Single.IsInfinity(hfvaluecompare) || Single.IsNaN(hfvaluecompare)) | 387 | if (Single.IsInfinity(hfvaluecompare) || Single.IsNaN(hfvaluecompare)) |
379 | hfvaluecompare = 0f; | 388 | hfvaluecompare = 0f; |
380 | 389 | ||
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 7cb1b36..59529d8 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | |||
@@ -325,8 +325,10 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
325 | protected static OSDMapLayer GetOSDMapLayerResponse() | 325 | protected static OSDMapLayer GetOSDMapLayerResponse() |
326 | { | 326 | { |
327 | OSDMapLayer mapLayer = new OSDMapLayer(); | 327 | OSDMapLayer mapLayer = new OSDMapLayer(); |
328 | mapLayer.Right = 2048; | 328 | // mapLayer.Right = 2048; |
329 | mapLayer.Top = 2048; | 329 | mapLayer.Right = 5000; |
330 | // mapLayer.Top = 2048; | ||
331 | mapLayer.Top = 5000; | ||
330 | mapLayer.ImageID = new UUID("00000000-0000-1111-9999-000000000006"); | 332 | mapLayer.ImageID = new UUID("00000000-0000-1111-9999-000000000006"); |
331 | 333 | ||
332 | return mapLayer; | 334 | return mapLayer; |
@@ -438,7 +440,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
438 | } | 440 | } |
439 | uint xstart = 0; | 441 | uint xstart = 0; |
440 | uint ystart = 0; | 442 | uint ystart = 0; |
441 | Utils.LongToUInts(m_scene.RegionInfo.RegionHandle, out xstart, out ystart); | 443 | Util.RegionHandleToWorldLoc(m_scene.RegionInfo.RegionHandle, out xstart, out ystart); |
444 | |||
442 | if (itemtype == 6) // Service 6 right now (MAP_ITEM_AGENTS_LOCATION; green dots) | 445 | if (itemtype == 6) // Service 6 right now (MAP_ITEM_AGENTS_LOCATION; green dots) |
443 | { | 446 | { |
444 | if (regionhandle == 0 || regionhandle == m_scene.RegionInfo.RegionHandle) | 447 | if (regionhandle == 0 || regionhandle == m_scene.RegionInfo.RegionHandle) |
@@ -450,8 +453,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
450 | if (m_scene.GetRootAgentCount() <= 1) | 453 | if (m_scene.GetRootAgentCount() <= 1) |
451 | { | 454 | { |
452 | mapitem = new mapItemReply(); | 455 | mapitem = new mapItemReply(); |
453 | mapitem.x = (uint)(xstart + 1); | 456 | mapitem.x = xstart + 1; |
454 | mapitem.y = (uint)(ystart + 1); | 457 | mapitem.y = ystart + 1; |
455 | mapitem.id = UUID.Zero; | 458 | mapitem.id = UUID.Zero; |
456 | mapitem.name = Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()); | 459 | mapitem.name = Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()); |
457 | mapitem.Extra = 0; | 460 | mapitem.Extra = 0; |
@@ -466,8 +469,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
466 | if (sp.UUID != remoteClient.AgentId) | 469 | if (sp.UUID != remoteClient.AgentId) |
467 | { | 470 | { |
468 | mapitem = new mapItemReply(); | 471 | mapitem = new mapItemReply(); |
469 | mapitem.x = (uint)(xstart + sp.AbsolutePosition.X); | 472 | mapitem.x = xstart + (uint)sp.AbsolutePosition.X; |
470 | mapitem.y = (uint)(ystart + sp.AbsolutePosition.Y); | 473 | mapitem.y = ystart + (uint)sp.AbsolutePosition.Y; |
471 | mapitem.id = UUID.Zero; | 474 | mapitem.id = UUID.Zero; |
472 | mapitem.name = Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()); | 475 | mapitem.name = Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()); |
473 | mapitem.Extra = 1; | 476 | mapitem.Extra = 1; |
@@ -517,8 +520,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
517 | float y = (min.Y+max.Y)/2; | 520 | float y = (min.Y+max.Y)/2; |
518 | 521 | ||
519 | mapitem = new mapItemReply(); | 522 | mapitem = new mapItemReply(); |
520 | mapitem.x = (uint)(xstart + x); | 523 | mapitem.x = xstart + (uint)x; |
521 | mapitem.y = (uint)(ystart + y); | 524 | mapitem.y = ystart +(uint)y; |
522 | // mapitem.z = (uint)m_scene.GetGroundHeight(x,y); | 525 | // mapitem.z = (uint)m_scene.GetGroundHeight(x,y); |
523 | mapitem.id = parcel.GlobalID; | 526 | mapitem.id = parcel.GlobalID; |
524 | mapitem.name = parcel.Name; | 527 | mapitem.name = parcel.Name; |
@@ -549,8 +552,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
549 | if (sog != null) | 552 | if (sog != null) |
550 | { | 553 | { |
551 | mapitem = new mapItemReply(); | 554 | mapitem = new mapItemReply(); |
552 | mapitem.x = (uint)(xstart + sog.AbsolutePosition.X); | 555 | mapitem.x = xstart + (uint)sog.AbsolutePosition.X; |
553 | mapitem.y = (uint)(ystart + sog.AbsolutePosition.Y); | 556 | mapitem.y = ystart + (uint)sog.AbsolutePosition.Y; |
554 | mapitem.id = UUID.Zero; | 557 | mapitem.id = UUID.Zero; |
555 | mapitem.name = sog.Name; | 558 | mapitem.name = sog.Name; |
556 | mapitem.Extra = 0; // color (not used) | 559 | mapitem.Extra = 0; // color (not used) |
@@ -721,7 +724,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
721 | if (httpserver.Length == 0) | 724 | if (httpserver.Length == 0) |
722 | { | 725 | { |
723 | uint x = 0, y = 0; | 726 | uint x = 0, y = 0; |
724 | Utils.LongToUInts(regionhandle, out x, out y); | 727 | Util.RegionHandleToWorldLoc(regionhandle, out x, out y); |
725 | GridRegion mreg = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, (int)x, (int)y); | 728 | GridRegion mreg = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, (int)x, (int)y); |
726 | 729 | ||
727 | if (mreg != null) | 730 | if (mreg != null) |
@@ -801,6 +804,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
801 | catch (WebException ex) | 804 | catch (WebException ex) |
802 | { | 805 | { |
803 | m_log.WarnFormat("[WORLD MAP]: Bad send on GetMapItems {0}", ex.Message); | 806 | m_log.WarnFormat("[WORLD MAP]: Bad send on GetMapItems {0}", ex.Message); |
807 | responseMap["connect"] = OSD.FromBoolean(false); | ||
804 | lock (m_blacklistedurls) | 808 | lock (m_blacklistedurls) |
805 | { | 809 | { |
806 | if (!m_blacklistedurls.ContainsKey(httpserver)) | 810 | if (!m_blacklistedurls.ContainsKey(httpserver)) |
@@ -842,7 +846,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
842 | } | 846 | } |
843 | } | 847 | } |
844 | catch (WebException) | 848 | catch (WebException) |
845 | { | 849 | { |
846 | lock (m_blacklistedurls) | 850 | lock (m_blacklistedurls) |
847 | { | 851 | { |
848 | if (!m_blacklistedurls.ContainsKey(httpserver)) | 852 | if (!m_blacklistedurls.ContainsKey(httpserver)) |
@@ -996,22 +1000,27 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
996 | // on an unloaded square. | 1000 | // on an unloaded square. |
997 | // But make sure: Look whether the one we requested is in there | 1001 | // But make sure: Look whether the one we requested is in there |
998 | List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, | 1002 | List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, |
999 | minX * (int)Constants.RegionSize, | 1003 | (int)Util.RegionToWorldLoc((uint)minX), |
1000 | maxX * (int)Constants.RegionSize, | 1004 | (int)Util.RegionToWorldLoc((uint)maxX), |
1001 | minY * (int)Constants.RegionSize, | 1005 | (int)Util.RegionToWorldLoc((uint)minY), |
1002 | maxY * (int)Constants.RegionSize); | 1006 | (int)Util.RegionToWorldLoc((uint)maxY) ); |
1003 | 1007 | ||
1004 | if (regions != null) | 1008 | if (regions != null) |
1005 | { | 1009 | { |
1006 | foreach (GridRegion r in regions) | 1010 | foreach (GridRegion r in regions) |
1007 | { | 1011 | { |
1008 | if ((r.RegionLocX == minX * (int)Constants.RegionSize) && | 1012 | if (r.RegionLocX == Util.RegionToWorldLoc((uint)minX) && |
1009 | (r.RegionLocY == minY * (int)Constants.RegionSize)) | 1013 | r.RegionLocY == Util.RegionToWorldLoc((uint)minY)) |
1010 | { | 1014 | { |
1011 | // found it => add it to response | 1015 | // found it => add it to response |
1012 | MapBlockData block = new MapBlockData(); | 1016 | MapBlockData block = new MapBlockData(); |
1013 | MapBlockFromGridRegion(block, r, flag); | 1017 | if ((flag & 2) == 2) |
1014 | response.Add(block); | 1018 | response.AddRange(Map2BlockFromGridRegion(r, flag)); |
1019 | else | ||
1020 | { | ||
1021 | MapBlockFromGridRegion(block, r, flag); | ||
1022 | response.Add(block); | ||
1023 | } | ||
1015 | break; | 1024 | break; |
1016 | } | 1025 | } |
1017 | } | 1026 | } |
@@ -1023,7 +1032,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1023 | MapBlockData block = new MapBlockData(); | 1032 | MapBlockData block = new MapBlockData(); |
1024 | block.X = (ushort)minX; | 1033 | block.X = (ushort)minX; |
1025 | block.Y = (ushort)minY; | 1034 | block.Y = (ushort)minY; |
1026 | block.Access = 254; // means 'simulator is offline' | 1035 | block.Access = (byte)SimAccess.Down; // means 'simulator is offline' |
1027 | response.Add(block); | 1036 | response.Add(block); |
1028 | } | 1037 | } |
1029 | // The lower 16 bits are an unsigned int16 | 1038 | // The lower 16 bits are an unsigned int16 |
@@ -1109,9 +1118,18 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1109 | foreach (GridRegion r in regions) | 1118 | foreach (GridRegion r in regions) |
1110 | { | 1119 | { |
1111 | MapBlockData block = new MapBlockData(); | 1120 | MapBlockData block = new MapBlockData(); |
1112 | MapBlockFromGridRegion(block, r, flag); | 1121 | if ((flag & 2) == 2) |
1113 | mapBlocks.Add(block); | 1122 | { |
1114 | allBlocks.Add(block); | 1123 | List<MapBlockData> blocks = Map2BlockFromGridRegion(r, flag); |
1124 | mapBlocks.AddRange(blocks); | ||
1125 | allBlocks.AddRange(blocks); | ||
1126 | } | ||
1127 | else | ||
1128 | { | ||
1129 | MapBlockFromGridRegion(block, r, flag); | ||
1130 | mapBlocks.Add(block); | ||
1131 | allBlocks.Add(block); | ||
1132 | } | ||
1115 | if (mapBlocks.Count >= 10) | 1133 | if (mapBlocks.Count >= 10) |
1116 | { | 1134 | { |
1117 | remoteClient.SendMapBlock(mapBlocks, flag & 0xffff); | 1135 | remoteClient.SendMapBlock(mapBlocks, flag & 0xffff); |
@@ -1147,6 +1165,41 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1147 | block.SizeY = (ushort)r.RegionSizeY; | 1165 | block.SizeY = (ushort)r.RegionSizeY; |
1148 | } | 1166 | } |
1149 | 1167 | ||
1168 | public List<MapBlockData> Map2BlockFromGridRegion(GridRegion r, uint flag) | ||
1169 | { | ||
1170 | List<MapBlockData> blocks = new List<MapBlockData>(); | ||
1171 | MapBlockData block = new MapBlockData(); | ||
1172 | if (r == null) | ||
1173 | { | ||
1174 | block.Access = (byte)SimAccess.Down; | ||
1175 | block.MapImageId = UUID.Zero; | ||
1176 | blocks.Add(block); | ||
1177 | } | ||
1178 | else | ||
1179 | { | ||
1180 | block.Access = r.Access; | ||
1181 | switch (flag & 0xffff) | ||
1182 | { | ||
1183 | case 0: | ||
1184 | block.MapImageId = r.TerrainImage; | ||
1185 | break; | ||
1186 | case 2: | ||
1187 | block.MapImageId = r.ParcelImage; | ||
1188 | break; | ||
1189 | default: | ||
1190 | block.MapImageId = UUID.Zero; | ||
1191 | break; | ||
1192 | } | ||
1193 | block.Name = r.RegionName; | ||
1194 | block.X = (ushort)(r.RegionLocX / Constants.RegionSize); | ||
1195 | block.Y = (ushort)(r.RegionLocY / Constants.RegionSize); | ||
1196 | block.SizeX = (ushort)r.RegionSizeX; | ||
1197 | block.SizeY = (ushort)r.RegionSizeY; | ||
1198 | blocks.Add(block); | ||
1199 | } | ||
1200 | return blocks; | ||
1201 | } | ||
1202 | |||
1150 | public Hashtable OnHTTPThrottled(Hashtable keysvals) | 1203 | public Hashtable OnHTTPThrottled(Hashtable keysvals) |
1151 | { | 1204 | { |
1152 | Hashtable reply = new Hashtable(); | 1205 | Hashtable reply = new Hashtable(); |
@@ -1166,7 +1219,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1166 | 1219 | ||
1167 | if (myMapImageJPEG.Length == 0) | 1220 | if (myMapImageJPEG.Length == 0) |
1168 | { | 1221 | { |
1169 | MemoryStream imgstream = new MemoryStream(); | 1222 | MemoryStream imgstream = null; |
1170 | Bitmap mapTexture = new Bitmap(1,1); | 1223 | Bitmap mapTexture = new Bitmap(1,1); |
1171 | ManagedImage managedImage; | 1224 | ManagedImage managedImage; |
1172 | Image image = (Image)mapTexture; | 1225 | Image image = (Image)mapTexture; |
@@ -1346,7 +1399,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1346 | uint xstart = 0; | 1399 | uint xstart = 0; |
1347 | uint ystart = 0; | 1400 | uint ystart = 0; |
1348 | 1401 | ||
1349 | Utils.LongToUInts(m_scene.RegionInfo.RegionHandle,out xstart,out ystart); | 1402 | Util.RegionHandleToWorldLoc(m_scene.RegionInfo.RegionHandle, out xstart, out ystart); |
1350 | 1403 | ||
1351 | // Service 6 (MAP_ITEM_AGENTS_LOCATION; green dots) | 1404 | // Service 6 (MAP_ITEM_AGENTS_LOCATION; green dots) |
1352 | 1405 | ||
@@ -1578,12 +1631,20 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1578 | 1631 | ||
1579 | private Byte[] GenerateOverlay() | 1632 | private Byte[] GenerateOverlay() |
1580 | { | 1633 | { |
1581 | using (Bitmap overlay = new Bitmap(256, 256)) | 1634 | // These need to be ints for bitmap generation |
1635 | int regionSizeX = (int)m_scene.RegionInfo.RegionSizeX; | ||
1636 | int regionSizeY = (int)m_scene.RegionInfo.RegionSizeY; | ||
1637 | |||
1638 | int landTileSize = LandManagementModule.landUnit; | ||
1639 | int regionLandTilesX = regionSizeX / landTileSize; | ||
1640 | int regionLandTilesY = regionSizeY / landTileSize; | ||
1641 | |||
1642 | using (Bitmap overlay = new Bitmap(regionSizeX, regionSizeY)) | ||
1582 | { | 1643 | { |
1583 | bool[,] saleBitmap = new bool[64, 64]; | 1644 | bool[,] saleBitmap = new bool[regionLandTilesX, regionLandTilesY]; |
1584 | for (int x = 0 ; x < 64 ; x++) | 1645 | for (int x = 0; x < regionLandTilesX; x++) |
1585 | { | 1646 | { |
1586 | for (int y = 0 ; y < 64 ; y++) | 1647 | for (int y = 0; y < regionLandTilesY; y++) |
1587 | saleBitmap[x, y] = false; | 1648 | saleBitmap[x, y] = false; |
1588 | } | 1649 | } |
1589 | 1650 | ||
@@ -1596,7 +1657,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1596 | using (Graphics g = Graphics.FromImage(overlay)) | 1657 | using (Graphics g = Graphics.FromImage(overlay)) |
1597 | { | 1658 | { |
1598 | using (SolidBrush transparent = new SolidBrush(background)) | 1659 | using (SolidBrush transparent = new SolidBrush(background)) |
1599 | g.FillRectangle(transparent, 0, 0, 256, 256); | 1660 | g.FillRectangle(transparent, 0, 0, regionSizeX, regionSizeY); |
1600 | 1661 | ||
1601 | 1662 | ||
1602 | foreach (ILandObject land in parcels) | 1663 | foreach (ILandObject land in parcels) |
@@ -1620,12 +1681,17 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1620 | 1681 | ||
1621 | using (SolidBrush yellow = new SolidBrush(Color.FromArgb(255, 249, 223, 9))) | 1682 | using (SolidBrush yellow = new SolidBrush(Color.FromArgb(255, 249, 223, 9))) |
1622 | { | 1683 | { |
1623 | for (int x = 0 ; x < 64 ; x++) | 1684 | for (int x = 0; x < regionLandTilesX ; x++) |
1624 | { | 1685 | { |
1625 | for (int y = 0 ; y < 64 ; y++) | 1686 | for (int y = 0; y < regionLandTilesY ; y++) |
1626 | { | 1687 | { |
1627 | if (saleBitmap[x, y]) | 1688 | if (saleBitmap[x, y]) |
1628 | g.FillRectangle(yellow, x * 4, 252 - (y * 4), 4, 4); | 1689 | g.FillRectangle( |
1690 | yellow, | ||
1691 | x * landTileSize, | ||
1692 | regionSizeX - landTileSize - (y * landTileSize), | ||
1693 | landTileSize, | ||
1694 | landTileSize); | ||
1629 | } | 1695 | } |
1630 | } | 1696 | } |
1631 | } | 1697 | } |