diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Scripting')
-rw-r--r-- | OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs | 77 |
1 files changed, 70 insertions, 7 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs index d7f39b0..e577fbe 100644 --- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs | |||
@@ -443,7 +443,16 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
443 | endPoint.X = (int) x; | 443 | endPoint.X = (int) x; |
444 | endPoint.Y = (int) y; | 444 | endPoint.Y = (int) y; |
445 | Image image = ImageHttpRequest(nextLine); | 445 | Image image = ImageHttpRequest(nextLine); |
446 | graph.DrawImage(image, (float) startPoint.X, (float) startPoint.Y, x, y); | 446 | if (image != null) |
447 | { | ||
448 | graph.DrawImage(image, (float)startPoint.X, (float)startPoint.Y, x, y); | ||
449 | } | ||
450 | else | ||
451 | { | ||
452 | graph.DrawString("URL couldn't be resolved or is", new Font("Arial",6), myBrush, startPoint); | ||
453 | graph.DrawString("not an image. Please check URL.", new Font("Arial", 6), myBrush, new Point(startPoint.X, 12 + startPoint.Y)); | ||
454 | graph.DrawRectangle(drawPen, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y); | ||
455 | } | ||
447 | startPoint.X += endPoint.X; | 456 | startPoint.X += endPoint.X; |
448 | startPoint.Y += endPoint.Y; | 457 | startPoint.Y += endPoint.Y; |
449 | } | 458 | } |
@@ -539,6 +548,57 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
539 | float size = Convert.ToSingle(nextLine, CultureInfo.InvariantCulture); | 548 | float size = Convert.ToSingle(nextLine, CultureInfo.InvariantCulture); |
540 | drawPen.Width = size; | 549 | drawPen.Width = size; |
541 | } | 550 | } |
551 | else if (nextLine.StartsWith("PenCap")) | ||
552 | { | ||
553 | bool start = true, end = true; | ||
554 | nextLine = nextLine.Remove(0, 6); | ||
555 | nextLine = nextLine.Trim(); | ||
556 | string[] cap = nextLine.Split(partsDelimiter); | ||
557 | if (cap[0].ToLower() == "start") | ||
558 | end = false; | ||
559 | else if (cap[0].ToLower() == "end") | ||
560 | start = false; | ||
561 | else if (cap[0].ToLower() != "both") | ||
562 | return; | ||
563 | string type = cap[1].ToLower(); | ||
564 | |||
565 | if (end) | ||
566 | { | ||
567 | switch (type) | ||
568 | { | ||
569 | case "arrow": | ||
570 | drawPen.EndCap = System.Drawing.Drawing2D.LineCap.ArrowAnchor; | ||
571 | break; | ||
572 | case "round": | ||
573 | drawPen.EndCap = System.Drawing.Drawing2D.LineCap.RoundAnchor; | ||
574 | break; | ||
575 | case "diamond": | ||
576 | drawPen.EndCap = System.Drawing.Drawing2D.LineCap.DiamondAnchor; | ||
577 | break; | ||
578 | case "flat": | ||
579 | drawPen.EndCap = System.Drawing.Drawing2D.LineCap.Flat; | ||
580 | break; | ||
581 | } | ||
582 | } | ||
583 | if (start) | ||
584 | { | ||
585 | switch (type) | ||
586 | { | ||
587 | case "arrow": | ||
588 | drawPen.StartCap = System.Drawing.Drawing2D.LineCap.ArrowAnchor; | ||
589 | break; | ||
590 | case "round": | ||
591 | drawPen.StartCap = System.Drawing.Drawing2D.LineCap.RoundAnchor; | ||
592 | break; | ||
593 | case "diamond": | ||
594 | drawPen.StartCap = System.Drawing.Drawing2D.LineCap.DiamondAnchor; | ||
595 | break; | ||
596 | case "flat": | ||
597 | drawPen.StartCap = System.Drawing.Drawing2D.LineCap.Flat; | ||
598 | break; | ||
599 | } | ||
600 | } | ||
601 | } | ||
542 | else if (nextLine.StartsWith("PenColour")) | 602 | else if (nextLine.StartsWith("PenColour")) |
543 | { | 603 | { |
544 | nextLine = nextLine.Remove(0, 9); | 604 | nextLine = nextLine.Remove(0, 9); |
@@ -610,16 +670,19 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
610 | 670 | ||
611 | private Bitmap ImageHttpRequest(string url) | 671 | private Bitmap ImageHttpRequest(string url) |
612 | { | 672 | { |
673 | try | ||
674 | { | ||
613 | WebRequest request = HttpWebRequest.Create(url); | 675 | WebRequest request = HttpWebRequest.Create(url); |
614 | //Ckrinke: Comment out for now as 'str' is unused. Bring it back into play later when it is used. | 676 | //Ckrinke: Comment out for now as 'str' is unused. Bring it back into play later when it is used. |
615 | //Ckrinke Stream str = null; | 677 | //Ckrinke Stream str = null; |
616 | HttpWebResponse response = (HttpWebResponse) (request).GetResponse(); | 678 | HttpWebResponse response = (HttpWebResponse)(request).GetResponse(); |
617 | if (response.StatusCode == HttpStatusCode.OK) | 679 | if (response.StatusCode == HttpStatusCode.OK) |
618 | { | 680 | { |
619 | Bitmap image = new Bitmap(response.GetResponseStream()); | 681 | Bitmap image = new Bitmap(response.GetResponseStream()); |
620 | return image; | 682 | return image; |
683 | } | ||
621 | } | 684 | } |
622 | 685 | catch { } | |
623 | return null; | 686 | return null; |
624 | } | 687 | } |
625 | } | 688 | } |