From f372ac9563b4903801cb47bbb4963b1c4f9172fe Mon Sep 17 00:00:00 2001 From: rnowak Date: Mon, 15 Jul 2024 17:57:35 +0200 Subject: [PATCH] bugfix for sequenced bookmarks bug in combination with traverses --- dotnetRunViewer.bat | 1 + src/PRo3D.Viewer/Viewer/ViewerLenses.fs | 92 +++++++++++++++---------- 2 files changed, 55 insertions(+), 38 deletions(-) create mode 100644 dotnetRunViewer.bat diff --git a/dotnetRunViewer.bat b/dotnetRunViewer.bat new file mode 100644 index 00000000..a6a69068 --- /dev/null +++ b/dotnetRunViewer.bat @@ -0,0 +1 @@ +dotnet run src\PRo3D.sln --project src\PRo3D.Viewer\PRo3D.Viewer.fsproj -loadRecent \ No newline at end of file diff --git a/src/PRo3D.Viewer/Viewer/ViewerLenses.fs b/src/PRo3D.Viewer/Viewer/ViewerLenses.fs index 409c0f28..96b8c12b 100644 --- a/src/PRo3D.Viewer/Viewer/ViewerLenses.fs +++ b/src/PRo3D.Viewer/Viewer/ViewerLenses.fs @@ -101,9 +101,10 @@ module ViewerLenses = m.scene.surfacesModel.sgSurfaces then state else Log.warn "[ViewerLenses] Surfaces have been added or removed making this scene state invalid. - Not applying surfaces for this scene state." + Not applying surfaces for this scene state. Update Scene State for this bookmark + or delete and create new bookmark." {state with stateSurfaces = m.scene.surfacesModel.surfaces} - + Log.line "m.origin = %s, state.origin = %s" (string m.scene.referenceSystem.origin) (string state.stateReferenceSystem.origin) let scaleBars = // check scale bars; using old segments for performance reasons if haveSameKeys state.stateScaleBars.scaleBars m.scene.scaleBars.scaleBars then @@ -139,44 +140,59 @@ module ViewerLenses = state.stateConfig.farPlane | true -> state.stateConfig.frustumModel.frustum - {m with - drawing = {m.drawing with annotations = state.stateAnnoatations} - scene = - {m.scene with - surfacesModel = {m.scene.surfacesModel with surfaces = state.stateSurfaces} - sceneObjectsModel = state.stateSceneObjects - scaleBars = scaleBars - geologicSurfacesModel = state.stateGeologicSurfaces - config = - {m.scene.config with - nearPlane = - {m.scene.config.nearPlane with value = state.stateConfig.nearPlane} - farPlane = - {m.scene.config.farPlane with value = state.stateConfig.farPlane} - frustumModel = state.stateConfig.frustumModel - arrowLength = - {m.scene.config.arrowLength with value = state.stateConfig.arrowLength} - arrowThickness = - {m.scene.config.arrowLength with value = state.stateConfig.arrowThickness} - dnsPlaneSize = - {m.scene.config.dnsPlaneSize with value = state.stateConfig.dnsPlaneSize} - lodColoring = state.stateConfig.lodColoring - drawOrientationCube = state.stateConfig.drawOrientationCube - } - referenceSystem = - {m.scene.referenceSystem with - origin = state.stateReferenceSystem.origin - isVisible = state.stateReferenceSystem.isVisible - size = - {m.scene.referenceSystem.size with - value = state.stateReferenceSystem.size} - selectedScale = state.stateReferenceSystem.selectedScale + let m = + let refSysState = + /// UPDATING REF SYSTEM HERE LEADS TO TRAVERSE CALCULATIONS BERING TRIGGERED, EVEN IF THE REF SYSTEM DOES NOT CHANGE! + /// so we check manually if the reference system has changed, and only assign it if there is a change + {m.scene.referenceSystem with + origin = state.stateReferenceSystem.origin + isVisible = state.stateReferenceSystem.isVisible + size = + {m.scene.referenceSystem.size with + value = state.stateReferenceSystem.size} + selectedScale = state.stateReferenceSystem.selectedScale + } + if m.scene.referenceSystem <> refSysState then + {m with scene = + {m.scene with + referenceSystem = refSysState } - traverses = traverses - } - frustum = frustum - } + else + m + + let m = + {m with + drawing = {m.drawing with annotations = state.stateAnnoatations} + scene = + {m.scene with + surfacesModel = {m.scene.surfacesModel with surfaces = state.stateSurfaces} + sceneObjectsModel = state.stateSceneObjects + scaleBars = scaleBars + geologicSurfacesModel = state.stateGeologicSurfaces + config = + {m.scene.config with + nearPlane = + {m.scene.config.nearPlane with value = state.stateConfig.nearPlane} + farPlane = + {m.scene.config.farPlane with value = state.stateConfig.farPlane} + frustumModel = state.stateConfig.frustumModel + arrowLength = + {m.scene.config.arrowLength with value = state.stateConfig.arrowLength} + arrowThickness = + {m.scene.config.arrowLength with value = state.stateConfig.arrowThickness} + dnsPlaneSize = + {m.scene.config.dnsPlaneSize with value = state.stateConfig.dnsPlaneSize} + lodColoring = state.stateConfig.lodColoring + drawOrientationCube = state.stateConfig.drawOrientationCube + } + traverses = traverses + + } + frustum = frustum + } + + m ) let _savedTimeSteps =