コード例 #1
0
ファイル: interface.py プロジェクト: k0ral/thereisnorush
    def selected_car_informations(self):
        """
        """
        information = ''

        if self.selected_car is not None:

            car = self.selected_car

            if car.dead:
                self.selected_car = None
                return information

            information += '<br/><b>Selected vehicle :</b><br/>'
            if car.position is not None:
                information += 'position : (' + str(
                    lib.round(car.position.x, 2)) + ', ' + str(
                        lib.round(car.position.y, 2)) + ') <br/>'
            information += 'length, width : ' + str(car.length) + ', ' + str(
                car.width) + '<br/>'
            information += 'speed : ' + str(lib.round(car.speed, 2)) + '<br/>'
            information += 'waiting time : ' + str(
                lib.round(car.total_waiting_time, 2)) + '<br/>'

            if car.destination is not None:
                information += 'destination : ' + str(
                    car.destination.name) + ' <br/>'

            if car.is_waiting:
                information += '<b>Waiting or braking</b><br/>'

        return information
コード例 #2
0
ファイル: interface.py プロジェクト: k0ral/thereisnorush
 def selected_car_informations(self):
     """
     """
     information = ''
     
     if self.selected_car is not None:
     
         car = self.selected_car
         
         if car.dead:
             self.selected_car = None
             return information
     
         information += '<br/><b>Selected vehicle :</b><br/>'
         if car.position is not None:
             information += 'position : (' + str(lib.round(car.position.x, 2)) + ', ' + str(lib.round(car.position.y, 2)) + ') <br/>'
         information += 'length, width : ' + str(car.length) + ', ' +  str(car.width) +'<br/>'
         information += 'speed : ' + str(lib.round(car.speed, 2)) + '<br/>'
         information += 'waiting time : ' + str(lib.round(car.total_waiting_time, 2)) + '<br/>'
         
         if car.destination is not None:
             information += 'destination : ' + str(car.destination.name) + ' <br/>'
             
         if car.is_waiting:
             information += '<b>Waiting or braking</b><br/>'
             
     return information
コード例 #3
0
ファイル: interface.py プロジェクト: k0ral/thereisnorush
 def selected_roundabout_informations(self):
     """
     """
     information = ''
     
     if self.selected_roundabout is not None:
         information += '<br/><b>Selected roundabout :</b><br/>'
         information += 'position : (' + str(self.selected_roundabout.position.x) + ',' + str(self.selected_roundabout.position.y) + ') <br/>'
         information += 'radius : ' + str(self.selected_roundabout.radius) + '<br/>'
         information += 'cars : ' + str(len(self.selected_roundabout.cars)) + '<br/>'
         information += 'load : ' + str(lib.round(self.selected_roundabout.global_load, 2)) + '<br/>'
         if self.selected_roundabout.spawning:
             information += '<b>Spawning mode</b><br/>'
         if len(self.selected_roundabout.leaving_roads) == 0:
             information += '<b>Destroying mode</b><br/>'
         if self.selected_roundabout.cars:
             avg_waiting_time = 0
             for car in self.selected_roundabout.cars:
                 avg_waiting_time += car.total_waiting_time / float(len(self.selected_roundabout.cars))
             information += '<br/><b>Average waiting time</b> (s) : ' + str(lib.round(avg_waiting_time,2)) + '<br/>'  
         if not self.is_spawning.isCheckable():
             self.is_spawning.setCheckable(True)
             self.is_spawning.setChecked(self.selected_roundabout.spawning)
         else:
             self.selected_roundabout.spawning = self.is_spawning.isChecked()
     else:
         self.is_spawning.setCheckable(False)
         
     return information
コード例 #4
0
ファイル: interface.py プロジェクト: k0ral/thereisnorush
 def simulation_informations(self):
     """
     """
     information = '<br/><b>Simulation</b><br/>'        
     
     hours, minutes, seconds = lib.get_simulation_time()
     
     information += 'Time elapsed : ' + str(hours) + '<sup>h</sup>&nbsp;' + str(minutes) + '<sup>m</sup>&nbsp;' + str(seconds) + '<sup>s</sup><br/>'
     information += 'Speed : &times;' + str(lib.round(lib.get_speed(), 2))   + '<br/>'
     
     if lib.delta_t != 0:
         information += 'FPS : ' + str(lib.round(lib.get_speed()/lib.delta_t, 2)) + '<br/>'
         information += '&Delta;t (s) : ' + str(lib.round(lib.delta_t, 2)) + '<br/>'
         
     return information
コード例 #5
0
ファイル: interface.py プロジェクト: k0ral/thereisnorush
    def simulation_informations(self):
        """
        """
        information = '<br/><b>Simulation</b><br/>'

        hours, minutes, seconds = lib.get_simulation_time()

        information += 'Time elapsed : ' + str(
            hours) + '<sup>h</sup>&nbsp;' + str(
                minutes) + '<sup>m</sup>&nbsp;' + str(
                    seconds) + '<sup>s</sup><br/>'
        information += 'Speed : &times;' + str(lib.round(lib.get_speed(),
                                                         2)) + '<br/>'

        if lib.delta_t != 0:
            information += 'FPS : ' + str(
                lib.round(lib.get_speed() / lib.delta_t, 2)) + '<br/>'
            information += '&Delta;t (s) : ' + str(lib.round(lib.delta_t,
                                                             2)) + '<br/>'

        return information
コード例 #6
0
ファイル: interface.py プロジェクト: k0ral/thereisnorush
    def selected_roundabout_informations(self):
        """
        """
        information = ''

        if self.selected_roundabout is not None:
            information += '<br/><b>Selected roundabout :</b><br/>'
            information += 'position : (' + str(
                self.selected_roundabout.position.x) + ',' + str(
                    self.selected_roundabout.position.y) + ') <br/>'
            information += 'radius : ' + str(
                self.selected_roundabout.radius) + '<br/>'
            information += 'cars : ' + str(len(
                self.selected_roundabout.cars)) + '<br/>'
            information += 'load : ' + str(
                lib.round(self.selected_roundabout.global_load, 2)) + '<br/>'
            if self.selected_roundabout.spawning:
                information += '<b>Spawning mode</b><br/>'
            if len(self.selected_roundabout.leaving_roads) == 0:
                information += '<b>Destroying mode</b><br/>'
            if self.selected_roundabout.cars:
                avg_waiting_time = 0
                for car in self.selected_roundabout.cars:
                    avg_waiting_time += car.total_waiting_time / float(
                        len(self.selected_roundabout.cars))
                information += '<br/><b>Average waiting time</b> (s) : ' + str(
                    lib.round(avg_waiting_time, 2)) + '<br/>'
            if not self.is_spawning.isCheckable():
                self.is_spawning.setCheckable(True)
                self.is_spawning.setChecked(self.selected_roundabout.spawning)
            else:
                self.selected_roundabout.spawning = self.is_spawning.isChecked(
                )
        else:
            self.is_spawning.setCheckable(False)

        return information