汽车导航gps软件设计课程 - 图文(3)

2019-04-16 18:19

FeatureLayer featurelayer = this.mobileService1.Layers[0] as FeatureLayer;

QueryFilter queryfilter = new QueryFilter(); FeatureDataTable featuredatatable = featurelayer.GetDataTable(queryfilter, null);

foreach (FeatureDataRow row in featuredatatable.Rows) row.Delete();

featuredatatable.SaveInFeatureLayer(); }

private void ShowCar(int t) {

ESRI.ArcGIS.Mobile.Geometries.Point tp = new ESRI.ArcGIS.Mobile.Geometries.Point(Pointkindscc[t]); string selectlayername = \;

m_selectedFeatureLayer = this.mobileService1.Layers[selectlayername] as FeatureLayer;

FeatureDataTable featureDataTable = m_selectedFeatureLayer.GetDataTable(); //要素表对象featureDataTable新增一条空的记录

FeatureDataRow editedFeature = featureDataTable.NewRow();

//获取要素图层对象的几何列,并把SketchGraphicLayer图层的几何值赋值给他

int geometryIndex = m_selectedFeatureLayer.GeometryColumnIndex;

editedFeature[geometryIndex] = tp; // 把新增的记录赋回到要素数据表中

featureDataTable.Rows.Add(editedFeature);

//保存结果

featureDataTable.SaveInFeatureLayer();

string X = tp.Coordinate.X.ToString();

string Y = tp.Coordinate.Y.ToString();

this.listBox1.Items.Add(name[t] + \ + X + \ + Y); this.listBox1.SelectedIndex = k++; UpLoad(name[t], X, Y); }

6)双击自动显示button控件,写入代码,实现每隔一秒显示汽车的当前位置,代码如下: this.timer1.Enabled = true;

private void timer1_Tick(object sender, EventArgs e) {

DeleteAll(); ShowCar(t); if (t < 29) {

t = t + 1; } else t = 0; }

7)双击停止button控件,写入代码,实现程序的停止,代码如下: this.timer1.Enabled = false; 截图如下所示: 图1为显示系统界面 图2为单步显示结果 图3为自动显示结果 图4为停止结果

图1

图2

图3

图4 (3)GPS数据上传至服务器数据库

1)建立Webservices,进行数据库连接,代码如下: public Service () {

//如果使用设计的组件,请取消注释以下行 //InitializeComponent(); } public

SqlConnection

connection

=

new

SqlConnection(\

Source=du-96e8d5846746;Initial Catalog=GISshixi;User ID=sa;Password=sa\ [WebMethod(Description = \

public void WriteGPS(string dianming, string X,string Y,string datetime) {

connection.Open();

string dian = string.Format(\ string XX = string.Format(\ string YY = string.Format(\ string tt = string.Format(\

string sqlstr = \信息(点号,X坐标,Y坐标,时间) VALUES (\+ dian + \

System.Data.SqlClient.SqlCommand sqlCommand = new SqlCommand(sqlstr, connection);

sqlCommand.ExecuteNonQuery(); connection.Close();

}2)将GPS信息写入到数据库中,代码如下:

汽车导航终端.shixi.Service hh = new 汽车导航终端.shixi.Service(); string datetime = DateTime.Now.ToString(); hh.WriteGPS(dianming, X, Y, datetime); 车辆GIS管理服务器端软件系统 (1)窗口界面设计

向窗口拖入2个button控件,修改它们的text属性,分别为历史轨迹查询、查询当前位置;向窗体拖入1个dataGridView1控件。窗口设计如下:

(2)读取终端上传过来的GPS数据,并存储

connectionString = \; myConnection = new SqlConnection(connectionString); string Olestr = \信息\;

SqlCommand cmd = new SqlCommand(Olestr, myConnection); SqlDataAdapter adp = new SqlDataAdapter(cmd);


汽车导航gps软件设计课程 - 图文(3).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:山东省增值税即征即退申请审批表

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: