Skip to content
Snippets Groups Projects
Commit a6fae9d0 authored by Omar Animashaun's avatar Omar Animashaun
Browse files

point clicker update

parent f31f0851
No related branches found
No related tags found
1 merge request!24Omar changes
Pipeline #722 passed
import sys
import numpy as np
from vtk.util import numpy_support
import vtk
from AmpScan import AmpObject
from AmpScan.registration import registration
from AmpScan.align import align
from AmpScan.ampVis import qtVtkWindow
from AmpScan.pressSens import pressSense
from AmpScan.ampVis import qtVtkWindow, vtkRenWin
from PyQt5.QtCore import QPoint, QSize, Qt, QTimer, QRect, pyqtSignal
from PyQt5.QtGui import (QColor, QFontMetrics, QImage, QPainter, QIcon,
QOpenGLVersionProfile)
......@@ -120,6 +118,26 @@ class AmpScanGUI(QMainWindow):
self.alCont.ytraButton.buttonClicked[QAbstractButton].connect(self.transy)
self.alCont.ztraButton.buttonClicked[QAbstractButton].connect(self.transz)
def Point_Pick(self):
"""
Pick a point on the mesh.
"""
#vtkRenWin.Pick_point(self.renWin, loc = [-59.2877082824707, -2.0703632831573486, 70.64564514160156])
self.vtkWidget.iren.AddObserver('RightButtonPressEvent', self.pick_loc)
self.renWin.Render()
def pick_loc(self, event, x):
"""
calcs the location of click
"""
#print(event, x)
self.vtkWidget.iren.RemoveObservers('RightButtonPressEvent')
loc = event.GetEventPosition()
pnt = vtkRenWin.Pick_point(self.renWin, loc)
[name, _, color, opacity, display] = self.fileManager.getRow(0)
self.files[name].MeasurementsOut(pnt)
def rotatex(self, button):
moving = str(self.alCont.moving.currentText())
ang = float(button.text())
......@@ -310,6 +328,8 @@ class AmpScanGUI(QMainWindow):
triggered=self.register)
self.analyse = QAction(QIcon('open.png'), 'Analyse', self,
triggered=self.analyse)
self.pick = QAction(QIcon('open.png'), 'Pick', self,
triggered=self.Point_Pick)
def createMenus(self):
"""
......@@ -331,6 +351,8 @@ class AmpScanGUI(QMainWindow):
self.analyseMenu.addAction(self.analyse)
self.kineticMenu = self.menuBar().addMenu("&Kinetic Measurements")
self.kineticMenu.addAction(self.openPress)
self.PointMenu = self.menuBar().addMenu("&Pick Point")
self.PointMenu.addAction(self.pick)
class fileManager(QMainWindow):
"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment