Exemple #1
0
    def __init__(self, time_step, dir_path):
        super().__init__(time_step)

        self._data_source = GenericDataSource.factory('FDS', dir_path)
        self._agents = []
        self._rescued = []
        self._filenames = {}
        self._tunnel = SFTunnel(self._data_source, self)
        self._spawn_agents()
Exemple #2
0
    def __init__(self, time_step, dir_path):
        super().__init__(time_step)

        self._data_source = GenericDataSource.factory('FDS', dir_path)
        self._agents = []
        self._rescued = []
        self._filenames = {}
        self._tunnel = SFTunnel(self._data_source, self)
        self._spawn_agents()
Exemple #3
0
    def _create_obstacles(self):
        obstacles = self._data_source.obstacles
        segments = []

        for obstacle in obstacles:
            segment1 = Segment(obstacle.start, [obstacle.start[0],
                               obstacle.end[1]])
            segement2 = Segment([obstacle.start[0], obstacle.end[1]],
                                obstacle.end)
            segment3 = Segment([obstacle.end[0], obstacle.start[1]],
                               obstacle.end)
            segment4 = Segment(obstacle.start, [obstacle.end[0],
                               obstacle.start[1]])

            segments.extend([segment1, segement2, segment3, segment4])

        self._segments.extend(segments)


class InproperCoordsError(Exception):

    pass


if __name__ == '__main__':
    src = GenericDataSource.factory('FDS', 'dane')
    tunnel = SFTunnel(src)
    for segment in tunnel.segments:
        print (segment.start, segment.end)