aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/Hypergrid/HGWorldMapModule.cs
diff options
context:
space:
mode:
authorJeff Ames2008-11-25 16:00:55 +0000
committerJeff Ames2008-11-25 16:00:55 +0000
commit518a8b9f2ac09a5060e2e59c913dfbe7faf397ef (patch)
tree8b3e39fbd54452e031873d31ff099e7db064cdee /OpenSim/Region/Environment/Modules/Hypergrid/HGWorldMapModule.cs
parent* minor: eliminate mono compiler warnings (diff)
downloadopensim-SC-518a8b9f2ac09a5060e2e59c913dfbe7faf397ef.zip
opensim-SC-518a8b9f2ac09a5060e2e59c913dfbe7faf397ef.tar.gz
opensim-SC-518a8b9f2ac09a5060e2e59c913dfbe7faf397ef.tar.bz2
opensim-SC-518a8b9f2ac09a5060e2e59c913dfbe7faf397ef.tar.xz
Update svn properties.
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Hypergrid/HGWorldMapModule.cs')
-rw-r--r--OpenSim/Region/Environment/Modules/Hypergrid/HGWorldMapModule.cs356
1 files changed, 178 insertions, 178 deletions
diff --git a/OpenSim/Region/Environment/Modules/Hypergrid/HGWorldMapModule.cs b/OpenSim/Region/Environment/Modules/Hypergrid/HGWorldMapModule.cs
index 7f8f285..e642b7f 100644
--- a/OpenSim/Region/Environment/Modules/Hypergrid/HGWorldMapModule.cs
+++ b/OpenSim/Region/Environment/Modules/Hypergrid/HGWorldMapModule.cs
@@ -1,178 +1,178 @@
1/** 1/**
2 * Copyright (c) 2008, Contributors. All rights reserved. 2 * Copyright (c) 2008, Contributors. All rights reserved.
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without modification, 5 * Redistribution and use in source and binary forms, with or without modification,
6 * are permitted provided that the following conditions are met: 6 * are permitted provided that the following conditions are met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright notice, 8 * * Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright notice, 10 * * Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation 11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution. 12 * and/or other materials provided with the distribution.
13 * * Neither the name of the Organizations nor the names of Individual 13 * * Neither the name of the Organizations nor the names of Individual
14 * Contributors may be used to endorse or promote products derived from 14 * Contributors may be used to endorse or promote products derived from
15 * this software without specific prior written permission. 15 * this software without specific prior written permission.
16 * 16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
20 * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 21 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
22 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 24 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
25 * OF THE POSSIBILITY OF SUCH DAMAGE. 25 * OF THE POSSIBILITY OF SUCH DAMAGE.
26 * 26 *
27 */ 27 */
28 28
29 29
30using System; 30using System;
31using System.Collections; 31using System.Collections;
32using System.Collections.Generic; 32using System.Collections.Generic;
33using System.Drawing; 33using System.Drawing;
34using System.Drawing.Imaging; 34using System.Drawing.Imaging;
35using System.IO; 35using System.IO;
36using System.Net; 36using System.Net;
37using System.Reflection; 37using System.Reflection;
38using System.Threading; 38using System.Threading;
39using OpenMetaverse; 39using OpenMetaverse;
40using OpenMetaverse.Imaging; 40using OpenMetaverse.Imaging;
41using OpenMetaverse.StructuredData; 41using OpenMetaverse.StructuredData;
42using log4net; 42using log4net;
43using Nini.Config; 43using Nini.Config;
44using Nwc.XmlRpc; 44using Nwc.XmlRpc;
45 45
46using OpenSim.Framework; 46using OpenSim.Framework;
47using OpenSim.Framework.Communications.Cache; 47using OpenSim.Framework.Communications.Cache;
48using OpenSim.Framework.Communications.Capabilities; 48using OpenSim.Framework.Communications.Capabilities;
49using OpenSim.Framework.Servers; 49using OpenSim.Framework.Servers;
50using OpenSim.Region.Environment.Interfaces; 50using OpenSim.Region.Environment.Interfaces;
51using OpenSim.Region.Environment.Modules.World.WorldMap; 51using OpenSim.Region.Environment.Modules.World.WorldMap;
52using OpenSim.Region.Environment.Scenes; 52using OpenSim.Region.Environment.Scenes;
53using OpenSim.Region.Environment.Types; 53using OpenSim.Region.Environment.Types;
54using Caps = OpenSim.Framework.Communications.Capabilities.Caps; 54using Caps = OpenSim.Framework.Communications.Capabilities.Caps;
55 55
56using OSD = OpenMetaverse.StructuredData.OSD; 56using OSD = OpenMetaverse.StructuredData.OSD;
57using OSDMap = OpenMetaverse.StructuredData.OSDMap; 57using OSDMap = OpenMetaverse.StructuredData.OSDMap;
58using OSDArray = OpenMetaverse.StructuredData.OSDArray; 58using OSDArray = OpenMetaverse.StructuredData.OSDArray;
59 59
60namespace OpenSim.Region.Environment.Modules.Hypergrid 60namespace OpenSim.Region.Environment.Modules.Hypergrid
61{ 61{
62 public class HGWorldMapModule : WorldMapModule, IRegionModule 62 public class HGWorldMapModule : WorldMapModule, IRegionModule
63 { 63 {
64 private static readonly ILog m_log = 64 private static readonly ILog m_log =
65 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 65 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
66 66
67 #region IRegionModule Members 67 #region IRegionModule Members
68 68
69 public override void Initialise(Scene scene, IConfigSource config) 69 public override void Initialise(Scene scene, IConfigSource config)
70 { 70 {
71 IConfig startupConfig = config.Configs["Startup"]; 71 IConfig startupConfig = config.Configs["Startup"];
72 if (startupConfig.GetString("WorldMapModule", "WorldMap") == "HGWorldMap") 72 if (startupConfig.GetString("WorldMapModule", "WorldMap") == "HGWorldMap")
73 m_Enabled = true; 73 m_Enabled = true;
74 74
75 if (!m_Enabled) 75 if (!m_Enabled)
76 return; 76 return;
77 m_log.Info("[HGMap] Initializing..."); 77 m_log.Info("[HGMap] Initializing...");
78 m_scene = scene; 78 m_scene = scene;
79 } 79 }
80 80
81 81
82 public override string Name 82 public override string Name
83 { 83 {
84 get { return "HGWorldMap"; } 84 get { return "HGWorldMap"; }
85 } 85 }
86 86
87 87
88 #endregion 88 #endregion
89 89
90 /// <summary> 90 /// <summary>
91 /// Requests map blocks in area of minX, maxX, minY, MaxY in world cordinates 91 /// Requests map blocks in area of minX, maxX, minY, MaxY in world cordinates
92 /// </summary> 92 /// </summary>
93 /// <param name="minX"></param> 93 /// <param name="minX"></param>
94 /// <param name="minY"></param> 94 /// <param name="minY"></param>
95 /// <param name="maxX"></param> 95 /// <param name="maxX"></param>
96 /// <param name="maxY"></param> 96 /// <param name="maxY"></param>
97 public override void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag) 97 public override void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag)
98 { 98 {
99 // 99 //
100 // WARNING!!! COPY & PASTE FROM SUPERCLASS 100 // WARNING!!! COPY & PASTE FROM SUPERCLASS
101 // The only difference is at the very end 101 // The only difference is at the very end
102 // 102 //
103 103
104 m_log.Info("[HGMap]: Request map blocks " + minX + "-" + maxX + " " + minY + "-" + maxY); 104 m_log.Info("[HGMap]: Request map blocks " + minX + "-" + maxX + " " + minY + "-" + maxY);
105 105
106 //m_scene.ForEachScenePresence(delegate (ScenePresence sp) { 106 //m_scene.ForEachScenePresence(delegate (ScenePresence sp) {
107 // if (!sp.IsChildAgent && sp.UUID == remoteClient.AgentId) 107 // if (!sp.IsChildAgent && sp.UUID == remoteClient.AgentId)
108 // { 108 // {
109 // Console.WriteLine("XXX Root agent"); 109 // Console.WriteLine("XXX Root agent");
110 // DoRequestMapBlocks(remoteClient, minX, minY, maxX, maxY, flag); 110 // DoRequestMapBlocks(remoteClient, minX, minY, maxX, maxY, flag);
111 // } 111 // }
112 //}; 112 //};
113 113
114 List<MapBlockData> mapBlocks; 114 List<MapBlockData> mapBlocks;
115 if ((flag & 0x10000) != 0) // user clicked on the map a tile that isn't visible 115 if ((flag & 0x10000) != 0) // user clicked on the map a tile that isn't visible
116 { 116 {
117 List<MapBlockData> response = new List<MapBlockData>(); 117 List<MapBlockData> response = new List<MapBlockData>();
118 118
119 // this should return one mapblock at most. But make sure: Look whether the one we requested is in there 119 // this should return one mapblock at most. But make sure: Look whether the one we requested is in there
120 mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks(minX, minY, maxX, maxY); 120 mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks(minX, minY, maxX, maxY);
121 if (mapBlocks != null) 121 if (mapBlocks != null)
122 { 122 {
123 foreach (MapBlockData block in mapBlocks) 123 foreach (MapBlockData block in mapBlocks)
124 { 124 {
125 if (block.X == minX && block.Y == minY) 125 if (block.X == minX && block.Y == minY)
126 { 126 {
127 // found it => add it to response 127 // found it => add it to response
128 response.Add(block); 128 response.Add(block);
129 break; 129 break;
130 } 130 }
131 } 131 }
132 } 132 }
133 response = mapBlocks; 133 response = mapBlocks;
134 if (response.Count == 0) 134 if (response.Count == 0)
135 { 135 {
136 // response still empty => couldn't find the map-tile the user clicked on => tell the client 136 // response still empty => couldn't find the map-tile the user clicked on => tell the client
137 MapBlockData block = new MapBlockData(); 137 MapBlockData block = new MapBlockData();
138 block.X = (ushort)minX; 138 block.X = (ushort)minX;
139 block.Y = (ushort)minY; 139 block.Y = (ushort)minY;
140 block.Access = 254; // == not there 140 block.Access = 254; // == not there
141 response.Add(block); 141 response.Add(block);
142 } 142 }
143 remoteClient.SendMapBlock(response, 0); 143 remoteClient.SendMapBlock(response, 0);
144 } 144 }
145 else 145 else
146 { 146 {
147 // normal mapblock request. Use the provided values 147 // normal mapblock request. Use the provided values
148 mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks(minX - 4, minY - 4, maxX + 4, maxY + 4); 148 mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks(minX - 4, minY - 4, maxX + 4, maxY + 4);
149 149
150 // Different from super 150 // Different from super
151 FillInMap(mapBlocks, minX, minY, maxX, maxY); 151 FillInMap(mapBlocks, minX, minY, maxX, maxY);
152 // 152 //
153 153
154 remoteClient.SendMapBlock(mapBlocks, flag); 154 remoteClient.SendMapBlock(mapBlocks, flag);
155 } 155 }
156 } 156 }
157 157
158 158
159 private void FillInMap(List<MapBlockData> mapBlocks, int minX, int minY, int maxX, int maxY) 159 private void FillInMap(List<MapBlockData> mapBlocks, int minX, int minY, int maxX, int maxY)
160 { 160 {
161 for (int x = minX; x <= maxX; x++) 161 for (int x = minX; x <= maxX; x++)
162 for (int y = minY; y <= maxY; y++) 162 for (int y = minY; y <= maxY; y++)
163 { 163 {
164 MapBlockData mblock = mapBlocks.Find(delegate(MapBlockData mb) { return ((mb.X == x) && (mb.Y == y)); }); 164 MapBlockData mblock = mapBlocks.Find(delegate(MapBlockData mb) { return ((mb.X == x) && (mb.Y == y)); });
165 if (mblock == null) 165 if (mblock == null)
166 { 166 {
167 mblock = new MapBlockData(); 167 mblock = new MapBlockData();
168 mblock.X = (ushort)x; 168 mblock.X = (ushort)x;
169 mblock.Y = (ushort)y; 169 mblock.Y = (ushort)y;
170 mblock.Name = ""; 170 mblock.Name = "";
171 mblock.Access = 254; // not here??? 171 mblock.Access = 254; // not here???
172 mblock.MapImageId = UUID.Zero; 172 mblock.MapImageId = UUID.Zero;
173 mapBlocks.Add(mblock); 173 mapBlocks.Add(mblock);
174 } 174 }
175 } 175 }
176 } 176 }
177 } 177 }
178} 178}