from axipy import CoordSystem


class MiCoordSystem:
    def __init__(self,dict_parsers):
        self.__obj_comp=dict_parsers['Set CoordSys']
    def parser(self,item_str):

        result=self.__obj_comp.parserToken(item_str)
        if result is None:
            return None
        name=result.named['name']
        if name=='Layout':
            mi_prj="CoordSys NonEarth Units "+result.named['units']
        else:
            mi_prj="CoordSys NonEarth Units "+result.named['units']
        cs=CoordSystem.from_prj(mi_prj)
        return cs
def parserCoordSystem(str_mi_wor,dict_parsers):
    cls_coordSys=MiCoordSystem(dict_parsers)
    return cls_coordSys.parser(str_mi_wor.lstrip())