aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/Scripting/VectorRender
diff options
context:
space:
mode:
authorAdam Frisby2008-04-30 21:43:47 +0000
committerAdam Frisby2008-04-30 21:43:47 +0000
commitbe20f41637b6c06ce3ab16bc25851b6e43468e12 (patch)
treec41081329891f4c24de704fc760fb9012954ac9d /OpenSim/Region/Environment/Modules/Scripting/VectorRender
parent* Sometimes you know, you do something really stupid. (diff)
downloadopensim-SC_OLD-be20f41637b6c06ce3ab16bc25851b6e43468e12.zip
opensim-SC_OLD-be20f41637b6c06ce3ab16bc25851b6e43468e12.tar.gz
opensim-SC_OLD-be20f41637b6c06ce3ab16bc25851b6e43468e12.tar.bz2
opensim-SC_OLD-be20f41637b6c06ce3ab16bc25851b6e43468e12.tar.xz
* Cruft removal step #1. Cleaning Modules directory.
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Scripting/VectorRender')
-rw-r--r--OpenSim/Region/Environment/Modules/Scripting/VectorRender/VectorRenderModule.cs132
1 files changed, 70 insertions, 62 deletions
diff --git a/OpenSim/Region/Environment/Modules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/Environment/Modules/Scripting/VectorRender/VectorRenderModule.cs
index 4fba5b9..386c2b5 100644
--- a/OpenSim/Region/Environment/Modules/Scripting/VectorRender/VectorRenderModule.cs
+++ b/OpenSim/Region/Environment/Modules/Scripting/VectorRender/VectorRenderModule.cs
@@ -44,14 +44,56 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender
44{ 44{
45 public class VectorRenderModule : IRegionModule, IDynamicTextureRender 45 public class VectorRenderModule : IRegionModule, IDynamicTextureRender
46 { 46 {
47 private Scene m_scene;
48 private string m_name = "VectorRenderModule"; 47 private string m_name = "VectorRenderModule";
48 private Scene m_scene;
49 private IDynamicTextureManager m_textureManager; 49 private IDynamicTextureManager m_textureManager;
50 50
51 public VectorRenderModule() 51 public VectorRenderModule()
52 { 52 {
53 } 53 }
54 54
55 #region IDynamicTextureRender Members
56
57 public string GetContentType()
58 {
59 return ("vector");
60 }
61
62 public string GetName()
63 {
64 return m_name;
65 }
66
67 public bool SupportsAsynchronous()
68 {
69 return true;
70 }
71
72 public byte[] ConvertUrl(string url, string extraParams)
73 {
74 return null;
75 }
76
77 public byte[] ConvertStream(Stream data, string extraParams)
78 {
79 return null;
80 }
81
82 public bool AsyncConvertUrl(LLUUID id, string url, string extraParams)
83 {
84 return false;
85 }
86
87 public bool AsyncConvertData(LLUUID id, string bodyData, string extraParams)
88 {
89 Draw(bodyData, id, extraParams);
90 return true;
91 }
92
93 #endregion
94
95 #region IRegionModule Members
96
55 public void Initialise(Scene scene, IConfigSource config) 97 public void Initialise(Scene scene, IConfigSource config)
56 { 98 {
57 if (m_scene == null) 99 if (m_scene == null)
@@ -83,21 +125,25 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender
83 get { return true; } 125 get { return true; }
84 } 126 }
85 127
128 #endregion
129
86 private void Draw(string data, LLUUID id, string extraParams) 130 private void Draw(string data, LLUUID id, string extraParams)
87 { 131 {
88 // TODO: this is a brutal hack. extraParams should actually be parsed reasonably. 132 // TODO: this is a brutal hack. extraParams should actually be parsed reasonably.
89 int size = 256; 133 int size = 256;
90 try { 134 try
135 {
91 size = Convert.ToInt32(extraParams); 136 size = Convert.ToInt32(extraParams);
92 } catch (Exception e) { 137 }
93 138 catch (Exception e)
139 {
94//Ckrinke: Add a WriteLine to remove the warning about 'e' defined but not used 140//Ckrinke: Add a WriteLine to remove the warning about 'e' defined but not used
95 Console.WriteLine("Problem with Draw. Please verify parameters." + e.ToString()); 141 Console.WriteLine("Problem with Draw. Please verify parameters." + e.ToString());
96 } 142 }
97 143
98 if ((size < 128) || (size > 1024)) 144 if ((size < 128) || (size > 1024))
99 size = 256; 145 size = 256;
100 146
101 Bitmap bitmap = new Bitmap(size, size, PixelFormat.Format32bppArgb); 147 Bitmap bitmap = new Bitmap(size, size, PixelFormat.Format32bppArgb);
102 148
103 Graphics graph = Graphics.FromImage(bitmap); 149 Graphics graph = Graphics.FromImage(bitmap);
@@ -121,13 +167,11 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender
121 } 167 }
122 } 168 }
123 169
124
125 170
126 GDIDraw(data, graph); 171 GDIDraw(data, graph);
127 172
128 byte[] imageJ2000 = OpenJPEG.EncodeFromImage(bitmap, true); 173 byte[] imageJ2000 = OpenJPEG.EncodeFromImage(bitmap, true);
129 m_textureManager.ReturnData(id, imageJ2000); 174 m_textureManager.ReturnData(id, imageJ2000);
130
131 } 175 }
132 176
133/* 177/*
@@ -175,10 +219,10 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender
175 Pen drawPen = new Pen(Color.Black, 7); 219 Pen drawPen = new Pen(Color.Black, 7);
176 Font myFont = new Font("Times New Roman", 14); 220 Font myFont = new Font("Times New Roman", 14);
177 SolidBrush myBrush = new SolidBrush(Color.Black); 221 SolidBrush myBrush = new SolidBrush(Color.Black);
178 char[] lineDelimiter = { ';' }; 222 char[] lineDelimiter = {';'};
179 char[] partsDelimiter = { ',' }; 223 char[] partsDelimiter = {','};
180 string[] lines = data.Split(lineDelimiter); 224 string[] lines = data.Split(lineDelimiter);
181 225
182 foreach (string line in lines) 226 foreach (string line in lines)
183 { 227 {
184 string nextLine = line.Trim(); 228 string nextLine = line.Trim();
@@ -188,16 +232,16 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender
188 float x = 0; 232 float x = 0;
189 float y = 0; 233 float y = 0;
190 GetParams(partsDelimiter, ref nextLine, 6, ref x, ref y); 234 GetParams(partsDelimiter, ref nextLine, 6, ref x, ref y);
191 startPoint.X = (int)x; 235 startPoint.X = (int) x;
192 startPoint.Y = (int)y; 236 startPoint.Y = (int) y;
193 } 237 }
194 else if (nextLine.StartsWith("LineTo")) 238 else if (nextLine.StartsWith("LineTo"))
195 { 239 {
196 float x = 0; 240 float x = 0;
197 float y = 0; 241 float y = 0;
198 GetParams(partsDelimiter, ref nextLine, 6, ref x, ref y); 242 GetParams(partsDelimiter, ref nextLine, 6, ref x, ref y);
199 endPoint.X = (int)x; 243 endPoint.X = (int) x;
200 endPoint.Y = (int)y; 244 endPoint.Y = (int) y;
201 graph.DrawLine(drawPen, startPoint, endPoint); 245 graph.DrawLine(drawPen, startPoint, endPoint);
202 startPoint.X = endPoint.X; 246 startPoint.X = endPoint.X;
203 startPoint.Y = endPoint.Y; 247 startPoint.Y = endPoint.Y;
@@ -213,10 +257,10 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender
213 float x = 0; 257 float x = 0;
214 float y = 0; 258 float y = 0;
215 GetParams(partsDelimiter, ref nextLine, 5, ref x, ref y); 259 GetParams(partsDelimiter, ref nextLine, 5, ref x, ref y);
216 endPoint.X = (int)x; 260 endPoint.X = (int) x;
217 endPoint.Y = (int)y; 261 endPoint.Y = (int) y;
218 Image image = ImageHttpRequest(nextLine); 262 Image image = ImageHttpRequest(nextLine);
219 graph.DrawImage(image, (float)startPoint.X, (float)startPoint.Y, x, y); 263 graph.DrawImage(image, (float) startPoint.X, (float) startPoint.Y, x, y);
220 startPoint.X += endPoint.X; 264 startPoint.X += endPoint.X;
221 startPoint.Y += endPoint.Y; 265 startPoint.Y += endPoint.Y;
222 } 266 }
@@ -225,8 +269,8 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender
225 float x = 0; 269 float x = 0;
226 float y = 0; 270 float y = 0;
227 GetParams(partsDelimiter, ref nextLine, 9, ref x, ref y); 271 GetParams(partsDelimiter, ref nextLine, 9, ref x, ref y);
228 endPoint.X = (int)x; 272 endPoint.X = (int) x;
229 endPoint.Y = (int)y; 273 endPoint.Y = (int) y;
230 graph.DrawRectangle(drawPen, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y); 274 graph.DrawRectangle(drawPen, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y);
231 startPoint.X += endPoint.X; 275 startPoint.X += endPoint.X;
232 startPoint.Y += endPoint.Y; 276 startPoint.Y += endPoint.Y;
@@ -236,8 +280,8 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender
236 float x = 0; 280 float x = 0;
237 float y = 0; 281 float y = 0;
238 GetParams(partsDelimiter, ref nextLine, 13, ref x, ref y); 282 GetParams(partsDelimiter, ref nextLine, 13, ref x, ref y);
239 endPoint.X = (int)x; 283 endPoint.X = (int) x;
240 endPoint.Y = (int)y; 284 endPoint.Y = (int) y;
241 graph.FillRectangle(myBrush, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y); 285 graph.FillRectangle(myBrush, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y);
242 startPoint.X += endPoint.X; 286 startPoint.X += endPoint.X;
243 startPoint.Y += endPoint.Y; 287 startPoint.Y += endPoint.Y;
@@ -247,8 +291,8 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender
247 float x = 0; 291 float x = 0;
248 float y = 0; 292 float y = 0;
249 GetParams(partsDelimiter, ref nextLine, 7, ref x, ref y); 293 GetParams(partsDelimiter, ref nextLine, 7, ref x, ref y);
250 endPoint.X = (int)x; 294 endPoint.X = (int) x;
251 endPoint.Y = (int)y; 295 endPoint.Y = (int) y;
252 graph.DrawEllipse(drawPen, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y); 296 graph.DrawEllipse(drawPen, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y);
253 startPoint.X += endPoint.X; 297 startPoint.X += endPoint.X;
254 startPoint.Y += endPoint.Y; 298 startPoint.Y += endPoint.Y;
@@ -271,7 +315,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender
271 { 315 {
272 nextLine = nextLine.Remove(0, 9); 316 nextLine = nextLine.Remove(0, 9);
273 nextLine = nextLine.Trim(); 317 nextLine = nextLine.Trim();
274 318
275 Color newColour = Color.FromName(nextLine); 319 Color newColour = Color.FromName(nextLine);
276 320
277 myBrush.Color = newColour; 321 myBrush.Color = newColour;
@@ -312,7 +356,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender
312 WebRequest request = HttpWebRequest.Create(url); 356 WebRequest request = HttpWebRequest.Create(url);
313//Ckrinke: Comment out for now as 'str' is unused. Bring it back into play later when it is used. 357//Ckrinke: Comment out for now as 'str' is unused. Bring it back into play later when it is used.
314//Ckrinke Stream str = null; 358//Ckrinke Stream str = null;
315 HttpWebResponse response = (HttpWebResponse)(request).GetResponse(); 359 HttpWebResponse response = (HttpWebResponse) (request).GetResponse();
316 if (response.StatusCode == HttpStatusCode.OK) 360 if (response.StatusCode == HttpStatusCode.OK)
317 { 361 {
318 Bitmap image = new Bitmap(response.GetResponseStream()); 362 Bitmap image = new Bitmap(response.GetResponseStream());
@@ -321,41 +365,5 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender
321 365
322 return null; 366 return null;
323 } 367 }
324
325 public string GetContentType()
326 {
327 return ("vector");
328 }
329
330 public string GetName()
331 {
332 return m_name;
333 }
334
335 public bool SupportsAsynchronous()
336 {
337 return true;
338 }
339
340 public byte[] ConvertUrl(string url, string extraParams)
341 {
342 return null;
343 }
344
345 public byte[] ConvertStream(Stream data, string extraParams)
346 {
347 return null;
348 }
349
350 public bool AsyncConvertUrl(LLUUID id, string url, string extraParams)
351 {
352 return false;
353 }
354
355 public bool AsyncConvertData(LLUUID id, string bodyData, string extraParams)
356 {
357 Draw(bodyData, id, extraParams);
358 return true;
359 }
360 } 368 }
361} \ No newline at end of file 369} \ No newline at end of file