From 1cfbac39ec900ba522ac279f570fb628f1b36463 Mon Sep 17 00:00:00 2001 From: Wieland Lindenthal Date: Wed, 24 Jun 2020 16:50:51 +0200 Subject: [PATCH] Fix: BCF-XML writer should not set FieldOfView but ViewToWorldScale instead. --- modules/bim/lib/open_project/bim/bcf_xml/viewpoint_writer.rb | 3 ++- modules/bim/spec/fixtures/viewpoints/minimal.bcfv.json | 2 +- modules/bim/spec/fixtures/viewpoints/minimal.bcfv.xml | 2 +- .../bcf/bcf_json/viewpoint_reader_shared_examples.rb | 3 ++- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/bim/lib/open_project/bim/bcf_xml/viewpoint_writer.rb b/modules/bim/lib/open_project/bim/bcf_xml/viewpoint_writer.rb index 4d734da22e..ee245d179c 100644 --- a/modules/bim/lib/open_project/bim/bcf_xml/viewpoint_writer.rb +++ b/modules/bim/lib/open_project/bim/bcf_xml/viewpoint_writer.rb @@ -112,7 +112,8 @@ module OpenProject::Bim::BcfXml to_xml_coords(coords, xml) end end - xml.FieldOfView convert_float(camera['field_of_view']) + xml.FieldOfView convert_float(camera['field_of_view']) if type == 'perspective_camera' + xml.ViewToWorldScale convert_float(camera['view_to_world_scale']) if type == 'orthogonal_camera' end end diff --git a/modules/bim/spec/fixtures/viewpoints/minimal.bcfv.json b/modules/bim/spec/fixtures/viewpoints/minimal.bcfv.json index 0711338b58..8ab9265df8 100644 --- a/modules/bim/spec/fixtures/viewpoints/minimal.bcfv.json +++ b/modules/bim/spec/fixtures/viewpoints/minimal.bcfv.json @@ -16,6 +16,6 @@ "y": 0.209889, "z": 0.951807 }, - "field_of_view": 180 + "view_to_world_scale": 180 } } \ No newline at end of file diff --git a/modules/bim/spec/fixtures/viewpoints/minimal.bcfv.xml b/modules/bim/spec/fixtures/viewpoints/minimal.bcfv.xml index d67ae08e07..de0352767d 100644 --- a/modules/bim/spec/fixtures/viewpoints/minimal.bcfv.xml +++ b/modules/bim/spec/fixtures/viewpoints/minimal.bcfv.xml @@ -16,6 +16,6 @@ 0.209889 0.951807 - 180 + 180 \ No newline at end of file diff --git a/modules/bim/spec/lib/open_project/bcf/bcf_json/viewpoint_reader_shared_examples.rb b/modules/bim/spec/lib/open_project/bcf/bcf_json/viewpoint_reader_shared_examples.rb index eb79015775..f5678a86d1 100644 --- a/modules/bim/spec/lib/open_project/bcf/bcf_json/viewpoint_reader_shared_examples.rb +++ b/modules/bim/spec/lib/open_project/bcf/bcf_json/viewpoint_reader_shared_examples.rb @@ -51,7 +51,8 @@ shared_examples 'has camera' do |camera_type| it 'has a camera object' do # camera xyz floats expect(subject.dig(camera_type)).to be_kind_of(Hash) - expect(subject.dig(camera_type, 'field_of_view')).to be_kind_of(Numeric) + expect(subject.dig(camera_type, 'field_of_view')).to be_kind_of(Numeric) if camera_type == 'perspective_camera' + expect(subject.dig(camera_type, 'view_to_world_scale')).to be_kind_of(Numeric) if camera_type == 'orthogonal_camera' %w[camera_view_point camera_direction camera_up_vector].each do |key| camera_vp = subject.dig(camera_type, key)