From 7d6d9db11abb622faf850c78f6220b7f391c49a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Couble?= Date: Tue, 4 Jul 2023 09:35:39 +0200 Subject: [PATCH 1/2] [refact] Remove unused save CSV from applogic --- Application/Client/LidarViewMainWindow.ui | 10 --- Application/Wrapping/Python/applogic.py | 76 ----------------------- 2 files changed, 86 deletions(-) diff --git a/Application/Client/LidarViewMainWindow.ui b/Application/Client/LidarViewMainWindow.ui index 6fa71131c..04bbab1ba 100644 --- a/Application/Client/LidarViewMainWindow.ui +++ b/Application/Client/LidarViewMainWindow.ui @@ -51,7 +51,6 @@ - @@ -668,15 +667,6 @@ Plane Fit to selection - - - - :/lvResources/Icons/pqSpreadsheet16.png:/lvResources/Icons/pqSpreadsheet16.png - - - Save Position CSV... - - true diff --git a/Application/Wrapping/Python/applogic.py b/Application/Wrapping/Python/applogic.py index 33d4602c3..f0e873185 100644 --- a/Application/Wrapping/Python/applogic.py +++ b/Application/Wrapping/Python/applogic.py @@ -21,7 +21,6 @@ from paraview import vtk import PythonQt from PythonQt import QtCore, QtGui -import lidarviewcore.kiwiviewerExporter as kiwiviewerExporter import lidarview.gridAdjustmentDialog import lidarview.planefit as planefit import lidarview.simple as lvsmp @@ -171,72 +170,6 @@ def UpdateApplogicReader(lidarName, posOrName): # WIP could explicit send Proxy updateUIwithNewLidar() -def rotateCSVFile(filename): - - # read the csv file, move the last 3 columns to the - # front, and then overwrite the file with the result - csvFile = open(filename, 'rt') - reader = csv.reader(csvFile, quoting=csv.QUOTE_NONNUMERIC) - rows = [row[-3:] + row[:-3] for row in reader] - csvFile.close() - - writer = csv.writer(open(filename, 'wt'), quoting=csv.QUOTE_NONNUMERIC, delimiter=',', lineterminator = '\n') - writer.writerows(rows) - - -def savePositionCSV(filename): - w = smp.CreateWriter(filename, getPosition()) - w.Precision = 16 - w.FieldAssociation = 'Point Data' - w.UpdatePipeline() - smp.Delete(w) - -def saveCSVCurrentFrame(filename): - w = smp.CreateWriter(filename, getLidar()) - w.Precision = 16 - w.FieldAssociation = 'Point Data' - w.UpdatePipeline() - smp.Delete(w) - rotateCSVFile(filename) - -def saveCSVCurrentFrameSelection(filename): - source = smp.GetActiveSource() - extractSelection = smp.ExtractSelection(Input = source) - w = smp.CreateWriter(filename, extractSelection) - w.Precision = 16 - w.FieldAssociation = 'Point Data' - w.UpdatePipeline() - smp.Delete(w) - rotateCSVFile(filename) - -def saveFrameRange(filename, frameStart, frameStop, saveFunction): - timesteps = range(frameStart, frameStop+1) - saveFunction(filename, timesteps) - - -def saveCSV(filename, timesteps): - - tempDir = kiwiviewerExporter.tempfile.mkdtemp() - basenameWithoutExtension = os.path.splitext(os.path.basename(filename))[0] - outDir = os.path.join(tempDir, basenameWithoutExtension) - filenameTemplate = os.path.join(outDir, basenameWithoutExtension + '_%04d.csv') - os.makedirs(outDir) - - writer = smp.CreateWriter('tmp.csv', getLidar()) - writer.FieldAssociation = 'Point Data' - writer.Precision = 16 - - for i in timesteps: - getAnimationScene().AnimationTime = getLidar().TimestepValues[i] - writer.FileName = filenameTemplate % i - writer.UpdatePipeline() - rotateCSVFile(writer.FileName) - - smp.Delete(writer) - - kiwiviewerExporter.zipDir(outDir, filename) - kiwiviewerExporter.shutil.rmtree(tempDir) - def getSaveFileName(title, extension, defaultFileName=None): settings = getPVSettings() @@ -285,11 +218,6 @@ def getFrameSelectionFromUser(frameStrideVisibility=False, framePackVisibility=F return frameOptions -def onSavePosition(): - fileName = getSaveFileName('Save CSV', 'csv', getDefaultSaveFileName('csv', '-position')) - if fileName: - savePositionCSV(fileName) - def onSavePCAP(): # It is not possible to save as PCAP during stream as we need frame numbers if getSensor(): @@ -387,13 +315,10 @@ def _setSaveActionsEnabled(enabled): def enableSaveActions(): _setSaveActionsEnabled(True) - if getPosition(): - app.actions['actionSavePositionCSV'].setEnabled(True) def disableSaveActions(): _setSaveActionsEnabled(False) - app.actions['actionSavePositionCSV'].setEnabled(False) def unloadData(): @@ -704,7 +629,6 @@ def setupActions(): app.actions['actionAdvanceFeature'].connect('triggered()', onToogleAdvancedGUI) app.actions['actionPlaneFit'].connect('triggered()', planeFit) app.actions['actionClose'].connect('triggered()', onClose) - app.actions['actionSavePositionCSV'].connect('triggered()', onSavePosition) app.actions['actionSavePCAP'].connect('triggered()', onSavePCAP) app.actions['actionGrid_Properties'].connect('triggered()', onGridProperties) app.actions['actionCropReturns'].connect('triggered()', onCropReturns) -- GitLab From c7605d51cd66ba06e2722dbb7ea79ba21570e887 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Couble?= Date: Mon, 24 Jul 2023 09:19:34 +0200 Subject: [PATCH 2/2] [submodule] Bump LVCore 7db6346c Merge branch 'feat/addCSVOpenToLVSMP' into 'master' 668be855 Merge branch 'feat/AddPCLPlaneAlignment' into 'master' ca5c619e Merge branch 'fix/ifndefExtractPointSelection' into 'master' --- LVCore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LVCore b/LVCore index fad66f89d..7db6346c3 160000 --- a/LVCore +++ b/LVCore @@ -1 +1 @@ -Subproject commit fad66f89d9e192a3f2f3aa12e78e946e8796cc7b +Subproject commit 7db6346c31c221771e2f607f81f933c031489cd3 -- GitLab