本文整理汇总了Python中importer.Importer.read_point_layer方法的典型用法代码示例。如果您正苦于以下问题:Python Importer.read_point_layer方法的具体用法?Python Importer.read_point_layer怎么用?Python Importer.read_point_layer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类importer.Importer
的用法示例。
在下文中一共展示了Importer.read_point_layer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Simulation
# 需要导入模块: from importer import Importer [as 别名]
# 或者: from importer.Importer import read_point_layer [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)