feat: add native center line style overrides
This commit is contained in:
@@ -663,6 +663,8 @@ def build(args):
|
||||
layer["id"]: material_from_spec(spec)
|
||||
for layer, spec in zip(catalog.ROAD_LAYERS, catalog.road_material_specs())
|
||||
}
|
||||
road_mats["native_center_line_white"] = material_from_spec(
|
||||
catalog.MATERIALS["native_center_line_white"])
|
||||
traffic_signal_mats = {
|
||||
"metal": material_from_spec(catalog.MATERIALS["traffic_signal_metal"]),
|
||||
"housing": material_from_spec(catalog.MATERIALS["traffic_signal_housing"]),
|
||||
@@ -801,9 +803,19 @@ def build(args):
|
||||
source_path = os.path.join(native_road_dir, "layers", source["source"] + ".geojson")
|
||||
if not os.path.isfile(source_path):
|
||||
raise RuntimeError("Native road layer is missing: " + source_path)
|
||||
count = _roads.assemble_geojson_layer(
|
||||
source_path, source["source"], projector, roads_c,
|
||||
road_mats[target], layer["z"])
|
||||
if source["source"] == "center_lines":
|
||||
count = _roads.assemble_geojson_layer(
|
||||
source_path, source["source"], projector, roads_c,
|
||||
road_mats[target], layer["z"],
|
||||
lambda props: props.get("color") != "white")
|
||||
count += _roads.assemble_geojson_layer(
|
||||
source_path, source["source"] + "_white", projector, roads_c,
|
||||
road_mats["native_center_line_white"], layer["z"],
|
||||
lambda props: props.get("color") == "white")
|
||||
else:
|
||||
count = _roads.assemble_geojson_layer(
|
||||
source_path, source["source"], projector, roads_c,
|
||||
road_mats[target], layer["z"])
|
||||
road_counts[source["source"]] = count
|
||||
elif geojson_dir and os.path.isdir(geojson_dir):
|
||||
for problem in catalog.check_layers(geojson_dir):
|
||||
|
||||
@@ -200,7 +200,10 @@ MATERIALS = {
|
||||
"traffic_signal_active_green": {"kind": "solid", "name": "Traffic Signal Active Green",
|
||||
"color": (0.04, 0.82, 0.22), "roughness": 0.25,
|
||||
"cesium": {"base_color": (0.04, 0.82, 0.22),
|
||||
"emission": ((0.04, 0.82, 0.22), 1.0)}},
|
||||
"emission": ((0.04, 0.82, 0.22), 1.0)}},
|
||||
"native_center_line_white": {"kind": "solid", "name": "Native Center Line White",
|
||||
"color": (0.95, 0.94, 0.82), "roughness": 0.52,
|
||||
"cesium": {"base_color": (0.95, 0.94, 0.82)}},
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,8 @@ from osmassets.geom import clip_polygon, feature_in_bounds, geometry_rings
|
||||
from osmassets.mesh import MeshBatch, add_polyline
|
||||
|
||||
|
||||
def assemble_geojson_layer(path, layer_id, projector, collection, material, z):
|
||||
def assemble_geojson_layer(path, layer_id, projector, collection, material, z,
|
||||
property_filter=None):
|
||||
if not os.path.exists(path):
|
||||
return 0
|
||||
with open(path, "r", encoding="utf-8") as handle:
|
||||
@@ -18,6 +19,8 @@ def assemble_geojson_layer(path, layer_id, projector, collection, material, z):
|
||||
xmax, ymax = projector.xy((b["max_lon"], b["max_lat"]))
|
||||
count = 0
|
||||
for feature in data.get("features", []):
|
||||
if property_filter and not property_filter(feature.get("properties", {})):
|
||||
continue
|
||||
if not feature_in_bounds(feature, projector):
|
||||
continue
|
||||
for ring in geometry_rings(feature.get("geometry")):
|
||||
|
||||
Reference in New Issue
Block a user