MCPcopy Create free account
hub / github.com/comaps/comaps / __init__

Method __init__

tools/python/mwm/mwm_python.py:173–211  ·  view source on GitHub ↗
(self, mwm: MwmPython, index: int)

Source from the content-addressed store, hash-verified

171
172class FeaturePython(mi.Feature):
173 def __init__(self, mwm: MwmPython, index: int):
174 self.mwm = mwm
175 self._index = index
176
177 header_bits = read_uint(self.mwm.file, 1)
178 types_count = (header_bits & 0x07) + 1
179 has_name = header_bits & 0x08 > 0
180 has_layer = header_bits & 0x10 > 0
181 has_addinfo = header_bits & 0x80 > 0
182 geom_type = header_bits & 0x60
183
184 self._types = [read_varuint(self.mwm.file) for _ in range(types_count)]
185 self._names = read_multilang(self.mwm.file) if has_name else {}
186 self._layer = read_uint(self.mwm.file, 1) if has_layer else 0
187
188 self._rank = 0
189 self._road_number = ""
190 self._house_number = ""
191
192 if has_addinfo:
193 if geom_type == GeomType.POINT:
194 self._rank = read_uint(self.mwm.file, 1)
195 elif geom_type == GeomType.LINE:
196 self._road_number = read_string(self.mwm.file)
197 elif geom_type == GeomType.AREA or geom_type == GeomType.POINT_EX:
198 self._house_number = read_numeric_string(self.mwm.file)
199
200 self._geom_type = mi.GeomType.undefined
201 self._geometry = []
202
203 if geom_type == GeomType.POINT or geom_type == GeomType.POINT_EX:
204 self._geometry = mi.GeomType.point
205 geometry = [
206 read_coord(self.mwm.file, self.mwm.base_point, self.mwm.coord_size)
207 ]
208 elif geom_type == GeomType.LINE:
209 self._geometry = mi.GeomType.line
210 elif geom_type == GeomType.AREA:
211 self._geometry = mi.GeomType.area
212
213 def readable_name(self) -> str:
214 if "default" in self._names:

Callers

nothing calls this directly

Calls 6

read_uintFunction · 0.85
read_varuintFunction · 0.85
read_multilangFunction · 0.85
read_stringFunction · 0.85
read_numeric_stringFunction · 0.85
read_coordFunction · 0.85

Tested by

no test coverage detected