Пример #1
0
	def read_osm_file(self, context):
		scene = context.scene
		
		osm = OsmParser(self.filepath,
			# possible values for wayHandlers and nodeHandlers list elements:
			#	1) a string name for the module containing classes (all classes from the modules will be used as handlers)
			#	2) a python variable representing the module containing classes (all classes from the modules will be used as handlers)
			#	3) a python variable representing the class
			wayHandlers = [buildings] #[handlers.buildings] #[handlers] #["handlers"]
		)
		
		if "latitude" in scene and "longitude" in scene and not self.ignoreGeoreferencing:
			lat = scene["latitude"]
			lon = scene["longitude"]
		else:
			lat = (osm.minLat + osm.maxLat)/2
			lon = (osm.minLon + osm.maxLon)/2
			scene["latitude"] = lat
			scene["longitude"] = lon
		
		osm.parse(
			projection = TransverseMercator(lat=lat, lon=lon),
			thickness = self.thickness,
			bm = self.bm # if present, indicates the we need to create as single mesh
		)
    def read_osm_file(self, context):
        scene = context.scene

        osm = OsmParser(
            self.filepath,
            # possible values for wayHandlers and nodeHandlers list elements:
            #	1) a string name for the module containing classes (all classes from the modules will be used as handlers)
            #	2) a python variable representing the module containing classes (all classes from the modules will be used as handlers)
            #	3) a python variable representing the class
            wayHandlers=[buildings
                         ]  #[handlers.buildings] #[handlers] #["handlers"]
        )

        if "latitude" in scene and "longitude" in scene and not self.ignoreGeoreferencing:
            lat = scene["latitude"]
            lon = scene["longitude"]
        else:
            lat = (osm.minLat + osm.maxLat) / 2
            lon = (osm.minLon + osm.maxLon) / 2
            scene["latitude"] = lat
            scene["longitude"] = lon

        osm.parse(
            projection=TransverseMercator(lat=lat, lon=lon),
            thickness=self.thickness,
            bm=self.
            bm  # if present, indicates the we need to create as single mesh
        )
    def read_osm_file(self, context):
        scene = context.scene

        wayHandlers = []
        if self.importBuildings:
            wayHandlers.append(Buildings)
            wayHandlers.append(BuildingParts)

        if self.importNaturals:
            wayHandlers.append(Naturals)

        if self.importHighways:
            wayHandlers.append(Highways)

        osm = OsmParser(
            self.filepath,
            # possible values for wayHandlers and nodeHandlers list elements:
            #    1) a string name for the module containing classes (all classes from the modules will be used as handlers)
            #    2) a python variable representing the module containing classes (all classes from the modules will be used as handlers)
            #    3) a python variable representing the class
            # Examples:
            # wayHandlers = [buildings, highways]
            # wayHandlers = [handlers.buildings]
            # wayHandlers = [handlers]
            # wayHandlers = ["handlers"]
            wayHandlers=wayHandlers,
        )

        if "latitude" in scene and "longitude" in scene and not self.ignoreGeoreferencing:
            lat = scene["latitude"]
            lon = scene["longitude"]
        else:
            if osm.bounds and self.importHighways:
                # If the .osm file contains the bounds tag,
                # use its values as the extent of the imported area.
                # Highways may go far beyond the values of the bounds tag.
                # A user might get confused if higways are used in the calculation of the extent of the imported area.
                bounds = osm.bounds
                lat = (bounds["minLat"] + bounds["maxLat"]) / 2
                lon = (bounds["minLon"] + bounds["maxLon"]) / 2
            else:
                lat = (osm.minLat + osm.maxLat) / 2
                lon = (osm.minLon + osm.maxLon) / 2
            scene["latitude"] = lat
            scene["longitude"] = lon

        osm.parse(
            projection=TransverseMercator(lat=lat, lon=lon),
            defaultHeight=self.defaultHeight,
            levelHeight=self.levelHeight,
            bm=self.bm,  # if present, indicates the we need to create as single mesh
        )
    def read_osm_file(self, context):
        scene = context.scene

        wayHandlers = []
        if self.importBuildings:
            wayHandlers.append(Buildings)
            wayHandlers.append(BuildingParts)

        if self.importNaturals:
            wayHandlers.append(Naturals)

        if self.importHighways: wayHandlers.append(Highways)

        osm = OsmParser(
            self.filepath,
            # possible values for wayHandlers and nodeHandlers list elements:
            #    1) a string name for the module containing classes (all classes from the modules will be used as handlers)
            #    2) a python variable representing the module containing classes (all classes from the modules will be used as handlers)
            #    3) a python variable representing the class
            # Examples:
            # wayHandlers = [buildings, highways]
            # wayHandlers = [handlers.buildings]
            # wayHandlers = [handlers]
            # wayHandlers = ["handlers"]
            wayHandlers=wayHandlers)

        if "latitude" in scene and "longitude" in scene and not self.ignoreGeoreferencing:
            lat = scene["latitude"]
            lon = scene["longitude"]
        else:
            if osm.bounds and self.importHighways:
                # If the .osm file contains the bounds tag,
                # use its values as the extent of the imported area.
                # Highways may go far beyond the values of the bounds tag.
                # A user might get confused if higways are used in the calculation of the extent of the imported area.
                bounds = osm.bounds
                lat = (bounds["minLat"] + bounds["maxLat"]) / 2
                lon = (bounds["minLon"] + bounds["maxLon"]) / 2
            else:
                lat = (osm.minLat + osm.maxLat) / 2
                lon = (osm.minLon + osm.maxLon) / 2
            scene["latitude"] = lat
            scene["longitude"] = lon

        osm.parse(
            projection=TransverseMercator(lat=lat, lon=lon),
            defaultHeight=self.defaultHeight,
            levelHeight=self.levelHeight,
            bm=self.
            bm  # if present, indicates the we need to create as single mesh
        )