Fix: BCF-XML writer should not set FieldOfView but ViewToWorldScale

instead.
pull/8471/head
Wieland Lindenthal 4 years ago
parent 6ba3e4d744
commit 1cfbac39ec
  1. 3
      modules/bim/lib/open_project/bim/bcf_xml/viewpoint_writer.rb
  2. 2
      modules/bim/spec/fixtures/viewpoints/minimal.bcfv.json
  3. 2
      modules/bim/spec/fixtures/viewpoints/minimal.bcfv.xml
  4. 3
      modules/bim/spec/lib/open_project/bcf/bcf_json/viewpoint_reader_shared_examples.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

@ -16,6 +16,6 @@
"y": 0.209889,
"z": 0.951807
},
"field_of_view": 180
"view_to_world_scale": 180
}
}

@ -16,6 +16,6 @@
<Y>0.209889</Y>
<Z>0.951807</Z>
</CameraUpVector>
<FieldOfView>180</FieldOfView>
<ViewToWorldScale>180</ViewToWorldScale>
</OrthogonalCamera>
</VisualizationInfo>

@ -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)

Loading…
Cancel
Save