淹没V-H关系构造

1)构造完成有限元网格后,产生HV表的数据。。

private void button1_Click_1(object sender, EventArgs e)
       {
           try{
               USTC.OleDbc db = new USTC.OleDbc();
               IFeatureCursor fc = null;
               for (double height = 6; height < 45; height += 0.1)
               {
                   IFeatureLayer layer = (IFeatureLayer)maptool.GetLayerByName("陈南圩区有限元");
                   fc = maptool.GetCountyFeature(layer, "Avg_elevat<" + height);
                   //ESRI.ArcGIS.Geodatabase.ISelectionSet selectionSet = featureSelection.SelectionSet;

                   ESRI.ArcGIS.Geodatabase.IFeature ft;
                   decimal sumArea = 0;
                   decimal sumVolume = 0;

                   while ((ft = fc.NextFeature()) != null)
                   {
                       try
                       {
                           decimal Area = System.Convert.ToDecimal(ft.get_Value(8));
                           sumArea += Area;
                           decimal high = System.Convert.ToDecimal(height) - System.Convert.ToDecimal(ft.get_Value(10));
                           sumVolume += high * Area;
                       }
                       catch (Exception ex1)
                       {
                       }

                   }
                   db.open(@"Provider=Microsoft.ACE.OLEDB.12.0;Data source=D:/工程项目/芜湖3D/my3d.mdb");
                   db.getData("insert into HV(H,S,V) values(" + height + "," + sumArea + "," + sumVolume + ")", false);
               }
           }
           catch (Exception ex)
           {
               MessageBox.Show(ex.ToString());
           }
           MessageBox.Show("ok!");
       }

2)调用该关系表数据。

public double getHeight(double Volume)
       {
           USTC.OleDbc db = new USTC.OleDbc();
           db.open(@"Provider=Microsoft.ACE.OLEDB.12.0;Data source=D:/工程项目/芜湖3D/my3d.mdb");
           DataSet ds=(DataSet)db.getData("select * from HV WHERE V<="+Volume+" ORDER BY V DESC", false);
           db.close();
           double h= (double)ds.Tables[0].Rows[0]["H"];
           return h;
       }

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值