1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224
|
/*=========================================================================
Program: ParaView
Module: vtkPVArrayInformation.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 vtkPVArrayInformation
* @brief Data array information like type.
*
* This objects is for eliminating direct access to vtkDataObjects
* by the "client". Only vtkPVPart and vtkPVProcessModule should access
* the data directly. At the moment, this object is only a container
* and has no useful methods for operating on data.
* Note: I could just use vtkDataArray objects and store the range
* as values in the array. This would eliminate this object.
*/
#ifndef vtkPVArrayInformation_h
#define vtkPVArrayInformation_h
#include "vtkPVClientServerCoreCoreModule.h" //needed for exports
#include "vtkPVInformation.h"
class vtkAbstractArray;
class vtkClientServerStream;
class vtkStdString;
class vtkStringArray;
class VTKPVCLIENTSERVERCORECORE_EXPORT vtkPVArrayInformation : public vtkPVInformation
{
public:
static vtkPVArrayInformation* New();
vtkTypeMacro(vtkPVArrayInformation, vtkPVInformation);
void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
//@{
/**
* DataType is the string name of the data type: VTK_FLOAT ...
* the value "VTK_VOID" means that different processes have different types.
*/
vtkSetMacro(DataType, int);
vtkGetMacro(DataType, int);
//@}
//@{
/**
* Set/get array's name
*/
vtkSetStringMacro(Name);
vtkGetStringMacro(Name);
//@}
//@{
/**
* Changing the number of components clears the ranges back to the default.
*/
void SetNumberOfComponents(int numComps);
vtkGetMacro(NumberOfComponents, int);
//@}
/**
* Set the name for a component. Must be >= 1.
*/
void SetComponentName(vtkIdType component, const char* name);
/**
* Get the component name for a given component.
* Note: the const char* that is returned is only valid
* intill the next call to this method!
*/
const char* GetComponentName(vtkIdType component);
//@{
/**
* Set/get the array's length
*/
vtkSetMacro(NumberOfTuples, vtkTypeInt64);
vtkGetMacro(NumberOfTuples, vtkTypeInt64);
//@}
//@{
/**
* There is a range for each component.
* Range for component -1 is the range of the vector magnitude.
* The number of components should be set before these ranges.
*/
void SetComponentRange(int comp, double min, double max);
void SetComponentRange(int comp, double* range)
{
this->SetComponentRange(comp, range[0], range[1]);
}
double* GetComponentRange(int component);
void GetComponentRange(int comp, double* range);
//@}
//@{
/**
* There is a range for each component.
* Range for component -1 is the range of the vector magnitude.
* The number of components should be set before these ranges.
*/
void SetComponentFiniteRange(int comp, double min, double max);
void SetComponentFiniteRange(int comp, double* range)
{
this->SetComponentFiniteRange(comp, range[0], range[1]);
}
double* GetComponentFiniteRange(int component);
void GetComponentFiniteRange(int comp, double* range);
//@}
/**
* This method return the Min and Max possible range of the native
* data type. For example if a vtkScalars consists of unsigned char
* data these will return (0,255).
* Nothing particular for 12bits data is done
*/
void GetDataTypeRange(double range[2]);
/**
* Returns 1 if the array can be combined.
* It must have the same name and number of components.
*/
int Compare(vtkPVArrayInformation* info);
/**
* Merge (union) ranges into this object.
*/
void AddRanges(vtkPVArrayInformation* info);
void AddFiniteRanges(vtkPVArrayInformation* info);
void DeepCopy(vtkPVArrayInformation* info);
/**
* Transfer information about a single object into this object.
*/
virtual void CopyFromObject(vtkObject*) VTK_OVERRIDE;
/**
* Merge another information object.
*/
virtual void AddInformation(vtkPVInformation*) VTK_OVERRIDE;
//@{
/**
* Manage a serialized version of the information.
*/
virtual void CopyToStream(vtkClientServerStream*) VTK_OVERRIDE;
virtual void CopyFromStream(const vtkClientServerStream*) VTK_OVERRIDE;
//@}
//@{
/**
* If IsPartial is true, this array is in only some of the
* parts of a multi-block dataset. By default, IsPartial is
* set to 0.
*/
vtkSetMacro(IsPartial, int);
vtkGetMacro(IsPartial, int);
//@}
/**
* Remove all infommation. Next add will be like a copy.
*/
void Initialize();
//@{
/**
* Merge (union) keys into this object.
*/
void AddInformationKeys(vtkPVArrayInformation* info);
void AddInformationKey(const char* location, const char* name);
void AddUniqueInformationKey(const char* location, const char* name);
//@}
//@{
/**
* Get information on the InformationKeys of this array
*/
int GetNumberOfInformationKeys();
const char* GetInformationKeyLocation(int);
const char* GetInformationKeyName(int);
int HasInformationKey(const char* location, const char* name);
//@}
protected:
vtkPVArrayInformation();
~vtkPVArrayInformation();
int IsPartial;
int DataType;
int NumberOfComponents;
vtkTypeInt64 NumberOfTuples;
char* Name;
double* Ranges;
double* FiniteRanges;
// this array is used to store existing information keys (location/name pairs)
class vtkInternalInformationKeys;
vtkInternalInformationKeys* InformationKeys;
// this is used by GetComponentName, so that it always return a valid component name
vtkStdString* DefaultComponentName;
/// assigns to a string to DefaultComponentName for this component
void DetermineDefaultComponentName(const int& component_no, const int& numComps);
class vtkInternalComponentNames;
vtkInternalComponentNames* ComponentNames;
vtkPVArrayInformation(const vtkPVArrayInformation&) VTK_DELETE_FUNCTION;
void operator=(const vtkPVArrayInformation&) VTK_DELETE_FUNCTION;
};
#endif
|