private void LinkTableData(AISData data) { if (yourDataTable.Rows.Count >= 1) { yourDataTable.Rows.Clear(); } ; yourDataTable.Rows.Add(new object[] { data.Name, data.MMSI, data.Heading, data.COG, data.SOG, data.Lat, data.Lon }); yourDataTable.Rows[0].Cells[0].Selected = false; }
public DataQuery() { try { InitializeComponent(); StartTime.PreviewMouseDown += EmptyState; EndTime.PreviewMouseDown += EmptyState; StartTime.SetTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1, 0, 0, 0); EndTime.SetTime = DateTime.Now; DataQueryPageNumber dqpn = new DataQueryPageNumber(); pageNumber.DataContext = dqpn; PageIndex = new _PageIndex(); AISList.Visibility = Visibility.Visible; starttime = GetTimeStamp(new DateTime(1970, 1, 1)); endtime = GetTimeStamp(new DateTime(2099, 1, 1)); aisp = new dataAnadll.AISDataProvider((uint)starttime, (uint)endtime); List <dataAnadll.FUS_ICD_MySql.AISMsg_SS> list; aisp.GetPageNum(out PageIndex.Total); aisp.GetFirtstPage(out list); PageIndex.Current = 1; AISDataList.Clear(); for (int i = 1; i < list.Count; i++) { AISData AIS = new AISData(); AIS.boatName = list[i].cName; AIS.IMO = list[i].ulIMO; AIS.MMSI = list[i].ulRecoCode; AIS.call = list[i].cCall_ID; AIS.country = list[i].country; AIS.longitude = list[i].dLong; AIS.latitude = list[i].dLat; AIS.angle = list[i].fDirectCourse; AIS.speed = list[i].fDirectSpeed; AIS.time = (GetTime((list[i].ulTime).ToString())).ToString(); AIS.trackState = list[i].ucSailStatus; AIS.high = list[i].fMaxDeep; AIS.people = list[i].ulCount; AIS.destance = list[i].cDestination; AISDataList.Add(AIS); } AISList.DataContext = AISDataList; } catch (Exception ee) { } }
public static AISData ConvertDatabaseAISDataToAISData(AISDatabase.AISData a) { var aisData = new AISData() { MMSI = a.MMSI, TimeStamp = a.TimeStamp, Latitude = a.Latitude, Longitude = a.Longitude, Name = a.Name, Callsign = a.Callsign, }; return aisData; }
private void AISClick(object sender, RoutedEventArgs e)//AIS { try { listType = _listType.ais; AIS.IsChecked = false; radar.IsChecked = false; fuse.IsChecked = false; login.IsChecked = false; operation.IsChecked = false; alarm.IsChecked = false; device.IsChecked = false; AIS.IsChecked = true; long startTime = dataTime()[0]; //开始时间 long endTime = dataTime()[1]; //结束时间 int pages = 0; AISList.Visibility = Visibility.Visible; radarList.Visibility = Visibility.Collapsed; fuseList.Visibility = Visibility.Collapsed; userLoginList.Visibility = Visibility.Collapsed; operateList.Visibility = Visibility.Collapsed; alarmList.Visibility = Visibility.Collapsed; deviceList.Visibility = Visibility.Collapsed; aisp = new dataAnadll.AISDataProvider((uint)startTime, (uint)endTime); List <dataAnadll.FUS_ICD_MySql.AISMsg_SS> list; aisp.GetPageNum(out PageIndex.Total); PageIndex.Current = 1; AISDataList.Clear(); for (int j = 0; j < PageIndex.Total; j++) { aisp.GetPage(j + 1, out list); for (int i = 0; i < list.Count; i++) { AISData AISTarget = new AISData(); AISTarget.boatName = list[i].cName; AISTarget.IMO = list[i].ulIMO; AISTarget.MMSI = list[i].ulRecoCode; AISTarget.call = list[i].cCall_ID; AISTarget.country = list[i].country; AISTarget.longitude = list[i].dLong; AISTarget.latitude = list[i].dLat; AISTarget.angle = list[i].fDirectCourse; AISTarget.speed = list[i].fDirectSpeed; AISTarget.time = (GetTime((list[i].ulTime).ToString())).ToString(); AISTarget.trackState = list[i].ucSailStatus; AISTarget.high = list[i].fMaxDeep; AISTarget.people = list[i].ulCount; AISTarget.destance = list[i].cDestination; AISDataList.Add(AISTarget); } } AISList.DataContext = AISDataList; } catch (Exception ee) { } }
void changeContent(_listType type, int currentPage) //将表格的内容进行切换 { try { PageIndex.Current = currentPage; switch (type) { case _listType.alarm: List <dataAnadll.AlarmLog> list; alarmp.GetPage(currentPage, out list); alarmDataList.Clear(); for (int i = 0; i < list.Count; i++) { alarmData alarmTarget = new alarmData(); string a = ""; if (list[i].alarm_area_num == 201) { a = alarmType[0]; } else if (list[i].alarm_area_num == 202) { a = alarmType[1]; } else if (list[i].alarm_area_num == 203) { a = alarmType[2]; } else if (list[i].alarm_area_num >= 210 && list[i].alarm_area_num <= 215) { a = alarmType[3]; } else if (list[i].alarm_area_num >= 220 && list[i].alarm_area_num <= 225) { a = alarmType[4]; } else if (list[i].alarm_area_num == 255) { a = alarmType[5]; } alarmTarget.DisplayNumber = (i + (PageIndex.Current - 1) * 1000).ToString(); alarmTarget.alarmNumber = a; alarmTarget.time = list[i].time.ToString(); alarmTarget.radarNumber = list[i].radar_batch_id.ToString(); alarmTarget.radarNumber2 = list[i].radar_batch_id2.ToString(); //告警日志添加雷达2 批号 alarmTarget.IMO = list[i].ais_batch_id.ToString(); switch (list[i].alarm_type) { case 1: alarmTarget.alarmString = "驶入"; break; case 2: alarmTarget.alarmString = "驶出"; break; default: alarmTarget.alarmString = "未知报警"; break; } switch (list[i].country) { case 412: case 413: alarmTarget.country = "中国"; break; case 574: case 576: alarmTarget.country = "越南"; break; case 533: alarmTarget.country = "马拉西亚"; break; default: alarmTarget.country = "其他"; break; } alarmTarget.Atrrib = state[list[i].iff_attrib]; alarmDataList.Add(alarmTarget); } alarmList.DataContext = alarmDataList; break; case _listType.ais: List <dataAnadll.FUS_ICD_MySql.AISMsg_SS> list_ais; aisp.GetPage(currentPage, out list_ais); AISDataList.Clear(); for (int i = 0; i < list_ais.Count; i++) { AISData AISTarget = new AISData(); AISTarget.boatName = list_ais[i].cName; AISTarget.IMO = list_ais[i].ulIMO; AISTarget.MMSI = list_ais[i].ulRecoCode; AISTarget.call = list_ais[i].cCall_ID; AISTarget.country = list_ais[i].country; AISTarget.longitude = list_ais[i].dLong; AISTarget.latitude = list_ais[i].dLat; AISTarget.angle = list_ais[i].fDirectCourse; AISTarget.speed = list_ais[i].fDirectSpeed; AISTarget.time = (GetTime((list_ais[i].ulTime).ToString())).ToString(); AISTarget.trackState = list_ais[i].ucSailStatus; AISTarget.high = list_ais[i].fMaxDeep; AISTarget.people = list_ais[i].ulCount; AISTarget.destance = list_ais[i].cDestination; AISDataList.Add(AISTarget); } AISList.DataContext = AISDataList; break; case _listType.dev: List <dataAnadll.SystemLog> list_dev; devp.GetPage(currentPage, out list_dev); deviceDataList.Clear(); for (int i = 0; i < list_dev.Count; i++) { deviceData deviceTarget = new deviceData(); deviceTarget.number = i.ToString(); deviceTarget.ip = list_dev[i].machine_IP.ToString(); deviceTarget.device = list_dev[i].machine_Name.ToString(); deviceTarget.networkState = this.type[list_dev[i].machine_Network]; deviceTarget.workState = this.type[list_dev[i].machine_Workstate]; deviceTarget.time = list_dev[i].machine_time.ToString(); deviceTarget.other = list_dev[i].reason.ToString(); deviceDataList.Add(deviceTarget); } deviceList.DataContext = deviceDataList; break; case _listType.fus: List <dataAnadll.FUS_ICD_MySql.FusTarget_SS> list_fus; fusp.GetPage(currentPage, out list_fus); fuseDataList.Clear(); for (int i = 0; i < list_fus.Count; i++) { fuseData fuseTarget = new fuseData(); fuseTarget.number = list_fus[i].lFusBatchID; fuseTarget.time = (GetTime((list_fus[i].lTime).ToString())).ToString(); string a = ""; if (list_fus[i].FusDataType == "2") { a = mix[0]; } else if (list_fus[i].FusDataType == "3") { a = mix[1]; } else if (list_fus[i].FusDataType == "100") { a = mix[2]; } fuseTarget.type = a; fuseTarget.dataNumber = list_fus[i].SrcNum; fuseTarget.longitude = list_fus[i].dLongti; fuseTarget.latitude = list_fus[i].dLati; fuseTarget.angle = list_fus[i].dNorthCourse; fuseTarget.name = list_fus[i].cName; fuseTarget.call = list_fus[i].cCall_ID; fuseTarget.country = list_fus[i].country; fuseTarget.Atrrbi = state[Convert.ToInt32(list_fus[i].ucIFFAttrib)]; fuseTarget.high = list_fus[i].fMaxDeep; fuseTarget.people = list_fus[i].ulCount; fuseTarget.IMO = list_fus[i].ulAISBatchID; fuseTarget.radar_batch_id = list_fus[i].ulRdbatchID; fuseTarget.radar_batch_id2 = list_fus[i].ulOpticalID; fuseDataList.Add(fuseTarget); } fuseList.DataContext = fuseDataList; break; case _listType.radar: List <dataAnadll.FUS_ICD_MySql.RdDetectMsg_SS> list_rd; radarp.GetPage(currentPage, out list_rd); radarDataList.Clear(); for (int i = 0; i < list_rd.Count; i++) { radarData radarTarget = new radarData(); radarTarget.radarID = list_rd[i].PardPara.ucRadarID.ToString(); radarTarget.number = list_rd[i].lTargetNo; radarTarget.distance = list_rd[i].ulTargetDis; radarTarget.longitude = list_rd[i].dLongti; radarTarget.latitude = list_rd[i].dLati; radarTarget.angle = list_rd[i].ulTargetCourse; radarTarget.north = list_rd[i].dNorthCourse; radarTarget.speed = list_rd[i].ulTargetSpeed; // if (list_rd[i].radar_count == 70.ToString()) { // radarTarget.time = list_rd[i].lFoundTime; } // else { radarTarget.time = (GetTime((list_rd[i].lFoundTime).ToString())).ToString(); } radarDataList.Add(radarTarget); } radarList.DataContext = radarDataList; break; case _listType.ope1: List <dataAnadll.OperationLog> list_ope1; opep.GetPage(currentPage, out list_ope1); loginDataList.Clear(); for (int i = 0; i < list_ope1.Count; i++) { loginData loginTarget = new loginData(); loginTarget.logNumber = (i + (PageIndex.Current - 1) * 1000).ToString(); loginTarget.userName = list_ope1[i].UserName.ToString(); loginTarget.operate = list_ope1[i].OptionName; loginTarget.time = list_ope1[i].OptionTime.ToString(); loginTarget.result = list_ope1[i].Result.ToString(); loginTarget.other = list_ope1[i].Note; loginTarget.ip = list_ope1[i].IP.ToString(); loginTarget.type = logType[list_ope1[i].LogType].ToString(); loginDataList.Add(loginTarget); } userLoginList.DataContext = loginDataList; break; case _listType.ope2: List <dataAnadll.OperationLog> list_ope2; opep.GetPage(currentPage, out list_ope2); operateDataList.Clear(); for (int i = 0; i < list_ope2.Count; i++) { operateData operateTarget = new operateData(); operateTarget.logNumber = (i + (PageIndex.Current - 1) * 1000).ToString(); operateTarget.userName = list_ope2[i].UserName.ToString(); operateTarget.operate = list_ope2[i].OptionName.ToString(); operateTarget.time = list_ope2[i].OptionTime.ToString(); operateTarget.result = list_ope2[i].Result; operateTarget.other = list_ope2[i].Note.ToString(); operateTarget.ip = list_ope2[i].IP.ToString(); operateTarget.type = logType[list_ope2[i].LogType].ToString(); operateDataList.Add(operateTarget); } operateList.DataContext = operateDataList; break; } } catch (Exception ee) { } }
private void InitDockLayout() { _mapForm = new ControlMapForm(); _mapForm.Text = "GIS地图"; _mapForm.Show(dockPanel1, DockState.Document); _mapForm.CloseButton = false; _mapForm.UiInitAndInvoke(); _mapForm.Activate(); MouseMoveOperator mouseMoveOperate; MouseDownOperator mouseDownOperate; sfHandle = new ShapeFileHandle(_mapForm.Map); #region 加载gis地图 string[] str = { @"D:\光纤传感监测系统\Monitor\Monitor\data\底图.shp", @"D:\光纤传感监测系统\Monitor\Monitor\data\省界WGS 84.shp", @"D:\光纤传感监测系统\Monitor\Monitor\data\海缆WGS 84.tif" }; mapLayer = new MapLayer(); MainLayerHandle = mapLayer.AddLayer(_mapForm.Map, str, "底图"); _mapForm.MainLayerHandle = MainLayerHandle; _mapForm.SetMainLayerHandle(); #endregion // _mapForm.Map.ZoomToMaxExtents(); _mapForm.Map.ZoomToLayer(MainLayerHandle); #region 在地图上划线 ClassLine line = new ClassLine(); ClassLine line_1 = new ClassLine(); GisPoint gisPoint = new GisPoint(); LineSet lineSet = new LineSet(tkMapColor.Yellow, 6.0f, tkDashStyle.dsSolid); LineSet lineSet_1 = new LineSet(tkMapColor.Red, 5.0f, tkDashStyle.dsCustom); gisPoint.connectToDB("Data Source=" + new DirectoryInfo("../../../../").FullName + "Monitor\\Monitor\\data\\data.db"); gisPoint.readData(); gisPoint.InitLineData(line); line_1.startX = gisPoint.m_PointList[15].X; line_1.startY = gisPoint.m_PointList[15].Y; line_1.endX = gisPoint.m_PointList[20].X; line_1.endY = gisPoint.m_PointList[20].Y; drawLine = new classDrawLine(_mapForm.Map); drawLine.WriteLine(line, lineSet); drawLine.WriteLine(line_1, lineSet_1); #endregion #region 在gis地图中添加ais数据 //1、获取数据库中数据 SqliteData sqlite = new SqliteData("Data Source=" + new DirectoryInfo("../../../../").FullName + "Monitor\\Monitor\\data\\data.db"); DataTable gisData = sqlite.readData("Point"); //2、实例化AISData类 ais = new AISData(_mapForm.Map, gisData); drawPoint_Ais = new classDrawPoint(MapForm.Map); //3、在地图上加载ais数据 pointSet = new PointSet("AisReal", tkDefaultPointSymbol.dpsTriangleUp, tkMapColor.Red, 16); drawPoint_Ais.CreatPoint(ais.point, pointSet); drawPoint_Ais.EditAttribute(); sfHandle.AddMouseMoveShapeFile("Ais", drawPoint_Ais.LayerHandle); #endregion #region drawPoint = new classDrawPoint(_mapForm.Map); var pnt = new ClassPoint(); pnt.x = 121.907567728461; pnt.y = 30.8729913928844; pnt.str = "图片详情"; string path = new DirectoryInfo("../../../../").FullName + "Monitor\\Monitor\\data\\ship3.png"; drawPoint.AddPicture(pnt, path); drawPoint.EditAttribute(); sfHandle.AddMouseDownShapeFile("pic", drawPoint.LayerHandle); #endregion _mapForm.Sf_MouseMove = sfHandle.Sf_MouseMove; _mapForm.Sf_MouseDown = sfHandle.Sf_MouseDown; mouseMoveOperate = new MouseMoveOperator(Operation.AddLabel); mouseDownOperate = new MouseDownOperator(Operation.AddLabel); //传入委托 MapForm.MouseMoveOperate = mouseMoveOperate; MapForm.mouseDownOperate = mouseDownOperate; //var point = new ClassPoint(); //point.x = 121.907567728461; //point.y = 30.8739913928844; //addText = new classAddText(_mapForm.Map, MainLayerHandle); //addText.AddText(point.x, point.y); }