some linter stuff
This commit is contained in:
parent
fb0f886083
commit
cfbe7c07f6
3 changed files with 7 additions and 3 deletions
|
@ -518,7 +518,7 @@ class LevelGeometries:
|
||||||
# lower faces
|
# lower faces
|
||||||
new_faces.append(np.dstack((self.vertices[np.flip(geom_faces, axis=1)], bottom[geom_faces])))
|
new_faces.append(np.dstack((self.vertices[np.flip(geom_faces, axis=1)], bottom[geom_faces])))
|
||||||
|
|
||||||
return (np.vstack(new_faces), )
|
return tuple((np.vstack(new_faces), ))
|
||||||
|
|
||||||
def build_mesh(self, interpolator=None):
|
def build_mesh(self, interpolator=None):
|
||||||
rings = tuple(chain(*(get_rings(geom) for geom in self.get_geometries())))
|
rings = tuple(chain(*(get_rings(geom) for geom in self.get_geometries())))
|
||||||
|
@ -566,7 +566,6 @@ class LevelGeometries:
|
||||||
self.optional_base.build_polyhedron(self._create_polyhedron, bottom=0, top=1)
|
self.optional_base.build_polyhedron(self._create_polyhedron, bottom=0, top=1)
|
||||||
|
|
||||||
# unset heightareas, they are no loinger needed
|
# unset heightareas, they are no loinger needed
|
||||||
self.vertex_altitudes = None
|
|
||||||
self.heightareas = None
|
self.heightareas = None
|
||||||
self.vertices = None
|
self.vertices = None
|
||||||
self.faces = None
|
self.faces = None
|
||||||
|
|
|
@ -7,6 +7,7 @@ from c3nav.mapdata.render.data import HybridGeometry
|
||||||
from c3nav.mapdata.render.engines.base import FillAttribs, RenderEngine, StrokeAttribs
|
from c3nav.mapdata.render.engines.base import FillAttribs, RenderEngine, StrokeAttribs
|
||||||
|
|
||||||
|
|
||||||
|
# noinspection PyAbstractClass
|
||||||
class Base3DEngine(RenderEngine):
|
class Base3DEngine(RenderEngine):
|
||||||
is_3d = True
|
is_3d = True
|
||||||
|
|
||||||
|
@ -22,7 +23,8 @@ class Base3DEngine(RenderEngine):
|
||||||
if fill is not None:
|
if fill is not None:
|
||||||
self.vertices.append(self._place_geometry(geometry))
|
self.vertices.append(self._place_geometry(geometry))
|
||||||
|
|
||||||
def _append_to_vertices(self, vertices, append=None):
|
@staticmethod
|
||||||
|
def _append_to_vertices(vertices, append=None):
|
||||||
if append is not None:
|
if append is not None:
|
||||||
append = np.array(append, dtype=np.float32).flatten()
|
append = np.array(append, dtype=np.float32).flatten()
|
||||||
vertices = np.dstack((
|
vertices = np.dstack((
|
||||||
|
|
|
@ -10,6 +10,7 @@ from shapely.geometry import MultiPolygon, Polygon
|
||||||
|
|
||||||
@lru_cache()
|
@lru_cache()
|
||||||
def get_face_indizes(start, length):
|
def get_face_indizes(start, length):
|
||||||
|
# noinspection PyTypeChecker
|
||||||
indices = np.tile(np.arange(start, start + length).reshape((-1, 1)), 2).flatten()[1:-1].reshape((length - 1, 2))
|
indices = np.tile(np.arange(start, start + length).reshape((-1, 1)), 2).flatten()[1:-1].reshape((length - 1, 2))
|
||||||
return np.vstack((indices, (indices[-1][-1], indices[0][0])))
|
return np.vstack((indices, (indices[-1][-1], indices[0][0])))
|
||||||
|
|
||||||
|
@ -28,6 +29,7 @@ def triangulate_rings(rings, holes=None):
|
||||||
indices = tuple(vertices_lookup[vertex] for vertex in ring[:-1])
|
indices = tuple(vertices_lookup[vertex] for vertex in ring[:-1])
|
||||||
segments.update(zip(indices, indices[1:]+indices[:1]))
|
segments.update(zip(indices, indices[1:]+indices[:1]))
|
||||||
|
|
||||||
|
# noinspection PyArgumentList
|
||||||
info = triangle.MeshInfo()
|
info = triangle.MeshInfo()
|
||||||
info.set_points(np.array(vertices).tolist())
|
info.set_points(np.array(vertices).tolist())
|
||||||
info.set_facets(segments)
|
info.set_facets(segments)
|
||||||
|
@ -50,6 +52,7 @@ def _triangulate_polygon(polygon: Polygon, keep_holes=False):
|
||||||
segments.append(get_face_indizes(offset, len(new_vertices)))
|
segments.append(get_face_indizes(offset, len(new_vertices)))
|
||||||
offset += len(new_vertices)
|
offset += len(new_vertices)
|
||||||
|
|
||||||
|
# noinspection PyArgumentList
|
||||||
info = triangle.MeshInfo()
|
info = triangle.MeshInfo()
|
||||||
info.set_points(np.vstack(vertices))
|
info.set_points(np.vstack(vertices))
|
||||||
info.set_facets(np.vstack(segments).tolist())
|
info.set_facets(np.vstack(segments).tolist())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue