fix imports for tileserver for real now
This commit is contained in:
parent
a3c008d590
commit
ef8175fafb
4 changed files with 9 additions and 9 deletions
|
@ -5,9 +5,9 @@ from os import PathLike
|
||||||
from typing import Self, Iterator, Union, TYPE_CHECKING
|
from typing import Self, Iterator, Union, TYPE_CHECKING
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
from numpy.typing import NDArray
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from numpy.typing import NDArray
|
|
||||||
from shapely import Polygon, MultiPolygon
|
from shapely import Polygon, MultiPolygon
|
||||||
|
|
||||||
from c3nav.mapdata.utils.cache.indexed import LevelGeometryIndexed
|
from c3nav.mapdata.utils.cache.indexed import LevelGeometryIndexed
|
||||||
|
@ -75,10 +75,10 @@ class AccessRestrictionAffectedCells:
|
||||||
self.selector = selector
|
self.selector = selector
|
||||||
self.values = self._get_values()
|
self.values = self._get_values()
|
||||||
|
|
||||||
def _get_values(self) -> 'NDArray':
|
def _get_values(self) -> NDArray:
|
||||||
return LevelGeometryIndexed.__getitem__(self.parent, self.selector)
|
return LevelGeometryIndexed.__getitem__(self.parent, self.selector)
|
||||||
|
|
||||||
def _set(self, values: 'NDArray'):
|
def _set(self, values: NDArray):
|
||||||
self.values = values
|
self.values = values
|
||||||
LevelGeometryIndexed.__setitem__(self.parent, self.selector, values)
|
LevelGeometryIndexed.__setitem__(self.parent, self.selector, values)
|
||||||
|
|
||||||
|
|
1
src/c3nav/mapdata/utils/cache/indexed.py
vendored
1
src/c3nav/mapdata/utils/cache/indexed.py
vendored
|
@ -12,7 +12,6 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from threading import local as LocalContext
|
from threading import local as LocalContext
|
||||||
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from shapely import Polygon, MultiPolygon
|
from shapely import Polygon, MultiPolygon
|
||||||
|
|
||||||
|
|
10
src/c3nav/mapdata/utils/cache/maphistory.py
vendored
10
src/c3nav/mapdata/utils/cache/maphistory.py
vendored
|
@ -1,14 +1,16 @@
|
||||||
import struct
|
import struct
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
from os import PathLike
|
from os import PathLike
|
||||||
from typing import Optional, Self
|
from typing import Optional, Self, TYPE_CHECKING, Union
|
||||||
from shapely import Polygon, MultiPolygon
|
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from c3nav.mapdata.utils.cache.types import MapUpdateTuple
|
from c3nav.mapdata.utils.cache.types import MapUpdateTuple
|
||||||
from c3nav.mapdata.utils.cache.indexed import LevelGeometryIndexed
|
from c3nav.mapdata.utils.cache.indexed import LevelGeometryIndexed
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from shapely import Polygon, MultiPolygon
|
||||||
|
|
||||||
|
|
||||||
class MapHistory(LevelGeometryIndexed):
|
class MapHistory(LevelGeometryIndexed):
|
||||||
# metadata format:
|
# metadata format:
|
||||||
|
@ -48,7 +50,7 @@ class MapHistory(LevelGeometryIndexed):
|
||||||
instance.save()
|
instance.save()
|
||||||
return instance
|
return instance
|
||||||
|
|
||||||
def add_geometry(self, geometry: Polygon | MultiPolygon, update: MapUpdateTuple):
|
def add_geometry(self, geometry: Union["Polygon", "MultiPolygon"], update: MapUpdateTuple):
|
||||||
if self.updates[-1] != update:
|
if self.updates[-1] != update:
|
||||||
self.updates.append(update)
|
self.updates.append(update)
|
||||||
|
|
||||||
|
@ -67,7 +69,7 @@ class MapHistory(LevelGeometryIndexed):
|
||||||
self.simplify()
|
self.simplify()
|
||||||
super().write(*args, **kwargs)
|
super().write(*args, **kwargs)
|
||||||
|
|
||||||
def composite(self, other: Self, mask_geometry: Optional[Polygon | MultiPolygon]):
|
def composite(self, other: Self, mask_geometry: Optional[Union["Polygon", "MultiPolygon"]]):
|
||||||
if self.resolution != other.resolution:
|
if self.resolution != other.resolution:
|
||||||
raise ValueError('Cannot composite with different resolutions.')
|
raise ValueError('Cannot composite with different resolutions.')
|
||||||
|
|
||||||
|
|
1
src/c3nav/mapdata/utils/cache/package.py
vendored
1
src/c3nav/mapdata/utils/cache/package.py
vendored
|
@ -1,6 +1,5 @@
|
||||||
import os
|
import os
|
||||||
import struct
|
import struct
|
||||||
from collections import namedtuple
|
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from tarfile import TarFile, TarInfo
|
from tarfile import TarFile, TarInfo
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue