0% found this document useful (0 votes)
82 views7 pages

Descrizione Di Riepilogo Per Webform1

The document describes a web form with labels, text boxes, buttons, and charts for calculating and displaying solar radiation data. It includes code for initializing the form controls and handling button click events to calculate slope, aspect, daily extraterrestrial radiation values, and hourly global solar radiation using input latitude, day of year, and other parameters. The results are displayed on line and scatter charts embedded in the web form.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
82 views7 pages

Descrizione Di Riepilogo Per Webform1

The document describes a web form with labels, text boxes, buttons, and charts for calculating and displaying solar radiation data. It includes code for initializing the form controls and handling button click events to calculate slope, aspect, daily extraterrestrial radiation values, and hourly global solar radiation using input latitude, day of year, and other parameters. The results are displayed on line and scatter charts embedded in the web form.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

using using using using using using using using using using using

System; System.Collections; System.ComponentModel; System.Data; System.Drawing; System.Web; System.Web.SessionState; System.Web.UI; System.Web.UI.WebControls; System.Web.UI.HtmlControls; ChartDirector;

namespace CRA.clima.webapplications.gsrad { /// <summary> /// Descrizione di riepilogo per WebForm1. /// </summary> public class WebForm1 : System.Web.UI.Page { protected System.Web.UI.WebControls.TextBox TextBox1; protected System.Web.UI.WebControls.TextBox TextBox2; protected System.Web.UI.WebControls.TextBox TextBox3; protected System.Web.UI.WebControls.TextBox TextBox4; protected System.Web.UI.WebControls.TextBox TextBox5; protected System.Web.UI.WebControls.TextBox TextBox6; protected System.Web.UI.WebControls.TextBox TextBox7; protected System.Web.UI.WebControls.TextBox TextBox8; protected System.Web.UI.WebControls.TextBox TextBox9; protected System.Web.UI.WebControls.Label Label2; protected System.Web.UI.WebControls.TextBox TextBox10; protected System.Web.UI.WebControls.Label Label3; protected System.Web.UI.WebControls.Button Button1; protected System.Web.UI.WebControls.Label Label4; protected System.Web.UI.WebControls.Label Label5; protected System.Web.UI.WebControls.Label lblSlope; protected System.Web.UI.WebControls.Label lblAspect; protected System.Web.UI.WebControls.HyperLink HyperLink1; protected System.Web.UI.WebControls.HyperLink HyperLink2; protected System.Web.UI.WebControls.HyperLink HyperLink3; protected System.Web.UI.WebControls.Image Image1; protected ChartDirector.WebChartViewer WebChartViewer1;

protected protected protected protected protected protected protected protected protected protected protected protected protected protected protected protected protected protected protected protected protected protected

System.Web.UI.WebControls.Label Label6; System.Web.UI.WebControls.Label Label7; System.Web.UI.WebControls.Label Label8; System.Web.UI.WebControls.TextBox TextBox11; System.Web.UI.WebControls.TextBox TextBox12; System.Web.UI.WebControls.TextBox TextBox13; System.Web.UI.WebControls.Label Label9; System.Web.UI.WebControls.Button Button2; ChartDirector.WebChartViewer WebChartViewer2; System.Web.UI.WebControls.Label Label10; System.Web.UI.WebControls.Label Label11; System.Web.UI.WebControls.Label Label12; System.Web.UI.WebControls.Button Button3; System.Web.UI.WebControls.TextBox TextBox14; System.Web.UI.WebControls.TextBox TextBox15; System.Web.UI.WebControls.Label Label13; System.Web.UI.WebControls.Label Label14; System.Web.UI.WebControls.Label Label15; System.Web.UI.WebControls.TextBox TextBox16; System.Web.UI.WebControls.TextBox TextBox17; System.Web.UI.WebControls.TextBox TextBox18; System.Web.UI.WebControls.Label Label1;

private void Page_Load(object sender, System.EventArgs e) { // Inserire qui il codice utente necessario per inizializzare la pagina. } #region Codice generato da Progettazione Web Form override protected void OnInit(EventArgs e) { // // CODEGEN: questa chiamata richiesta da Progettazione Web Form ASP.NET. // InitializeComponent(); base.OnInit(e); } /// /// /// /// <summary> Metodo necessario per il supporto della finestra di progettazione. Non modificare il contenuto del metodo con l'editor di codice. </summary>

private void InitializeComponent() { this.Button1.Click += new System.EventHandler(this.Button1_Click); this.Button2.Click += new System.EventHandler(this.Button2_Click); this.Button3.Click += new System.EventHandler(this.Button3_Click); this.Load += new System.EventHandler(this.Page_Load); } #endregion private void Button1_Click(object sender, System.EventArgs e) { //instance of the web service class CRA.clima.webapplications.gsrad.it.sipeaa.www.CRA_clima_GSRad g = new CRA.clima.webapplications.gsrad.it.sipeaa.www.CRA_clima_GSRad(); double[] elevation = new double[9]; elevation[0] = double.Parse(TextBox1.Text); elevation[1] = double.Parse(TextBox2.Text); elevation[2] = double.Parse(TextBox3.Text); elevation[3] = double.Parse(TextBox4.Text); elevation[4] = double.Parse(TextBox5.Text); elevation[5] = double.Parse(TextBox6.Text); elevation[6] = double.Parse(TextBox7.Text); elevation[7] = double.Parse(TextBox8.Text); elevation[8] = double.Parse(TextBox9.Text); double cellSize = double.Parse(TextBox10.Text); lblSlope.Text = Math.Round(g.SlopeAspect(cellSize, elevation)[0], 1).ToString(); lblAspect.Text = Math.Round(g.SlopeAspect(cellSize, elevation)[1], 1).ToString(); } private void Button2_Click(object sender, System.EventArgs e) { WebChartViewer1.Visible = false; WebChartViewer2.Visible = false; //instance of the web service class CRA.clima.webapplications.gsrad.it.sipeaa.www.CRA_clima_GSRad g = new CRA.clima.webapplications.gsrad.it.sipeaa.www.CRA_clima_GSRad(); // data for the graph //the data for the line chart double[] dataY1 = new double[365];

double[] dataY2 = new double[365]; double[] dataY3 = new double[365]; double[] dataX = new double[365]; double lat1 = double.Parse(TextBox11.Text); double lat2 = double.Parse(TextBox12.Text); double lat3 = double.Parse(TextBox13.Text);

int i = 0; for (i=0; i<365; i++) { // day of the year dataX[i] = i+1; // extraterrestrial rad dataY1[i] = g.ExtraterrestrialRadiationDaily(i+1, lat1); dataY2[i] = g.ExtraterrestrialRadiationDaily(i+1, lat2); dataY3[i] = g.ExtraterrestrialRadiationDaily(i+1, lat3); } //Create a XYChart object of size 500 x 256 pixels XYChart c = new XYChart(500, 256); //Set the plotarea and add grids c.setPlotArea(50, 25, 440, 180, -1, -1, 0xc0c0c0, 0xc0c0c0, -1); //Add titles to the top and bottom of the chart using 7.5pt Arial font. //The text is white 0xffffff on a deep blue 0x31319C background. c.addTitle2(Chart.Top, "extraterrestrial solar radiation", "arial.ttf", 10, 0xffffff, 0x31319c); //Add text in the plot area (top left corner of plotarea) c.addText(50, 26, "daily", "arial.ttf", 10, 0x31319C).setAlignment(Chart.TopLeft); //Use 10 pts Arial as the y axis label font c.yAxis().setLabelStyle("", 7.5); c.yAxis().setTitle("SRad (MJ m-2 d-1)", "arial.ttf", 10); //Use 7.5 pts Arial as the x axis label font c.xAxis().setLabelStyle("", 7.5); c.xAxis().setTitle("day of the year", "arial.ttf", 10);

//set labels c.xAxis().setLinearScale(1,365,30); //Add a red diamonds layer to the chart c.addLineLayer(dataY1,0xc00000, TextBox11.Text); c.addLineLayer(dataY2,0x31319c, TextBox12.Text); c.addLineLayer(dataY3,0x40cf40, TextBox13.Text); //output the chart WebChartViewer1.Image = c.makeWebImage(1); //include tool tip for the chart WebChartViewer1.ImageMap = c.getHTMLImageMap("clickable", "", "title='GSR hourly data'"); WebChartViewer1.Visible = true; } private void Button3_Click(object sender, System.EventArgs e) { WebChartViewer2.Visible = false; WebChartViewer1.Visible = false; //instance of the web service class CRA.clima.webapplications.gsrad.it.sipeaa.www.CRA_clima_GSRad g = new CRA.clima.webapplications.gsrad.it.sipeaa.www.CRA_clima_GSRad(); double lat; int DOY; double[] extraRadHourly = new double[24]; double gsrad; double extraRad; lat = double.Parse(TextBox15.Text); DOY = int.Parse(TextBox14.Text); double rangeTD = double.Parse(TextBox16.Text); double rangeTM = double.Parse(TextBox17.Text); double BC_b = double.Parse(TextBox18.Text); //extraterresrialRadiation extraRad = g.ExtraterrestrialRadiationDaily(DOY, lat); extraRadHourly = g.ExtraterrestrialRadiationHourly(DOY, lat); //GSRad

gsrad = g.GlobalSolarRadiationBristowCampbell(1, BC_b,rangeTD, rangeTM, 0.75, extraRad); // data for the graph //the data for the line chart double[] dataY = new double[24]; double[] dataX = new double[24]; dataY = g.HourlyGlobalSolarRadiationDaily(gsrad, extraRadHourly, extraRad); int i = 0; for (i=0; i<23; i++) { dataX[i] = i+1; } //Create a XYChart object of size 500 x 256 pixels XYChart c = new XYChart(500, 256); //Set the plotarea and add grids c.setPlotArea(50, 25, 440, 180, -1, -1, 0xc0c0c0, 0xc0c0c0, -1); //Add titles to the top and bottom of the chart using 7.5pt Arial font. //The text is white 0xffffff on a deep blue 0x31319C background. c.addTitle2(Chart.Top, "hourly values of global solar radiation", "arial.ttf", 10, 0xffffff, 0x31319c); //Add text in the plot area (top left corner of plotarea) c.addText(50, 26, "hourly", "arial.ttf", 10, 0x31319C).setAlignment(Chart.TopLeft); //Use 10 pts Arial as the y axis label font c.yAxis().setLabelStyle("", 7.5); c.yAxis().setTitle("GSRad (MJ m-2 h-1)", "arial.ttf", 10); //Use 7.5 pts Arial as the x axis label font c.xAxis().setLabelStyle("", 7.5); c.xAxis().setTitle("hour", "arial.ttf", 10); //set labels c.xAxis().setLinearScale(0,23,6); //Add a red diamonds layer to the chart c.addScatterLayer(dataX, dataY,"hourlyGSRad", Chart.DiamondSymbol, 8, 0xc00000);

//output the chart WebChartViewer2.Image = c.makeWebImage(1); //include tool tip for the chart WebChartViewer2.ImageMap = c.getHTMLImageMap("clickable", "", "title='GSR hourly data'"); WebChartViewer2.Visible = true; } } }

You might also like