Exemplo n.º 1
0
        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的索引
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
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);
 }