예제 #1
0
파일: Form1.cs 프로젝트: JokerDLord/GISbook
        private void Button1_Click(object sender, EventArgs e)
        {
            double    x         = Convert.ToDouble(textBox1.Text);
            double    y         = Convert.ToDouble(textBox2.Text);
            GISVertex onevertex = new GISVertex(x, y);
            GISPoint  onepoint  = new GISPoint(onevertex);


            //获取属性信息
            string       attribute    = textBox3.Text;
            GISAttribute oneattribute = new GISAttribute();

            oneattribute.AddValue(attribute);

            //新建一个GISFeature 并添加到features数组中
            GISFeature onefeature = new GISFeature(onepoint, oneattribute);

            features.Add(onefeature);

            //画出这个GISFeature
            Graphics graphics = this.CreateGraphics();

            onefeature.draw(graphics, true, 0);
            //参数分别是画笔 是否绘制属性 属性列表values的索引
        }
예제 #2
0
파일: Form1.cs 프로젝트: JokerDLord/GISbook
        private void Button1_Click(object sender, EventArgs e)
        {
            double    x         = Convert.ToDouble(textBox1.Text);
            double    y         = Convert.ToDouble(textBox2.Text);
            string    attribute = textBox3.Text;
            GISVertex onevertex = new GISVertex(x, y);
            GISPoint  onepoint  = new GISPoint(onevertex, attribute);
            Graphics  graphics  = this.CreateGraphics();

            onepoint.DrawPoint(graphics);
            onepoint.DrawAttribute(graphics); //绘制属性
            points.Add(onepoint);             //保存点到已建好的列表
        }
예제 #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            double   x         = Convert.ToDouble(textBox1.Text);
            double   y         = Convert.ToDouble(textBox2.Text);
            string   attribute = textBox3.Text;
            GISPoint onepoint  = new GISPoint(new GISVertex(x, y));

            GISAttribute attributeset = new GISAttribute();

            attributeset.AddValue(attribute);

            GISFeature onefeasure = new GISFeature(onepoint, attributeset);

            features.Add(onefeasure);

            Graphics graphics = CreateGraphics();

            onefeasure.draw(graphics, view, true, 0);
        }
예제 #4
0
 private List <GISFeature> GetRandomFeature(Random randobj, List <GISFeature> randgisfeature, int number)
 {
     //根据指定数量创造随机gisfeature对象
     for (int i = 0; i < number; i++)
     {
         double    lon       = 360 * randobj.NextDouble() - 180;
         double    lat       = 170 * randobj.NextDouble() - 85;
         GISVertex onevertex = new GISVertex(lon, lat);
         GISPoint  onepoint  = new GISPoint(onevertex);
         //获取属性信息
         string       attribute1   = lon.ToString() + "," + lat.ToString();
         string       attribute2   = "地理坐标为:" + onevertex.mercatorx.ToString() + "," + onevertex.mercatory.ToString();
         GISAttribute oneattribute = new GISAttribute();
         oneattribute.AddValue(attribute1);
         oneattribute.AddValue(attribute2);
         //新建一个GISFeature 并添加到features数组中
         GISFeature onefeature = new GISFeature(onepoint, oneattribute);
         randgisfeature.Add(onefeature);
     }
     return(randgisfeature);
 }