vtkSpreadSheetView.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-License-Identifier: BSD-3-Clause
12 #ifndef vtkSpreadSheetView_h
13 #define vtkSpreadSheetView_h
14 
15 #include "vtkPVView.h"
16 #include "vtkRemotingViewsModule.h" //needed for exports
17 
18 #include <string> // for std::string
19 
20 class vtkCSVExporter;
23 class vtkReductionFilter;
25 class vtkTable;
26 class vtkVariant;
27 
29 {
30 public:
31  static vtkSpreadSheetView* New();
32  vtkTypeMacro(vtkSpreadSheetView, vtkPVView);
33  void PrintSelf(ostream& os, vtkIndent indent) override;
34 
36 
40  vtkSetMacro(Identifier, vtkTypeUInt32);
41  vtkGetMacro(Identifier, vtkTypeUInt32);
43 
48  void StillRender() override { this->StreamToClient(); }
49 
55  void InteractiveRender() override { this->StreamToClient(); }
56 
60  void Update() override;
61 
63 
68  void SetShowExtractedSelection(bool);
69  vtkBooleanMacro(ShowExtractedSelection, bool);
70  vtkGetMacro(ShowExtractedSelection, bool);
72 
74 
77  vtkSetMacro(GenerateCellConnectivity, bool);
78  vtkGetMacro(GenerateCellConnectivity, bool);
79  vtkBooleanMacro(GenerateCellConnectivity, bool);
81 
83 
87  vtkSetMacro(ShowFieldData, bool);
88  vtkGetMacro(ShowFieldData, bool);
89  vtkBooleanMacro(ShowFieldData, bool);
91 
93 
97  vtkSetMacro(FieldAssociation, int);
98  vtkGetMacro(FieldAssociation, int);
100 
102 
111  void OrderColumnsByList(bool enable);
112  void InitializeOrderedColumnList();
113  std::vector<std::string> GetOrderedColumnList();
114  void SetOrderedColumnList(std::vector<std::string> list);
115  void ClearOrderedColumnList();
117 
119 
123  void HideColumnByName(const char* columnName);
124  bool IsColumnHiddenByName(const char* columnName);
125  void ClearHiddenColumnsByName();
126 
127  void HideColumnByLabel(const char* columnLabel);
128  bool IsColumnHiddenByLabel(const std::string& columnLabel);
129  void ClearHiddenColumnsByLabel();
131 
136  virtual vtkIdType GetNumberOfColumns();
137 
142  virtual vtkIdType GetNumberOfRows();
143 
148  virtual const char* GetColumnName(vtkIdType index);
149 
151 
154  virtual bool IsColumnInternal(vtkIdType index);
155  virtual bool IsColumnInternal(const char* columnName);
157 
159 
168  virtual std::string GetColumnLabel(vtkIdType index);
169  virtual std::string GetColumnLabel(const char* columnName);
171 
176  vtkIdType GetColumnByName(const char* columnName);
177 
181  virtual bool GetColumnVisibility(vtkIdType index);
182 
184 
190  virtual vtkVariant GetValue(vtkIdType row, vtkIdType col);
191  virtual vtkVariant GetValueByName(vtkIdType row, const char* columnName);
193 
197  virtual bool IsRowSelected(vtkIdType row);
198 
202  virtual bool IsAvailable(vtkIdType row);
203 
207  virtual bool IsDataValid(vtkIdType row, vtkIdType col);
208 
209  //***************************************************************************
210  // Forwarded to vtkSortedTableStreamer.
215  void SetColumnNameToSort(const char*);
216  void SetColumnNameToSort() { this->SetColumnNameToSort(nullptr); }
217 
222  void SetInvertSortOrder(bool);
223 
228  void SetBlockSize(vtkIdType val);
229 
233  virtual bool Export(vtkCSVExporter* exporter);
234 
238  void ClearCache();
239  using Superclass::ClearCache;
240 
241  // INTERNAL METHOD. Don't call directly.
242  vtkTable* FetchBlockCallback(vtkIdType blockindex);
243 
244 protected:
246  ~vtkSpreadSheetView() override;
247 
254  int StreamToClient();
255 
256  void OnRepresentationUpdated();
257 
258  virtual vtkTable* FetchBlock(vtkIdType blockindex);
259 
260  bool ShowExtractedSelection = false;
261  bool GenerateCellConnectivity = false;
262  bool ShowFieldData = false;
268 
269  unsigned long CRMICallbackTag;
270  unsigned long PRMICallbackTag;
271  vtkTypeUInt32 Identifier;
272 
273  enum
274  {
275  FETCH_BLOCK_TAG = 394732
276  };
277 
278 private:
279  vtkSpreadSheetView(const vtkSpreadSheetView&) = delete;
280  void operator=(const vtkSpreadSheetView&) = delete;
281 
282  class vtkInternals;
283  friend class vtkInternals;
284  vtkInternals* Internals;
285  bool SomethingUpdated;
286 
287  int FieldAssociation;
288 };
289 
290 #endif
vtkTypeUInt32 Identifier
return a sorted subset of the original table
void InteractiveRender() override
Triggers a interactive render.
Moves data from the server root node to the client.
static vtkView * New()
#define VTKREMOTINGVIEWS_EXPORT
vtkReductionFilter * ReductionFilter
vtkSpreadSheetView is a vtkPVView subclass for a view used to show any data as a spreadsheet.
void Update() override
Overridden to not call Update() directly on the input representations, instead use ProcessViewRequest...
int vtkIdType
vtkMarkSelectedRows * TableSelectionMarker
virtual void ClearCache(vtkPVDataRepresentation *)
Called by vtkPVDataRepresentation whenever vtkPVDataRepresentation::MarkModified is called...
baseclass for all ParaView views.
Definition: vtkPVView.h:32
ValueType GetValue(vtkIdType valueIdx) const
vtkClientServerMoveData * DeliveryFilter
vtkSortedTableStreamer * TableStreamer
unsigned long CRMICallbackTag
unsigned long PRMICallbackTag
mark rows that are selected as such.
exporter used by certain views to export data as CSV.
void PrintSelf(ostream &os, vtkIndent indent) override
void StillRender() override
Triggers a high-resolution render.
index
A generic filter that can reduce any type of dataset using any reduction algorithm.