Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Mathematica Graphics output in an ASP.NET WebApplication II

  • To: mathgroup at smc.vnet.net
  • Subject: [mg54740] Re: Mathematica Graphics output in an ASP.NET WebApplication II
  • From: "Hans Michel" <hmichel at sdc.cox.net>
  • Date: Mon, 28 Feb 2005 03:27:53 -0500 (EST)
  • References: <cvrpmf$ovi$1@smc.vnet.net>
  • Reply-to: "Hans Michel" <hmichel at sdc.cox.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Javier:

To answer part 1 of your question.

You can use the querystring .

 <IMG id="Img1" style="Z-INDEX: 116; LEFT: 496px; POSITION: absolute; TOP: 
16px" height="200" 
src="Graphics.aspx?a=whateveryouwant&b=whateverelseyouwant" width="200" 
runat="server">

Or you can use ServerVariables, Cookies, Form Variables or ASP.NET Params 
Collection.

If Img1 is run at server than you can access all properties, methods or 
attributes in WebForm1 code behind for example Img1.Src = "whateveryouwant"

As for part 2 I have had no problems executing these methods and if it is 
fixed in 5.1 or whtever version we are up to in .NET/Link Todd gives the 
user where the problem occurs we have all the source code to comiple our own 
version of the .NET/Link assembly.

Good Luck.

Hans

"Javier Chicote" <goraperas at hotmail.com> wrote in message 
news:cvrpmf$ovi$1 at smc.vnet.net...
> Hi,
>
>
>
> I would like to place the Mathematica Graphics output in an ASP.NET
> WebApplication using Wolfram.NETLink referente, like in the example of
> C:\...\Mathematica\5.0\AddOns\NETLink\Examples\Part2\MathKernelApp.
>
>
>
> First of all, I tried to use the mathKernel.Graphics property to get the
> image from the Mathematica graphics output during the last call to
> mathKernel.Compute(). The problem is that in WebForms I cannot use
> System.Windows.Forms.PictureBox that I can use in Windows, so I need to
> refer a URL for the System.Web.UI.WebControls.Image when I only have a
> System.Drawing.Image object.
>
>
>
> Then, I check out the possibilies proposed in Wolfram MathGroup:
>
>
>
>       How to give back to an image using "Net/Link" and "asp.net"?
>
>       http://forums.wolfram.com/mathgroup/archive/2004/Mar/msg00143.html
>
>
>
>       how to save a mathematica-made imagebox.image as jpg, gif, bmp in
> c#/.netlink?
>
>       http://forums.wolfram.com/mathgroup/archive/2004/May/msg00087.html
>
>
>
>       Mathematica Graphics output in an ASP.NET WebApplication
>
>       http://forums.wolfram.com/mathgroup/archive/2005/Jan/msg00238.html
>
>
>
> Now I have 2 WebForms, but I still haven't found the solution to my 
> problem,
> althought I can see the graphic in certain cases.
>
>
>
> ----------------------------------------------------------------------------
>
>
>
> In WebForm1.aspx I define the image:
>
>
>
> HTML:
>
>
>
> <IMG id="Img1" style="Z-INDEX: 116; LEFT: 496px; POSITION: absolute; TOP:
> 16px" height="200" src="Graphics.aspx" width="200" runat="server"></form>
>
>
>
>
>
> Graphics.aspx is the WebForm that I use as an image:
>
>
>
> HTML:
>
>
>
> <%@ Page language="c#" Codebehind="Graphics.aspx.cs" 
> AutoEventWireup="false"
> Inherits="MathKernelAppWeb.Graphics" EnableSessionState="False"
> enableViewState="False" contentType="image/jpeg"%>
>
>
>
> Code:
>
>
>
> protected string input;
>
> protected System.Drawing.Image image;
>
>
>
> private void Page_Load(object sender, System.EventArgs e)
>
> {
>
>       input = "Plot3D[Sin[x y], {x, -Pi, Pi}, {y, 0 ,10}]";           //1
>
>       image = WebForm1.mathKernel.Link.EvaluateToImage(input,200,200);//2
>
>       image.Save(Response.OutputStream, ImageFormat.Jpeg);
>
> }
>
>
>
> ----------------------------------------------------------------------------
>
>
>
> The previos code works, but I have two problems:
>
>
>
> 1) It is supposed that the application runs in WebForm1, so I need to pass
> the input string from WebForm1 to Grapthics, and I don't know how to do
> this.
>
>
>
> 2) I would like to use the mathKernel.Compute() method and the the
> mathKernel.Graphics[0] property instead of
> mathKernel.Link.EvaluateToImage(), it's supossed that they do the same 
> task
> but it doesn't work if I do this:
>
>
>
>       WebForm1.mathKernel.Compute(input);
>
>       image = WebForm1.mathKernel.Graphics[0];
>
>
>
> or this:
>
>
>
>       Bitmap bmp = new Bitmap(WebForm1.mathKernel.Graphics[0]);
>
>       image = (System.Drawing.Image) bmp;
>
>
>
> In the explanation that Todd Gayley gives in of the articles above says 
> that
> maybe it could be a bug in Mathematica. If so, I would really appreciate 
> if
> you could inform me if it's solved in Mathematica 5.1 or newer versions.
>
>
>
> Thanks,
>
>
>
>       Javier Chicote
>
>
>
>
>
>
>
> 


  • Prev by Date: Re: Construcing correlation matrix from time-ordered list
  • Next by Date: Re: Re: Bounds for Trig expression
  • Previous by thread: Polygons on spheres