fix: match Cesium intersection asphalt

This commit is contained in:
2026-08-05 11:54:26 +08:00
parent 15a8429af9
commit 400525dd07
2 changed files with 12 additions and 1 deletions

View File

@@ -29,7 +29,7 @@ ROAD_LAYERS = [
{"id": "road_surface", "material": "Road Asphalt", {"id": "road_surface", "material": "Road Asphalt",
"color": (0.055, 0.065, 0.070), "z": 0.03}, "color": (0.055, 0.065, 0.070), "z": 0.03},
{"id": "intersection_surface", "material": "Intersection Asphalt", {"id": "intersection_surface", "material": "Intersection Asphalt",
"color": (0.065, 0.075, 0.080), "z": 0.035}, "color": (0.055, 0.065, 0.070), "z": 0.035},
{"id": "sidewalks", "material": "Sidewalk", {"id": "sidewalks", "material": "Sidewalk",
"color": (0.49, 0.51, 0.49), "z": 0.065}, "color": (0.49, 0.51, 0.49), "z": 0.065},
{"id": "sidewalk_corners", "material": "Sidewalk Corner", {"id": "sidewalk_corners", "material": "Sidewalk Corner",

View File

@@ -30,12 +30,23 @@ from osmassets.geom import (
sample_tree_row, sample_tree_row,
signed_polygon_area, signed_polygon_area,
) )
from osmassets.catalog import ROAD_LAYERS
from osmassets.osm import Projector, parse_height, parse_osm, tags from osmassets.osm import Projector, parse_height, parse_osm, tags
SQUARE = [(0.0, 0.0), (10.0, 0.0), (10.0, 10.0), (0.0, 10.0)] SQUARE = [(0.0, 0.0), (10.0, 0.0), (10.0, 10.0), (0.0, 10.0)]
class RoadLayerCatalogTest(unittest.TestCase):
def test_intersection_and_road_asphalt_share_the_same_colour(self):
layers = {layer["id"]: layer for layer in ROAD_LAYERS}
self.assertEqual(layers["road_surface"]["color"],
layers["intersection_surface"]["color"])
# They remain distinct meshes so the intersection stays above the road.
self.assertNotEqual(layers["road_surface"]["z"],
layers["intersection_surface"]["z"])
class GeometryRingsTest(unittest.TestCase): class GeometryRingsTest(unittest.TestCase):
def test_polygon_keeps_only_the_exterior_ring(self): def test_polygon_keeps_only_the_exterior_ring(self):
geometry = {"type": "Polygon", "coordinates": [["outer"], ["hole"]]} geometry = {"type": "Polygon", "coordinates": [["outer"], ["hole"]]}