/// <summary> /// 创建BaseCalibreationView新实例 /// </summary> public BaseCalibreationView() { InitializeComponent(); var viewModel = new BaseCalibreationViewModel(); DataContext = viewModel; viewModel.MessageRaised += ViewModel_MessageRaised; }
/// <summary> /// 创建AdvanceCalibrationViewModel新实例 /// </summary> public AdvanceCalibrationViewModel() { sceneManager = SceneManager.GetInstance(); UpdateScenes(); UpdateRobotAssembly(); BaseCalibreationViewModel = new BaseCalibreationViewModel(); BaseCalibreationViewModel.MessageRaised += BaseCalibreationViewModel_MessageRaised; BaseCalibreationViewModel.CalibrationPointListChanged += BaseCalibreationViewModel_CalibrationPointListChanged; BaseCalibreationViewModel.CalibrationPointSelectionChanged += BaseCalibreationViewModel_CalibrationPointSelectionChanged; NotifyOfPropertyChange(() => BaseCalibreationViewModel); PointIndexs.Clear(); for (int i = 0; i < BaseCalibreationViewModel.CalibPointList.Count + 1; i++) { PointIndexs.Add(i); } RobotPointIndex = ImagePointIndex = PointIndexs[PointIndexs.Count - 1]; }
/// <summary> /// 设置机器人标定点 /// </summary> /// <param name="index">点位索引</param> /// <param name="qx">机器人X</param> /// <param name="qy">机器人Y</param> public void SetRobotCalibrationPoint(int index, double qx, double qy) { try { if (index < BaseCalibreationViewModel.CalibPointList.Count) { //覆盖 BaseCalibreationViewModel.Cover(index, BaseCalibreationViewModel.CalibPointList[index].Px, BaseCalibreationViewModel.CalibPointList[index].Py, qx, qy); } else if (index == BaseCalibreationViewModel.CalibPointList.Count) { //追加 BaseCalibreationViewModel.Add(0, 0, qx, qy); } else { //无效输入 } } catch (Exception ex) { OnMessageRaised(MessageLevel.Err, ex.Message, ex); } }
/// <summary> /// 设置图像标定点 /// </summary> /// <param name="index">点位索引</param> /// <param name="px">图像坐标X</param> /// <param name="py">图像坐标Y</param> public void SetImageCalibrationPoint(int index, double px, double py) { try { if (index < BaseCalibreationViewModel.CalibPointList.Count) { //覆盖 BaseCalibreationViewModel.Cover(index, px, py, BaseCalibreationViewModel.CalibPointList[index].Qx, BaseCalibreationViewModel.CalibPointList[index].Qy); } else if (index == BaseCalibreationViewModel.CalibPointList.Count) { //追加 BaseCalibreationViewModel.Add(px, py, 0, 0); } else { //无效输入 } } catch (Exception ex) { OnMessageRaised(MessageLevel.Err, ex.Message, ex); } }