Skip to content

Commit

Permalink
Fix problem with COLLADA lines missing colour
Browse files Browse the repository at this point in the history
  • Loading branch information
vjf committed Dec 20, 2024
1 parent 88c14cc commit 744d851
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ dependencies = [
"numpy>=1.14",
"OWSLib",
"Pillow",
"pycollada",
"pycollada>=0.8",
"pyproj",
"SQLAlchemy",
"diskcache",
Expand All @@ -32,5 +32,3 @@ test = [
requires = ["pdm-backend"]
build-backend = "pdm.backend"

[tool.pdm]

3 changes: 3 additions & 0 deletions scripts/lib/exports/collada_kit.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ def add_geom_to_collada(self, geom_obj, style_obj, meta_obj):
self.mesh_obj.geometries.append(geom)
self.geomnode_list.append(Collada.scene.GeometryNode(geom, [matnode]))

# Create metadata for popup window on map
popup_dict[geometry_name] = {'title': meta_obj.name, 'name': meta_obj.name}
node_label = geometry_name

Expand All @@ -151,6 +152,7 @@ def add_geom_to_collada(self, geom_obj, style_obj, meta_obj):
self.geomnode_list, geom_obj.seg_arr,
geom_obj.vrtx_arr, self.obj_cnt,
geom_obj.line_width, not geom_obj.is_vert_line)
# Create metadata for popup window on map
for geom_label in geom_label_list:
popup_dict[geom_label] = {'title': meta_obj.name, 'name': meta_obj.name}
node_label = geom_label
Expand Down Expand Up @@ -183,6 +185,7 @@ def add_geom_to_collada(self, geom_obj, style_obj, meta_obj):
self.geomnode_list, vrtx, self.obj_cnt,
self.POINT_SIZE, colour_num)

# Create metadata for popup window on map
popup_dict[geom_label] = {'name': meta_obj.get_property_name(),
'title': geometry_name.replace('_', ' ')}
# Some vertices do not have properties
Expand Down
4 changes: 2 additions & 2 deletions scripts/lib/exports/collada_out.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,6 @@ def make_line(self, mesh, geometry_name, geomnode_list, seg_arr, vrtx_arr, obj_c
:param z_expand: is true if line width is drawn in z-direction else x-direction
:returns: the line's geometry label
'''
matnode = Collada.scene.MaterialNode("materialref-{0:05d}".format(obj_cnt),
mesh.materials[-1], inputs=[])
geom_label_list = []

for point_cnt, vert_floats, indices in line_gen(seg_arr, vrtx_arr, line_width, z_expand):
Expand All @@ -142,6 +140,8 @@ def make_line(self, mesh, geometry_name, geomnode_list, seg_arr, vrtx_arr, obj_c
input_list.addInput(0, 'VERTEX',
"#lineverts-array-{0:010d}-{1:05d}".format(point_cnt, obj_cnt))

matnode = Collada.scene.MaterialNode("materialref-{0:010d}-{0:05d}".format(point_cnt, obj_cnt),
mesh.materials[-1], inputs=[])
triset = geom.createTriangleSet(numpy.array(indices),
input_list, "materialref-{0:05d}".format(obj_cnt))
geom.primitives.append(triset)
Expand Down

0 comments on commit 744d851

Please sign in to comment.