diff --git a/Application/Client/LidarViewMainWindow.cxx b/Application/Client/LidarViewMainWindow.cxx index 628d45dae51cb7cc99f552d0217f1d8e557da90c..2fc53aa0303a011cebaa4b4f9f66e25804d7cbb4 100644 --- a/Application/Client/LidarViewMainWindow.cxx +++ b/Application/Client/LidarViewMainWindow.cxx @@ -25,6 +25,7 @@ #include "lqOpenSensorReaction.h" #include "lqSaveLidarFrameReaction.h" #include "lqSaveLidarStateReaction.h" +#include "lqSavePcapReaction.h" #include "lqUpdateCalibrationReaction.h" #include "vtkLVVersion.h" #include @@ -430,19 +431,15 @@ void LidarViewMainWindow::setupGUICustom() new lqOpenRecentFilesReaction( this->Internals->menuRecent_Files, this->Internals->actionClear_Menu); - // Writer reactions (action, writerName, extension, displaySettings, useDirectory, - // keepNameFromPcapFile, fileNameWithFrameNumber ) - new lqSaveLidarFrameReaction( - this->Internals->actionSavePCD, "PCDWriter", "pcd", false, false, true, true); - new lqSaveLidarFrameReaction( - this->Internals->actionSaveCSV, "DataSetCSVWriter", "csv", false, false, true, true); - new lqSaveLidarFrameReaction( - this->Internals->actionSavePLY, "PPLYWriter", "ply", false, false, true, true); + // Writer reactions (action, writerName, extension, displaySettings) + new lqSaveLidarFrameReaction(this->Internals->actionSavePCD, "PCDWriter", "pcd"); + new lqSaveLidarFrameReaction(this->Internals->actionSaveCSV, "DataSetCSVWriter", "csv"); + new lqSaveLidarFrameReaction(this->Internals->actionSavePLY, "PPLYWriter", "ply"); + new lqSavePcapReaction(this->Internals->actionSavePcap); // Check if PDAL should be used with lidarview. #if LIDARVIEW_USE_PDAL - new lqSaveLidarFrameReaction( - this->Internals->actionSaveLAS, "PLASWriter", "las", false, false, true, true); + new lqSaveLidarFrameReaction(this->Internals->actionSaveLAS, "PLASWriter", "las"); #else this->Internals->actionSaveLAS->setEnabled(false); #endif diff --git a/Application/Client/LidarViewMainWindow.ui b/Application/Client/LidarViewMainWindow.ui index 4fa39709c0eddb5e425aa2939725b367ad794a51..3d521208c40a546e9de2767eeb85590c952837c5 100644 --- a/Application/Client/LidarViewMainWindow.ui +++ b/Application/Client/LidarViewMainWindow.ui @@ -49,7 +49,7 @@ Save &As - + @@ -522,7 +522,7 @@ Grid Properties - + :/lvResources/Icons/WiresharkDoc-128.png:/lvResources/Icons/WiresharkDoc-128.png diff --git a/Application/Qt/ApplicationComponents/lqPythonQtLidarView.h b/Application/Qt/ApplicationComponents/lqPythonQtLidarView.h index e1bf288ed8ae7582b8dea024418e8ad6042bb3ca..2881d2010dbd328325508a8adffd79f75ef6d031 100644 --- a/Application/Qt/ApplicationComponents/lqPythonQtLidarView.h +++ b/Application/Qt/ApplicationComponents/lqPythonQtLidarView.h @@ -36,7 +36,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include "lqCropReturnsDialog.h" -#include "lqSelectFramesDialog.h" #include "lqLidarViewManager.h" #include "lvApplicationComponentsModule.h" @@ -53,7 +52,6 @@ public: this->registerClassForPythonQt(&lqLidarViewManager::staticMetaObject); this->registerClassForPythonQt(&lqCropReturnsDialog::staticMetaObject); - this->registerClassForPythonQt(&lqSelectFramesDialog::staticMetaObject); } inline void registerClassForPythonQt(const QMetaObject* metaobject) @@ -66,11 +64,6 @@ public Q_SLOTS: { return new lqCropReturnsDialog(arg0); } - - lqSelectFramesDialog* new_lqSelectFramesDialog(QWidget* arg0) - { - return new lqSelectFramesDialog(arg0); - } }; #endif // lqPythonQtLidarView_h diff --git a/Application/Qt/Components/CMakeLists.txt b/Application/Qt/Components/CMakeLists.txt index e318789ae0198ec2bcc69fb2489aa20a30264ab8..8c0f80af4b9254c20d19ca3b77f9e455ae461153 100644 --- a/Application/Qt/Components/CMakeLists.txt +++ b/Application/Qt/Components/CMakeLists.txt @@ -2,7 +2,6 @@ set(classes lqAboutDialog lqCalibrationDialog lqCropReturnsDialog - lqSelectFramesDialog ) set(headers @@ -13,7 +12,7 @@ set(ui_files Resources/UI/lqAboutDialog.ui Resources/UI/lqCalibrationDialog.ui Resources/UI/lqCropReturnsDialog.ui - Resources/UI/lqSelectFramesDialog.ui) +) set(resource_files Resources/lvComponents.qrc diff --git a/Application/Qt/Components/Resources/UI/lqSelectFramesDialog.ui b/Application/Qt/Components/Resources/UI/lqSelectFramesDialog.ui deleted file mode 100644 index 1f0399bbcf9e3cc60f7da81fa9dc27632f1b078c..0000000000000000000000000000000000000000 --- a/Application/Qt/Components/Resources/UI/lqSelectFramesDialog.ui +++ /dev/null @@ -1,261 +0,0 @@ - - - lqSelectFramesDialog - - - - 0 - 0 - 267 - 407 - - - - Select Frames - - - - - - Frame Selection - - - - - - Current frame - - - true - - - - - - - All frames - - - - - - - 0 - - - 0 - - - - - Frames from - - - - - - - Qt::WheelFocus - - - 100 - - - 0 - - - - - - - to - - - - - - - Qt::WheelFocus - - - 100 - - - 10 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - 0 - - - - - Qt::Horizontal - - - - - - - Frame Stride: - - - - - - - 1 - - - 999 - - - - - - - - - - - - - Archive Mode - - - - - - Single file - - - true - - - - - - - File per frame - - - - - - - - - - Coordinate System - - - - - - Write position information relative to the sensor - - - Sensor - - - - - - - Write position information transformed for platform orientation and relative position - - - Relative geoposition - - - - - - - Write position information as absolute geoposition in UTM coordinates - - - Absolute geoposition (UTM) - - - - - - - Write position information as absolute geoposition in Lat/Lon - - - Absolute geoposition (Lat/Lon) - - - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - buttonBox - accepted() - lqSelectFramesDialog - accept() - - - 252 - 223 - - - 157 - 274 - - - - - buttonBox - rejected() - lqSelectFramesDialog - reject() - - - 319 - 223 - - - 286 - 274 - - - - - diff --git a/Application/Qt/Components/lqSelectFramesDialog.cxx b/Application/Qt/Components/lqSelectFramesDialog.cxx deleted file mode 100644 index 2771c933f9dd679b7348a4b788b8439432845019..0000000000000000000000000000000000000000 --- a/Application/Qt/Components/lqSelectFramesDialog.cxx +++ /dev/null @@ -1,295 +0,0 @@ -// Copyright 2013 Velodyne Acoustics, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -#include "lqSelectFramesDialog.h" - -#include "ui_lqSelectFramesDialog.h" - -#include -#include - -#include - -//----------------------------------------------------------------------------- -class lqSelectFramesDialog::pqInternal : public Ui::lqSelectFramesDialog -{ -}; - -//----------------------------------------------------------------------------- -lqSelectFramesDialog::lqSelectFramesDialog(QWidget* p) - : QDialog(p) -{ - this->Internal = new pqInternal; - this->Internal->setupUi(this); - this->Internal->FrameStart->clearFocus(); -} - -//----------------------------------------------------------------------------- -lqSelectFramesDialog::~lqSelectFramesDialog() -{ - delete this->Internal; -} - -//----------------------------------------------------------------------------- -void lqSelectFramesDialog::accept() -{ - if (this->Internal->FrameStop->value() < this->Internal->FrameStart->value()) - { - QMessageBox::critical(this, - "Invalid frame range", - "The requested frame range is not valid. " - "The start frame must be less than or equal to the stop frame."); - return; - } - - this->saveState(); - QDialog::accept(); -} - -//----------------------------------------------------------------------------- -int lqSelectFramesDialog::frameMode() const -{ - if (this->Internal->CurrentFrameButton->isChecked()) - { - return CURRENT_FRAME; - } - else if (this->Internal->AllFramesButton->isChecked()) - { - return ALL_FRAMES; - } - else - { - return FRAME_RANGE; - } -} - -//----------------------------------------------------------------------------- -void lqSelectFramesDialog::setFrameMode(int frameMode) -{ - if (frameMode == CURRENT_FRAME) - { - this->Internal->CurrentFrameButton->setChecked(true); - } - else if (frameMode == ALL_FRAMES) - { - this->Internal->AllFramesButton->setChecked(true); - } - else if (frameMode == FRAME_RANGE) - { - this->Internal->FrameRangeButton->setChecked(true); - } -} - -//----------------------------------------------------------------------------- -int lqSelectFramesDialog::frameStart() const -{ - return this->Internal->FrameStart->value(); -} - -//----------------------------------------------------------------------------- -int lqSelectFramesDialog::frameStop() const -{ - return this->Internal->FrameStop->value(); -} - -//----------------------------------------------------------------------------- -int lqSelectFramesDialog::frameStride() const -{ - return this->Internal->FrameStride->value(); -} - -//----------------------------------------------------------------------------- -void lqSelectFramesDialog::setFrameStart(int frameStart) -{ - this->Internal->FrameStart->setValue(frameStart); -} - -//----------------------------------------------------------------------------- -void lqSelectFramesDialog::setFrameStop(int frameStop) -{ - this->Internal->FrameStop->setValue(frameStop); -} - -//----------------------------------------------------------------------------- -void lqSelectFramesDialog::setFrameStride(int frameStride) -{ - this->Internal->FrameStride->setValue(frameStride); -} - -//----------------------------------------------------------------------------- -int lqSelectFramesDialog::framePack() const -{ - if (this->Internal->FilePerFrameButton->isChecked()) - { - return FILE_PER_FRAME; - } - else - { - return SINGLE_FILE; - } -} - -//----------------------------------------------------------------------------- -void lqSelectFramesDialog::setFramePack(int framePack) -{ - if (framePack == SINGLE_FILE) - { - this->Internal->SingleFileButton->setChecked(true); - } - else if (framePack == FILE_PER_FRAME) - { - this->Internal->FilePerFrameButton->setChecked(true); - } -} - -//----------------------------------------------------------------------------- -int lqSelectFramesDialog::frameTransform() const -{ - if (this->Internal->RelativeButton->isChecked()) - { - return RELATIVE_GEOPOSITION; - } - else if (this->Internal->AbsoluteUtmButton->isChecked()) - { - return ABSOLUTE_GEOPOSITION_UTM; - } - else if (this->Internal->AbsoluteLatLonButton->isChecked()) - { - return ABSOLUTE_GEOPOSITION_LATLON; - } - else - { - return SENSOR; - } -} - -//----------------------------------------------------------------------------- -int lqSelectFramesDialog::frameMaximun() const -{ - return std::max(this->Internal->FrameStart->maximum(), this->Internal->FrameStop->maximum()); -} - -//----------------------------------------------------------------------------- -int lqSelectFramesDialog::frameMinimun() const -{ - return std::max(this->Internal->FrameStart->minimum(), this->Internal->FrameStop->minimum()); - ; -} - -//----------------------------------------------------------------------------- -bool lqSelectFramesDialog::frameStrideVisibility() const -{ - return this->Internal->FrameStrideContainer->isVisible(); - ; -} - -//----------------------------------------------------------------------------- -bool lqSelectFramesDialog::framePackVisibility() const -{ - return this->Internal->FramePackContainer->isVisible(); - ; -} - -//----------------------------------------------------------------------------- -bool lqSelectFramesDialog::frameTransformVisibility() const -{ - return this->Internal->FrameTransformContainer->isVisible(); - ; -} - -//----------------------------------------------------------------------------- -void lqSelectFramesDialog::setFrameTransform(int frameTransform) -{ - if (frameTransform == SENSOR) - { - this->Internal->SensorButton->setChecked(true); - } - else if (frameTransform == RELATIVE_GEOPOSITION) - { - this->Internal->RelativeButton->setChecked(true); - } - else if (frameTransform == ABSOLUTE_GEOPOSITION_UTM) - { - this->Internal->AbsoluteUtmButton->setChecked(true); - } - else if (frameTransform == ABSOLUTE_GEOPOSITION_LATLON) - { - this->Internal->AbsoluteLatLonButton->setChecked(true); - } -} - -//----------------------------------------------------------------------------- -void lqSelectFramesDialog::setFrameMinimum(int frameMin) -{ - this->Internal->FrameStart->setMinimum(frameMin); - this->Internal->FrameStop->setMinimum(frameMin); -} - -//----------------------------------------------------------------------------- -void lqSelectFramesDialog::setFrameMaximum(int frameMax) -{ - this->Internal->FrameStart->setMaximum(frameMax); - this->Internal->FrameStop->setMaximum(frameMax); -} - -//----------------------------------------------------------------------------- -void lqSelectFramesDialog::setFrameStrideVisibility(bool visible) -{ - this->Internal->FrameStrideContainer->setVisible(visible); -} - -//----------------------------------------------------------------------------- -void lqSelectFramesDialog::setFramePackVisibility(bool visible) -{ - this->Internal->FramePackContainer->setVisible(visible); -} - -//----------------------------------------------------------------------------- -void lqSelectFramesDialog::setFrameTransformVisibility(bool visible) -{ - this->Internal->FrameTransformContainer->setVisible(visible); -} - -//----------------------------------------------------------------------------- -void lqSelectFramesDialog::showEvent(QShowEvent* e) -{ - QDialog::showEvent(e); - this->resize(this->width(), this->minimumSizeHint().height()); -} - -//----------------------------------------------------------------------------- -void lqSelectFramesDialog::saveState() -{ - pqSettings* settings = pqApplicationCore::instance()->settings(); - settings->setValue("LidarPlugin/SelectFramesDialog/Mode", this->frameMode()); - settings->setValue("LidarPlugin/SelectFramesDialog/Start", this->frameStart()); - settings->setValue("LidarPlugin/SelectFramesDialog/Stop", this->frameStop()); - settings->setValue("LidarPlugin/SelectFramesDialog/Stride", this->frameStride()); - settings->setValue("LidarPlugin/SelectFramesDialog/Pack", this->framePack()); - settings->setValue("LidarPlugin/SelectFramesDialog/Transform", this->frameTransform()); - settings->setValue("LidarPlugin/SelectFramesDialog/Geometry", this->saveGeometry()); -} - -//----------------------------------------------------------------------------- -void lqSelectFramesDialog::restoreState() -{ - pqSettings* settings = pqApplicationCore::instance()->settings(); - this->restoreGeometry(settings->value("LidarPlugin/SelectFramesDialog/Geometry").toByteArray()); - this->setFrameMode(settings->value("LidarPlugin/SelectFramesDialog/Mode", CURRENT_FRAME).toInt()); - this->setFrameStart(settings->value("LidarPlugin/SelectFramesDialog/Start", 0).toInt()); - this->setFrameStop(settings->value("LidarPlugin/SelectFramesDialog/Stop", 10).toInt()); - this->setFrameStride(settings->value("LidarPlugin/SelectFramesDialog/Stride", 1).toInt()); - this->setFramePack(settings->value("LidarPlugin/SelectFramesDialog/Pack", SINGLE_FILE).toInt()); - this->setFrameTransform( - settings->value("LidarPlugin/SelectFramesDialog/Transform", SENSOR).toInt()); -} diff --git a/Application/Qt/Components/lqSelectFramesDialog.h b/Application/Qt/Components/lqSelectFramesDialog.h deleted file mode 100644 index c3aab3fcc8892bcd3683ee2979c55fd8e37874d8..0000000000000000000000000000000000000000 --- a/Application/Qt/Components/lqSelectFramesDialog.h +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright 2013 Velodyne Acoustics, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -#ifndef lqSelectFramesDialog_h -#define lqSelectFramesDialog_h - -#include "lvComponentsModule.h" - -#include - -class LVCOMPONENTS_EXPORT lqSelectFramesDialog : public QDialog -{ - Q_OBJECT - Q_PROPERTY(int frameMode READ frameMode WRITE setFrameMode) - Q_PROPERTY(int frameStart READ frameStart WRITE setFrameStart) - Q_PROPERTY(int frameStop READ frameStop WRITE setFrameStop) - Q_PROPERTY(int frameStride READ frameStride WRITE setFrameStride) - Q_PROPERTY(int framePack READ framePack WRITE setFramePack) - Q_PROPERTY(int frameMinimum READ frameMinimun WRITE setFrameMinimum) - Q_PROPERTY(int frameMaximum READ frameMaximun WRITE setFrameMaximum) - Q_PROPERTY(int frameTransform READ frameTransform WRITE setFrameTransform) - Q_PROPERTY(bool frameStrideVisibility READ frameStrideVisibility WRITE setFrameStrideVisibility) - Q_PROPERTY(bool framePackVisibility READ framePackVisibility WRITE setFramePackVisibility) - Q_PROPERTY( - bool frameTransformVisibility READ frameTransformVisibility WRITE setFrameTransformVisibility) - Q_ENUMS(FrameMode FramePack FrameTransform) - -public: - lqSelectFramesDialog(QWidget* p = 0); - virtual ~lqSelectFramesDialog(); - - enum FrameMode - { - CURRENT_FRAME = 0, - ALL_FRAMES, - FRAME_RANGE - }; - enum FramePack - { - SINGLE_FILE = 0, - FILE_PER_FRAME - }; - enum FrameTransform - { - SENSOR = 0, - RELATIVE_GEOPOSITION, - ABSOLUTE_GEOPOSITION_UTM, - ABSOLUTE_GEOPOSITION_LATLON, - }; - - int frameMode() const; - int frameStart() const; - int frameStop() const; - int frameStride() const; - int framePack() const; - int frameTransform() const; - - int frameMaximun() const; - int frameMinimun() const; - - bool frameStrideVisibility() const; - bool framePackVisibility() const; - bool frameTransformVisibility() const; - -public Q_SLOTS: - virtual void accept() override; - - void setFrameMode(int frameMode); - void setFrameStart(int frameStart); - void setFrameStop(int frameStop); - void setFrameStride(int frameStride); - void setFramePack(int framePack); - void setFrameTransform(int frameTransform); - - void setFrameMinimum(int frameMin); - void setFrameMaximum(int frameMax); - - void setFrameStrideVisibility(bool visible); - void setFramePackVisibility(bool visible); - void setFrameTransformVisibility(bool visible); - - void saveState(); - void restoreState(); - -protected: - virtual void showEvent(QShowEvent*) override; - -private: - class pqInternal; - pqInternal* Internal; - - Q_DISABLE_COPY(lqSelectFramesDialog) -}; - -#endif diff --git a/Application/Wrapping/Python/applogic.py b/Application/Wrapping/Python/applogic.py index df92660bd050bc54681370856bd84b4bcc8c0ec8..1c9386cc0545737f98be044e2ced9733d447833e 100644 --- a/Application/Wrapping/Python/applogic.py +++ b/Application/Wrapping/Python/applogic.py @@ -25,7 +25,7 @@ import lidarview.gridAdjustmentDialog import lidarview.planefit as planefit import lidarview.simple as lvsmp -from PythonQt.paraview import lqCropReturnsDialog, lqSelectFramesDialog +from PythonQt.paraview import lqCropReturnsDialog # import the vtk wrapping of the Lidar Plugin # this enable to get the specific vtkObject behind a proxy via GetClientSideObject() @@ -67,28 +67,6 @@ def hasArrayName(sourceProxy, arrayName): def planeFit(): planefit.fitPlane(app.actions['actionSpreadsheet']) -def getDefaultSaveFileName(extension, suffix='', frameId=None, baseName="Frame"): - - sensor = getSensor() - reader = getReader() - - # Use current datetime and Interpreter DefaultRecordFileName - if sensor and sensor.Interpreter: - sensor.Interpreter.UpdatePipelineInformation() - return '%s.%s' % (sensor.Interpreter.GetProperty("DefaultRecordFileName")[0], extension) - - # Use PCAP Basename - if reader: - filename = reader.FileName - filename = filename[0] if isinstance(filename, paraview.servermanager.FileNameProperty) else filename # WIP FIX ? - basename = os.path.splitext(os.path.basename(filename))[0] - if frameId is not None: - suffix = '%s(%s%04d)' % (suffix, baseName, frameId) - return '%s%s.%s' % (basename, suffix, extension) - - else: - return "filename" - # Main API def UpdateApplogicCommon(lidar): # WIP ACTUALLY THINK ABOUT always enabled ok, just apply settings on current lidar actually needed @@ -135,121 +113,6 @@ def UpdateApplogicReader(lidarName, posOrName): # WIP could explicit send Proxy smp.SetActiveView(smp.GetActiveView()) -def getSaveFileName(title, extension, defaultFileName=None): - - settings = getPVSettings() - defaultDir = settings.value('LidarPlugin/OpenData/DefaultDir', PythonQt.QtCore.QDir.homePath()) - defaultFileName = defaultDir if not defaultFileName else os.path.join(defaultDir, defaultFileName) - - filters = '%s (*.%s)' % (extension, extension) - selectedFilter = '%s (*.%s)' % (extension, extension) - fileName = QtGui.QFileDialog.getSaveFileName(getMainWindow(), title, - defaultFileName, filters, selectedFilter, 0) - - if fileName: - settings.setValue('LidarPlugin/OpenData/DefaultDir', PythonQt.QtCore.QFileInfo(fileName).absoluteDir().absolutePath()) - return fileName - -# Action related Logic -def getFrameSelectionFromUser(frameStrideVisibility=False, framePackVisibility=False, frameTransformVisibility=False): - class FrameOptions(object): - pass - - dialog = PythonQt.paraview.lqSelectFramesDialog(getMainWindow()) - dialog.frameMinimum = 0 - if getReader() is None: - dialog.frameMaximum = 0 - elif getReader().GetClientSideObject().GetShowFirstAndLastFrame(): - dialog.frameMaximum = getReader().GetClientSideObject().GetNumberOfFrames() - 1 - else: - dialog.frameMaximum = getReader().GetClientSideObject().GetNumberOfFrames() - 3 - dialog.frameStrideVisibility = frameStrideVisibility - dialog.framePackVisibility = framePackVisibility - dialog.frameTransformVisibility = frameTransformVisibility - dialog.restoreState() - - if not dialog.exec_(): - return None - - frameOptions = FrameOptions() - frameOptions.mode = dialog.frameMode - frameOptions.start = dialog.frameStart - frameOptions.stop = dialog.frameStop - frameOptions.stride = dialog.frameStride - frameOptions.pack = dialog.framePack - frameOptions.transform = dialog.frameTransform - - dialog.setParent(None) - - return frameOptions - -def onSavePCAP(): - # It is not possible to save as PCAP during stream as we need frame numbers - if getSensor(): - QtGui.QMessageBox.information(getMainWindow(), - 'Save As PCAP not available during stream', - 'Saving as PCAP is not possible during lidar stream mode. ' - 'Please use the "Record" tool, and open the resulting pcap offline to process it.') - return - - frameOptions = getFrameSelectionFromUser(frameTransformVisibility=False) - if frameOptions is None: - return - - if frameOptions.mode == lqSelectFramesDialog.CURRENT_FRAME: - frameOptions.start = getFrameFromAnimationTime(getAnimationScene().AnimationTime) - frameOptions.stop = frameOptions.start - defaultFileName = getDefaultSaveFileName('pcap', frameId=frameOptions.start) - elif frameOptions.mode == lqSelectFramesDialog.ALL_FRAMES: - frameOptions.start = 0 - frameOptions.stop = 0 if getReader() is None else getReader().GetClientSideObject().GetNumberOfFrames() - 1 - defaultFileName = getDefaultSaveFileName('pcap') - else: - defaultFileName = getDefaultSaveFileName('pcap', suffix=' (Frame %d to %d)' % (frameOptions.start, frameOptions.stop)) - - fileName = getSaveFileName('Save PCAP', 'pcap', defaultFileName) - if not fileName: - return - PythonQt.paraview.lqLidarViewManager.saveFramesToPCAP(getReader().SMProxy, frameOptions.start, frameOptions.stop, fileName) - -def getFrameFromAnimationTime(time): - if not getReader(): - return -1 - - index = bisect.bisect_right(getAnimationScene().TimeKeeper.TimestepValues, time) - if index > 0: - previousTime = getAnimationScene().TimeKeeper.TimestepValues[index - 1] - nextTime = getAnimationScene().TimeKeeper.TimestepValues[index] - index = index - 1 if (abs(previousTime - time) < abs(nextTime - time)) else index - return index - -def exportToDirectory(outDir, timesteps): - - filenames = [] - - alg = smp.GetActiveSource().GetClientSideObject() - - writer = vtk.vtkXMLPolyDataWriter() - writer.SetDataModeToAppended() - writer.EncodeAppendedDataOff() - writer.SetCompressorTypeToZLib() - - for t in timesteps: - - filename = 'frame_%04d.vtp' % t - filenames.append(filename) - - getAnimationScene().AnimationTime = t - polyData = vtk.vtkPolyData() - polyData.ShallowCopy(alg.GetOutput()) - - writer.SetInputData(polyData) - writer.SetFileName(os.path.join(outDir, filename)) - writer.Update() - - return filenames - - def onClose(): # Pause smp.GetAnimationScene().Stop() @@ -267,7 +130,7 @@ def onClose(): # Generic Helpers def _setSaveActionsEnabled(enabled): - for action in ('SavePCAP', 'Close', 'CropReturns'): + for action in ('Close', 'CropReturns'): app.actions['action'+action].setEnabled(enabled) getMainWindow().findChild('QMenu', 'menuSaveAs').enabled = enabled @@ -568,7 +431,6 @@ def setupActions(): app.actions['actionAdvanceFeature'].connect('triggered()', onToogleAdvancedGUI) app.actions['actionPlaneFit'].connect('triggered()', planeFit) app.actions['actionClose'].connect('triggered()', onClose) - app.actions['actionSavePCAP'].connect('triggered()', onSavePCAP) app.actions['actionGrid_Properties'].connect('triggered()', onGridProperties) app.actions['actionCropReturns'].connect('triggered()', onCropReturns) app.actions['actionShowPosition'].connect('triggered()', ShowPosition) diff --git a/LVCore b/LVCore index 458d8fc5beb29a81fd0fc0593d40329715e65c83..399d6f79edbbf88309056a0f1652080d93f0788d 160000 --- a/LVCore +++ b/LVCore @@ -1 +1 @@ -Subproject commit 458d8fc5beb29a81fd0fc0593d40329715e65c83 +Subproject commit 399d6f79edbbf88309056a0f1652080d93f0788d