from . import no_distort
from ..coord import coord2
from ...properties.descriptor import lock_and_convert_property


__all__ = []

BASE = no_distort.gds_no_distort_transform

class gds_special_no_distort_transform(BASE):
    """ abstract base class for special transforms that are subclassed from gds_no_distort_transforms"""

    def __make_simple__(self):
        self.__class__ = no_distort.gds_no_distort_transform
        
    translation = lock_and_convert_property(BASE, "translation", __make_simple__)
    rotation = lock_and_convert_property(BASE, "rotation", __make_simple__)
    magnification = lock_and_convert_property(BASE, "magnification", __make_simple__)
    v_mirror = lock_and_convert_property(BASE, "v_mirror", __make_simple__)
    absolute_magnification = lock_and_convert_property(BASE, "absolute_magnification", __make_simple__)
    absolute_rotation = lock_and_convert_property(BASE, "absolute_rotation", __make_simple__)

    def __isub__(self, other):
        """ concatenates reverse of other to this transformation """
        self.__make_simple__()
        return BASE.__isub__(self, other)

    def __iadd__(self, other):
        """ concatenates other to this transformation """
        self.__make_simple__()
        return BASE.__iadd__(self, other)

    def apply_to_angle_deg(self, angle):
        """ applies transformation to absolute angle (degrees) """
        return angle
    
    def reverse_on_angle_deg(self, angle):
        """ applies reverse transformation to absolute angle (degrees) """
        return angle

    def apply_to_angle_rad(self, angle):
        """ applies transformation to absolute angle (radians) """
        return angle
    
    def reverse_on_angle_rad(self, angle):
        """ applies reverse transformation to absolute angle (radians) """
        return angle

    def apply_to_length(self, length):
        """ applies transformation to distance """
        return length

    def reverse_on_length(self, length):
        """ applies reverse transformation to distance """
        return length

    def is_isometric(self):
        """ returns True if the transformation does nothing """
        return True
