爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 4369|回复: 0

[其他] asp.net 里面如何给一个surfer生成的图加文字标题

[复制链接]

新浪微博达人勋

发表于 2015-6-7 16:56:12 | 显示全部楼层 |阅读模式

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册 新浪微博登陆

x
我需要在这张图的顶部加上一些文字信息。


        string strAppPath = Server.MapPath("data");


        // 调用Surfer画等值线
        Surfer.Application app = new Surfer.Application();
        app.WindowState = SrfWindowState.srfWindowStateNormal;
        app.ShowStatusBar = false;
        app.Visible = false;
        
        app.Caption = @"Suirfer绘制等值线图";
        Surfer.IDocuments Docs = app.Documents;
        
        // Type.Missing为缺省参数
        app.GridData(strAppPath + "\\"+drpZB.SelectedValue+".dat", 1, 2, 3, Type.Missing, //5
            Type.Missing, Type.Missing, Type.Missing,502, 558, //10
            115.84834f, 120.442548f, 23.567314f, 28.316788f,2, //15
            false, Type.Missing, Type.Missing, Type.Missing, Type.Missing, //20
            Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, //25
            Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, //30
            Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, //35
            Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, //40
            Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, //45
            Type.Missing, Type.Missing, Type.Missing, Type.Missing, strAppPath + "\\"+drpZB.SelectedValue+".grd", //50
            SrfGridFormat.srfGridFmtAscii, Type.Missing, Type.Missing, Type.Missing, Type.Missing, //55
            Type.Missing, Type.Missing
            );

        app.GridBlank(strAppPath + "\\" + drpZB.SelectedValue + ".grd", strAppPath + @"\fj.bln", strAppPath + @"\out" + drpZB.SelectedValue + ".grd", SrfGridFormat.srfGridFmtAscii);
        Surfer.IPlotDocument PlotDoc = (Surfer.IPlotDocument)Docs.Add(SrfDocTypes.srfDocPlot);
        Surfer.IMapFrame MapF = PlotDoc.Shapes.AddContourMap(strAppPath + @"\out" + drpZB.SelectedValue + ".grd");
        //PlotDoc.Shapes.AddBaseMap(strAppPath + @"\region.bln", "");
        //PlotDoc.Shapes.AddBaseMap(strAppPath + @"\县界.bln", "");

        IPostMap PostMap = (IPostMap)PlotDoc.Shapes.AddPostMap(strAppPath + "\\"+drpZB.SelectedValue+".dat", 1, 2, 3, 0, 0).Overlays.Item(1);
        IPostMap PostMap1 = (IPostMap)PlotDoc.Shapes.AddPostMap(strAppPath + "\\" + drpZB.SelectedValue + ".dat", 1, 2, 4, 0, 0).Overlays.Item(1);

        // 数据和站点显示
        PostMap.LabelPos = SrfPostPosType.srfPostPosBelow;
        PostMap.LabelFont.Face = @"宋体";
        PostMap.LabelFont.Size = 9;
        PostMap.Symbol.Index = 11;
        PostMap.Symbol.Color = srfColor.srfColorBlue;
        PostMap.Symbol.Size = 0.04;

        PostMap1.LabelPos = SrfPostPosType.srfPostPosAbove;
        PostMap1.LabelFont.Face = @"宋体";
        PostMap1.LabelFont.Size = 9;
        PostMap1.Symbol.Index = 11;
        PostMap1.Symbol.Color = srfColor.srfColorBlue;
        PostMap1.Symbol.Size = 0.04;

        //IPostMap PostMapCap = (IPostMap)PlotDoc.Shapes.AddPostMap(

        //等值线填充
        Surfer.IContourMap ContourMap = (Surfer.IContourMap)MapF.Overlays.Item(1);
        ContourMap.FillContours = true;
        ContourMap.ShowColorScale = true;
        ContourMap.SmoothContours = SrfConSmoothType.srfConSmoothHigh;

        ContourMap.Levels.LoadFile(strAppPath + @"\RainBow1.lvl");
      

        //覆盖所有地图
        PlotDoc.Shapes.SelectAll();
        Surfer.IMapFrame MapFrame = PlotDoc.Selection.OverlayMaps();
        MapFrame.Axes.Item(1).Visible = false;
        MapFrame.Axes.Item(2).Visible = false;
        MapFrame.Axes.Item(3).Visible = false;
        MapFrame.Axes.Item(4).Visible = false;

        PlotDoc.SaveAs(strAppPath + "\\"+drpZB.SelectedValue+".srf", "", SrfSaveFormat.srfSaveFormatDat);
        string strWidthHeight = string.Format("width={0:f0},height={1:f0}", 600.0 * 1.2, 465.0 * 1.2);
        PlotDoc.Export(strAppPath +"\\"+drpZB.SelectedValue+"Contour.gif", true, strWidthHeight);

        image1.Src = "data\\"+drpZB.SelectedValue+"Contour.gif";
        app.Quit();
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表