aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/World/WorldMap
diff options
context:
space:
mode:
authorTeravus Ovares2008-09-06 07:52:41 +0000
committerTeravus Ovares2008-09-06 07:52:41 +0000
commit7d89e122930be39e84a6d174548fa2d12ac0484a (patch)
treee5aa5752f988a9aba2a969f49e5e208985eda80c /OpenSim/Region/Environment/Modules/World/WorldMap
parent* minor: speculatively try a change to bamboo.build to see if this generates ... (diff)
downloadopensim-SC-7d89e122930be39e84a6d174548fa2d12ac0484a.zip
opensim-SC-7d89e122930be39e84a6d174548fa2d12ac0484a.tar.gz
opensim-SC-7d89e122930be39e84a6d174548fa2d12ac0484a.tar.bz2
opensim-SC-7d89e122930be39e84a6d174548fa2d12ac0484a.tar.xz
* This is the fabled LibOMV update with all of the libOMV types from JHurliman
* This is a HUGE OMG update and will definitely have unknown side effects.. so this is really only for the strong hearted at this point. Regular people should let the dust settle. * This has been tested to work with most basic functions. However.. make sure you back up 'everything' before using this. It's that big! * Essentially we're back at square 1 in the testing phase.. so lets identify things that broke.
Diffstat (limited to 'OpenSim/Region/Environment/Modules/World/WorldMap')
-rw-r--r--OpenSim/Region/Environment/Modules/World/WorldMap/MapImageModule.cs79
-rw-r--r--OpenSim/Region/Environment/Modules/World/WorldMap/ShadedMapTileRenderer.cs5
-rw-r--r--OpenSim/Region/Environment/Modules/World/WorldMap/TexturedMapTileRenderer.cs33
-rw-r--r--OpenSim/Region/Environment/Modules/World/WorldMap/WorldMapModule.cs49
4 files changed, 85 insertions, 81 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/WorldMap/MapImageModule.cs b/OpenSim/Region/Environment/Modules/World/WorldMap/MapImageModule.cs
index bfb5016..cfbe5ae 100644
--- a/OpenSim/Region/Environment/Modules/World/WorldMap/MapImageModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/WorldMap/MapImageModule.cs
@@ -32,13 +32,12 @@ using System.Drawing;
32using System.Drawing.Drawing2D; 32using System.Drawing.Drawing2D;
33using System.Drawing.Imaging; 33using System.Drawing.Imaging;
34using System.Reflection; 34using System.Reflection;
35using Axiom.Math;
36using Nini.Config; 35using Nini.Config;
36using OpenMetaverse.Imaging;
37using log4net; 37using log4net;
38using OpenJPEGNet;
39using OpenSim.Region.Environment.Interfaces; 38using OpenSim.Region.Environment.Interfaces;
40using OpenSim.Region.Environment.Scenes; 39using OpenSim.Region.Environment.Scenes;
41using libsecondlife; 40using OpenMetaverse;
42 41
43namespace OpenSim.Region.Environment.Modules.World.WorldMap 42namespace OpenSim.Region.Environment.Modules.World.WorldMap
44{ 43{
@@ -252,7 +251,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
252 if (part.Shape.Textures.DefaultTexture == null) 251 if (part.Shape.Textures.DefaultTexture == null)
253 continue; 252 continue;
254 253
255 LLColor texcolor = part.Shape.Textures.DefaultTexture.RGBA; 254 Color4 texcolor = part.Shape.Textures.DefaultTexture.RGBA;
256 255
257 // Not sure why some of these are null, oh well. 256 // Not sure why some of these are null, oh well.
258 257
@@ -265,7 +264,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
265 //Try to set the map spot color 264 //Try to set the map spot color
266 try 265 try
267 { 266 {
268 // If the color gets goofy somehow, skip it *shakes fist at LLColor 267 // If the color gets goofy somehow, skip it *shakes fist at Color4
269 mapdotspot = Color.FromArgb(colorr, colorg, colorb); 268 mapdotspot = Color.FromArgb(colorr, colorg, colorb);
270 } 269 }
271 catch (ArgumentException) 270 catch (ArgumentException)
@@ -282,7 +281,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
282 // Mono Array 281 // Mono Array
283 } 282 }
284 283
285 LLVector3 pos = part.GetWorldPosition(); 284 Vector3 pos = part.GetWorldPosition();
286 285
287 // skip prim outside of retion 286 // skip prim outside of retion
288 if (pos.X < 0f || pos.X > 256f || pos.Y < 0f || pos.Y > 256f) 287 if (pos.X < 0f || pos.X > 256f || pos.Y < 0f || pos.Y > 256f)
@@ -312,20 +311,20 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
312 Vector3 tScale = new Vector3(); 311 Vector3 tScale = new Vector3();
313 Vector3 axPos = new Vector3(pos.X,pos.Y,pos.Z); 312 Vector3 axPos = new Vector3(pos.X,pos.Y,pos.Z);
314 313
315 LLQuaternion llrot = part.GetWorldRotation(); 314 Quaternion llrot = part.GetWorldRotation();
316 Quaternion rot = new Quaternion(llrot.W, llrot.X, llrot.Y, llrot.Z); 315 Quaternion rot = new Quaternion(llrot.W, llrot.X, llrot.Y, llrot.Z);
317 scale = rot * lscale; 316 scale = lscale * rot;
318 317
319 // negative scales don't work in this situation 318 // negative scales don't work in this situation
320 scale.x = Math.Abs(scale.x); 319 scale.X = Math.Abs(scale.X);
321 scale.y = Math.Abs(scale.y); 320 scale.Y = Math.Abs(scale.Y);
322 scale.z = Math.Abs(scale.z); 321 scale.Z = Math.Abs(scale.Z);
323 322
324 // This scaling isn't very accurate and doesn't take into account the face rotation :P 323 // This scaling isn't very accurate and doesn't take into account the face rotation :P
325 int mapdrawstartX = (int)(pos.X - scale.x); 324 int mapdrawstartX = (int)(pos.X - scale.X);
326 int mapdrawstartY = (int)(pos.Y - scale.y); 325 int mapdrawstartY = (int)(pos.Y - scale.Y);
327 int mapdrawendX = (int)(pos.X + scale.x); 326 int mapdrawendX = (int)(pos.X + scale.X);
328 int mapdrawendY = (int)(pos.Y + scale.y); 327 int mapdrawendY = (int)(pos.Y + scale.Y);
329 328
330 // If object is beyond the edge of the map, don't draw it to avoid errors 329 // If object is beyond the edge of the map, don't draw it to avoid errors
331 if (mapdrawstartX < 0 || mapdrawstartX > 255 || mapdrawendX < 0 || mapdrawendX > 255 330 if (mapdrawstartX < 0 || mapdrawstartX > 255 || mapdrawendX < 0 || mapdrawendX > 255
@@ -342,9 +341,9 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
342 Vector3[] FaceC = new Vector3[6]; // vertex C for Facei 341 Vector3[] FaceC = new Vector3[6]; // vertex C for Facei
343 Vector3[] FaceD = new Vector3[6]; // vertex D for Facei 342 Vector3[] FaceD = new Vector3[6]; // vertex D for Facei
344 343
345 tScale = new Vector3(lscale.x, -lscale.y, lscale.z); 344 tScale = new Vector3(lscale.X, -lscale.Y, lscale.Z);
346 scale = ((rot * tScale)); 345 scale = ((tScale * rot));
347 vertexes[0] = (new Vector3((pos.X + scale.x), (pos.Y + scale.y), (pos.Z + scale.z))); 346 vertexes[0] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
348 // vertexes[0].x = pos.X + vertexes[0].x; 347 // vertexes[0].x = pos.X + vertexes[0].x;
349 //vertexes[0].y = pos.Y + vertexes[0].y; 348 //vertexes[0].y = pos.Y + vertexes[0].y;
350 //vertexes[0].z = pos.Z + vertexes[0].z; 349 //vertexes[0].z = pos.Z + vertexes[0].z;
@@ -354,8 +353,8 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
354 FaceA[4] = vertexes[0]; 353 FaceA[4] = vertexes[0];
355 354
356 tScale = lscale; 355 tScale = lscale;
357 scale = ((rot * tScale)); 356 scale = ((tScale * rot));
358 vertexes[1] = (new Vector3((pos.X + scale.x), (pos.Y + scale.y), (pos.Z + scale.z))); 357 vertexes[1] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
359 358
360 // vertexes[1].x = pos.X + vertexes[1].x; 359 // vertexes[1].x = pos.X + vertexes[1].x;
361 // vertexes[1].y = pos.Y + vertexes[1].y; 360 // vertexes[1].y = pos.Y + vertexes[1].y;
@@ -365,10 +364,10 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
365 FaceA[1] = vertexes[1]; 364 FaceA[1] = vertexes[1];
366 FaceC[4] = vertexes[1]; 365 FaceC[4] = vertexes[1];
367 366
368 tScale = new Vector3(lscale.x, -lscale.y, -lscale.z); 367 tScale = new Vector3(lscale.X, -lscale.Y, -lscale.Z);
369 scale = ((rot * tScale)); 368 scale = ((tScale * rot));
370 369
371 vertexes[2] = (new Vector3((pos.X + scale.x), (pos.Y + scale.y), (pos.Z + scale.z))); 370 vertexes[2] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
372 371
373 //vertexes[2].x = pos.X + vertexes[2].x; 372 //vertexes[2].x = pos.X + vertexes[2].x;
374 //vertexes[2].y = pos.Y + vertexes[2].y; 373 //vertexes[2].y = pos.Y + vertexes[2].y;
@@ -378,9 +377,9 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
378 FaceD[3] = vertexes[2]; 377 FaceD[3] = vertexes[2];
379 FaceC[5] = vertexes[2]; 378 FaceC[5] = vertexes[2];
380 379
381 tScale = new Vector3(lscale.x, lscale.y, -lscale.z); 380 tScale = new Vector3(lscale.X, lscale.Y, -lscale.Z);
382 scale = ((rot * tScale)); 381 scale = ((tScale * rot));
383 vertexes[3] = (new Vector3((pos.X + scale.x), (pos.Y + scale.y), (pos.Z + scale.z))); 382 vertexes[3] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
384 383
385 //vertexes[3].x = pos.X + vertexes[3].x; 384 //vertexes[3].x = pos.X + vertexes[3].x;
386 // vertexes[3].y = pos.Y + vertexes[3].y; 385 // vertexes[3].y = pos.Y + vertexes[3].y;
@@ -390,9 +389,9 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
390 FaceC[1] = vertexes[3]; 389 FaceC[1] = vertexes[3];
391 FaceA[5] = vertexes[3]; 390 FaceA[5] = vertexes[3];
392 391
393 tScale = new Vector3(-lscale.x, lscale.y, lscale.z); 392 tScale = new Vector3(-lscale.X, lscale.Y, lscale.Z);
394 scale = ((rot * tScale)); 393 scale = ((tScale * rot));
395 vertexes[4] = (new Vector3((pos.X + scale.x), (pos.Y + scale.y), (pos.Z + scale.z))); 394 vertexes[4] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
396 395
397 // vertexes[4].x = pos.X + vertexes[4].x; 396 // vertexes[4].x = pos.X + vertexes[4].x;
398 // vertexes[4].y = pos.Y + vertexes[4].y; 397 // vertexes[4].y = pos.Y + vertexes[4].y;
@@ -402,9 +401,9 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
402 FaceA[2] = vertexes[4]; 401 FaceA[2] = vertexes[4];
403 FaceD[4] = vertexes[4]; 402 FaceD[4] = vertexes[4];
404 403
405 tScale = new Vector3(-lscale.x, lscale.y, -lscale.z); 404 tScale = new Vector3(-lscale.X, lscale.Y, -lscale.Z);
406 scale = ((rot * tScale)); 405 scale = ((tScale * rot));
407 vertexes[5] = (new Vector3((pos.X + scale.x), (pos.Y + scale.y), (pos.Z + scale.z))); 406 vertexes[5] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
408 407
409 // vertexes[5].x = pos.X + vertexes[5].x; 408 // vertexes[5].x = pos.X + vertexes[5].x;
410 // vertexes[5].y = pos.Y + vertexes[5].y; 409 // vertexes[5].y = pos.Y + vertexes[5].y;
@@ -414,9 +413,9 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
414 FaceC[2] = vertexes[5]; 413 FaceC[2] = vertexes[5];
415 FaceB[5] = vertexes[5]; 414 FaceB[5] = vertexes[5];
416 415
417 tScale = new Vector3(-lscale.x, -lscale.y, lscale.z); 416 tScale = new Vector3(-lscale.X, -lscale.Y, lscale.Z);
418 scale = ((rot * tScale)); 417 scale = ((tScale * rot));
419 vertexes[6] = (new Vector3((pos.X + scale.x), (pos.Y + scale.y), (pos.Z + scale.z))); 418 vertexes[6] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
420 419
421 // vertexes[6].x = pos.X + vertexes[6].x; 420 // vertexes[6].x = pos.X + vertexes[6].x;
422 // vertexes[6].y = pos.Y + vertexes[6].y; 421 // vertexes[6].y = pos.Y + vertexes[6].y;
@@ -426,9 +425,9 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
426 FaceA[3] = vertexes[6]; 425 FaceA[3] = vertexes[6];
427 FaceB[4] = vertexes[6]; 426 FaceB[4] = vertexes[6];
428 427
429 tScale = new Vector3(-lscale.x, -lscale.y, -lscale.z); 428 tScale = new Vector3(-lscale.X, -lscale.Y, -lscale.Z);
430 scale = ((rot * tScale)); 429 scale = ((tScale * rot));
431 vertexes[7] = (new Vector3((pos.X + scale.x), (pos.Y + scale.y), (pos.Z + scale.z))); 430 vertexes[7] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
432 431
433 // vertexes[7].x = pos.X + vertexes[7].x; 432 // vertexes[7].x = pos.X + vertexes[7].x;
434 // vertexes[7].y = pos.Y + vertexes[7].y; 433 // vertexes[7].y = pos.Y + vertexes[7].y;
@@ -533,8 +532,8 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
533 //Vector3 topos = new Vector3(0, 0, 0); 532 //Vector3 topos = new Vector3(0, 0, 0);
534 // float z = -point3d.z - topos.z; 533 // float z = -point3d.z - topos.z;
535 534
536 returnpt.X = (int)point3d.x;//(int)((topos.x - point3d.x) / z * d); 535 returnpt.X = (int)point3d.X;//(int)((topos.x - point3d.x) / z * d);
537 returnpt.Y = (int)(255 - point3d.y);//(int)(255 - (((topos.y - point3d.y) / z * d))); 536 returnpt.Y = (int)(255 - point3d.Y);//(int)(255 - (((topos.y - point3d.y) / z * d)));
538 537
539 return returnpt; 538 return returnpt;
540 } 539 }
diff --git a/OpenSim/Region/Environment/Modules/World/WorldMap/ShadedMapTileRenderer.cs b/OpenSim/Region/Environment/Modules/World/WorldMap/ShadedMapTileRenderer.cs
index 1ee86ba..dffa72a 100644
--- a/OpenSim/Region/Environment/Modules/World/WorldMap/ShadedMapTileRenderer.cs
+++ b/OpenSim/Region/Environment/Modules/World/WorldMap/ShadedMapTileRenderer.cs
@@ -32,13 +32,12 @@ using System.Drawing;
32using System.Drawing.Drawing2D; 32using System.Drawing.Drawing2D;
33using System.Drawing.Imaging; 33using System.Drawing.Imaging;
34using System.Reflection; 34using System.Reflection;
35using Axiom.Math; 35using OpenMetaverse;
36using OpenMetaverse.Imaging;
36using Nini.Config; 37using Nini.Config;
37using log4net; 38using log4net;
38using OpenJPEGNet;
39using OpenSim.Region.Environment.Interfaces; 39using OpenSim.Region.Environment.Interfaces;
40using OpenSim.Region.Environment.Scenes; 40using OpenSim.Region.Environment.Scenes;
41using libsecondlife;
42 41
43namespace OpenSim.Region.Environment.Modules.World.WorldMap 42namespace OpenSim.Region.Environment.Modules.World.WorldMap
44{ 43{
diff --git a/OpenSim/Region/Environment/Modules/World/WorldMap/TexturedMapTileRenderer.cs b/OpenSim/Region/Environment/Modules/World/WorldMap/TexturedMapTileRenderer.cs
index 615befc..ff8d0b9 100644
--- a/OpenSim/Region/Environment/Modules/World/WorldMap/TexturedMapTileRenderer.cs
+++ b/OpenSim/Region/Environment/Modules/World/WorldMap/TexturedMapTileRenderer.cs
@@ -32,15 +32,14 @@ using System.Drawing;
32using System.Drawing.Drawing2D; 32using System.Drawing.Drawing2D;
33using System.Drawing.Imaging; 33using System.Drawing.Imaging;
34using System.Reflection; 34using System.Reflection;
35using Axiom.Math; 35using OpenMetaverse;
36using Nini.Config; 36using Nini.Config;
37using log4net; 37using log4net;
38using OpenJPEGNet; 38using OpenMetaverse.Imaging;
39using OpenSim.Framework; 39using OpenSim.Framework;
40using OpenSim.Region.Environment.Interfaces; 40using OpenSim.Region.Environment.Interfaces;
41using OpenSim.Region.Environment.Scenes; 41using OpenSim.Region.Environment.Scenes;
42using OpenSim.Region.Environment.Modules.World.Terrain; 42using OpenSim.Region.Environment.Modules.World.Terrain;
43using libsecondlife;
44 43
45namespace OpenSim.Region.Environment.Modules.World.WorldMap 44namespace OpenSim.Region.Environment.Modules.World.WorldMap
46{ 45{
@@ -122,15 +121,15 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
122 121
123 // some hardcoded terrain UUIDs that work with SL 1.20 (the four default textures and "Blank"). 122 // some hardcoded terrain UUIDs that work with SL 1.20 (the four default textures and "Blank").
124 // The color-values were choosen because they "look right" (at least to me) ;-) 123 // The color-values were choosen because they "look right" (at least to me) ;-)
125 private static readonly LLUUID defaultTerrainTexture1 = new LLUUID("0bc58228-74a0-7e83-89bc-5c23464bcec5"); 124 private static readonly UUID defaultTerrainTexture1 = new UUID("0bc58228-74a0-7e83-89bc-5c23464bcec5");
126 private static readonly Color defaultColor1 = Color.FromArgb(165, 137, 118); 125 private static readonly Color defaultColor1 = Color.FromArgb(165, 137, 118);
127 private static readonly LLUUID defaultTerrainTexture2 = new LLUUID("63338ede-0037-c4fd-855b-015d77112fc8"); 126 private static readonly UUID defaultTerrainTexture2 = new UUID("63338ede-0037-c4fd-855b-015d77112fc8");
128 private static readonly Color defaultColor2 = Color.FromArgb(69, 89, 49); 127 private static readonly Color defaultColor2 = Color.FromArgb(69, 89, 49);
129 private static readonly LLUUID defaultTerrainTexture3 = new LLUUID("303cd381-8560-7579-23f1-f0a880799740"); 128 private static readonly UUID defaultTerrainTexture3 = new UUID("303cd381-8560-7579-23f1-f0a880799740");
130 private static readonly Color defaultColor3 = Color.FromArgb(162, 154, 141); 129 private static readonly Color defaultColor3 = Color.FromArgb(162, 154, 141);
131 private static readonly LLUUID defaultTerrainTexture4 = new LLUUID("53a2f406-4895-1d13-d541-d2e3b86bc19c"); 130 private static readonly UUID defaultTerrainTexture4 = new UUID("53a2f406-4895-1d13-d541-d2e3b86bc19c");
132 private static readonly Color defaultColor4 = Color.FromArgb(200, 200, 200); 131 private static readonly Color defaultColor4 = Color.FromArgb(200, 200, 200);
133 private static readonly LLUUID blankTerrainTexture = new LLUUID("5748decc-f629-461c-9a36-a35a221fe21f"); 132 private static readonly UUID blankTerrainTexture = new UUID("5748decc-f629-461c-9a36-a35a221fe21f");
134 133
135 #endregion 134 #endregion
136 135
@@ -142,14 +141,14 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
142 // added when the terrain textures are changed in the estate dialog and a new map is generated (and will stay in 141 // added when the terrain textures are changed in the estate dialog and a new map is generated (and will stay in
143 // that map until the region-server restarts. This could be considered a memory-leak, but it's a *very* small one. 142 // that map until the region-server restarts. This could be considered a memory-leak, but it's a *very* small one.
144 // TODO does it make sense to use a "real" cache and regenerate missing entries on fetch? 143 // TODO does it make sense to use a "real" cache and regenerate missing entries on fetch?
145 private Dictionary<LLUUID, Color> m_mapping; 144 private Dictionary<UUID, Color> m_mapping;
146 145
147 146
148 public void Initialise(Scene scene, IConfigSource source) 147 public void Initialise(Scene scene, IConfigSource source)
149 { 148 {
150 m_scene = scene; 149 m_scene = scene;
151 // m_config = source; // not used currently 150 // m_config = source; // not used currently
152 m_mapping = new Dictionary<LLUUID,Color>(); 151 m_mapping = new Dictionary<UUID,Color>();
153 m_mapping.Add(defaultTerrainTexture1, defaultColor1); 152 m_mapping.Add(defaultTerrainTexture1, defaultColor1);
154 m_mapping.Add(defaultTerrainTexture2, defaultColor2); 153 m_mapping.Add(defaultTerrainTexture2, defaultColor2);
155 m_mapping.Add(defaultTerrainTexture3, defaultColor3); 154 m_mapping.Add(defaultTerrainTexture3, defaultColor3);
@@ -164,12 +163,18 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
164 // TODO (- on "map" command: We are in the command-line thread, we will wait for completion anyway) 163 // TODO (- on "map" command: We are in the command-line thread, we will wait for completion anyway)
165 // TODO (- on "automatic" update after some change: We are called from the mapUpdateTimer here and 164 // TODO (- on "automatic" update after some change: We are called from the mapUpdateTimer here and
166 // will wait anyway) 165 // will wait anyway)
167 private Bitmap fetchTexture(LLUUID id) 166 private Bitmap fetchTexture(UUID id)
168 { 167 {
169 AssetBase asset = m_scene.AssetCache.GetAsset(id, true); 168 AssetBase asset = m_scene.AssetCache.GetAsset(id, true);
170 m_log.DebugFormat("Fetched texture {0}, found: {1}", id, asset != null); 169 m_log.DebugFormat("Fetched texture {0}, found: {1}", id, asset != null);
171 if (asset == null) return null; 170 if (asset == null) return null;
172 return new Bitmap(OpenJPEG.DecodeToImage(asset.Data)); 171
172 ManagedImage managedImage;
173 Image image;
174 if (OpenJPEG.DecodeToImage(asset.Data, out managedImage, out image))
175 return new Bitmap(image);
176 else
177 return null;
173 } 178 }
174 179
175 // Compute the average color of a texture. 180 // Compute the average color of a texture.
@@ -196,8 +201,8 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
196 201
197 // return either the average color of the texture, or the defaultColor if the texturID is invalid 202 // return either the average color of the texture, or the defaultColor if the texturID is invalid
198 // or the texture couldn't be found 203 // or the texture couldn't be found
199 private Color computeAverageColor(LLUUID textureID, Color defaultColor) { 204 private Color computeAverageColor(UUID textureID, Color defaultColor) {
200 if (textureID == LLUUID.Zero) return defaultColor; // not set 205 if (textureID == UUID.Zero) return defaultColor; // not set
201 if (m_mapping.ContainsKey(textureID)) return m_mapping[textureID]; // one of the predefined textures 206 if (m_mapping.ContainsKey(textureID)) return m_mapping[textureID]; // one of the predefined textures
202 207
203 Bitmap bmp = fetchTexture(textureID); 208 Bitmap bmp = fetchTexture(textureID);
diff --git a/OpenSim/Region/Environment/Modules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/Environment/Modules/World/WorldMap/WorldMapModule.cs
index 2430822..ec9b79c 100644
--- a/OpenSim/Region/Environment/Modules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/WorldMap/WorldMapModule.cs
@@ -32,8 +32,8 @@ using System.Drawing;
32using System.Drawing.Imaging; 32using System.Drawing.Imaging;
33using System.IO; 33using System.IO;
34using System.Reflection; 34using System.Reflection;
35using libsecondlife; 35using OpenMetaverse;
36using OpenJPEGNet; 36using OpenMetaverse.Imaging;
37using log4net; 37using log4net;
38using Nini.Config; 38using Nini.Config;
39using OpenSim.Framework; 39using OpenSim.Framework;
@@ -103,7 +103,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
103 103
104 #endregion 104 #endregion
105 105
106 public void OnRegisterCaps(LLUUID agentID, Caps caps) 106 public void OnRegisterCaps(UUID agentID, Caps caps)
107 { 107 {
108 m_log.DebugFormat("[VOICE] OnRegisterCaps: agentID {0} caps {1}", agentID, caps); 108 m_log.DebugFormat("[VOICE] OnRegisterCaps: agentID {0} caps {1}", agentID, caps);
109 string capsBase = "/CAPS/" + caps.CapsObjectPath; 109 string capsBase = "/CAPS/" + caps.CapsObjectPath;
@@ -127,7 +127,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
127 /// <param name="caps"></param> 127 /// <param name="caps"></param>
128 /// <returns></returns> 128 /// <returns></returns>
129 public string MapLayerRequest(string request, string path, string param, 129 public string MapLayerRequest(string request, string path, string param,
130 LLUUID agentID, Caps caps) 130 UUID agentID, Caps caps)
131 { 131 {
132 //try 132 //try
133 //{ 133 //{
@@ -197,7 +197,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
197 LLSDMapLayer mapLayer = new LLSDMapLayer(); 197 LLSDMapLayer mapLayer = new LLSDMapLayer();
198 mapLayer.Right = 5000; 198 mapLayer.Right = 5000;
199 mapLayer.Top = 5000; 199 mapLayer.Top = 5000;
200 mapLayer.ImageID = new LLUUID("00000000-0000-1111-9999-000000000006"); 200 mapLayer.ImageID = new UUID("00000000-0000-1111-9999-000000000006");
201 201
202 return mapLayer; 202 return mapLayer;
203 } 203 }
@@ -223,7 +223,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
223 //doFriendListUpdateOnline(client.AgentId); 223 //doFriendListUpdateOnline(client.AgentId);
224 client.OnRequestMapBlocks += RequestMapBlocks; 224 client.OnRequestMapBlocks += RequestMapBlocks;
225 } 225 }
226 private void ClientLoggedOut(LLUUID AgentId) 226 private void ClientLoggedOut(UUID AgentId)
227 { 227 {
228 228
229 } 229 }
@@ -248,15 +248,14 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
248 m_log.Info("[WEBMAP]: Sending map image jpeg"); 248 m_log.Info("[WEBMAP]: Sending map image jpeg");
249 Hashtable reply = new Hashtable(); 249 Hashtable reply = new Hashtable();
250 int statuscode = 200; 250 int statuscode = 200;
251 251 byte[] jpeg = new byte[0];
252 byte[] jpeg;
253
254 252
255 if (myMapImageJPEG.Length == 0) 253 if (myMapImageJPEG.Length == 0)
256 { 254 {
257 MemoryStream imgstream = new MemoryStream(); 255 MemoryStream imgstream = new MemoryStream();
258 Bitmap mapTexture = new Bitmap(1,1); 256 Bitmap mapTexture = new Bitmap(1,1);
259 System.Drawing.Image image = (System.Drawing.Image)mapTexture; 257 ManagedImage managedImage;
258 Image image = (Image)mapTexture;
260 259
261 try 260 try
262 { 261 {
@@ -268,21 +267,24 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
268 AssetBase mapasset = m_scene.AssetCache.GetAsset(m_scene.RegionInfo.lastMapUUID, true); 267 AssetBase mapasset = m_scene.AssetCache.GetAsset(m_scene.RegionInfo.lastMapUUID, true);
269 268
270 // Decode image to System.Drawing.Image 269 // Decode image to System.Drawing.Image
271 image = OpenJPEG.DecodeToImage(mapasset.Data); 270 if (OpenJPEG.DecodeToImage(mapasset.Data, out managedImage, out image))
271 {
272 // Save to bitmap
273 mapTexture = new Bitmap(image);
272 274
273 // Save to bitmap 275 ImageCodecInfo myImageCodecInfo;
274 mapTexture = new Bitmap(image);
275 276
276 ImageCodecInfo myImageCodecInfo; 277 Encoder myEncoder;
277 278
278 Encoder myEncoder; 279 EncoderParameter myEncoderParameter;
280 EncoderParameters myEncoderParameters = new EncoderParameters();
279 281
280 EncoderParameter myEncoderParameter; 282 myImageCodecInfo = GetEncoderInfo("image/jpeg");
281 EncoderParameters myEncoderParameters = new EncoderParameters();
282 283
283 myImageCodecInfo = GetEncoderInfo("image/jpeg"); 284 myEncoder = Encoder.Quality;
284 285
285 myEncoder = Encoder.Quality; 286 myEncoderParameter = new EncoderParameter(myEncoder, 95L);
287 myEncoderParameters.Param[0] = myEncoderParameter;
286 288
287 myEncoderParameter = new EncoderParameter(myEncoder, 95L); 289 myEncoderParameter = new EncoderParameter(myEncoder, 95L);
288 myEncoderParameters.Param[0] = myEncoderParameter; 290 myEncoderParameters.Param[0] = myEncoderParameter;
@@ -290,14 +292,14 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
290 // Save bitmap to stream 292 // Save bitmap to stream
291 mapTexture.Save(imgstream, myImageCodecInfo, myEncoderParameters); 293 mapTexture.Save(imgstream, myImageCodecInfo, myEncoderParameters);
292 294
293 // Write the stream to a byte array for output 295 // Write the stream to a byte array for output
294 jpeg = imgstream.ToArray(); 296 jpeg = imgstream.ToArray();
295 myMapImageJPEG = jpeg; 297 myMapImageJPEG = jpeg;
298 }
296 } 299 }
297 catch (Exception) 300 catch (Exception)
298 { 301 {
299 // Dummy! 302 // Dummy!
300 jpeg = new byte[0];
301 m_log.Warn("[WEBMAP]: Unable to generate Map image"); 303 m_log.Warn("[WEBMAP]: Unable to generate Map image");
302 } 304 }
303 finally 305 finally
@@ -314,7 +316,6 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
314 // Use cached version so we don't have to loose our mind 316 // Use cached version so we don't have to loose our mind
315 jpeg = myMapImageJPEG; 317 jpeg = myMapImageJPEG;
316 } 318 }
317 //jpeg = new byte[0];
318 319
319 reply["str_response_string"] = Convert.ToBase64String(jpeg); 320 reply["str_response_string"] = Convert.ToBase64String(jpeg);
320 reply["int_response_code"] = statuscode; 321 reply["int_response_code"] = statuscode;