爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
楼主: ???еС?

[源程序] C# 调用surfer 的可以看看

[复制链接]
发表于 2015-5-15 20:10:06 | 显示全部楼层
想请教下,如何获取某个多边形的实际经纬度。
密码修改失败请联系微信:mofangbao
发表于 2015-8-4 08:35:30 | 显示全部楼层
chengxf 发表于 2013-4-17 13:34
我不懂C#,具体的语句无法帮到你,但可以给你一个思路供参考。你要在图中某些位置显示文字,比如街区的名称 ...

contourMap.ApplyFillToLevels(1, 1, 0);这句c#没有

密码修改失败请联系微信:mofangbao
发表于 2015-8-4 08:36:24 | 显示全部楼层
contourMap.ApplyFillToLevels(1, 1, 0);这句c#没有,该程序不能正常运行

密码修改失败请联系微信:mofangbao
发表于 2015-8-4 08:39:01 | 显示全部楼层
// 数据和站点显示
密码修改失败请联系微信:mofangbao
发表于 2015-8-4 08:39:45 | 显示全部楼层
chengxf 发表于 2013-4-17 13:34
我不懂C#,具体的语句无法帮到你,但可以给你一个思路供参考。你要在图中某些位置显示文字,比如街区的名称 ...

IPostMap PostMap = (IPostMap)PlotDoc.Shapes.AddPostMap(strDataPath + @"Data1.txt", 2, 3, 1, 0, 1).Overlays.Item(1);
                IPostMap PostMap1 = (IPostMap)PlotDoc.Shapes.AddPostMap(strDataPath + @"Data1.txt", 2, 3, 4, 0, 0).Overlays.Item(1);

// 数据和站点显示
                PostMap.LabelPos = SrfPostPosType.srfPostPosBelow;
                PostMap.LabelFont.Face = @"宋体";
                PostMap.LabelFont.Size = 10;
                PostMap.LabelFont.Bold = true;
                PostMap.Symbol.Index = 11;
                PostMap.Symbol.Color = srfColor.srfColorBlue;
                PostMap.Symbol.Size = 0.04;
                PostMap1.LabelPos = SrfPostPosType.srfPostPosAbove;
                PostMap1.LabelFont.Face = @"宋体";
                PostMap1.LabelFont.Bold = true;
                PostMap1.LabelFont.Size = 10;
                PostMap1.Symbol.Index = 11;
                PostMap1.Symbol.Color = srfColor.srfColorBlue;
                PostMap1.Symbol.Size = 0.04;
密码修改失败请联系微信:mofangbao
发表于 2015-8-4 08:43:02 | 显示全部楼层
chengxf 发表于 2013-4-18 10:04
"您好   追加一个问题  我要去掉底图以外的图  怎么去掉     就是只要 边线以内的"

“去掉底图以外的图 ...

  public bool  ht(string picname)
        {
            
            bool success = false;
            Surfer.Application app = new Surfer.Application();
            try
            {
                // 调用Surfer画等值线            
               
                app.Visible = SufBool;
                app.Caption = strName;// @"区域自动站雨量等值线图";

                // Type.Missing为缺省参数
                app.GridData(strDataPath + @"\Data1.txt", 2, 3, 4, Type.Missing, //5   
                    Type.Missing, Type.Missing, Type.Missing, 200, 200, //10         
                    minLon, maxLon, minLat, maxLat, Type.Missing, //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, strDataPath + @"data1.grd", //50         
                    SrfGridFormat.srfGridFmtAscii, Type.Missing, Type.Missing, Type.Missing, Type.Missing, //55  
                    Type.Missing, Type.Missing
                    );
                app.GridBlank(strDataPath + @"data1.grd", strMapPath, strDataPath + @"out1.grd", SrfGridFormat.srfGridFmtAscii);
                Surfer.IDocuments Docs = app.Documents;// = new Surfer.IDocuments();         
                Surfer.IPlotDocument PlotDoc = (Surfer.IPlotDocument)Docs.Add(SrfDocTypes.srfDocPlot);
                Surfer.IMapFrame MapF = PlotDoc.Shapes.AddContourMap(strDataPath + @"out1.grd");
                PlotDoc.Shapes.AddBaseMap(strMapPath, "");
                IPostMap PostMap = (IPostMap)PlotDoc.Shapes.AddPostMap(strDataPath + @"Data1.txt", 2, 3, 1, 0, 1).Overlays.Item(1);
                IPostMap PostMap1 = (IPostMap)PlotDoc.Shapes.AddPostMap(strDataPath + @"Data1.txt", 2, 3, 4, 0, 0).Overlays.Item(1);

               
                //PlotDoc1.Shapes.AddText().
                // 数据和站点显示
                PostMap.LabelPos = SrfPostPosType.srfPostPosBelow;
                PostMap.LabelFont.Face = @"宋体";
                PostMap.LabelFont.Size = 10;
                PostMap.LabelFont.Bold = true;
                PostMap.Symbol.Index = 11;
                PostMap.Symbol.Color = srfColor.srfColorBlue;
                PostMap.Symbol.Size = 0.04;
                PostMap1.LabelPos = SrfPostPosType.srfPostPosAbove;
                PostMap1.LabelFont.Face = @"宋体";
                PostMap1.LabelFont.Bold = true;
                PostMap1.LabelFont.Size = 10;
                PostMap1.Symbol.Index = 11;
                PostMap1.Symbol.Color = srfColor.srfColorBlue;
                PostMap1.Symbol.Size = 0.04;
                //等值线填充  
                Surfer.IContourMap ContourMap = (Surfer.IContourMap)MapF.Overlays.Item(1);
                ContourMap.FillContours = true; //添加颜色填充
                ContourMap.ShowColorScale = true; // 显示对应色柱
                ContourMap.SmoothContours = SrfConSmoothType.srfConSmoothHigh;
                ContourMap.Levels.LoadFile(XGlobal.str雨量等值线色标 + colorfile);
                for (int i = 0; i < ContourMap.Levels.Count; i++)
                {
                    ContourMap.Levels.Item(i + 1).ShowLabel = true;                 //显示等值线上的数值
                   ContourMap.Levels.Item(i + 1).ShowHach = false;                 //
                    ContourMap.Levels.Item(i + 1).Line.Style = "Invisible";         //不显示线
                }
                ContourMap.SmoothContours = SrfConSmoothType.srfConSmoothNone;   //平滑等值线边界当前设置不平滑
                ContourMap.ColorScale.Height = 1.4;
                ContourMap.ColorScale.Width = 0.3;

                double x = ContourMap.Left + 1.4;
                double y = ContourMap.Top -ContourMap.Height -0.5 ;

                IText Itext = PlotDoc.Shapes.AddText(x, y, strName);//2.5,2.6
                Itext.Font.Bold = true;
                Itext.Font.Size = 14;
                Itext.Font.Face = @"宋体";




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

                PlotDoc.SaveAs(strDataPath + @"Data1.srf", "", SrfSaveFormat.srfSaveFormatDat);
                mapw = pictureBox11.Width;
                maph = pictureBox11.Height;
                string strWidthHeight = string.Format("width={0:f0},height={1:f0}", mapw, maph);
                PlotDoc.Export(XGlobal.str雨量等值线基图 + picname, true, strWidthHeight);

                if (SufBool == false)
                {
                    app.Quit();
                }
                pictureBox11.Image = Bitmap.FromFile(XGlobal.str雨量等值线基图 + picname);
                success = true;
            }
            catch (Exception E)
            {
                MessageBox.Show(E.Message.ToString());
                success = false;
            }
            finally
            {
                ;
            }
            return success ;
        }
密码修改失败请联系微信:mofangbao
发表于 2015-9-17 11:07:16 | 显示全部楼层
谢谢了,  正在研究
密码修改失败请联系微信:mofangbao
发表于 2015-11-3 22:24:07 | 显示全部楼层
谢谢, 正在研究C#掉surfer,希望能用上。
密码修改失败请联系微信:mofangbao
发表于 2015-11-9 14:30:07 | 显示全部楼层
我想请教一下楼主,在调用surfer的时候,IIS需要怎么配置呢
密码修改失败请联系微信:mofangbao
发表于 2015-11-13 13:55:04 | 显示全部楼层
LZ万分感谢,正愁没相关的资料啦。
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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