Source code for View_Panorama

"""
This module defines the Panorama class which handles the panorama view functionality
in the MoilApp application.

Dependencies:
- Utils: Utility functions for drawing points on images.
- ShowResult: Import ShowImageResult class for displaying images.

Classes:
- Panorama: Manages the panorama view functionality of images in the main application window.
"""

import Utils
from ShowResult import ShowImageResult


[docs] class Panorama: """ The Panorama class manages the panorama view of images in the main application window. Attributes: parent (MainWindow): The main application window instance. show (ShowImageResult): Instance of ShowImageResult for displaying images. max (float): Maximum value for panorama settings. min (float): Minimum value for panorama settings. """ def __init__(self, MainWindow): self.parent = MainWindow self.show = ShowImageResult(self.parent) self.max = float(110) self.min = float(10) self.parent.ui.lineEdit_Max.setText(str(self.max)) self.parent.ui.lineEdit_Min.setText(str(self.min)) self.connectToButton()
[docs] def connectToButton(self): """ Connects the UI buttons to their respective functions. """ self.parent.ui.checkPanorama.clicked.connect(self.panorama_view) self.parent.ui.pushButtonPanorama.clicked.connect(self.set_pano)
[docs] def set_pano(self): """ Sets the panorama view parameters based on the values entered in the UI. """ self.max = float(self.parent.ui.lineEdit_Max.text()) self.min = float(self.parent.ui.lineEdit_Min.text()) self.panorama_view()
[docs] def panorama_view(self): """ Updates the view to display the panorama image or the original image based on the state of the panorama checkbox. """ if self.parent.image is None: pass else: image = self.parent.image.copy() if self.parent.ui.checkPanorama.isChecked(): self.parent.ui.checkAnypoint.setChecked(False) self.parent.ui.frame_4.setDisabled(True) self.parent.ui.frame_5.setDisabled(False) self.parent.ui.lineEdit_Max.setText(str(self.max)) self.parent.ui.lineEdit_Min.setText(str(self.min)) self.parent.mapX, self.parent.mapY = self.parent.moildev.getPanoramaMaps(self.min, self.max) # self.parent.moildev.PanoramaX(self.parent.mapX, self.parent.mapY, self.parent.imageWidth, self.parent.imageHeight, self.parent.m_ratio, # self.max, self.min) self.showOriginalPanorama() self.show.showPanoAnyImage() else: self.parent.ui.frame_4.setDisabled(True) self.parent.ui.frame_5.setDisabled(True) self.show.showOriginalImage(image) self.show.showResult(image)
[docs] def showOriginalPanorama(self): """ Displays the original panorama image with a point drawn at the center or specified coordinates. """ image = self.parent.image.copy() if self.parent.anypoint_Image is not None: self.parent.coor = self.parent.center oriImage = Utils.drawPoint(image, self.parent.imageHeight, self.parent.coor) else: if self.parent.coor: oriImage = Utils.drawPoint(image, self.parent.imageHeight, self.parent.coor) else: oriImage = Utils.drawPoint(image, self.parent.imageHeight, self.parent.center) self.show.showOriginalImage(oriImage)