资源简介

基于sharpmap的GIS技术的form程序,虽然已经没有多少人用from了! 以全国省级和河流3级为GIS底图,SHP格式 以三角网实现等值线的跟踪显示 功能:分层显示,自由缩放,鼠标推动移动,A3、A4打印输出 适合于水文气象雨量水情的显示和打印。 本例数据读《实时雨水情数据库表结构与标识符标准》2005版数据库

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Printing;
using System.Drawing.Drawing2D;
using System.Drawing.Text;
using System.Text;
using System.Windows.Forms;

using SharpMap;
using SharpMap.Forms;
using SharpMap.Data.Providers;
using SharpMap.layers;
using SharpMap.Rendering;
using SharpMap.Rendering.Symbolizer;
using SharpMap.styles;
using SharpMap.Geometries;
using Point = SharpMap.Geometries.Point;

using contour;
using DataAccess;

namespace WindowsFormsApplication3
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            mapBox1.ActiveTool = MapBox.Tools.Pan;
            mapBox1.Map = InitializeMapOrig(0);
            checkedListBox1.SetItemChecked(0 true);  //true改为false为没有选中
            //this.button1_Click(this.button1 null);
        }

        private void button1_Click(object sender EventArgs e)
        {
            Cursor mic = mapBox1.Cursor;
            mapBox1.Cursor = Cursors.WaitCursor;
            Cursor = Cursors.WaitCursor;
            Contour mContour = new Contour();//实例等值线
            mContour.FreeData();//初始化
            List mylsum = new List();//建立 站号、站名、经、纬、时段值(高程)结构的数组。
            MSSQLConnection mysql = new MSSQLConnection();//建立水情数据库实例连接
            string mysqlstr = “Data Source = “ + textBox1.Text.Trim().ToString() + “;Initial Catalog = “ + textBox2.Text.Trim().ToString() + “;User ID = “ + textBox3.Text.Trim().ToString() + “;Password = “ + textBox4.Text.Trim().ToString();
            mysql.SetCurSQLconn(mysqlstr);//修改数据库连接参数
            //mylsum = mysql.Get_2005_Data(System.IO.Directory.GetCurrentDirectory().ToString() + “\\st_stbprp_b.txt“ DateTime.Parse(“2011-08-1 08:00:00“) DateTime.Parse(“2011-09-01 08:00:00“));//2005版实时雨水情数据库表结构与标识符标准,也为标准版

            mylsum = mysql.Get_2005_Data(System.IO.Directory.GetCurrentDirectory().ToString() + “\\st_stbprp_b.txt“ dateTimePicker1.Value dateTimePicker2.Value);//2005版实时雨水情数据库表结构与标识符标准,也为标准版
            if (mylsum != null)
            {
                if (mylsum.Count == 0)
                {
                    MessageBox.Show(“本次没有雨量,如果是新版数据库,请使用Get_2012_Data“);
                    Cursor = Cursors.Default;
                    mapBox1.Cursor = mic;
                    return;

                }
                for (int i = 0; i < mylsum.Count; i++)
                {
                    if (mylsum[i].YL > 0)
                    {
                        mContour.AddPointRandom(mylsum[i].STCD mylsum[i].STNM mylsum[i].LGTD mylsum[i].LTTD mylsum[i].YL);//逐个点增加数据
                    }
                }
            }
            else
            {
                MessageBox.Show(“本次没有雨量,如果是新版数据库,请使用Get_2012_Data“);
                Cursor = Cursors.Default;
                mapBox1.Cursor = mic;
         

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        144  2012-01-02 11:05  WindowsFormsApplication3\WindowsFormsApplication3\app.config

     文件      56832  2012-01-04 16:09  WindowsFormsApplication3\WindowsFormsApplication3\bin\Debug\contour.dll

     文件      77312  2012-01-04 16:24  WindowsFormsApplication3\WindowsFormsApplication3\bin\Debug\DataAccess.dll

     文件     182392  2012-01-02 13:41  WindowsFormsApplication3\WindowsFormsApplication3\bin\Debug\GeoData\World\china2.dbf

     文件        157  2012-01-02 13:41  WindowsFormsApplication3\WindowsFormsApplication3\bin\Debug\GeoData\World\china2.prj

     文件    1395500  2012-01-02 13:41  WindowsFormsApplication3\WindowsFormsApplication3\bin\Debug\GeoData\World\china2.shp

     文件     102525  2012-01-02 13:43  WindowsFormsApplication3\WindowsFormsApplication3\bin\Debug\GeoData\World\china2.shp.sidx

     文件      14380  2012-01-02 13:41  WindowsFormsApplication3\WindowsFormsApplication3\bin\Debug\GeoData\World\china2.shx

     文件      25464  2011-12-22 05:43  WindowsFormsApplication3\WindowsFormsApplication3\bin\Debug\GeoData\World\cities.DBF

     文件        142  2011-12-22 05:43  WindowsFormsApplication3\WindowsFormsApplication3\bin\Debug\GeoData\World\cities.prj

     文件      13484  2011-12-22 05:43  WindowsFormsApplication3\WindowsFormsApplication3\bin\Debug\GeoData\World\cities.SHP

     文件      34613  2011-12-22 05:43  WindowsFormsApplication3\WindowsFormsApplication3\bin\Debug\GeoData\World\cities.shp.sidx

     文件       3924  2011-12-22 05:43  WindowsFormsApplication3\WindowsFormsApplication3\bin\Debug\GeoData\World\cities.SHX

     文件       7301  2011-12-22 05:43  WindowsFormsApplication3\WindowsFormsApplication3\bin\Debug\GeoData\World\countries.dbf

     文件        142  2011-12-22 05:43  WindowsFormsApplication3\WindowsFormsApplication3\bin\Debug\GeoData\World\countries.prj

     文件     459332  2011-12-22 05:43  WindowsFormsApplication3\WindowsFormsApplication3\bin\Debug\GeoData\World\countries.shp

     文件      11637  2011-12-22 05:43  WindowsFormsApplication3\WindowsFormsApplication3\bin\Debug\GeoData\World\countries.shp.sidx

     文件       1276  2011-12-22 05:43  WindowsFormsApplication3\WindowsFormsApplication3\bin\Debug\GeoData\World\countries.shx

     文件       8036  2011-12-22 05:43  WindowsFormsApplication3\WindowsFormsApplication3\bin\Debug\GeoData\World\rivers.dbf

     文件        142  2011-12-22 05:43  WindowsFormsApplication3\WindowsFormsApplication3\bin\Debug\GeoData\World\rivers.prj

     文件      69344  2011-12-22 05:43  WindowsFormsApplication3\WindowsFormsApplication3\bin\Debug\GeoData\World\rivers.shp

     文件       7703  2011-12-22 05:43  WindowsFormsApplication3\WindowsFormsApplication3\bin\Debug\GeoData\World\rivers.shp.sidx

     文件        884  2011-12-22 05:43  WindowsFormsApplication3\WindowsFormsApplication3\bin\Debug\GeoData\World\rivers.shx

     文件     555320  2012-01-02 13:42  WindowsFormsApplication3\WindowsFormsApplication3\bin\Debug\GeoData\World\rivers1.dbf

     文件        157  2012-01-02 13:42  WindowsFormsApplication3\WindowsFormsApplication3\bin\Debug\GeoData\World\rivers1.prj

     文件    3470812  2012-01-02 13:42  WindowsFormsApplication3\WindowsFormsApplication3\bin\Debug\GeoData\World\rivers1.shp

     文件     167423  2012-01-02 13:43  WindowsFormsApplication3\WindowsFormsApplication3\bin\Debug\GeoData\World\rivers1.shp.sidx

     文件      23964  2012-01-02 13:42  WindowsFormsApplication3\WindowsFormsApplication3\bin\Debug\GeoData\World\rivers1.shx

     文件     351870  2012-01-02 13:36  WindowsFormsApplication3\WindowsFormsApplication3\bin\Debug\GeoData\World\rivers2.dbf

     文件        157  2012-01-02 13:36  WindowsFormsApplication3\WindowsFormsApplication3\bin\Debug\GeoData\World\rivers2.prj

............此处省略49个文件信息

评论

共有 条评论