private void Cruise_LineAnalyseHotPic(int taskIndex, int tempValueType, IRCtrl irCtrl, TVCtrl tvCtrl) { MySqlConnection conn = GlobalCtrl.GetSqlConnection(); string strSql = "select * from cruise_lineset where MeasureTask_Index = @taskIndex"; List <MySqlParameter> parameters = new List <MySqlParameter>(); parameters.Add(new MySqlParameter("@taskIndex", taskIndex)); DataTable lineDatas = SqlHelper.QueryData(conn, strSql, parameters.ToArray()); if (lineDatas.Rows.Count != 0) { for (var i = 0; i < lineDatas.Rows.Count; i++) { switch (tempValueType) { case 0: //最大值 break; case 1: //平均值 break; case 2: //最小值 break; case 4: //差值 break; } } } }
private bool AddSpotMeaTempRecords(int taskId, double temperature) { MySqlConnection conn = GlobalCtrl.GetSqlConnection(); string strSql = "insert into record_tempmeasure (MeasureTask_Index,MonDev_Index,MeasureValueMin,MeasureValueAvg,MeasureValueMax,AirTemperature,Humidity,Electricty,RecordTime," + "TVFilePath,IRFilePath,TVVImgPath,IRVImgPath,IRHImgPath,Readed) values(@MeasureTask_Index,@MonDev_Index,@MeasureValueMin,@MeasureValueAvg,@MeasureValueMax,@AirTemperature," + "@Humidity,@Electricty,@RecordTime,@TVFilePath,@IRFilePath,@TVVImgPath,@IRVImgPath,@IRHImgPath,@Readed)"; List <MySqlParameter> parameters = new List <MySqlParameter>(); parameters.Add(new MySqlParameter("@MeasureTask_Index", taskId)); parameters.Add(new MySqlParameter("@MonDev_Index", 0)); parameters.Add(new MySqlParameter("@MeasureValueMin", temperature)); parameters.Add(new MySqlParameter("@MeasureValueAvg", temperature)); parameters.Add(new MySqlParameter("@MeasureValueMax", temperature)); parameters.Add(new MySqlParameter("@AirTemperature", 0)); parameters.Add(new MySqlParameter("@Humidity", 0)); parameters.Add(new MySqlParameter("@Electricty", 0)); parameters.Add(new MySqlParameter("@RecordTime", DateTime.Now)); parameters.Add(new MySqlParameter("@TVFilePath", null)); parameters.Add(new MySqlParameter("@IRFilePath", null)); parameters.Add(new MySqlParameter("@TVVImgPath", null)); parameters.Add(new MySqlParameter("@IRVImgPath", null)); parameters.Add(new MySqlParameter("@IRHImgPath", null)); parameters.Add(new MySqlParameter("@Readed", false)); return(SqlHelper.AddData(conn, strSql, parameters.ToArray())); }
public IRTestForm(Form1 frm1) { this.frm1 = frm1; globalCtrl = frm1.M_ClientOpt.globalCtrl; InitializeComponent(); tBox_ip.Text = globalCtrl.irCtrl.IP; tBox_port.Text = globalCtrl.irCtrl.port.ToString(); label4.Text = globalCtrl.IRScanState().ToString(); }
//-------------------------------------------------------------------------------------------------------------------------- // Collision Detection / Force Feedback // Called when this object enters the collider of another object protected virtual void OnTriggerEnter(Collider col) { SenseGlove_Interactable interact = col.attachedRigidbody != null?col.attachedRigidbody.GetComponent <SenseGlove_Interactable>() : col.GetComponent <SenseGlove_Interactable>(); if (interact != null) { interact.TouchedBy(this); if (this.touchedObject == null) { //if (!this.IsTouching(col.gameObject)) //{ // //touching a new object! //} this.touchedObject = interact.gameObject; this.touchedScript = interact; if (this.touchedObject.transform.parent != null) { if (this.touchedObject.transform.parent.name == "Tastatur" && this.name == "indexPickupCollider") { this.transform.root.GetComponent <SenseGlove_Object>().SendBuzzCmd(new bool[5] { false, true, false, false, false }, 100, 50); GlobalCtrl text = this.transform.root.GetComponent <GlobalCtrl>(); text.textChange(this.touchedObject); } else if (this.touchedObject.transform.parent.name == "GUILoad" && this.name == "indexPickupCollider") { this.transform.root.GetComponent <SenseGlove_Object>().SendBuzzCmd(new bool[5] { false, true, false, false, false }, 100, 50); if (this.touchedObject.name == "Down") { GlobalCtrl.updown += 1; } else if (this.touchedObject.name == "Up" && GlobalCtrl.updown >= 1) { GlobalCtrl.updown -= 1; } else if (this.touchedObject.name.StartsWith("Platz")) { List <atomData> loadFile = new List <atomData>(); loadFile = (List <atomData>)CFileHelper.LoadData(Application.dataPath + "/MoleculeFiles/" + touchedObject.transform.GetChild(0).GetComponent <Text>().text, typeof(List <atomData>)); this.transform.root.GetComponent <GlobalCtrl>().loadMolecule(loadFile); } else if (this.touchedObject.name == "ExitLoadGui") { GlobalCtrl.loadGUI = false; GameObject.Find("GUILoad").SetActive(false); molecule.SetActive(true); } } } } } }
public TVTestForm(Form1 frm1) { this.frm1 = frm1; globalCtrl = frm1.M_ClientOpt.globalCtrl; InitializeComponent(); tBox_ip.Text = globalCtrl.tvCtrl.IP; tBox_port.Text = globalCtrl.tvCtrl.port.ToString(); label4.Text = globalCtrl.tvCtrl.GetTVStatus().ToString(); tBox_username.Text = globalCtrl.tvCtrl.username; tBox_psw.Text = globalCtrl.tvCtrl.password; tBox_channel.Text = globalCtrl.tvCtrl.channel.ToString(); }
public void SqlStatusScan() { while (true) { Debug.WriteLine(">>>>>>>>>>>>>>>>数据库状态监控线程:" + Thread.CurrentThread.Name + ";数据库状态:" + globalCtrl.GetSqlConnectionStatus()); if (!globalCtrl.GetSqlConnectionStatus()) { SqlReconnectCount++; GlobalCtrl.GetSqlConnection(); } else { SqlReconnectCount = 0; } Thread.Sleep(4000); } }
private void Cruise_SpotAnalyseHotPic(int taskId, IRCtrl irCtrl, TVCtrl tvCtrl, string IRImagefileName) { MySqlConnection conn = GlobalCtrl.GetSqlConnection(); double temperature = 0; string strSql = "select * from cruise_spotset where MeasureTask_Index = @taskId"; List <MySqlParameter> parameters = new List <MySqlParameter>(); parameters.Add(new MySqlParameter("@taskId", taskId)); DataTable spotDatas = SqlHelper.QueryData(conn, strSql, parameters.ToArray()); if (spotDatas.Rows.Count != 0) { for (var i = 0; i < spotDatas.Rows.Count; i++) { } } }
private void Awake() { if (instance == null) { DontDestroyOnLoad(gameObject); instance = this; } else if (instance != this) { Destroy(gameObject); } numOfLevels = 3; // 3 levels for now ( other than the main one) levelsCompleted = new bool[numOfLevels]; for (int i = 0; i < numOfLevels; i++) { levelsCompleted[i] = false; } dungeonMasterState = 0; }
private void button1_Click(object sender, EventArgs e) { Position pos = new Position(); pos.PositionName = pos_name.Text; pos.Station_Index = Convert.ToInt32(pos_stationIndex.Value); string sql = null; List <MySqlParameter> pamList = new List <MySqlParameter>(); if (pos_cruiseType.Text.ToString().Equals("隔时巡检")) { pos.CruiseType = 0; pos.CruiseInterval = Convert.ToInt32(pos_interval.Value); sql = "insert into cruise_position(Station_Index,PositionName,CruiseInterval,CruiseType) values(@Station_Index,@PositionName,@CruiseInterval,@CruiseType)"; pamList.Add(new MySqlParameter("@Station_Index", pos.Station_Index)); pamList.Add(new MySqlParameter("@PositionName", pos.PositionName)); pamList.Add(new MySqlParameter("@CruiseInterval", pos.CruiseInterval)); pamList.Add(new MySqlParameter("@CruiseType", pos.CruiseType)); } else if (pos_cruiseType.Text.ToString().Equals("定时巡检")) { pos.CruiseType = 1; pos.StartCruiseTime = pos_cruiseStartTime.Value; sql = "insert into cruise_position(Station_Index, PositionName, StartCruiseTime, CruiseType) values(@Station_Index,@PositionName,@StartCruiseTime,@CruiseType)"; pamList.Add(new MySqlParameter("@Station_Index", pos.Station_Index)); pamList.Add(new MySqlParameter("@PositionName", pos.PositionName)); pamList.Add(new MySqlParameter("@StartCruiseTime", pos.StartCruiseTime)); pamList.Add(new MySqlParameter("@CruiseType", pos.CruiseType)); } MySqlConnection conn = GlobalCtrl.GetSqlConnection(); if (SqlHelper.AddData(conn, sql, pamList.ToArray())) { sql = "select * from cruise_position where Position_Index = (select max(Position_Index) from cruise_position)"; DataTable data = SqlHelper.QueryData(conn, sql, null); MessageBox.Show("固定点添加成功"); } else { MessageBox.Show("固定点添加失败"); } }
private void Update() { if (!isActive) { isActive = true; this.transform.GetChild(0).gameObject.SetActive(true); } //IF Trackpad is touched in the front mittle of the trackpad, the laserpointer appears Vector2 touchPos = trackpadtouch.GetAxis(SteamVR_Input_Sources.Any); if (touchPos.y >= 0.5) { var device = trackpadtouch.GetActiveDevice(SteamVR_Input_Sources.Any); if (device == transform.GetComponent <SteamVR_Behaviour_Pose>().inputSource) { transform.GetChild(1).GetChild(0).gameObject.SetActive(true); } } else { this.transform.GetChild(1).GetChild(0).gameObject.SetActive(false); } Transform rayTrans = transform.GetChild(1).transform; rayTrans.localRotation = Quaternion.Euler(30, 0, 0); Ray raycast = new Ray(transform.position, rayTrans.forward); RaycastHit hit; bool bHit = Physics.Raycast(raycast, out hit); //Klick on the trackpad confirms the selection, target gets executed if (trackpadklicked.stateDown && bHit && touchPos.y >= 0.5) { //Open an already saved molecule if (false && hit.collider.name == "Öffnen" && (guiSave.activeInHierarchy == false) && (guiLoad.activeInHierarchy == false)) { vibration.Execute(0, 0.2f, 1, 1, this.pose.inputSource); GameObject.Find("Molekül").GetComponent <EditMode>().editMode = false; GameObject.Find("UI0").transform.position = new Vector3(0, 0, 0); GameObject.Find("UI1").transform.position = new Vector3(0, 0, 0); GameObject.Find("UI2").transform.position = new Vector3(0, 0, 0); GameObject.Find("UI3").transform.position = new Vector3(0, 0, 0); GameObject.Find("Molekül").SetActive(false); this.GetComponentInParent <GlobalCtrl>().loadGUILoad(); guiLoad.SetActive(true); } //Save created molecule else if (false && hit.collider.name == "Speichern" && guiSave.activeInHierarchy == false && (guiLoad.activeInHierarchy == false)) { vibration.Execute(0, 0.2f, 1, 1, this.pose.inputSource); guiSave.SetActive(true); GameObject.Find("Molekül").GetComponent <EditMode>().editMode = false; GameObject.Find("UI0").transform.position = new Vector3(0, 0, 0); GameObject.Find("UI1").transform.position = new Vector3(0, 0, 0); GameObject.Find("UI2").transform.position = new Vector3(0, 0, 0); GameObject.Find("UI3").transform.position = new Vector3(0, 0, 0); GameObject.Find("Molekül").SetActive(false); } //Create new carbon atom else if (hit.collider.name == "PeriodensystemC" && (guiSave.activeInHierarchy == false) && (guiLoad.activeInHierarchy == false)) { vibration.Execute(0, 0.2f, 1, 1, this.pose.inputSource); this.GetComponentInParent <GlobalCtrl>().createCarbon(this.transform.position); } //Create new hydrogen atom else if (hit.collider.name == "PeriodensystemH" && (guiSave.activeInHierarchy == false) && (guiLoad.activeInHierarchy == false)) { vibration.Execute(0, 0.2f, 1, 1, this.pose.inputSource); this.GetComponentInParent <GlobalCtrl>().createHydrogen(this.transform.position); } //Delete atoms or whole molecule else if (hit.collider.name == "recycle bin" && (guiSave.activeInHierarchy == false) && (guiLoad.activeInHierarchy == false)) { vibration.Execute(0, 0.2f, 1, 1, this.pose.inputSource); this.GetComponentInParent <GlobalCtrl>().recycle(); } //Mark an existing atom to edit / delete it else if (false && hit.collider.name.StartsWith("atom") && (guiSave.activeInHierarchy == false) && (guiLoad.activeInHierarchy == false)) { vibration.Execute(0, 0.2f, 1, 1, this.pose.inputSource); //if it isn't selected before,start edit mode if (GameObject.Find("Molekül").GetComponent <EditMode>().editMode == false) { GameObject.Find("Molekül").GetComponent <EditMode>().editMode = true; GameObject.Find("Molekül").GetComponent <EditMode>().fixedAtom = hit.collider.gameObject.GetComponent <Atom>(); hit.collider.gameObject.GetComponent <Renderer>().material.color = new Color32(255, 0, 0, 255); hit.collider.gameObject.GetComponent <SenseGlove_Grabable>().editMarker = true; } //if it already was selected before, close edit mode else if (GameObject.Find("Molekül").GetComponent <EditMode>().editMode == true && hit.collider.gameObject.GetComponent <Atom>()._id == GameObject.Find("Molekül").GetComponent <EditMode>().fixedAtom._id) { hit.collider.gameObject.GetComponent <SenseGlove_Grabable>().editMarker = false; GameObject.Find("Molekül").GetComponent <EditMode>().editMode = false; GameObject.Find("Molekül").GetComponent <EditMode>().fixedAtom = null; hit.collider.transform.GetComponent <Atom>().setOriginalColor(); } } //Select the whole molecule -- moves as a solid structure else if ((hit.collider.name == "AllAtoms") && (guiSave.activeInHierarchy == false) && (guiLoad.activeInHierarchy == false)) { GameObject.Find("AllAtoms").transform.localScale = new Vector3(0.1f, 0.1f, 0.1f); GameObject.Find("SingleAtom").transform.localScale = new Vector3(0.07f, 0.1f, 0.07f); this.GetComponentInParent <GlobalCtrl>().allAtom = true; } //Select single atom -- moves independent from the molecule else if ((hit.collider.name == "SingleAtom") && (guiSave.activeInHierarchy == false) && (guiLoad.activeInHierarchy == false)) { GameObject.Find("AllAtoms").transform.localScale = new Vector3(0.07f, 0.1f, 0.07f); GameObject.Find("SingleAtom").transform.localScale = new Vector3(0.1f, 0.1f, 0.1f); this.GetComponentInParent <GlobalCtrl>().allAtom = false; } //Turn off the forcefield, no forces are calculated else if ((hit.collider.name == "ButtonOFF") && (guiSave.activeInHierarchy == false) && (guiLoad.activeInHierarchy == false)) { GameObject.Find("ButtonON").transform.localPosition = new Vector3(4.75f, 1.6f, 6.5f); GameObject.Find("ButtonOFF").transform.localPosition = new Vector3(4.775f, 1.6f, 6.53f); this.GetComponentInParent <GlobalCtrl>().forceField = true; } //Turn on the forcefiled, forces are calculated, atoms are going to move if forces are big enough else if ((hit.collider.name == "ButtonON") && (guiSave.activeInHierarchy == false) && (guiLoad.activeInHierarchy == false)) { GameObject.Find("ButtonOFF").transform.localPosition = new Vector3(4.75f, 1.6f, 6.5f); GameObject.Find("ButtonON").transform.localPosition = new Vector3(4.775f, 1.6f, 6.53f); this.GetComponentInParent <GlobalCtrl>().forceField = false; } //Typing on virtual keyboard else if (hit.collider.transform.parent != null && hit.collider.transform.parent.name == "Tastatur") { GlobalCtrl text = this.transform.root.GetComponent <GlobalCtrl>(); text.textChange(hit.collider.gameObject); } //Scrollbar and update in GUI, if "open created molecule" is active else if (hit.collider.transform.parent != null && hit.collider.transform.parent.name == "GUILoad") { if (hit.collider.name == "Down") { GlobalCtrl.updown += 1; } else if (hit.collider.name == "Up" && GlobalCtrl.updown >= 1) { GlobalCtrl.updown -= 1; } else if (hit.collider.name.StartsWith("Platz")) { List <atomData> loadFile = new List <atomData>(); loadFile = (List <atomData>)CFileHelper.LoadData(Application.dataPath + "/MoleculeFiles/" + hit.collider.transform.GetChild(0).GetComponent <Text>().text, typeof(List <atomData>)); this.transform.root.GetComponent <GlobalCtrl>().loadMolecule(loadFile); } else if (hit.collider.name == "ExitLoadGui") { GlobalCtrl.loadGUI = false; GameObject.Find("GUILoad").SetActive(false); molecule.SetActive(true); } } } }
public void funReceiCmdAnalyseScan(GlobalCtrl ctrl) //定时100ms接收到命令解析 用于在中断线程内调用,解析完后,分别生对应的接收命令表 { try { while (true) { if (lststu_ReceiCmdBuf.Count > 0) { string str1; stuWholeCmdBuf mOneCmd = lststu_ReceiCmdBuf[0]; lststu_ReceiCmdBuf.RemoveAt(0); JObject job1 = mOneCmd.jobjOneContent; string strer = job1["receiver"].ToString(); string strName = job1["sender"].ToString(); str1 = JsonConvert.SerializeObject(job1); string str2 = "接收到返回信息"; #region JObject jobCmd = new JObject(); jobCmd.Add(new JProperty("Server", "A5x0")); jobCmd.Add(new JProperty("sender", "CmdServer")); jobCmd.Add(new JProperty("receiver", strer)); JArray jarr = new JArray(); JObject jobbuf = new JObject(); jobbuf.Add(new JProperty("", "")); jarr.Add(jobbuf); jobCmd.Add(new JProperty("", jarr)); string strjsons = JsonConvert.SerializeObject(jobCmd); #endregion if (!str1.Equals(strjsons)) { frmMain.strMessageDispBuf = str2 + str1 + "\r\n"; // gLogWriter.WriteLog(str2, str1); lsts_CmdStrBuf.Clear(); //清空 } string strUser = job1["receiver"].ToString(); //获取本地地址 string strjson = JsonConvert.SerializeObject(job1).ToString(); lsts_Cmduser.Add(strUser); string str4 = "登录命令"; frmMain.strMessageDispBuf = str4 + strjson + "\r\n"; // m_stuSystemVar.intLoginStatus = 1;//用户登录成功 string strJson = ctrl.ReceiveMsgScan(job1); //if (!job1.ToString().Contains("Server")) //{ // strJson = ctrl.ReceiveMsgScan(job1); //} if (!string.IsNullOrEmpty(strJson)) { funSendOneFramCmd(strJson); } // m_stuSystemVar.intLoginStatus = ctrl.LoginStatus;//用户登录成功 } else { break; } } } catch (Exception ex) { Debug.WriteLine("提示:命令解析回传过程中出错,异常信息:" + ex.Message); // throw ex; } return; }
public void actionOneTaskCruise(int taskId, IRCtrl irCtrl, TVCtrl tvCtrl) { //Check PrePosImf MySqlConnection conn = GlobalCtrl.GetSqlConnection(); string strSql = "SELECT m.MeasureTask_Index,m.PrePosSet_Index,m.DeviceInfo_Index,m.MeaType,m.TaskName,m.GetValueType," + "p.Position_Index,p.PrePositionNO,p.PrePositionName,p.PrePosType,p.TVZoom,p.IRFocus,p.GoPrePosDelays,p.PanAngle,p.TiltAngle,p.PTZHorAngle,p.PTZVerAngle,p.PaletteType " + "from cruise_measuretaskset m, cruise_prepositionset p where m.PrePosSet_Index = p.PrePosSet_Index and p.EnbleMeasure = 1 and m.MeasureTask_Index = @taskId"; List <MySqlParameter> parmList = new List <MySqlParameter>(); parmList.Add(new MySqlParameter("@taskId", taskId)); DataTable datas = SqlHelper.QueryData(conn, strSql, parmList.ToArray()); //根据巡检任务id获取对应的预置位相关的信息 if (datas.Rows.Count != 0) { for (var i = 0; i < datas.Rows.Count; i++) { //check IR Camera Seting irCtrl.SetFocusPos(Convert.ToInt32(datas.Rows[i]["IRFocus"])); //Goto PrePos; tvCtrl.InvokePrePos(Convert.ToInt32(datas.Rows[i]["PrePosSet_Index"])); //Sleep Time wait for Pantilt to Position Thread.Sleep(3000); //Autofocus Or Manual Focus; irCtrl.SetAutoFocus(); //sleep time wait for Auto Focus Finish Thread.Sleep(3000); //Snap Picture; string IRImagefileName = ""; string TVImagefileName = ""; CruiseSnapPictures(taskId, datas.Rows[i]["Position_Index"].ToString(), datas.Rows[i]["PrePositionName"].ToString(), irCtrl, tvCtrl, out IRImagefileName, out TVImagefileName); //sleep wiait for FIle save finish Thread.Sleep(3000); //Analyse Hot Picture; switch (Convert.ToInt32(datas.Rows[i]["MeaType"])) { case 0: //点温 Cruise_SpotAnalyseHotPic(taskId, irCtrl, tvCtrl, IRImagefileName); break; case 1: //线温 Cruise_LineAnalyseHotPic(taskId, Convert.ToInt32(datas.Rows[i]["GetValueType"]), irCtrl, tvCtrl); break; case 2: //区域测温 Cruise_AreaAnalyseHotPic(taskId, Convert.ToInt32(datas.Rows[i]["GetValueType"]), irCtrl, tvCtrl); break; case 3: //多边形测温 Cruise_PolygonAnalyseHotPic(taskId, Convert.ToInt32(datas.Rows[i]["GetValueType"]), irCtrl, tvCtrl); break; case 4: //圆形测温 Cruise_CircleAnalyseHotPic(taskId, Convert.ToInt32(datas.Rows[i]["GetValueType"]), irCtrl, tvCtrl); break; } //Create Temptrue Record //Analyse AlarmRecord; //Upload FTP File //check File } } }