Closed mdastous-bentley closed 2 years ago
Thanks for reporting this issue. We will take a look.
@mdastous-bentley --
@Ellord207 can provide some more details about ViewSetup.getDefaultView, which your sandbox uses. Apparently, that method results in cameras with invalid lenses being returned, which resulted in this problem.
@Ellord207 also suggested to me an alternate approach to the sandbox which would be a preferred method for opening a default view.
The main issues seems to be 2 fold:
ViewSetup.getDefaultView
has an undefined lens and is initialized to 0 (an invalid value)ViewState3d.lookAtGlobalLocation
that fails if the lens is invalid.The default view of any given iModel is whatever the creator has defined. Sometimes, it can be more contestant to create a new view from scratch than to use the default one. The ViewCreator3d is helpful for doing this.
I have forked and updated your sandbox to use ViewCreator3d(...).createDefaultView(...)
. After doing so ViewState3d.lookAtGlobalLocation
works. I also reorganized the code to follow the best practices when initializing the view state.
Here is the sandbox: https://www.itwinjs.org/sandboxes/NathanElrod/Re.GitHubDiscussions-3390
All right, so my understanding is that the default view was not setup properly to support ViewState3d.lookAtGlobalLocation
. It would be great to get an error code that indicates lookAtGlobalLocation
cannot perform with the current view state.
There's nothing wrong with an orthographic view having an "invalid" camera.
lookAtGlobalLocation
attempts to support orthographic views - it just doesn't do so properly and needs to be fixed.
Describe the bug Calling
ViewState3d.lookAtGlobalLocation
with aGlobalLocation
parameter that does not contain anarea
property, won't update the view.Calling
Camera.validateLens()
prior to`ViewState3d.lookAtGlobalLocation
solves the issue.To Reproduce Please use this sandbox to reproduce the issue. Basically, the following call is made to center view around Exton office:
view.lookAtGlobalLocation( 1000, Angle.createDegrees(65).radians, {center: Cartographic.fromDegrees({longitude: -75.696, latitude: 40.065757})} );
Expected behavior View should be tilted 65 degrees and have an elevation of 1000m
Screenshots
Desktop (please complete the applicable information):
Additional context