# Path: Generic/Kernel/GeoEntity/geometricalentity.py
# class GeometricalEntity(dict):
#     """
#         This class provide the basic interface for all the geometrical entitys
#     """
#     def __init__(self, kw, argNameType):
#         """
#             argv name must be created befor init the base class
#         """
#         if kw is None and argNameType is None:
#             return
#         if len(kw) != len(argNameType):
#             raise TypeError("Wrong number of items ")
#         for k in kw:
#             if k in argNameType:
#                 if isinstance(kw[k], argNameType[k]):
#                     self[k] = kw[k]
#                 else:
#                     raise TypeError("Wrong Type for argument %s" % str(k))
#             else:
#                 raise TypeError("Wrong argument %s " % str(k))
#         self.arguments = argNameType
#         self._snapPoints = []
#     
#     def updateSnapPoint(self, force = None, fromPoint = None, fromEnt = None):
#         pass
#     
#     def getUpdatedSnapPoints(self, force, fromPoint = None,  fromEnt = None):
#         """
#             update the snappoint with force argument and return an array of geopoint
#         """
#         self.updateSnapPoint(force, fromPoint, fromEnt)
#         return self.snapPoints
#     
#     @property
#     def snapPoints(self):
#         """
#             return the snap points
#         """
#         return self._snapPoints
#         
#     @snapPoints.setter
#     def snapPoints(self, value):
#         self._snapPoints = value
#         
#     def getArgumentsName(self):
#         """
#             get the construction arguments Name
#         """
#         return self.arguments
#     
#     def getConstructionElements(self):
#         """
#             Get the construction element of entity..
#         """
#         return self
#         
#     def setConstructionElements(self, **kw):
#         """
#             set the construction elemtnts
#         """
#         self = kw
#         
#     def move(self, fromPoint, toPoint):
#         """
#             this method must be defined for moving operation
#         """
#         from Kernel.GeoUtil.geolib import Vector
#         from Kernel.GeoEntity.point import Point
#         v = Vector(fromPoint, toPoint)
#         for key in self:
#             if isinstance(self[key], Point):
#                 self[key] += v.point
#         return v.point
#     
#     def rotate(self, rotationPoint, angle):
#         """
#             this method must be defined for rotation
#         """
#         from Kernel.GeoUtil.geolib import Vector
#         from Kernel.GeoEntity.point import Point
#         
#         for key in self:
#             if isinstance(self[key], Point):
#                 v = Vector(rotationPoint, self[key])
#                 v.rotate(angle)
#                 self[key] = rotationPoint + v.point
#         
#     
#     def getSympy(self):
#         """
#             get the sympy object
#         """
#         pass
#         
#     def setFromSympy(self, sympyPoint):    
#         """
#             update the points cord from a sympyobject
#         """
#         pass   


from .geometricalentity import GeometricalEntity
from GeoUtil.util import *
from GeoEntity.point import Point
        from Kernel.initsetting import TEXT_POSITION
        from Kernel.initsetting import TEXT_POSITION
        from Kernel.exception import PythopnCadWarning
        A Text instance has the following attributes:
    """
    def __init__(self, kw):
        """
            Initialize a Arc/Circle.
            kw['TEXT_0'] position point must be a point 
            kw['TEXT_1'] text must be a valid text
            kw['TEXT_2'] angle must be a valid radiant float value or None
            kw['TEXT_3'] position of the text refered to the position point must be a valid string value or None
        """
        argDescription={
                        "TEXT_0": Point,
                        "TEXT_1": (float, str, unicode), 
                        "TEXT_2": (float, int), 
                        "TEXT_3": (str, unicode)
                        }
        
        if kw['TEXT_2'] == None:
            kw['TEXT_2'] = 0
        
        if kw['TEXT_3'] == None:
            kw['TEXT_3'] = 'sw'
        else:
            if not kw['TEXT_3'] in TEXT_POSITION:
                kw['TEXT_3'] = 'sw'
                #if kw['TEXT_3']=='':
                #    kw['TEXT_3'] = 'sw'
                #else:
                #    raise TypeError, "Argument for TEXT_3 not supported"


# Path: Generic/Kernel/GeoEntity/geometricalentity.py
# class GeometricalEntity(dict):
#     """
#         This class provide the basic interface for all the geometrical entitys
#     """
#     def __init__(self, kw, argNameType):
#         """
#             argv name must be created befor init the base class
#         """
#         if kw is None and argNameType is None:
#             return
#         if len(kw) != len(argNameType):
#             raise TypeError("Wrong number of items ")
#         for k in kw:
#             if k in argNameType:
#                 if isinstance(kw[k], argNameType[k]):
#                     self[k] = kw[k]
#                 else:
#                     raise TypeError("Wrong Type for argument %s" % str(k))
#             else:
#                 raise TypeError("Wrong argument %s " % str(k))
#         self.arguments = argNameType
#         self._snapPoints = []
#     
#     def updateSnapPoint(self, force = None, fromPoint = None, fromEnt = None):
#         pass
#     
#     def getUpdatedSnapPoints(self, force, fromPoint = None,  fromEnt = None):
#         """
#             update the snappoint with force argument and return an array of geopoint
#         """
#         self.updateSnapPoint(force, fromPoint, fromEnt)
#         return self.snapPoints
#     
#     @property
#     def snapPoints(self):
#         """
#             return the snap points
#         """
#         return self._snapPoints
#         
#     @snapPoints.setter
#     def snapPoints(self, value):
#         self._snapPoints = value
#         
#     def getArgumentsName(self):
#         """
#             get the construction arguments Name
#         """
#         return self.arguments
#     
#     def getConstructionElements(self):
#         """
#             Get the construction element of entity..
#         """
#         return self
#         
#     def setConstructionElements(self, **kw):
#         """
#             set the construction elemtnts
#         """
#         self = kw
#         
#     def move(self, fromPoint, toPoint):
#         """
#             this method must be defined for moving operation
#         """
#         from Kernel.GeoUtil.geolib import Vector
#         from Kernel.GeoEntity.point import Point
#         v = Vector(fromPoint, toPoint)
#         for key in self:
#             if isinstance(self[key], Point):
#                 self[key] += v.point
#         return v.point
#     
#     def rotate(self, rotationPoint, angle):
#         """
#             this method must be defined for rotation
#         """
#         from Kernel.GeoUtil.geolib import Vector
#         from Kernel.GeoEntity.point import Point
#         
#         for key in self:
#             if isinstance(self[key], Point):
#                 v = Vector(rotationPoint, self[key])
#                 v.rotate(angle)
#                 self[key] = rotationPoint + v.point
#         
#     
#     def getSympy(self):
#         """
#             get the sympy object
#         """
#         pass
#         
#     def setFromSympy(self, sympyPoint):    
#         """
#             update the points cord from a sympyobject
#         """
#         pass   


# Path: Generic/Kernel/GeoEntity/text.py
from .geometricalentity import GeometricalEntity
from GeoUtil.util import *
from GeoEntity.point import Point
        from Kernel.initsetting import TEXT_POSITION
        from Kernel.initsetting import TEXT_POSITION
        from Kernel.exception import PythopnCadWarning

        A Text instance has the following attributes:
    """
    def __init__(self, kw):
        """
            Initialize a Arc/Circle.
            kw['TEXT_0'] position point must be a point 
            kw['TEXT_1'] text must be a valid text
            kw['TEXT_2'] angle must be a valid radiant float value or None
            kw['TEXT_3'] position of the text refered to the position point must be a valid string value or None
        """
        argDescription={
                        "TEXT_0": Point,
                        "TEXT_1": (float, str, unicode), 
                        "TEXT_2": (float, int), 
                        "TEXT_3": (str, unicode)
                        }
        
        if kw['TEXT_2'] == None:
            kw['TEXT_2'] = 0
        
        if kw['TEXT_3'] == None:
            kw['TEXT_3'] = 'sw'
        else:
            if not kw['TEXT_3'] in TEXT_POSITION:
                kw['TEXT_3'] = 'sw'
                #if kw['TEXT_3']=='':
                #    kw['TEXT_3'] = 'sw'
                #else:
                #    raise TypeError, "Argument for TEXT_3 not supported"


        GeometricalEntity.__init__(self, kw, argDescription)