#!D:/IDE/anaconda3/envs/Microscope_Scan python
# -*- coding: UTF-8 -*-
"""
@FileName：MoveDirection.py
@Description：
@Author：XSH
@Time：2025/12/18 13:21
@Department：研发部
@Copyright：©2025 乐辰生物
"""
class MoveDirection(int):
    STOP        = 0
    Forward     = 1
    Backward    = 2

    Left        = 3
    Right       = 4
    Up          = 5
    Down        = 6
    Init        = 7


    @classmethod
    def all(cls) -> list:
        return [
            cls.STOP        ,
            cls.Forward     ,
            cls.Backward    ,
        ]

    @classmethod
    def is_stop(cls, offset: (int, float)) -> bool:
        return int(round( offset * 100.0, 2)) == 0

    @classmethod
    def is_forward(cls, offset: (int, float)) -> bool:
        return int(round( offset * 100.0, 2)) > 0

    @classmethod
    def is_backward(cls, offset: (int, float)) -> bool:
        return int(round( offset * 100.0, 2)) < 0

    @classmethod
    def get_value(cls, offset: (int, float)) -> int:
        if cls.is_stop(offset):
            return cls.STOP
        if cls.is_forward(offset):
            return cls.Forward
        if cls.is_backward(offset):
            return cls.Backward
        return cls.STOP

    @classmethod
    def get_x_value(cls, offset: (int, float)) -> int:
        if cls.is_stop(offset):
            return cls.STOP
        if cls.is_forward(offset):
            return cls.Forward
        if cls.is_backward(offset):
            return cls.Backward
        return cls.STOP

    @classmethod
    def get_y_value(cls, offset: (int, float)) -> int:
        if cls.is_stop(offset):
            return cls.STOP
        if int(round( offset * 100.0, 2)) > 0:
            return cls.Backward
        if int(round( offset * 100.0, 2)) < 0:
            return cls.Forward
        return cls.STOP