资源简介

本代码是关于空间分析的源代码,里面包含了DEM模拟表面积求算、球面点距离计算、空间点距离计算、道格拉斯算法、多边形与点空间位置的判定等等

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 空间分析
{
    public partial class DrawArea : Form
    {
        public DrawArea()
        {
            StartPosition = FormStartPosition.CenterScreen;
            InitializeComponent();
        }
        private List point;
        private bool Dr = false;
        private Graphics g;
        Pen pen;
        bool judge = false;
        private static DrawArea _instance = null;
        private void DrawBtn_Click(object sender EventArgs e)
        {
           
            Dr = true;
            point = new List();
            if (Dr)
            {
                label3.Text = “可以进行绘图“;
            
            }
        }

        private void DrawArea_Load(object sender EventArgs e)
        {
           
            pen = new Pen(Color.Blue 2);
            if (!Dr) {

                label3.Text = “不可绘图“;
            }
        }
        public static DrawArea GetInstance()
        {
            if (_instance == null || _instance.IsDisposed)
            {
                _instance = new DrawArea();
                return _instance;

            }

            return _instance;

        }

        private void pictureBox1_Paint(object sender PaintEventArgs e)
        {
            g = this.pictureBox1.CreateGraphics();   
        }

        private void pictureBox1_MouseDown(object sender MouseEventArgs e)
        {

            Point p;

            if (Dr)
            {

                p = new Point();
                p.X = e.X;
                p.Y = e.Y;
                point.Add(p);
                if (point.Count > 1)
                {
                    g.DrawLine(pen point[point.Count - 2] p);

                }

                

            }
            if (judge)
            {
                List angle = new List();
                Point pS = new Point();
                Point pE = new Point();
                double sin cos;
                for (int i = 0; i < point.Count-1; i++)
                {
                    pS.X = point[i].X - e.X;
                    pS.Y = point[i].Y - e.Y;
                    pE.X = point[i+1].X - e.X;
                    pE.Y = point[i+1].Y - e.Y;
                    sin = pS.X * pE.Y - pS.Y * pE.X;//网上找的
                    cos = pS.X * pE.X + pS.Y * pE.Y;//


                    angle.Add(Math.Atan2(sincos)*(180/Math.PI));




                }
                double result = Math.Abs(angle.Sum());
                if (Math.Abs(angle.Sum()-360)<0.01)
                {
                    MessageBox.Show(“点在多边形内部“);
                }
                else
                {
                    MessageBox.Show(“点在多边形外部“);
            

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

     文件        187  2015-09-18 11:51  空间分析\空间分析\App.config

     文件       5466  2015-09-19 13:37  空间分析\空间分析\Area.cs

     文件      13225  2015-09-18 16:05  空间分析\空间分析\Area.Designer.cs

     文件       5817  2015-09-18 16:05  空间分析\空间分析\Area.resx

     文件      54272  2015-10-25 12:07  空间分析\空间分析\bin\Debug\空间分析.exe

     文件        187  2015-09-18 11:51  空间分析\空间分析\bin\Debug\空间分析.exe.config

     文件     124416  2015-10-25 12:07  空间分析\空间分析\bin\Debug\空间分析.pdb

     文件      22984  2015-10-25 12:09  空间分析\空间分析\bin\Debug\空间分析.vshost.exe

     文件        187  2015-09-18 11:51  空间分析\空间分析\bin\Debug\空间分析.vshost.exe.config

     文件        490  2014-01-13 21:31  空间分析\空间分析\bin\Debug\空间分析.vshost.exe.manifest

     文件      30100  2015-10-25 12:11  空间分析\空间分析\DemArea.cs

     文件       9214  2015-10-25 12:11  空间分析\空间分析\DemArea.Designer.cs

     文件       5817  2015-09-19 15:13  空间分析\空间分析\DemArea.resx

     文件       1374  2015-09-19 08:39  空间分析\空间分析\Form1.cs

     文件       4644  2015-09-19 08:39  空间分析\空间分析\Form1.Designer.cs

     文件       5817  2015-09-19 08:39  空间分析\空间分析\Form1.resx

     文件       4084  2015-09-19 13:40  空间分析\空间分析\Globe.cs

     文件      15500  2015-09-19 13:32  空间分析\空间分析\Globe.Designer.cs

     文件       5817  2015-09-19 13:32  空间分析\空间分析\Globe.resx

     文件       6485  2015-09-19 08:36  空间分析\空间分析\Length.cs

     文件       8619  2015-09-19 08:34  空间分析\空间分析\Length.Designer.cs

     文件       5817  2015-09-19 08:34  空间分析\空间分析\Length.resx

     文件       1308  2015-09-18 11:59  空间分析\空间分析\obj\Debug\DesignTimeResolveAssemblyReferences.cache

     文件       7031  2015-10-25 11:39  空间分析\空间分析\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件          0  2015-09-18 11:51  空间分析\空间分析\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs

     文件          0  2015-09-18 11:51  空间分析\空间分析\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs

     文件          0  2015-09-18 11:51  空间分析\空间分析\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs

     文件       2844  2015-10-25 12:09  空间分析\空间分析\obj\Debug\空间分析.csproj.FileListAbsolute.txt

     文件       1332  2015-09-19 15:13  空间分析\空间分析\obj\Debug\空间分析.csproj.GenerateResource.Cache

     文件       2209  2015-09-19 12:42  空间分析\空间分析\obj\Debug\空间分析.csprojResolveAssemblyReference.cache

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

评论

共有 条评论