Commit ce89a8ee authored by Andrew Bauer's avatar Andrew Bauer

Adding option to output text files as tab-delimited

This works for both exporting a spreadsheet view through the view's
Export Spreadsheet option as well as through the File->Save Data
option. Also made vtkCinemaExporter only built/available when
PARAVIEW_ENABLE_PYTHON is on.

Fixes #17734
parent 40689f71
......@@ -308,6 +308,7 @@ list(APPEND TESTS_WITH_BASELINES
${CMAKE_CURRENT_SOURCE_DIR}/EnSightTensorInversionBin.xml
${CMAKE_CURRENT_SOURCE_DIR}/ExodusXML.xml
${CMAKE_CURRENT_SOURCE_DIR}/ExportLinePlotToCSV.xml
${CMAKE_CURRENT_SOURCE_DIR}/ExportLinePlotToTSV.xml
${CMAKE_CURRENT_SOURCE_DIR}/ExportSceneSpreadSheetView2.xml
${CMAKE_CURRENT_SOURCE_DIR}/ExportX3dPOVVRML.xml
${CMAKE_CURRENT_SOURCE_DIR}/ExTimeseries.xml
......@@ -378,6 +379,8 @@ list(APPEND TESTS_WITH_BASELINES
# ${CMAKE_CURRENT_SOURCE_DIR}/SaveAnimationGeometry.xml
${CMAKE_CURRENT_SOURCE_DIR}/SaveColorMap.xml
${CMAKE_CURRENT_SOURCE_DIR}/SaveCSV.xml
${CMAKE_CURRENT_SOURCE_DIR}/SaveTSV.xml
${CMAKE_CURRENT_SOURCE_DIR}/SaveTXT.xml
${CMAKE_CURRENT_SOURCE_DIR}/SelectedProxyPanelVisibility.xml
${CMAKE_CURRENT_SOURCE_DIR}/SelectionModifiersCells.xml
${CMAKE_CURRENT_SOURCE_DIR}/SelectionModifiersPoints.xml
......@@ -742,9 +745,11 @@ SET (ColorEditorVolumeControls_THRESHOLD 300)
set (SpreadSheet2_THRESHOLD 50)
set (PlotOverTimeAutoApply_THRESHOLD 50)
set (ExportLinePlotToCSV_THRESHOLD 30)
set (ExportLinePlotToTSV_THRESHOLD 30)
set (PlotOverTimeAutoApply_DISABLE_CRS TRUE) # since this uses surface selection.
set (QuartilePlot_THRESHOLD 20)
# The ExportLinePlotToTSV test uses the same image baseline as the ExportLinePlotToCSV test
set (ExportLinePlotToTSV_BASELINE ExportLinePlotToCSV.png)
# DisconnectAndSaveAnimation is only support in Client-Server mode.
set (DisconnectAndSaveAnimation_DISABLE_C TRUE)
......@@ -830,6 +835,11 @@ SET (XdmfReadImageDataCollection_THRESHOLD 20)
# This test renders points and they are offsetted a bit differently on
# different platforms so just increase the threshold
SET (SaveCSV_THRESHOLD 40)
SET (SaveTSV_THRESHOLD 40)
SET (SaveTXT_THRESHOLD 40)
# The SaveTXT and SaveTSV tests use the same image baseline as the SaveCSV test
SET (SaveTSV_BASELINE SaveCSV.png)
SET (SaveTXT_BASELINE SaveCSV.png)
# Disable some testing configurations for these tests.
......
......@@ -22,4 +22,15 @@
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqcheck object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/CentralWidgetFrame/Viewport/1pqSpreadSheetViewWidget0" property="modelItemData" arguments="13.1,99.3058" />
<pqcheck object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/CentralWidgetFrame/Viewport/1pqSpreadSheetViewWidget0" property="modelItemData" arguments="13.0,13" />
<!-- now try doing the same thing but in a tsv file -->
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/CentralWidgetFrame/Viewport/pqSpreadSheetViewDecorator/actionExport" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/FileExportDialog" command="filesSelected" arguments="$PARAVIEW_DATA_ROOT/dummy.tsv" />
<pqevent object="pqClientMainWindow/1QDialog0/1pqProxyWidget0/FilterColumnsByVisibility/CheckBox" command="set_boolean" arguments="true" />
<pqevent object="pqClientMainWindow/1QDialog0/1QDialogButtonBox0/1QPushButton0" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Delete" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/MainControlsToolbar/actionOpenData" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/FileOpenDialog" command="filesSelected" arguments="$PARAVIEW_DATA_ROOT/dummy.tsv" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqcheck object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/CentralWidgetFrame/Viewport/1pqSpreadSheetViewWidget0" property="modelItemData" arguments="13.1,99.3058" />
<pqcheck object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/CentralWidgetFrame/Viewport/1pqSpreadSheetViewWidget0" property="modelItemData" arguments="13.0,13" />
</pqevents>
<?xml version="1.0" ?>
<pqevents>
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menuSources" />
<pqevent object="pqClientMainWindow/menubar/menuSources" command="activate" arguments="RTAnalyticSource" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menuFilters" />
<pqevent object="pqClientMainWindow/menubar/menuFilters/DataAnalysis" command="activate" arguments="ProbeLine" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<!-- let's just confirm that the "Plot Over Line" data was shown in the render
view as well before we proceed -->
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Splitter.0/Frame.1/TitleBar/ToolBar" command="mousePress" arguments="1,1,0,203,12" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Splitter.0/Frame.1/TitleBar/ToolBar" command="mouseRelease" arguments="1,0,0,203,12" />
<pqevent object="pqClientMainWindow/pipelineBrowserDock/pipelineBrowser" command="mousePress" arguments="1,1,0,79,12,/0:0/0:0/0:0" />
<pqevent object="pqClientMainWindow/pipelineBrowserDock/pipelineBrowser" command="mouseRelease" arguments="1,0,0,79,12,/0:0/0:0/0:0" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/SearchBox/SearchLineEdit" command="set_string" arguments="line" />
<!-- below will fail if plot over line was not shown in the render view -->
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/DisplayFrame/ProxyPanel/LineWidth/LineEdit0" command="set_string" arguments="5" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/SearchBox/SearchLineEdit" command="key" arguments="16777216" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Splitter.0/Frame.2/TitleBar/TitleLabel" command="mousePress" arguments="1,1,0,47,10" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Splitter.0/Frame.2/TitleBar/TitleLabel" command="mouseRelease" arguments="1,0,0,59,10" />
<!-- let's go back to the test -->
<pqevent object="pqClientMainWindow/pipelineBrowserDock/pipelineBrowser" command="mousePress" arguments="1,1,0,24,3,/0:0/0:0" />
<pqevent object="pqClientMainWindow/pipelineBrowserDock/pipelineBrowser" command="mouseRelease" arguments="1,0,0,24,3,/0:0/0:0" />
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menuFilters" />
<pqevent object="pqClientMainWindow/menubar/menuFilters/Recent" command="activate" arguments="ProbeLine" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/Source/ProxySelectionWidget/frame/ChosenProxyWidget/InteractiveLine/yAxis" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_vcontainer/1QScrollBar0" command="mousePress" arguments="1,1,0,9,56" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_vcontainer/1QScrollBar0" command="mouseMove" arguments="1,0,0,8,93" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_vcontainer/1QScrollBar0" command="mouseRelease" arguments="1,0,0,8,93" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/Source/ProxySelectionWidget/frame/ChosenProxyWidget/Resolution/LineEdit0" command="set_string" arguments="13" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/DisplayFrame/ProxyPanel/SeriesEditor/SeriesTable" command="setCurrent" arguments="1.2" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/DisplayFrame/ProxyPanel/SeriesEditor/SeriesTable" command="edit" arguments="1.2" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/DisplayFrame/ProxyPanel/SeriesEditor/SeriesTable/qt_scrollarea_viewport/1QExpandingLineEdit0" command="set_string" arguments="RTData2" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/DisplayFrame/ProxyPanel/SeriesEditor/SeriesTable" command="editAccepted" arguments="1.2,RTData2" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/DisplayFrame/ProxyPanel/UseIndexForXAxis/CheckBox" command="set_boolean" arguments="true" />
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menu_File" />
<pqevent object="pqClientMainWindow/menubar/menu_File" command="activate" arguments="actionExport" />
<pqevent object="pqClientMainWindow/FileExportDialog" command="filesSelected" arguments="$PARAVIEW_TEST_ROOT/data.tsv" />
<pqevent object="pqClientMainWindow/1QDialog0/1pqProxyWidget0/FilterColumnsByVisibility/CheckBox" command="set_boolean" arguments="false" />
<pqevent object="pqClientMainWindow/1QDialog0/1QDialogButtonBox0/1QPushButton0" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menu_File" />
<pqevent object="pqClientMainWindow/menubar/menu_File" command="activate" arguments="actionFileOpen" />
<pqevent object="pqClientMainWindow/FileOpenDialog" command="filesSelected" arguments="$PARAVIEW_TEST_ROOT/data.tsv" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Splitter.0/Splitter.2/Frame.6/TitleBar/Close" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Splitter.0/Frame.2/TitleBar/Close" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/TitleBar/Close" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/CentralWidgetFrame/EmptyView/scrollArea/qt_scrollarea_viewport/widgetFoo/ConvertActionsFrame/XYChartView" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/pipelineBrowserDock/pipelineBrowser" command="mousePress" arguments="1,1,0,17,13,/0:0/1:1" />
<pqevent object="pqClientMainWindow/pipelineBrowserDock/pipelineBrowser" command="mouseRelease" arguments="1,0,0,17,13,/0:0/1:1" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/DisplayFrame/ProxyPanel/SeriesEditor/SeriesTable" command="setCheckState" arguments="0.0,0" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/DisplayFrame/ProxyPanel/UseIndexForXAxis/CheckBox" command="set_boolean" arguments="false" />
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menuTools" />
<pqevent object="pqClientMainWindow/menubar/menuTools" command="activate" arguments="actionTesting_Window_Size" />
<pqevent object="pqClientMainWindow/cameraToolbar/actionResetCamera" command="activate" arguments="" />
</pqevents>
<?xml version="1.0" ?>
<pqevents>
<pqevent object="pqClientMainWindow/MainControlsToolbar/actionOpenData" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/FileOpenDialog" command="filesSelected" arguments="$PARAVIEW_DATA_ROOT/can.ex2" />
<pqevent object="pqClientMainWindow/VCRToolbar/actionVCRFirstFrame" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/ArrayStatus/SelectionWidget/1QHeaderView0" command="mousePress" arguments="1,1,0,0,0,0" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/ArrayStatus/SelectionWidget/1QHeaderView0" command="mouseRelease" arguments="1,0,0,0,0,0" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/cameraToolbar/actionNegativeY" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/menubar/menu_File" command="activate" arguments="actionFileSaveData" />
<pqevent object="pqClientMainWindow/FileSaveDialog" command="remove" arguments="$PARAVIEW_TEST_ROOT/SaveTXT0.txt" />
<pqevent object="pqClientMainWindow/FileSaveDialog" command="filesSelected" arguments="$PARAVIEW_TEST_ROOT/SaveTXT.txt" />
<pqevent object="pqClientMainWindow/WriterSettingsDialog/widget/OKButton" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/MainControlsToolbar/actionOpenData" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/FileOpenDialog" command="filesSelected" arguments="$PARAVIEW_TEST_ROOT/SaveTXT0.txt" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Splitter.0/Frame.2/Close" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/menubar/menuFilters/Alphabetical" command="activate" arguments="TableToPolyData" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/XColumn/ComboBox" command="set_string" arguments="Points:0" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/YColumn/ComboBox" command="set_string" arguments="Points:1" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/ZColumn/ComboBox" command="set_string" arguments="Points:2" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/pipelineBrowserDock/pipelineBrowser" command="mousePress" arguments="1,1,0,9,13,/0:0/0:1" />
<pqevent object="pqClientMainWindow/pipelineBrowserDock/pipelineBrowser" command="mouseRelease" arguments="1,0,0,9,13,/0:0/0:1" />
<pqevent object="pqClientMainWindow/representationToolbar/displayRepresentation/comboBox" command="set_string" arguments="Points" />
<pqevent object="pqClientMainWindow/cameraToolbar/actionResetCamera" command="activate" arguments="" />
</pqevents>
<?xml version="1.0" ?>
<pqevents>
<pqevent object="pqClientMainWindow/MainControlsToolbar/actionOpenData" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/FileOpenDialog" command="filesSelected" arguments="$PARAVIEW_DATA_ROOT/can.ex2" />
<pqevent object="pqClientMainWindow/VCRToolbar/actionVCRFirstFrame" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/ArrayStatus/SelectionWidget/1QHeaderView0" command="mousePress" arguments="1,1,0,0,0,0" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/ArrayStatus/SelectionWidget/1QHeaderView0" command="mouseRelease" arguments="1,0,0,0,0,0" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/cameraToolbar/actionNegativeY" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/menubar/menu_File" command="activate" arguments="actionFileSaveData" />
<pqevent object="pqClientMainWindow/FileSaveDialog" command="remove" arguments="$PARAVIEW_TEST_ROOT/SaveTXT0.txt" />
<pqevent object="pqClientMainWindow/FileSaveDialog" command="filesSelected" arguments="$PARAVIEW_TEST_ROOT/SaveTXT.txt" />
<pqevent object="pqClientMainWindow/WriterSettingsDialog/widget/OKButton" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/MainControlsToolbar/actionOpenData" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/FileOpenDialog" command="filesSelected" arguments="$PARAVIEW_TEST_ROOT/SaveTXT0.txt" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Splitter.0/Frame.2/Close" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/menubar/menuFilters/Alphabetical" command="activate" arguments="TableToPolyData" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/XColumn/ComboBox" command="set_string" arguments="Points:0" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/YColumn/ComboBox" command="set_string" arguments="Points:1" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/ZColumn/ComboBox" command="set_string" arguments="Points:2" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/pipelineBrowserDock/pipelineBrowser" command="mousePress" arguments="1,1,0,9,13,/0:0/0:1" />
<pqevent object="pqClientMainWindow/pipelineBrowserDock/pipelineBrowser" command="mouseRelease" arguments="1,0,0,9,13,/0:0/0:1" />
<pqevent object="pqClientMainWindow/representationToolbar/displayRepresentation/comboBox" command="set_string" arguments="Points" />
<pqevent object="pqClientMainWindow/cameraToolbar/actionResetCamera" command="activate" arguments="" />
</pqevents>
......@@ -36,6 +36,7 @@ set (Module_SRCS
vtkSMCameraConfigurationReader.cxx
vtkSMCameraConfigurationWriter.cxx
vtkSMCSVExporterProxy.cxx
vtkSMCSVProxiesInitializationHelper.cxx
vtkSMDirectoryProxy.cxx
vtkSMEnsembleDataReaderProxy.cxx
vtkSMExporterProxy.cxx
......
......@@ -17,9 +17,13 @@
#include "vtkCSVExporter.h"
#include "vtkObjectFactory.h"
#include "vtkPVXYChartView.h"
#include "vtkSMPropertyHelper.h"
#include "vtkSMViewProxy.h"
#include "vtkSpreadSheetView.h"
#include <string>
#include <vtksys/SystemTools.hxx>
vtkStandardNewMacro(vtkSMCSVExporterProxy);
//----------------------------------------------------------------------------
vtkSMCSVExporterProxy::vtkSMCSVExporterProxy()
......@@ -56,6 +60,16 @@ void vtkSMCSVExporterProxy::Write()
vtkErrorMacro("No vtkCSVExporter.");
return;
}
std::string fileName = vtkSMPropertyHelper(this, "FileName").GetAsString();
if (fileName.empty())
{
return;
}
if (vtksys::SystemTools::GetFilenameLastExtension(fileName) != ".tsv")
{
exporter->SetFieldDelimiter("\t");
}
vtkObjectBase* obj = this->View->GetClientSideObject();
if (vtkSpreadSheetView* sview = vtkSpreadSheetView::SafeDownCast(obj))
{
......
/*=========================================================================
Program: ParaView
Module: vtkSMCSVProxiesInitializationHelper.cxx
Copyright (c) Kitware, Inc.
All rights reserved.
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#include "vtkSMCSVProxiesInitializationHelper.h"
#include "vtkObjectFactory.h"
#include "vtkSMProperty.h"
#include "vtkSMPropertyHelper.h"
#include "vtkSMProxy.h"
#include <cassert>
#include <vtksys/SystemTools.hxx>
vtkStandardNewMacro(vtkSMCSVProxiesInitializationHelper);
//----------------------------------------------------------------------------
vtkSMCSVProxiesInitializationHelper::vtkSMCSVProxiesInitializationHelper()
{
}
//----------------------------------------------------------------------------
vtkSMCSVProxiesInitializationHelper::~vtkSMCSVProxiesInitializationHelper()
{
}
//----------------------------------------------------------------------------
void vtkSMCSVProxiesInitializationHelper::PostInitializeProxy(
vtkSMProxy* proxy, vtkPVXMLElement*, vtkMTimeType)
{
std::string fileName = vtkSMPropertyHelper(proxy, "FileName").GetAsString();
if (vtksys::SystemTools::GetFilenameLastExtension(fileName) != ".tsv")
{
if (proxy->IsA("vtkSMWriterProxy"))
{ // exporter
vtkSMPropertyHelper(proxy, "FieldDelimiter").Set("\t");
}
else
{ // reader
vtkSMPropertyHelper(proxy, "AddTabFieldDelimiter").Set(1);
}
}
}
//----------------------------------------------------------------------------
void vtkSMCSVProxiesInitializationHelper::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os, indent);
}
/*=========================================================================
Program: ParaView
Module: vtkSMCSVProxiesInitializationHelper.h
Copyright (c) Kitware, Inc.
All rights reserved.
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/**
* @class vtkSMCSVProxiesInitializationHelper
* @brief initialization helper for
* (writers, PCSVReader) proxy.
*
* vtkSMCSVProxiesInitializationHelper is an initialization helper for
* the PCSVReader or PCSVWriter proxy that sets up the delimiter to use based on the
* file extension. If the file extension is .txt or .tsv then '\t' is set as
* the delimiter.
*/
#ifndef vtkSMCSVProxiesInitializationHelper_h
#define vtkSMCSVProxiesInitializationHelper_h
#include "vtkPVServerManagerDefaultModule.h" //needed for exports
#include "vtkSMProxyInitializationHelper.h"
class VTKPVSERVERMANAGERDEFAULT_EXPORT vtkSMCSVProxiesInitializationHelper
: public vtkSMProxyInitializationHelper
{
public:
static vtkSMCSVProxiesInitializationHelper* New();
vtkTypeMacro(vtkSMCSVProxiesInitializationHelper, vtkSMProxyInitializationHelper);
void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
void PostInitializeProxy(vtkSMProxy*, vtkPVXMLElement*, vtkMTimeType) override;
protected:
vtkSMCSVProxiesInitializationHelper();
~vtkSMCSVProxiesInitializationHelper() override;
private:
vtkSMCSVProxiesInitializationHelper(const vtkSMCSVProxiesInitializationHelper&) = delete;
void operator=(const vtkSMCSVProxiesInitializationHelper&) = delete;
};
#endif
......@@ -19,13 +19,14 @@
#include "vtkProcessModule.h"
#include "vtkSMViewProxy.h"
#include <vtksys/SystemTools.hxx>
vtkCxxSetObjectMacro(vtkSMExporterProxy, View, vtkSMViewProxy);
//----------------------------------------------------------------------------
vtkSMExporterProxy::vtkSMExporterProxy()
{
this->View = 0;
this->FileExtension = 0;
this->SetFileExtension("txt");
this->FileExtensions.push_back("txt");
this->SetLocation(vtkProcessModule::CLIENT);
}
......@@ -33,19 +34,64 @@ vtkSMExporterProxy::vtkSMExporterProxy()
vtkSMExporterProxy::~vtkSMExporterProxy()
{
this->SetView(0);
this->SetFileExtension(0);
}
#ifndef VTK_LEGACY_REMOVE
//----------------------------------------------------------------------------
int vtkSMExporterProxy::ReadXMLAttributes(vtkSMSessionProxyManager* pxm, vtkPVXMLElement* element)
const char* vtkSMExporterProxy::GetFileExtension()
{
const char* exts = element->GetAttribute("file_extension");
if (exts)
VTK_LEGACY_BODY(vtkSMExporterProxy::GetFileExtension, "ParaView 5.5")
if (this->FileExtensions.empty())
{
this->SetFileExtension(exts);
return nullptr;
}
return this->FileExtensions[0].c_str();
}
#endif
//----------------------------------------------------------------------------
int vtkSMExporterProxy::ReadXMLAttributes(vtkSMSessionProxyManager* pxm, vtkPVXMLElement* element)
{
// we let the superclass read in information first so that we can just
// get the proper hints (i.e. not hints from base proxies) after that to
// figure out file extensions
int retVal = this->Superclass::ReadXMLAttributes(pxm, element);
return this->Superclass::ReadXMLAttributes(pxm, element);
bool addedExtension = false;
if (const char* exts = element->GetAttribute("file_extension"))
{
vtkWarningMacro("Export proxy definition for file_extension has been deprecated."
<< " Use ExporterFactory extensions in Hints instead.");
this->FileExtensions[0] = exts;
addedExtension = true;
}
if (vtkPVXMLElement* hintElement = this->GetHints())
{
vtkPVXMLElement* exporterFactoryElement =
hintElement->FindNestedElementByName("ExporterFactory");
if (exporterFactoryElement)
{
if (const char* e = exporterFactoryElement->GetAttribute("extensions"))
{
std::string extensions = e;
std::vector<std::string> extensionsVec;
vtksys::SystemTools::Split(extensions, extensionsVec, ' ');
for (auto iter = extensionsVec.begin(); iter != extensionsVec.end(); iter++)
{
if (addedExtension)
{
this->FileExtensions.push_back(*iter);
}
else
{
this->FileExtensions[0] = *iter;
addedExtension = true;
}
}
}
}
}
return retVal;
}
//----------------------------------------------------------------------------
......@@ -53,6 +99,10 @@ void vtkSMExporterProxy::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os, indent);
os << indent << "View: " << this->View << endl;
os << indent << "FileExtension: " << (this->FileExtension ? this->FileExtension : "(none)")
<< endl;
os << indent << "FileExtensions:";
for (const auto& fname : this->FileExtensions)
{
os << " " << fname;
}
os << endl;
}
......@@ -26,6 +26,9 @@
#include "vtkPVServerManagerDefaultModule.h" //needed for exports
#include "vtkSMProxy.h"
#include <string> // For storing file extensions
#include <vector> // For storing file extensions
class vtkSMViewProxy;
class VTKPVSERVERMANAGERDEFAULT_EXPORT vtkSMExporterProxy : public vtkSMProxy
......@@ -53,11 +56,18 @@ public:
*/
virtual bool CanExport(vtkSMProxy*) = 0;
//@{
/**
* Returns the suggested file extensions for this exporter.
*/
const std::vector<std::string>& GetFileExtensions() const { return this->FileExtensions; };
//@}
//@{
/**
* Returns the suggested file extension for this exporter.
* @deprecated ParaView 5.5. `UseGetNumberOfFileExtensions` instead.
*/
vtkGetStringMacro(FileExtension);
//@}
protected:
......@@ -68,9 +78,8 @@ protected:
*/
int ReadXMLAttributes(vtkSMSessionProxyManager* pm, vtkPVXMLElement* element) VTK_OVERRIDE;
vtkSetStringMacro(FileExtension);
vtkSMViewProxy* View;
char* FileExtension;
std::vector<std::string> FileExtensions;
private:
vtkSMExporterProxy(const vtkSMExporterProxy&) = delete;
......
......@@ -59,21 +59,31 @@ vtkStdString vtkSMViewExportHelper::GetSupportedFileTypes(vtkSMViewProxy* view)
{
vtkSMExporterProxy* prototype =
vtkSMExporterProxy::SafeDownCast(pxm->GetPrototypeProxy("exporters", iter->GetProxyName()));
if (prototype && prototype->CanExport(view) && prototype->GetFileExtension() != NULL)
if (prototype && prototype->CanExport(view) && !prototype->GetFileExtensions().empty())
{
vtkSMDocumentation* doc = prototype->GetDocumentation();
std::ostringstream helpstream;
std::ostringstream fileExtensionsStream;
std::vector<std::string> fileExtensions = prototype->GetFileExtensions();
for (size_t i = 0; i < fileExtensions.size(); i++)
{
fileExtensionsStream << "*." << fileExtensions[i];
if (i + 1 != fileExtensions.size())
{ // don't add in the space on the last entry to make it look better
fileExtensionsStream << " ";
}
}
if (doc && doc->GetShortHelp())
{
helpstream << doc->GetShortHelp();
}
else
{
helpstream << vtksys::SystemTools::UpperCase(prototype->GetFileExtension()).c_str()
helpstream << vtksys::SystemTools::UpperCase(fileExtensionsStream.str().c_str())
<< " Files";
}
stream << (count > 0 ? ";;" : "") << helpstream.str().c_str() << " (*."
<< prototype->GetFileExtension() << ")";
stream << (count > 0 ? ";;" : "") << helpstream.str() << " (" << fileExtensionsStream.str()
<< ")";
count++;
}
}
......@@ -97,25 +107,28 @@ vtkSMExporterProxy* vtkSMViewExportHelper::CreateExporter(
{
vtkSMExporterProxy* prototype =
vtkSMExporterProxy::SafeDownCast(pxm->GetPrototypeProxy("exporters", iter->GetProxyName()));
if (prototype && prototype->CanExport(view) && prototype->GetFileExtension() != NULL)
if (prototype && prototype->CanExport(view))
{
std::ostringstream reStream;
reStream << "^" // start
<< ".*" // leading text
<< "\\." // extension separator
<< prototype->GetFileExtension() << "$"; // end
vtksys::RegularExpression re(reStream.str().c_str());
if (re.find(filename))
for (auto& ext : prototype->GetFileExtensions())
{
vtkSMExporterProxy* exporter =
vtkSMExporterProxy::SafeDownCast(pxm->NewProxy("exporters", iter->GetProxyName()));
vtkNew<vtkSMParaViewPipelineController> controller;
controller->PreInitializeProxy(exporter);
exporter->SetView(view);
vtkSMPropertyHelper(exporter, "FileName").Set(filename);
controller->PostInitializeProxy(exporter);
exporter->UpdateVTKObjects();
return exporter;
std::ostringstream reStream;
reStream << "^" // start
<< ".*" // leading text
<< "\\." // extension separator
<< ext << "$"; // end
vtksys::RegularExpression re(reStream.str().c_str());
if (re.find(filename))
{
vtkSMExporterProxy* exporter =
vtkSMExporterProxy::SafeDownCast(pxm->NewProxy("exporters", iter->GetProxyName()));
vtkNew<vtkSMParaViewPipelineController> controller;
controller->PreInitializeProxy(exporter);
exporter->SetView(view);
vtkSMPropertyHelper(exporter, "FileName").Set(filename);
controller->PostInitializeProxy(exporter);
exporter->UpdateVTKObjects();
return exporter;
}
}
}
}
......
......@@ -577,4 +577,48 @@ annotation text.
<!-- end of PythonAnimationCue -->
</Proxy>
</ProxyGroup>
<ProxyGroup name="exporters">
<!-- Proxy group for exporters used to export views. -->
<RenderViewExporterProxy class="vtkCinemaExporter"
name="CinemaExporter">
<Documentation long_help="Export view to a Cinema Database"
short_help="Cinema Database">CinemaExporter is a render window
exporter which writes out the renderered scene as a
Cinema database.</Documentation>
<StringVectorProperty name="FileName"
command="SetFileName"
number_of_elements="1">
<Documentation>Name of the file to be written.</Documentation>
</StringVectorProperty>
<StringVectorProperty name="ViewSelection"
command="SetViewSelection"
number_of_elements="1">
<Documentation>Script string defining the view selection.</Documentation>
</StringVectorProperty>
<StringVectorProperty name="TrackSelection"
command="SetTrackSelection"
number_of_elements="1">
<Documentation>Script string defining the track selection.</Documentation>
</StringVectorProperty>
<StringVectorProperty name="ArraySelection"
command="SetArraySelection"
number_of_elements="1">
<Documentation>Script string defining the arrays selected in an item.</Documentation>
</StringVectorProperty>
<PropertyGroup label="Cinema Configuration"
panel_widget="cinema_export_selector">
<Property name="ViewSelection"/>
<Property name="TrackSelection"/>
<Property name="ArraySelection"/>
</PropertyGroup>
<Hints>
<ExporterFactory extensions="cdb" />
</Hints>
<!-- End of Cinema Exporter -->
</RenderViewExporterProxy>
</ProxyGroup>
</ServerManagerConfiguration>
......@@ -1399,6 +1399,15 @@
<Documentation>This property indicates whether to use the string
delimiter.</Documentation>
</IntVectorProperty>
<IntVectorProperty command="SetAddTabFieldDelimiter"
default_values="0"
name="AddTabFieldDelimiter"
number_of_elements="1">
<BooleanDomain name="bool" />
<Documentation>This property indicates whether to add the tab character as a
field delimiter to the list of other delimiter characters. This is needed
since in the GUI the user can't enter a tab character.</Documentation>
</IntVectorProperty>
<IntVectorProperty command="SetHaveHeaders"
default_values="1"
name="HaveHeaders"
......@@ -6911,14 +6920,16 @@
<Property name="UseStringDelimiter" />
<Property name="HaveHeaders" />
<Property name="FieldDelimiterCharacters" />
<Property name="AddTabFieldDelimiter" />
<Property name="MergeConsecutiveDelimiters" />
</ExposedProperties>
</SubProxy>
<Hints>
<!-- View can be used to specify the preferred view for the proxy -->
<View type="SpreadSheetView" />
<ReaderFactory extensions="csv txt CSV TXT"
<ReaderFactory extensions="csv tsv txt CSV TSV TXT"
file_description="Delimited Text" />
<InitializationHelper class="vtkSMCSVProxiesInitializationHelper" />
</Hints>
<!-- End of CSVReader -->
</SourceProxy>
......
......@@ -1300,10 +1300,11 @@
<PSWriterProxy class="vtkParallelSerialWriter"
file_name_method="SetFileName"
name="CSVWriter">
<Documentation short_help="Writer to write CSV files">Writer to write CSV
files from table. In parallel, it delivers the table to the root node and
then saves the CSV. For composite datasets, it saves multiple csv
files.</Documentation>
<Documentation short_help="Writer to write CSV files">Writer to write comma or tab
delimited files from a table. In parallel, it delivers the table to the root node and
then saves the delimited file. For composite datasets, it saves multiple delimited
files. If the file extension is tsv it uses the tab character
for the delimiter. Otherwise it uses a comma.</Documentation>
<SubProxy>
<Proxy class="vtkCSVWriter"
name="Writer">
......@@ -1320,10 +1321,19 @@
number_of_elements="1">
<BooleanDomain name="bool" />
</IntVectorProperty>
<StringVectorProperty command="SetFieldDelimiter"
name="FieldDelimiter"
default_values=","
number_of_elements="1">
<Documentation>Used to set the delimiter character. This is hidden from the user
and set automatically based on the file extension. An extension of .tsv will set
the delimiter character to a tab. Otherwise a comma will be used as the delimiter.</Documentation>
</StringVectorProperty>
</Proxy>
<ExposedProperties>
<Property name="Precision" />
<Property name="UseScientificNotation" />
<Property name="FieldDelimiter" />
</ExposedProperties>
</SubProxy>
<InputProperty command="SetInputConnection"
......@@ -1354,10 +1364,13 @@
<Hints>
<Property name="Input"
show="0" />
<Property name="FieldDelimiter"
show="0" />
<Property name="FileName"
show="0" />
<WriterFactory extensions="csv"