本文整理匯總了Python中importer.Importer.set_global_extent方法的典型用法代碼示例。如果您正苦於以下問題:Python Importer.set_global_extent方法的具體用法?Python Importer.set_global_extent怎麽用?Python Importer.set_global_extent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類importer.Importer
的用法示例。
在下文中一共展示了Importer.set_global_extent方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Simulation
# 需要導入模塊: from importer import Importer [as 別名]
# 或者: from importer.Importer import set_global_extent [as 別名]
class Simulation(object):
"""Just a Container for object lists and other global stuff"""
def __init__(self):
'''
input the scenario here. make sure the configuration files
are in the correct folder!
'''
self.scenario = "default"
''' time management '''
self.start_time = 3600 * 5
self.current_time = self.start_time + 0
self.speed = 5
self.timestring = str(datetime.timedelta(seconds=math.floor(self.current_time)))
self.debugbatch = pyglet.graphics.Batch()
''' setup, check and clear resources '''
self.resources = ResourceSetup(self.scenario)
self.spatial_db = self.resources.mongo_connection['spatial_db']
'''
import static geodata directly (every other import is done
via the appropriate manager classes
'''
self.importer = Importer("thesis_db", "thesis", "thesis")
self.extent = self.importer.set_global_extent("street_network")
self.roads = self.importer.read_line_layer("street_network")
self.buildings_footprint = self.importer.read_line_layer("buildings_line")
''' create building centroids '''
self.building_manager = BuildingManager(self,
self.importer.read_point_layer(
"buildings_centroid", attributes=["building_id"]),
"config/"+self.scenario+"/building_attributes.json")
''' create actor manager '''
self.actor_manager = ActorManager(self)
''' create routable network (coarse routing and between vectors as edge attributes) '''
self.router = Router(self)
self.router.create_routable_network_from_line_data(self.roads)
self.router.create_lane_collsion_data()
''' create parking lots via the lot manager. initial config is provided via config json '''
self.lots = self.importer.read_line_layer("parking_lots", attributes=["lot_permis", "lot_type", "lot_tech"])
self.lot_manager = LotManager(self, self.lots,
"config/"+self.scenario+"/lot_init_fill.json",
"config/"+self.scenario+"/actor_attributes.json")
''' create spawners from config json file. See config for details'''
self.spawner = Spawner(self, "config/"+self.scenario+"/actor_spawn.json",
"config/"+self.scenario+"/actor_attributes.json",
"config/"+self.scenario+"/exit_nodes.json")
''' display objects '''
self.window = pyglet.window.Window(width=1000, height=600)
self.window.set_location(10, 10)
self.camera = Camera((200, 500), 50, 0, 1000)
self.graphics = Graphics()
self.fps_display = pyglet.clock.ClockDisplay()
''' create displayable batches '''
self.buildings_footprint_batch = self.graphics.create_pyglet_line_batch(
self.buildings_footprint, (200, 200, 200))
self.router.create_pyglet_batch_from_network()
''' debug options '''
self.debug_layer = None
self.click_debug = None
self.stop = False
''' GUI '''
#self.gui = Frame(Theme('/Users/anresources/gui/'), w=1000, h=600)
#self.window.push_handlers(self.gui)
self.current_actor = None
''' mouse management '''
self.mouse = []
def change_speed(self, speed_change):
if self.speed + speed_change != 0:
self.speed += speed_change
def trigger_stop(self):
self.stop = (not self.stop)