Пример #1
0
 def add_street(self, street):
     """ Adds a street to the partition object
     
     The bounding box of the partition is calculated by the bounding boxes of the added streets.
     @type street: L{geo.osm_import.Way}
     @param street: OSM way object representing a street
     """
     if self.__box:
         self.__box = merge_boxes(self.__box, street.box)
     else:
         self.__box = street.box
     self.__streets.add(street)
Пример #2
0
    def append_partition(self, other_partition):
        """
        Merges two partition objects to one single object
        
        @type other_partition: L{Partition}
        @param other_partition: Partition object of the second partition
        """
        streets = other_partition.streets
        nodes = other_partition.nodes
        
        # copy the partition ids
        for node in nodes:
            node.partition_id = self.__partition_id
        for street in streets:
            street.partition_id = self.__partition_id

        # merge streets, nodes and boxes
        self.__streets.update(streets)
        self.__nodes.update(nodes)
        self.__box = merge_boxes(self.__box, other_partition.box)