MCPcopy Create free account
hub / github.com/Kitware/VeloView / toggleSelectDualReturn

Function toggleSelectDualReturn

Application/Ui/python/lidarview/applogic.py:1527–1574  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1525 " support dual returns.")
1526
1527def toggleSelectDualReturn():
1528 import warnings;warnings.simplefilter(action = "ignore", category = FutureWarning) # try removing this when vtk is upgraded
1529
1530 # test if we are on osx os
1531 osName = str(sys.platform)
1532 if osName == 'darwin':
1533 QtGui.QMessageBox.warning(getMainWindow(), 'Information', 'This functionality is not yet available on %s' % osName)
1534 return
1535
1536 if len(app.trailingFrame) == 0:
1537 return
1538
1539 #Get the active source
1540 source = app.trailingFrame[0]
1541 lidarPacketInterpreter = getLidarPacketInterpreter()
1542
1543 #If no data are available
1544 if not source :
1545 return
1546
1547 if not hasDualReturn(lidarPacketInterpreter):
1548 warnNoDualReturns()
1549 return
1550
1551 #Get the selected Points
1552 selectedPoints = source.GetSelectionOutput(0)
1553 polyData = selectedPoints.GetClientSideObject().GetOutput()
1554 nSelectedPoints = polyData.GetNumberOfPoints()
1555
1556 if nSelectedPoints > 0:
1557 # implementation for a non-multiblock object:
1558 # idArray = polyData.GetPointData().GetArray('dual_return_matching')
1559 # query = 'np.logical_and(dual_return_matching > -1, np.in1d(id, [{}]))'.format(','.join(selectedDualIds))
1560
1561 if polyData.GetNumberOfBlocks() != 1:
1562 QtGui.QMessageBox.warning(getMainWindow(),
1563 'Cannot select dual return matching',
1564 'Number of blocks is not 1. Please set 0 trailing frame and retry.')
1565 return
1566
1567 idArray = polyData.GetBlock(0).GetPointData().GetArray('dual_return_matching')
1568 selectedDualIds = set(str(int(idArray.GetValue(i))) for i in range(nSelectedPoints))
1569 query = 'dsa.VTKArray([dual_return_matching.Arrays[0][i] > -1 and i in [{}] for i in range(id.size)])' \
1570 .format(','.join(selectedDualIds))
1571 else:
1572 query = 'dual_return_matching > -1'
1573 smp.SelectPoints(query)
1574 smp.Render()
1575
1576
1577def toggleCrashAnalysis():

Callers

nothing calls this directly

Calls 4

getMainWindowFunction · 0.85
hasDualReturnFunction · 0.85
warnNoDualReturnsFunction · 0.85

Tested by

no test coverage detected