# Path: osm_data_processing/relations2lines/lineelement.py
# class LineElement:
#     def __init__(self, relation):
#         self.osmcSymbol = relation.osmcSymbol
#         self.network = relation.network
# 
#     def __eq__(self, other):
#         return self.osmcSymbol == other.osmcSymbol
# 
#     def __lt__(self, other):
#         if (other.network in networkOrder) and (self.network in networkOrder):
#             #both elements has specified networks or both hasn't
#             if self.network == other.network:
#                 return OsmcSymbol(self.osmcSymbol) < OsmcSymbol(other.osmcSymbol)
#             else:
#                 return networkOrder.index(self.network) > networkOrder.index(other.network)
#         elif (not other.network in networkOrder) and (not self.network in networkOrder):
#             return OsmcSymbol(self.osmcSymbol) < OsmcSymbol(other.osmcSymbol)
#         elif self.network in networkOrder:
#             #other has not specified network, but self has: self is not less than other
#             return False
#         else:
#             #self has not specified network, but other has: self is less than other
#             return True
# 
#     def __repr__(self):
#         return repr((self.osmcSymbol, self.network))


from .lineelement import LineElement
    def __init__(self, r_id, relation):
        self.id = r_id
        self.geometry = None
        self.highway = None
        self.tracktype = None
        self.mtbScale = relation.mtbScale
        self.mtbUphill = relation.mtbUphill
        self.firstNode = None
        self.lastNode = None
        self.previousRoutes = []
        self.nextRoutes = []
        self.offset = None

        line_element = LineElement(relation)
        self.osmcSigns = [line_element]
        self.numOfSigns = 1

    def add_sign(self, relation):
        le = LineElement(relation)
        if not le in self.osmcSigns:
            self.osmcSigns.append(le)
            self.numOfSigns += 1
            # first item in osmcSigns has the highest priority
            self.osmcSigns.sort(reverse=True)

    def get_values_row(self):
            values = str(self.id) + ", '" + self.geometry + "'"
            if self.highway is not None:
                values += ", '" + self.highway + "'"
            else:

# Path: osm_data_processing/relations2lines/lineelement.py
# class LineElement:
#     def __init__(self, relation):
#         self.osmcSymbol = relation.osmcSymbol
#         self.network = relation.network
# 
#     def __eq__(self, other):
#         return self.osmcSymbol == other.osmcSymbol
# 
#     def __lt__(self, other):
#         if (other.network in networkOrder) and (self.network in networkOrder):
#             #both elements has specified networks or both hasn't
#             if self.network == other.network:
#                 return OsmcSymbol(self.osmcSymbol) < OsmcSymbol(other.osmcSymbol)
#             else:
#                 return networkOrder.index(self.network) > networkOrder.index(other.network)
#         elif (not other.network in networkOrder) and (not self.network in networkOrder):
#             return OsmcSymbol(self.osmcSymbol) < OsmcSymbol(other.osmcSymbol)
#         elif self.network in networkOrder:
#             #other has not specified network, but self has: self is not less than other
#             return False
#         else:
#             #self has not specified network, but other has: self is less than other
#             return True
# 
#     def __repr__(self):
#         return repr((self.osmcSymbol, self.network))


# Path: osm_data_processing/relations2lines/route.py
from .lineelement import LineElement

    def __init__(self, r_id, relation):
        self.id = r_id
        self.geometry = None
        self.highway = None
        self.tracktype = None
        self.mtbScale = relation.mtbScale
        self.mtbUphill = relation.mtbUphill
        self.firstNode = None
        self.lastNode = None
        self.previousRoutes = []
        self.nextRoutes = []
        self.offset = None

        line_element = LineElement(relation)
        self.osmcSigns = [line_element]
        self.numOfSigns = 1

    def add_sign(self, relation):
        le = LineElement(relation)
        if not le in self.osmcSigns:
            self.osmcSigns.append(le)
            self.numOfSigns += 1
            # first item in osmcSigns has the highest priority
            self.osmcSigns.sort(reverse=True)

    def get_values_row(self):
            values = str(self.id) + ", '" + self.geometry + "'"
            if self.highway is not None:
                values += ", '" + self.highway + "'"
            else:

                values += ", NULL"