/usr/include/paraview/vtkStructuredVisibilityConstraint.h is in paraview-dev 4.0.1-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | /*=========================================================================
Program: Visualization Toolkit
Module: vtkStructuredVisibilityConstraint.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm 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.
=========================================================================*/
// .NAME vtkStructuredVisibilityConstraint - helper object to manage the
// visibility of points and cells
// .SECTION Description
// vtkStructuredVisibilityConstraint is a general class to manage
// a list of points/cell marked as invalid or invisible. Currently,
// it does this by maintaining an unsigned char array associated
// with points/cells. To conserve memory, this array is allocated
// only when it is needed (when Blank() is called the first time).
// Make sure to call Initialize() with the right dimensions before
// calling any methods that set/get visibility.
#ifndef __vtkStructuredVisibilityConstraint_h
#define __vtkStructuredVisibilityConstraint_h
#include "vtkCommonDataModelModule.h" // For export macro
#include "vtkObject.h"
#include "vtkUnsignedCharArray.h" // Needed for inline methods.
class VTKCOMMONDATAMODEL_EXPORT vtkStructuredVisibilityConstraint : public vtkObject
{
public:
static vtkStructuredVisibilityConstraint *New();
vtkTypeMacro(vtkStructuredVisibilityConstraint,vtkObject);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Returns 1 is the point/cell is visible, 0 otherwise.
unsigned char IsVisible(vtkIdType id);
// Description:
// Sets the visibility flag of the given point/cell off.
// The first time blank is called, a new visibility array
// is created if it doesn't exist.
void Blank(vtkIdType id);
// Description:
// Sets the visibility flag of the given point/cell on.
void UnBlank(vtkIdType id);
// Description:
// Get the dimensions used to initialize the object.
vtkGetVectorMacro(Dimensions,int,3);
// Description:
// Set the dimensions and set the Initialized flag to 1. Once
// an object is initialized, it's dimensions can not be
// changed anymore.
void Initialize(int dims[3]);
// Description:
// Allocates the internal visibility data-structure iff the object has
// been initialized.
void Allocate();
// Description:
// Set/Get the array used to store the visibility flags.
void SetVisibilityById(vtkUnsignedCharArray* vis);
vtkGetObjectMacro(VisibilityById, vtkUnsignedCharArray);
// Description:
// Copies the dimensions, the visibility array pointer
// and the initialized flag.
void ShallowCopy(vtkStructuredVisibilityConstraint* src);
// Description:
// Copies the dimensions, the visibility array
// and the initialized flag.
void DeepCopy(vtkStructuredVisibilityConstraint* src);
// Description:
// Returns 0 if there is no visibility array (all cells/points
// are visible), 0 otherwise.
unsigned char IsConstrained()
{
return this->VisibilityById ? 1 : 0;
}
protected:
vtkStructuredVisibilityConstraint();
~vtkStructuredVisibilityConstraint();
vtkUnsignedCharArray* VisibilityById;
int Dimensions[3];
vtkIdType NumberOfIds;
unsigned char Initialized;
private:
vtkStructuredVisibilityConstraint(const vtkStructuredVisibilityConstraint&); // Not implemented.
void operator=(const vtkStructuredVisibilityConstraint&); // Not implemented.
};
//----------------------------------------------------------------------------
// These methods are inline for efficiency.
//----------------------------------------------------------------------------
inline void vtkStructuredVisibilityConstraint::Allocate()
{
if( !this->VisibilityById )
{
this->VisibilityById = vtkUnsignedCharArray::New();
this->VisibilityById->SetNumberOfTuples( this->NumberOfIds );
for( int i=0; i < this->NumberOfIds; ++i )
{
this->VisibilityById->SetValue( i, 1 );
}
}
}
//----------------------------------------------------------------------------
inline unsigned char vtkStructuredVisibilityConstraint::IsVisible(
vtkIdType id)
{
vtkUnsignedCharArray* vis = this->VisibilityById;
return vis ? vis->GetValue(id) : 1;
}
//----------------------------------------------------------------------------
inline void vtkStructuredVisibilityConstraint::Blank(vtkIdType id)
{
vtkUnsignedCharArray* vis = this->VisibilityById;
if (!vis)
{
this->VisibilityById = vtkUnsignedCharArray::New();
vis = this->VisibilityById;
this->VisibilityById->SetNumberOfTuples(this->NumberOfIds);
for (int i=0; i<this->NumberOfIds; ++i)
{
this->VisibilityById->SetValue(i, 1);
}
}
vis->SetValue(id, 0);
}
//----------------------------------------------------------------------------
inline void vtkStructuredVisibilityConstraint::UnBlank(vtkIdType id)
{
vtkUnsignedCharArray* vis = this->VisibilityById;
if (!vis)
{
return;
}
vis->SetValue(id, 1);
}
//----------------------------------------------------------------------------
inline void vtkStructuredVisibilityConstraint::Initialize(int dims[3])
{
if (this->Initialized)
{
return;
}
for (int i=0; i<3; i++)
{
this->Dimensions[i] = dims[i];
}
this->NumberOfIds = static_cast<vtkIdType>(dims[0])*
static_cast<vtkIdType>(dims[1])*
static_cast<vtkIdType>(dims[2]);
this->Initialized = 1;
}
#endif
|