def __init__(self, filename: str, parse: bool = False): super().__init__(filename) self.f = open(filename, "rb") self.file = mmap.mmap(self.f.fileno(), 0, access=mmap.ACCESS_READ) self.tags = self._read_sections_info() self.seek_tag("header") coord_bits = read_varuint(self.file) self.coord_size = (1 << coord_bits) - 1 self.base_point = mwm_bitwise_split(read_varuint(self.file)) self.bounds_ = read_bounds(self.file, self.coord_size) self.scales = read_uint_array(self.file) self.langs = [mi.LANGS[code] for code in read_uint_array(self.file)] self.map_type = mi.MapType(read_varint(self.file)) self.version_ = self._read_version() self.metadata_offsets = self._read_metadata_offsets()
def type(self) -> mi.MapType: t = self.mwm.type() return mi.MapType(int(t))