diff options
author | Melanie | 2014-01-28 21:02:20 +0000 |
---|---|---|
committer | Melanie | 2014-01-28 21:02:20 +0000 |
commit | c6e9db58669d773c85041db99b19b942f70324f7 (patch) | |
tree | 99f69fb669332cff69a45ce6f7473aed6d965a0d /OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | |
parent | Merge branch 'master' into careminster (diff) | |
parent | Merge branch 'justincc-master' (diff) | |
download | opensim-SC_OLD-c6e9db58669d773c85041db99b19b942f70324f7.zip opensim-SC_OLD-c6e9db58669d773c85041db99b19b942f70324f7.tar.gz opensim-SC_OLD-c6e9db58669d773c85041db99b19b942f70324f7.tar.bz2 opensim-SC_OLD-c6e9db58669d773c85041db99b19b942f70324f7.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Framework/RegionSettings.cs
OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
OpenSim/Region/Framework/Interfaces/IInterregionComms.cs
OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
Diffstat (limited to 'OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | 126 |
1 files changed, 61 insertions, 65 deletions
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 98fa763..5412359 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | |||
@@ -115,6 +115,11 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
115 | "export-map [<path>]", | 115 | "export-map [<path>]", |
116 | "Save an image of the world map", HandleExportWorldMapConsoleCommand); | 116 | "Save an image of the world map", HandleExportWorldMapConsoleCommand); |
117 | 117 | ||
118 | m_scene.AddCommand( | ||
119 | "Regions", this, "generate map", | ||
120 | "generate map", | ||
121 | "Generates and stores a new maptile.", HandleGenerateMapConsoleCommand); | ||
122 | |||
118 | AddHandlers(); | 123 | AddHandlers(); |
119 | } | 124 | } |
120 | } | 125 | } |
@@ -1324,6 +1329,16 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1324 | m_scene.RegionInfo.RegionName, exportPath); | 1329 | m_scene.RegionInfo.RegionName, exportPath); |
1325 | } | 1330 | } |
1326 | 1331 | ||
1332 | public void HandleGenerateMapConsoleCommand(string module, string[] cmdparams) | ||
1333 | { | ||
1334 | Scene consoleScene = m_scene.ConsoleScene(); | ||
1335 | |||
1336 | if (consoleScene != null && consoleScene != m_scene) | ||
1337 | return; | ||
1338 | |||
1339 | GenerateMaptile(); | ||
1340 | } | ||
1341 | |||
1327 | public OSD HandleRemoteMapItemRequest(string path, OSD request, string endpoint) | 1342 | public OSD HandleRemoteMapItemRequest(string path, OSD request, string endpoint) |
1328 | { | 1343 | { |
1329 | uint xstart = 0; | 1344 | uint xstart = 0; |
@@ -1561,88 +1576,69 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1561 | 1576 | ||
1562 | private Byte[] GenerateOverlay() | 1577 | private Byte[] GenerateOverlay() |
1563 | { | 1578 | { |
1564 | Bitmap overlay = new Bitmap(256, 256); | 1579 | using (Bitmap overlay = new Bitmap(256, 256)) |
1565 | |||
1566 | bool[,] saleBitmap = new bool[64, 64]; | ||
1567 | for (int x = 0 ; x < 64 ; x++) | ||
1568 | { | 1580 | { |
1569 | for (int y = 0 ; y < 64 ; y++) | 1581 | bool[,] saleBitmap = new bool[64, 64]; |
1570 | saleBitmap[x, y] = false; | 1582 | for (int x = 0 ; x < 64 ; x++) |
1571 | } | 1583 | { |
1572 | 1584 | for (int y = 0 ; y < 64 ; y++) | |
1573 | bool landForSale = false; | 1585 | saleBitmap[x, y] = false; |
1586 | } | ||
1574 | 1587 | ||
1575 | List<ILandObject> parcels = m_scene.LandChannel.AllParcels(); | 1588 | bool landForSale = false; |
1576 | 1589 | ||
1577 | Color background = Color.FromArgb(0, 0, 0, 0); | 1590 | List<ILandObject> parcels = m_scene.LandChannel.AllParcels(); |
1578 | SolidBrush transparent = new SolidBrush(background); | ||
1579 | Graphics g = Graphics.FromImage(overlay); | ||
1580 | g.FillRectangle(transparent, 0, 0, 255, 255); | ||
1581 | 1591 | ||
1582 | SolidBrush yellow = new SolidBrush(Color.FromArgb(255, 249, 223, 9)); | 1592 | Color background = Color.FromArgb(0, 0, 0, 0); |
1583 | Pen grey = new Pen(Color.FromArgb(255, 92, 92, 92)); | ||
1584 | 1593 | ||
1585 | foreach (ILandObject land in parcels) | 1594 | using (Graphics g = Graphics.FromImage(overlay)) |
1586 | { | ||
1587 | // m_log.DebugFormat("[WORLD MAP]: Parcel {0} flags {1}", land.LandData.Name, land.LandData.Flags); | ||
1588 | if ((land.LandData.Flags & (uint)ParcelFlags.ForSale) != 0) | ||
1589 | { | 1595 | { |
1590 | landForSale = true; | 1596 | using (SolidBrush transparent = new SolidBrush(background)) |
1591 | 1597 | g.FillRectangle(transparent, 0, 0, 256, 256); | |
1592 | bool[,] landBitmap = land.GetLandBitmap(); | 1598 | |
1599 | |||
1600 | foreach (ILandObject land in parcels) | ||
1601 | { | ||
1602 | // m_log.DebugFormat("[WORLD MAP]: Parcel {0} flags {1}", land.LandData.Name, land.LandData.Flags); | ||
1603 | if ((land.LandData.Flags & (uint)ParcelFlags.ForSale) != 0) | ||
1604 | { | ||
1605 | landForSale = true; | ||
1606 | |||
1607 | saleBitmap = land.MergeLandBitmaps(saleBitmap, land.GetLandBitmap()); | ||
1608 | } | ||
1609 | } | ||
1610 | |||
1611 | if (!landForSale) | ||
1612 | { | ||
1613 | m_log.DebugFormat("[WORLD MAP]: Region {0} has no parcels for sale, not generating overlay", m_scene.RegionInfo.RegionName); | ||
1614 | return null; | ||
1615 | } | ||
1616 | |||
1617 | m_log.DebugFormat("[WORLD MAP]: Region {0} has parcels for sale, generating overlay", m_scene.RegionInfo.RegionName); | ||
1593 | 1618 | ||
1594 | for (int x = 0 ; x < 64 ; x++) | 1619 | using (SolidBrush yellow = new SolidBrush(Color.FromArgb(255, 249, 223, 9))) |
1595 | { | 1620 | { |
1596 | for (int y = 0 ; y < 64 ; y++) | 1621 | for (int x = 0 ; x < 64 ; x++) |
1597 | { | 1622 | { |
1598 | if (landBitmap[x, y]) | 1623 | for (int y = 0 ; y < 64 ; y++) |
1599 | { | 1624 | { |
1600 | g.FillRectangle(yellow, x * 4, 252 - (y * 4), 4, 4); | 1625 | if (saleBitmap[x, y]) |
1601 | 1626 | g.FillRectangle(yellow, x * 4, 252 - (y * 4), 4, 4); | |
1602 | if (x > 0) | ||
1603 | { | ||
1604 | if ((saleBitmap[x - 1, y] || landBitmap[x - 1, y]) == false) | ||
1605 | g.DrawLine(grey, x * 4, 252 - (y * 4), x * 4, 255 - (y * 4)); | ||
1606 | } | ||
1607 | if (y > 0) | ||
1608 | { | ||
1609 | if ((saleBitmap[x, y-1] || landBitmap[x, y-1]) == false) | ||
1610 | g.DrawLine(grey, x * 4, 255 - (y * 4), x * 4 + 3, 255 - (y * 4)); | ||
1611 | } | ||
1612 | if (x < 63) | ||
1613 | { | ||
1614 | if ((saleBitmap[x + 1, y] || landBitmap[x + 1, y]) == false) | ||
1615 | g.DrawLine(grey, x * 4 + 3, 252 - (y * 4), x * 4 + 3, 255 - (y * 4)); | ||
1616 | } | ||
1617 | if (y < 63) | ||
1618 | { | ||
1619 | if ((saleBitmap[x, y + 1] || landBitmap[x, y + 1]) == false) | ||
1620 | g.DrawLine(grey, x * 4, 252 - (y * 4), x * 4 + 3, 252 - (y * 4)); | ||
1621 | } | ||
1622 | } | 1627 | } |
1623 | } | 1628 | } |
1624 | } | 1629 | } |
1625 | |||
1626 | saleBitmap = land.MergeLandBitmaps(saleBitmap, landBitmap); | ||
1627 | } | 1630 | } |
1628 | } | ||
1629 | 1631 | ||
1630 | if (!landForSale) | 1632 | try |
1631 | { | 1633 | { |
1632 | m_log.DebugFormat("[WORLD MAP]: Region {0} has no parcels for sale, not generating overlay", m_scene.RegionInfo.RegionName); | 1634 | return OpenJPEG.EncodeFromImage(overlay, true); |
1633 | return null; | 1635 | } |
1636 | catch (Exception e) | ||
1637 | { | ||
1638 | m_log.DebugFormat("[WORLD MAP]: Error creating parcel overlay: " + e.ToString()); | ||
1639 | } | ||
1634 | } | 1640 | } |
1635 | 1641 | ||
1636 | m_log.DebugFormat("[WORLD MAP]: Region {0} has parcels for sale, generating overlay", m_scene.RegionInfo.RegionName); | ||
1637 | |||
1638 | try | ||
1639 | { | ||
1640 | return OpenJPEG.EncodeFromImage(overlay, true); | ||
1641 | } | ||
1642 | catch (Exception e) | ||
1643 | { | ||
1644 | m_log.DebugFormat("[WORLD MAP]: Error creating parcel overlay: " + e.ToString()); | ||
1645 | } | ||
1646 | return null; | 1642 | return null; |
1647 | } | 1643 | } |
1648 | } | 1644 | } |