///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Вычитание опорной плоскости ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void choosePointsClicked(object sender, RoutedEventArgs e) { currentCursorMode = CursorMode.defaultMode; if (mainImage.Source == null) { MessageBox.Show("Главное изображение пустое"); return; } if (zArrayDescriptor == null) { MessageBox.Show("Z-массив пуст"); return; } needPointsCapture = true; firstClick = null; secondClick = null; PointsChooseForm pointsChooseForm = new PointsChooseForm(); pointsChooseForm.cosinusChoosed+= PointsChooseFormOnCosinusChoosed; pointsChooseForm.Show(); }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Mouse Events ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void mainImage_MouseUp(object sender, MouseButtonEventArgs e) { if (currentCursorMode == CursorMode.defaultMode) { if (needPointsCapture == false) { return; } if (firstClick == null) { int x = (int) e.GetPosition(mainImage).X; int y = (int) e.GetPosition(mainImage).Y; int z = (int) zArrayDescriptor.array[x][y]; firstClick = new Point3D(x, y, z); return; } else { int x = (int) e.GetPosition(mainImage).X; int y = (int) e.GetPosition(mainImage).Y; int z = (int) zArrayDescriptor.array[x][y]; secondClick = new Point3D(x, y, z); } ZArrayDescriptor result = Pi_Class1.Z_sub(firstClick.x, firstClick.y, secondClick.x, secondClick.y, zArrayDescriptor, cosinusValue); zArrayDescriptor = result; mainImage.Source = Utils.getImageFromArray(zArrayDescriptor); adjustSliders(); needPointsCapture = false; } else if (currentCursorMode == CursorMode.graphBuildMode) { int x = (int)e.GetPosition(mainImage).X; int y = (int)e.GetPosition(mainImage).Y; Graphic graphic = new Graphic(zArrayDescriptor, x, y); // График новый graphic.Show(); } else if (currentCursorMode == CursorMode.tableBuildMode) { if (imageContainersList[8].getzArrayDescriptor() == null) { MessageBox.Show("9 изображение пустое!"); return; } if (imageContainersList[9].getzArrayDescriptor() == null) { MessageBox.Show("10 изображение пустое!"); return; } if (imageContainersList[10].getzArrayDescriptor() == null) { MessageBox.Show("11 изображение пустое!"); return; } ZArrayDescriptor[] imagesForTable = new ZArrayDescriptor[3]; imagesForTable[0] = imageContainersList[8].getzArrayDescriptor(); imagesForTable[1] = imageContainersList[9].getzArrayDescriptor(); imagesForTable[2] = imageContainersList[10].getzArrayDescriptor(); TableGenerateForm tableGenerateForm = new TableGenerateForm(imagesForTable); tableGenerateForm.setX((int)e.GetPosition(mainImage).X); tableGenerateForm.setY((int)e.GetPosition(mainImage).Y); tableGenerateForm.Show(); } else if (currentCursorMode == CursorMode.doubleGraph) { if (imageContainersList[0].getzArrayDescriptor() == null) { MessageBox.Show("1-e изображение пустое!"); return; } int x = (int)e.GetPosition(mainImage).X; int y = (int)e.GetPosition(mainImage).Y; Graphic graphic = new Graphic(zArrayDescriptor, imageContainersList[0].getzArrayDescriptor(), x, y); graphic.Show(); } }
//Interface Methods ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public void addPoint(Point3D newPoint) { listOfPoints.Add(newPoint); glControl1.Invalidate(); }