vtkSMCoreUtilities.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: vtkSMCoreUtilities.h
5 
6  Copyright (c) Kitware, Inc.
7  All rights reserved.
8  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
22 #ifndef vtkSMCoreUtilities_h
23 #define vtkSMCoreUtilities_h
24 
25 #include "vtkObject.h"
26 #include "vtkRemotingServerManagerModule.h" //needed for exports
27 
28 #include <string> // for std::string
29 #include <vector> // for std::vector
30 
31 class vtkSMProxy;
32 
34 {
35 public:
36  static vtkSMCoreUtilities* New();
37  vtkTypeMacro(vtkSMCoreUtilities, vtkObject);
38  void PrintSelf(ostream& os, vtkIndent indent) override;
39 
45  static const char* GetFileNameProperty(vtkSMProxy*);
46 
51  static std::vector<std::string> GetFileNameProperties(vtkSMProxy* proxy);
52 
56  static std::string SanitizeName(const char*);
57  static std::string SanitizeName(const std::string& name)
58  {
59  return vtkSMCoreUtilities::SanitizeName(name.c_str());
60  }
61 
63 
67  static bool AdjustRangeForLog(double range[2]);
68  static bool AdjustRangeForLog(double& rmin, double& rmax)
69  {
70  double range[2] = { rmin, rmax };
71  bool retVal = vtkSMCoreUtilities::AdjustRangeForLog(range);
72  rmin = range[0];
73  rmax = range[1];
74  return retVal;
75  }
77 
79 
93  static bool AdjustRange(double range[2]);
94  static bool AdjustRange(double& rmin, double& rmax)
95  {
96  double range[2] = { rmin, rmax };
97  bool retVal = vtkSMCoreUtilities::AdjustRange(range);
98  rmin = range[0];
99  rmax = range[1];
100  return retVal;
101  }
103 
105 
109  static bool AlmostEqual(const double range[2], int ulpsDiff);
110  static bool AlmostEqual(double rmin, double rmax, int ulpsDiff)
111  {
112  double range[2] = { rmin, rmax };
113  return vtkSMCoreUtilities::AlmostEqual(range, ulpsDiff);
114  }
116 
118 
121  static const char* GetInputPropertyName(vtkSMProxy* proxy, int port = 0);
123 
130  static const char* GetStringForCellType(int cellType);
131 
137  static void ReplaceReaderFileName(
138  vtkSMProxy* proxy, const std::vector<std::string>& files, const char* propName);
139 
145  static std::string FindLargestPrefix(const std::vector<std::string>& files);
146 
147 protected:
149  ~vtkSMCoreUtilities() override;
150 
151 private:
152  vtkSMCoreUtilities(const vtkSMCoreUtilities&) = delete;
153  void operator=(const vtkSMCoreUtilities&) = delete;
154 };
155 
156 #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:152
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...