//writelog("更新周期开始" + System.DateTime.Now.ToString()); //OracleConnection con = new OracleConnection(mysqlstr); //try //{ // con.Open(); // OracleCommand cmd = new OracleCommand("Select * from GPS警车定位系统", con); // cmd.ExecuteNonQuery(); // OracleDataAdapter apt = new OracleDataAdapter(cmd); // DataTable dt = new DataTable(); // apt.Fill(dt); // string cnum = string.Empty; // double x; // double y; // double prx; // double pry; // if (dt.Rows.Count > 0) // { // foreach (DataRow dr in dt.Rows) // { // cnum = Convert.ToString(dr["终端车辆号牌"]); // x = Convert.ToDouble(dr["X"]); // y = Convert.ToDouble(dr["Y"]); // prx = Convert.ToDouble(dr["PREX"]); // pry = Convert.ToDouble(dr["PREY"]); // Catalog cat = MapInfo.Engine.Session.Current.Catalog; // Table tbl = cat.GetTable("CarLayer"); // MapInfo.Mapping.Map map = null; // map = MapInfo.Engine.Session.Current.MapFactory[1]; // MapInfo.Data.MIConnection micon = new MIConnection(); // micon.Open(); // string tblname = "CarLayer"; // string colname = "Name"; // MapInfo.Data.MICommand micmd = micon.CreateCommand(); // Table selecttable = MapInfo.Engine.Session.Current.Catalog.GetTable(tblname); // micmd.CommandText = "select * from " + mapControl1.Map.Layers[tblname].ToString() + " where " + colname + "= '" + cnum + "'"; // IResultSetFeatureCollection rsfcflash3 = micmd.ExecuteFeatureCollection(); // micon.Close(); // micon.Dispose(); // micmd.Cancel(); // micmd.Dispose(); // if (tbl != null) // { // if (rsfcflash3.Count == 1) // { // tbl.BeginAccess(MapInfo.Data.TableAccessMode.Write); // foreach (Feature fcar in rsfcflash3) // { // fcar.Geometry.GetGeometryEditor().OffsetByXY(x - prx, y - pry, MapInfo.Geometry.DistanceUnit.Degree, MapInfo.Geometry.DistanceType.Spherical); // MapInfo.Geometry.DPoint dpoint; // MapInfo.Geometry.Point point; // dpoint = new DPoint(x, y); // point = new MapInfo.Geometry.Point(map.GetDisplayCoordSys(), dpoint); // fcar.Geometry = point; // //Boolean inflag = this.IsInBounds(x, y); // //if (inflag == false) // //{ // // mapControl1.Map.Center = dpoint; // //} // //Trackline(x, y, xx, yy); // //if (this.JzFlag == true) // //{ // // //居中 // // mapControl1.Map.Center = dpoint; // //} // fcar.Geometry.EditingComplete(); // fcar.Update(); // mapControl1.Refresh(); // tbl.EndAccess(); // updateprvxy(cnum, x, y); // break; // } // } // rsfcflash3.Clear(); // } // } // } //} //catch (Exception ex) //{ // writelog("GPS监控--实时监控时发生错误--" + ex.Message); //} //finally //{ // con.Close(); //} //writelog("更新周期结束" + System.DateTime.Now.ToString());
坐标合肥,非典型GIS开发人员 GitHub。