Skip to content

Commit 8a2911a

Browse files
Add "Reset center to lidar" and "Reset Camera to predefined viewpoint" buttons
"Reset center to lidar" Reset the center of rotation to the grid/lidar center "Reset Camera to predefined viewpoint" place the view 30° up and center to the lidar Also add shortcuts for this 2 features
1 parent 11f1ff8 commit 8a2911a

File tree

5 files changed

+46
-1
lines changed

5 files changed

+46
-1
lines changed
2.48 KB
Loading
3.88 KB
Loading

Application/Ui/python/lidarview/applogic.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -922,6 +922,25 @@ class FrameOptions(object):
922922
return frameOptions
923923

924924

925+
def resetCenterToLidarCenter():
926+
view = smp.GetActiveView()
927+
view.CenterOfRotation = [0, 0, 0]
928+
smp.Render()
929+
930+
931+
def resetCameraLidar():
932+
view = app.mainView
933+
view.CameraFocalPoint = [0,0,0]
934+
view.CameraViewUp = [0, 0, 1]
935+
936+
# Position at 30° [0, -(squareRoot(3)/2)*L, (1/2)*L]
937+
L = 100
938+
view.CameraPosition = [0, -0.866025 * L, (1.0/2.0) * L]
939+
940+
view.CenterOfRotation = [0, 0, 0]
941+
smp.Render(view)
942+
943+
925944
def onSaveCSV():
926945

927946
frameOptions = getFrameSelectionFromUser()
@@ -1939,14 +1958,18 @@ def setupActions():
19391958
app.actions['actionSelectDualReturn'].connect('triggered()',toggleSelectDualReturn)
19401959
app.actions['actionSelectDualReturn2'].connect('triggered()',toggleSelectDualReturn)
19411960

1961+
app.actions['actionResetCenterToLidarCenter'].connect('triggered()', resetCenterToLidarCenter)
1962+
addShortcuts("Ctrl+Alt+l",resetCenterToLidarCenter)
1963+
app.actions['actionResetCameraLidar'].connect('triggered()', resetCameraLidar)
1964+
addShortcuts("Ctrl+Alt+v",resetCameraLidar)
1965+
19421966
# Restore action states from settings
19431967
settings = getPVSettings()
19441968
app.actions['actionIgnoreZeroDistances'].setChecked(int(settings.value('LidarPlugin/IgnoreZeroDistances', 1)))
19451969
app.actions['actionHideDropPoints'].setChecked(int(settings.value('LidarPlugin/HideDropPoints', 1)))
19461970
app.actions['actionIntraFiringAdjust'].setChecked(int(settings.value('LidarPlugin/IntraFiringAdjust', 1)))
19471971
app.actions['actionIgnoreEmptyFrames'].setChecked(int(settings.value('LidarPlugin/IgnoreEmptyFrames', 1)))
19481972

1949-
19501973
advanceMode = int(settings.value("LidarPlugin/AdvanceFeature/Enable", 0))
19511974
if not advanceMode:
19521975
app.actions['actionAdvanceFeature'].checked = False

Application/vvMainWindow.ui

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,8 @@
217217
<addaction name="actionMeasure"/>
218218
<addaction name="actionPlaneFit"/>
219219
<addaction name="separator"/>
220+
<addaction name="actionResetCenterToLidarCenter"/>
221+
<addaction name="actionResetCameraLidar"/>
220222
</widget>
221223
<widget class="QToolBar" name="geolocationToolbar">
222224
<property name="windowTitle">
@@ -899,6 +901,24 @@
899901
<string>Show the GPS Track</string>
900902
</property>
901903
</action>
904+
<action name="actionResetCenterToLidarCenter">
905+
<property name="icon">
906+
<iconset resource="vvResources.qrc">
907+
<normaloff>:/vvResources/Icons/pqResetCenterLidar.png</normaloff>:/vvResources/Icons/pqResetCenterLidar.png</iconset>
908+
</property>
909+
<property name="text">
910+
<string>Reset center to lidar (Ctrl+Alt+l)</string>
911+
</property>
912+
</action>
913+
<action name="actionResetCameraLidar">
914+
<property name="icon">
915+
<iconset resource="vvResources.qrc">
916+
<normaloff>:/vvResources/Icons/pqResetCameraLidar.png</normaloff>:/vvResources/Icons/pqResetCameraLidar.png</iconset>
917+
</property>
918+
<property name="text">
919+
<string>Reset camera view to predefined viewpoint - 30 degrees behind the grid center (Ctrl+Alt+v)</string>
920+
</property>
921+
</action>
902922
</widget>
903923
<customwidgets>
904924
<customwidget>

Application/vvResources.qrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
<file>Icons/pqSurfaceSelectionPoint24.png</file>
1111
<file>Icons/pqSpreadsheet16.png</file>
1212
<file>Icons/pqResetCamera32.png</file>
13+
<file>Icons/pqResetCenterLidar.png</file>
14+
<file>Icons/pqResetCameraLidar.png</file>
1315
<file>Icons/python_logo_124.png</file>
1416
<file>Icons/pqXMinus32.png</file>
1517
<file>Icons/pqXPlus32.png</file>

0 commit comments

Comments
 (0)