#!D:/IDE/anaconda3/envs/Microscope_Scan python
# -*- coding: UTF-8 -*-
"""
@FileName：SurfaceFittingInterface.py
@Description：
@Author：XSH
@Time：2025/11/26 10:02
@Department：研发部
@Copyright：©2025 乐辰生物
"""
from PyQt5 import Qt
import numpy as np
from abc import abstractmethod
from AppInterfaces.AppAlgorithmInterfaces.AlgorithmInterface import AlgorithmInterface

class SurfaceFittingInterface(AlgorithmInterface):
    default_expand_size : list[int]         #
    Max_X               : int               #
    Max_Y               : int               #
    start_point         : list[int]         #
    scan_size           : list[int]         #

    @abstractmethod
    def initValue(self):
        pass

    @abstractmethod
    def initAlgorithm(self, start_x: int, start_y: int, scan_size_x: int, scan_size_y: int, z_min: float = None, z_max: float = None, **args):
        pass

    @abstractmethod
    def start_update(self, x_row: int, y_col: int, z: int):
        # 预设平面的四个角点
        pass

    @abstractmethod
    def def_points_update(self, x_row: int, y_col: int, z: int):
        pass

    @abstractmethod
    def surface_fitting_scan(self, ):
        ############## 090909hzh新加
        pass

    @abstractmethod
    def get_point_scan(self, x_row: int, y_col: int) -> int:
        # 输入网格索引[行,列]， 返回网格索引的xyz坐标
        pass

    @abstractmethod
    def get_point_scan_list(self, x_row: int, y_col: int) -> list[int]:
        # 输入网格索引[行,列]， 返回网格索引的xyz坐标
        pass

    @abstractmethod
    def get_point_scan_all(self) -> np.ndarray:
        # 输入网格索引[行,列]， 返回网格索引的xyz坐标
        pass

    @abstractmethod
    def set_begin_point(self, x_row: int, y_col: int, z: int):
        pass

    @abstractmethod
    def append_point(self, x_row: int, y_col: int, z: int):
        pass

    @abstractmethod
    def get_point(self, x_row: int, y_col: int) -> (int, int, int):
        pass

    @abstractmethod
    def get_z_point(self, x_row: int, y_col: int) -> int:
        pass


    @property
    def has_default_expand_size (self) -> bool:
        return hasattr(self, 'default_expand_size') and isinstance(self.default_expand_size , (tuple, list)  )

    @property
    def has_Max_X               (self) -> bool:
        return hasattr(self, 'Max_X'              ) and isinstance(self.Max_X               , (int, float )  )

    @property
    def has_Max_Y               (self) -> bool:
        return hasattr(self, 'Max_Y'              ) and isinstance(self.Max_Y               , (int, float )  )

    @property
    def has_start_point         (self) -> bool:
        return hasattr(self, 'start_point'        ) and isinstance(self.start_point         , (tuple, list)  )

    @property
    def has_scan_size           (self) -> bool:
        return hasattr(self, 'scan_size'          ) and isinstance(self.scan_size           , (tuple, list)  )
