# Path: chart-installation/generate_map_files/mapgen/filters.py
# class MSAnd(_MSCombiner):
#     __slots__ = ()
#     separator = ' AND '
# 
#     def __and__(self, other):
#         if type(self) is type(other):
#             return MSAnd(*self, *other)
# 
#         return MSAnd(*self, other)
# 
#     def __rand__(self, other):
#         if type(self) is type(other):
#             return MSAnd(*other, *self)
# 
#         return MSAnd(other, *self)
# 
# Path: chart-installation/generate_map_files/mapgen/instructions.py
# class SY(Command):
#     """ShowPoint 9.2"""
# 
#     def __init__(self, symbol, rot=0):
#         self.symbol = symbol
#         self.rot_field = None
#         try:
#             self.rot = int(rot)
#         except ValueError:
#             self.rot_field = rot
#             self.rot = '[{}_CAL]'.format(rot)
# 
#     def get_symbol_size(self, sym_size_overwrite):
#         # NOTE: layers are case senssitive
#         for prefix, size in sym_size_overwrite.items():
#             if self.symbol.startswith(prefix):
#                 return 'SIZE {size}'.format(size=size)
# 
#         # Layer not funded, simply return empty string
#         return ''
# 
#     def __call__(self, chartsymbols, layer, geom_type, fields):
#         # OFFSET
#         x = 0
#         y = 0
# 
#         # Hardcoded value to skip typo in official XML
#         # TODO: Validate that the symbol exists
#         if self.symbol == 'BCNCON81':
#             return ''
#         if self.symbol == 'FOGSIG01':
#             x = -15
# 
#         # some pixmap symbols are too big or too small
#         size = self.get_symbol_size(chartsymbols.symbol_size_override)
# 
#         if self.symbol in chartsymbols.symbols_def:
#             symbol_name = self.symbol
#         else:
#             symbol_name = 'QUESMRK1'
# 
#         symbol = chartsymbols.symbols_def[symbol_name]
#         x += -(symbol['size'][0] // 2)
#         x += symbol['pivot'][0]
#         y += symbol['size'][1] // 2
#         y -= symbol['pivot'][1]
# 
#         gap = ''
#         geomtransform = ''
#         if geom_type == 'POLYGON':
#             geomtransform = 'GEOMTRANSFORM centroid'
#             # if polygon, no reason to offset symbol localization
#             x = y = 0
#         else:
#             gap = 'GAP 2000'
# 
#         return """
#         STYLE
#             {geomtransform}
#             {size}
#             SYMBOL "{symbol}"
#             OFFSET {x} {y}
#             ANGLE {angle}
#             {gap}
#         END
#         """.format(symbol=symbol_name, x=x, y=y, angle=self.rot,
#                    geomtransform=geomtransform, size=size, gap=gap)
# 
# Path: chart-installation/generate_map_files/mapgen/layer.py
# class DisplayPriority(OrderedEnum):
#     NotSet = -1
#     NoData = 0  # no data fill area pattern
#     Group1 = 1  # S57 group 1 filled areas
#     Area1 = 2  # superimposed areas
#     Area2 = 3  # superimposed areas also water features
#     PointSymbol = 4  # point symbol also land features
#     LineSymbol = 5  # line symbol also restricted areas
#     AreaSymbol = 6  # area symbol also traffic areas
#     Routing = 7  # routeing lines
#     Hazards = 8  # hazards
#     Mariners = 9  # VRM, EBL, own ship
# 
#     @classmethod
#     def get(cls, key):
#         key = key.title().replace(' ', '')
#         try:
#             return cls[key]
#         except KeyError:
#             return cls.NotSet


from .filters import MSAnd
from .instructions import SY
from .layer import DisplayPriority


class Lookup:
    def __init__(self, id='', table=None, display=None, comment='',
                 instruction=None, rules=None,
                 display_priority=DisplayPriority.NotSet):
        if rules is None:

# Path: chart-installation/generate_map_files/mapgen/filters.py
# class MSAnd(_MSCombiner):
#     __slots__ = ()
#     separator = ' AND '
# 
#     def __and__(self, other):
#         if type(self) is type(other):
#             return MSAnd(*self, *other)
# 
#         return MSAnd(*self, other)
# 
#     def __rand__(self, other):
#         if type(self) is type(other):
#             return MSAnd(*other, *self)
# 
#         return MSAnd(other, *self)
# 
# Path: chart-installation/generate_map_files/mapgen/instructions.py
# class SY(Command):
#     """ShowPoint 9.2"""
# 
#     def __init__(self, symbol, rot=0):
#         self.symbol = symbol
#         self.rot_field = None
#         try:
#             self.rot = int(rot)
#         except ValueError:
#             self.rot_field = rot
#             self.rot = '[{}_CAL]'.format(rot)
# 
#     def get_symbol_size(self, sym_size_overwrite):
#         # NOTE: layers are case senssitive
#         for prefix, size in sym_size_overwrite.items():
#             if self.symbol.startswith(prefix):
#                 return 'SIZE {size}'.format(size=size)
# 
#         # Layer not funded, simply return empty string
#         return ''
# 
#     def __call__(self, chartsymbols, layer, geom_type, fields):
#         # OFFSET
#         x = 0
#         y = 0
# 
#         # Hardcoded value to skip typo in official XML
#         # TODO: Validate that the symbol exists
#         if self.symbol == 'BCNCON81':
#             return ''
#         if self.symbol == 'FOGSIG01':
#             x = -15
# 
#         # some pixmap symbols are too big or too small
#         size = self.get_symbol_size(chartsymbols.symbol_size_override)
# 
#         if self.symbol in chartsymbols.symbols_def:
#             symbol_name = self.symbol
#         else:
#             symbol_name = 'QUESMRK1'
# 
#         symbol = chartsymbols.symbols_def[symbol_name]
#         x += -(symbol['size'][0] // 2)
#         x += symbol['pivot'][0]
#         y += symbol['size'][1] // 2
#         y -= symbol['pivot'][1]
# 
#         gap = ''
#         geomtransform = ''
#         if geom_type == 'POLYGON':
#             geomtransform = 'GEOMTRANSFORM centroid'
#             # if polygon, no reason to offset symbol localization
#             x = y = 0
#         else:
#             gap = 'GAP 2000'
# 
#         return """
#         STYLE
#             {geomtransform}
#             {size}
#             SYMBOL "{symbol}"
#             OFFSET {x} {y}
#             ANGLE {angle}
#             {gap}
#         END
#         """.format(symbol=symbol_name, x=x, y=y, angle=self.rot,
#                    geomtransform=geomtransform, size=size, gap=gap)
# 
# Path: chart-installation/generate_map_files/mapgen/layer.py
# class DisplayPriority(OrderedEnum):
#     NotSet = -1
#     NoData = 0  # no data fill area pattern
#     Group1 = 1  # S57 group 1 filled areas
#     Area1 = 2  # superimposed areas
#     Area2 = 3  # superimposed areas also water features
#     PointSymbol = 4  # point symbol also land features
#     LineSymbol = 5  # line symbol also restricted areas
#     AreaSymbol = 6  # area symbol also traffic areas
#     Routing = 7  # routeing lines
#     Hazards = 8  # hazards
#     Mariners = 9  # VRM, EBL, own ship
# 
#     @classmethod
#     def get(cls, key):
#         key = key.title().replace(' ', '')
#         try:
#             return cls[key]
#         except KeyError:
#             return cls.NotSet


# Path: chart-installation/generate_map_files/mapgen/lookup.py
from .filters import MSAnd
from .instructions import SY
from .layer import DisplayPriority



class Lookup:
    def __init__(self, id='', table=None, display=None, comment='',
                 instruction=None, rules=None,
                 display_priority=DisplayPriority.NotSet):
        if rules is None:

            rules = MSAnd()