vtkSMCoreUtilities.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-License-Identifier: BSD-3-Clause
10 #ifndef vtkSMCoreUtilities_h
11 #define vtkSMCoreUtilities_h
12 
13 #include "vtkObject.h"
14 #include "vtkRemotingServerManagerModule.h" //needed for exports
15 
16 #include <string> // for std::string
17 #include <vector> // for std::vector
18 
19 class vtkSMProxy;
20 
22 {
23 public:
24  static vtkSMCoreUtilities* New();
25  vtkTypeMacro(vtkSMCoreUtilities, vtkObject);
26  void PrintSelf(ostream& os, vtkIndent indent) override;
27 
33  static const char* GetFileNameProperty(vtkSMProxy*);
34 
39  static std::vector<std::string> GetFileNameProperties(vtkSMProxy* proxy);
40 
44  static std::string SanitizeName(const char*);
45  static std::string SanitizeName(const std::string& name)
46  {
47  return vtkSMCoreUtilities::SanitizeName(name.c_str());
48  }
49 
51 
55  static bool AdjustRangeForLog(double range[2]);
56  static bool AdjustRangeForLog(double& rmin, double& rmax)
57  {
58  double range[2] = { rmin, rmax };
59  bool retVal = vtkSMCoreUtilities::AdjustRangeForLog(range);
60  rmin = range[0];
61  rmax = range[1];
62  return retVal;
63  }
65 
67 
81  static bool AdjustRange(double range[2]);
82  static bool AdjustRange(double& rmin, double& rmax)
83  {
84  double range[2] = { rmin, rmax };
85  bool retVal = vtkSMCoreUtilities::AdjustRange(range);
86  rmin = range[0];
87  rmax = range[1];
88  return retVal;
89  }
91 
93 
97  static bool AlmostEqual(const double range[2], int ulpsDiff);
98  static bool AlmostEqual(double rmin, double rmax, int ulpsDiff)
99  {
100  double range[2] = { rmin, rmax };
101  return vtkSMCoreUtilities::AlmostEqual(range, ulpsDiff);
102  }
104 
106 
109  static const char* GetInputPropertyName(vtkSMProxy* proxy, int port = 0);
111 
118  static const char* GetStringForCellType(int cellType);
119 
125  static void ReplaceReaderFileName(
126  vtkSMProxy* proxy, const std::vector<std::string>& files, const char* propName);
127 
133  static std::string FindLargestPrefix(const std::vector<std::string>& files);
134 
135 protected:
137  ~vtkSMCoreUtilities() override;
138 
139 private:
140  vtkSMCoreUtilities(const vtkSMCoreUtilities&) = delete;
141  void operator=(const vtkSMCoreUtilities&) = delete;
142 };
143 
144 #endif
static bool AdjustRange(double range[2])
Adjust the given range to make it suitable for use with color maps.
static bool AlmostEqual(const double range[2], int ulpsDiff)
Compares val1 and val2 and returns true is the two numbers are within ulpsDiff ULPs (units in last pl...
#define VTKREMOTINGSERVERMANAGER_EXPORT
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
collection of utilities.
static bool AdjustRangeForLog(double range[2])
Given a range, converts it to be a valid range to switch to log space.
static std::string SanitizeName(const std::string &name)
static bool AdjustRangeForLog(double &rmin, double &rmax)
Given a range, converts it to be a valid range to switch to log space.
static bool AdjustRange(double &rmin, double &rmax)
Adjust the given range to make it suitable for use with color maps.
range
CellTypeInDataSet cellType(vtkDataSet *input)
proxy for a VTK object(s) on a server
Definition: vtkSMProxy.h:140
port
static vtkObject * New()
void operator=(const vtkObjectBase &)
static std::string SanitizeName(const char *)
Sanitize a label/name to be remove spaces, delimiters etc.
static bool AlmostEqual(double rmin, double rmax, int ulpsDiff)
Compares val1 and val2 and returns true is the two numbers are within ulpsDiff ULPs (units in last pl...