Commit 71431c65 authored by Will Schroeder's avatar Will Schroeder
Browse files

ENH: Added documentation.

parent b0fed0fe
......@@ -13,9 +13,13 @@ written consent of the authors.
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
//
// Dynamic, self adjusting bit array
//
// .NAME vlBitArray - dynamic, self adjusting array of bits
// .SECTION Description
// vlBitArray is an array of bits (0/1 data value). The array is packed
// so that each byte stores eight bits. vlBitArray provides methods
// for insertion and retrieval of bits, and will automatically resize
// itself to hold new data.
#ifndef __vlBitArray_h
#define __vlBitArray_h
......@@ -25,49 +29,32 @@ class vlBitArray : public vlObject
{
public:
vlBitArray():Array(NULL),Size(0),MaxId(-1),Extend(1000) {};
void Initialize();
int Allocate(const int sz, const int ext);
vlBitArray(const int sz, const int ext);
void Initialize();
vlBitArray(const int sz, const int ext=1000);
vlBitArray(const vlBitArray& ia);
~vlBitArray();
int GetValue(const int id)
{if (this->Array[id/8]&(0x80 >> (id%8))) return 1; return 0;};
char *GetPtr(const int id) {return this->Array + id/8;};
vlBitArray &SetValue(const int id, const int i)
{
if (i) this->Array[id/8] |= (0x80 >> id%8);
else this->Array[id/8] &= (~(0x80 >> id%8));
if ( id > this->MaxId ) this->MaxId = id;
}
virtual char *GetClassName() {return "vlBitArray";};
void PrintSelf(ostream& os, vlIndent indent);
vlBitArray &InsertValue(const int id, const int i)
{
if ( id >= this->Size ) this->Resize(id);
if (i) this->Array[id/8] |= (0x80 >> id%8);
else this->Array[id/8] &= (~(0x80 >> id%8));
if ( id > this->MaxId ) this->MaxId = id;
return *this;
}
// access/insertion methods
int GetValue(const int id);
char *GetPtr(const int id);
vlBitArray &InsertValue(const int id, const int i);
int InsertNextValue(const int i);
int InsertNextValue(const int i)
{this->InsertValue (++this->MaxId,i); return this->MaxId;};
// special operators
vlBitArray &operator=(const vlBitArray& ia);
vlBitArray &operator+=(const vlBitArray& ia);
void operator+=(const char i) {this->InsertNextValue(i);};
// operator[] can be used on both left and right side of expression;
// Note: if used on lh side, user's responsibility to do range checking
// Note: bit arrays don't handle [] very well
// char& operator[](const int i)
// {if (i > this->MaxId) this->MaxId = i;
// return (this->Array[i/8]&(0x80 >> (id%8)));};
void Squeeze() {this->Resize (this->MaxId+1);};
int GetSize() {return this->Size;};
int GetMaxId() {return this->MaxId;};
char *GetArray() {return this->Array;};
void Reset() {this->MaxId = -1;};
virtual char *GetClassName() {return "vlBitArray";};
void PrintSelf(ostream& os, vlIndent indent);
vlBitArray &SetValue(const int id, const int i);
// miscellaneous methods
void Squeeze();
int GetSize();
int GetMaxId();
char *GetArray();
void Reset();
private:
unsigned char *Array; // pointer to data
......@@ -77,5 +64,71 @@ private:
char *Resize(const int sz); // function to resize data
};
// Description:
// Get the data at a particular index.
inline int vlBitArray::GetValue(const int id)
{
if (this->Array[id/8]&(0x80 >> (id%8))) return 1; return 0;
};
// Description:
// Get the address of a particular data index.
inline char *vlBitArray::GetPtr(const int id)
{
return this->Array + id/8;
};
// Description:
// Insert data at a specified position in the array. Does not perform
// range checking.
inline vlBitArray& vlBitArray::SetValue(const int id, const int i)
{
if (i) this->Array[id/8] |= (0x80 >> id%8);
else this->Array[id/8] &= (~(0x80 >> id%8));
if ( id > this->MaxId ) this->MaxId = id;
return *this;
}
// Description:
// Insert data at a specified position in the array.
inline vlBitArray& vlBitArray::InsertValue(const int id, const int i)
{
if ( id >= this->Size ) this->Resize(id);
if (i) this->Array[id/8] |= (0x80 >> id%8);
else this->Array[id/8] &= (~(0x80 >> id%8));
if ( id > this->MaxId ) this->MaxId = id;
return *this;
}
// Description:
// Insert data at the end of the array. Return its location in the array.
inline int vlBitArray::InsertNextValue(const int i)
{
this->InsertValue (++this->MaxId,i); return this->MaxId;
}
// Description:
// Resize object to just fit data requirement. Reclaims extra memory.
inline void vlBitArray::Squeeze() {this->Resize (this->MaxId+1);}
// Description:
// Get the allocated size of the object in terms of number of data items.
inline int vlBitArray::GetSize() {return this->Size;}
// Description:
// Returning the maximum index of data inserted so far.
inline int vlBitArray::GetMaxId() {return this->MaxId;}
// Description:
// Get the pointer to the array. Useful for interfacing to C or
// FORTRAN routines.
inline char *vlBitArray::GetArray() {return this->Array;}
// Description:
// Reuse the memory allocated by this object. Objects appears like
// no data has been previously inserted.
inline void vlBitArray::Reset() {this->MaxId = -1;}
#endif
......@@ -6,8 +6,6 @@
Date: $Date$
Version: $Revision$
Description:
---------------------------------------------------------------------------
This file is part of the Visualization Library. No part of this file
or its contents may be copied, reproduced or altered in any way
without the express written consent of the authors.
......@@ -15,9 +13,12 @@ without the express written consent of the authors.
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
//
// Dynamic, self adjusting char array
//
// .NAME vlCharArray - dynamic, self adjusting character array
// .SECTION Description
// vlCharArray is an array of character values. It provides methods
// for insertion and retrieval of characters, and will automatically
// resize itself to hold new data.
#ifndef __vlCharArray_h
#define __vlCharArray_h
......@@ -27,43 +28,96 @@ class vlCharArray : public vlObject
{
public:
vlCharArray():Array(NULL),Size(0),MaxId(-1),Extend(1000) {};
int Allocate(const int sz, const int ext=1000);
void Initialize();
int Allocate(const int sz, const int ext);
vlCharArray(const int sz, const int ext);
vlCharArray(const int sz, const int ext=1000);
vlCharArray(const vlCharArray& ia);
~vlCharArray();
char GetValue(const int id) {return this->Array[id];};
char *GetPtr(const int id) {return this->Array + id;};
vlCharArray &InsertValue(const int id, const int i)
{if ( id >= this->Size ) this->Resize(id);
this->Array[id] = i;
if ( id > this->MaxId ) this->MaxId = id;
return *this;
}
int InsertNextValue(const int i)
{this->InsertValue (++this->MaxId,i); return this->MaxId;};
vlCharArray &operator=(const vlCharArray& ia);
vlCharArray &operator+=(const vlCharArray& ia);
void operator+=(const char i) {this->InsertNextValue(i);};
// operator[] can be used on both left and right side of expression;
// Note: if used on lh side, user's responsibility to do range checking
char& operator[](const int i)
{if (i > this->MaxId) this->MaxId = i; return this->Array[i];};
void Squeeze() {this->Resize (this->MaxId+1);};
int GetSize() {return this->Size;};
int GetMaxId() {return this->MaxId;};
char *GetArray() {return this->Array;};
void Reset() {this->MaxId = -1;};
virtual char *GetClassName() {return "vlCharArray";};
void PrintSelf(ostream& os, vlIndent indent);
// access/insertion methods
char GetValue(const int id);
char *GetPtr(const int id);
vlCharArray &InsertValue(const int id, const char i);
int InsertNextValue(const char i);
// special operators
vlCharArray &operator=(const vlCharArray& ia);
void operator+=(const vlCharArray& ia);
void operator+=(const char i) {this->InsertNextValue(i);};
char& operator[](const int i);
// miscellaneous methods
void Squeeze();
int GetSize();
int GetMaxId();
char *GetArray();
void Reset();
private:
char *Array; // pointer to data
int Size; // allocated size of data
int MaxId; // maximum index inserted thus iar
int MaxId; // maximum index inserted thus far
int Extend; // grow array by this point
char *Resize(const int sz); // function to resize data
};
#endif
// Description:
// Get the data at a particular index.
inline char vlCharArray::GetValue(const int id) {return this->Array[id];};
// Description:
// Get the address of a particular data index.
inline char *vlCharArray::GetPtr(const int id) {return this->Array + id;};
// Description:
// Insert data at a specified position in the array.
inline vlCharArray& vlCharArray::InsertValue(const int id, const char i)
{
if ( id >= this->Size ) this->Resize(id);
this->Array[id] = i;
if ( id > this->MaxId ) this->MaxId = id;
return *this;
}
// Description:
// Insert data at the end of the array. Return its location in the array.
inline int vlCharArray::InsertNextValue(const char i)
{
this->InsertValue (++this->MaxId,i);
return this->MaxId;
}
// Description:
// Does insert or get (depending on location on lhs or rhs of statement). Does
// not do automatic resizing - user's responsibility to range check.
inline char& vlCharArray::operator[](const int i)
{
if (i > this->MaxId) this->MaxId = i;
return this->Array[i];
}
// Description:
// Resize object to just fit data requirement. Reclaims extra memory.
inline void vlCharArray::Squeeze() {this->Resize (this->MaxId+1);};
// Description:
// Get the allocated size of the object in terms of number of data items.
inline int vlCharArray::GetSize() {return this->Size;};
// Description:
// Returning the maximum index of data inserted so far.
inline int vlCharArray::GetMaxId() {return this->MaxId;};
// Description:
// Get the pointer to the array. Useful for interfacing to C or
// FORTRAN routines.
inline char *vlCharArray::GetArray() {return this->Array;};
// Description:
// Reuse the memory allocated by this object. Objects appears like
// no data has been previously inserted.
inline void vlCharArray::Reset() {this->MaxId = -1;};
#endif
......@@ -13,6 +13,12 @@ written consent of the authors.
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
// .NAME vlCollection - create and manipulate lists of objects
// .SECTION Description
// vlCollection is a general object for creating and manipulating lists
// of objects. vlCollection also serves as a base class for lists of
// specific types of objects.
#ifndef __vlCollection_hh
#define __vlCollection_hh
......@@ -29,12 +35,6 @@ class vlCollection : public vlObject
{
public:
int NumberOfItems;
private:
vlCollectionElement *Top;
vlCollectionElement *Bottom;
public:
vlCollection();
void AddItem(vlObject *);
void RemoveItem(vlObject *);
......@@ -43,6 +43,11 @@ class vlCollection : public vlObject
vlObject *GetItem(int num);
void PrintSelf(ostream& os, vlIndent indent);
char *GetClassName() {return "vlCollection";};
private:
vlCollectionElement *Top;
vlCollectionElement *Bottom;
};
#endif
......
......@@ -13,9 +13,15 @@ written consent of the authors.
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
//
// DataSetMapper takes DataSet as input
//
// .NAME vlDataSetMapper - map vlDataSet and derived classes to graphics primitives
// .SECTION Description
// vlDataSetMapper is a mapper to map data sets (i.e., vlDataSet and
// all derived classes) to graphics primitives. The mapping procedure
// is as follows: all 0-D, 1-D, and 2-D cells are converted into points,
// lines, and polygons/triangle strips and mapped. The 2-D faces of
// 3-D cells are mapped only if they are used by only one cell, i.e.,
// on the boundary of the data set.
#ifndef __vlDataSetMapper_h
#define __vlDataSetMapper_h
......@@ -33,6 +39,9 @@ public:
void PrintSelf(ostream& os, vlIndent indent);
void Render(vlRenderer *ren);
float *GetBounds();
// Description:
// Specify the input data to map.
virtual void SetInput(vlDataSet *in);
virtual vlDataSet* GetInput();
......
......@@ -13,9 +13,15 @@ written consent of the authors.
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
//
// Abstract class to map pipeline data to graphics primitives
//
// .NAME vlMapper - abstract class specifies interface to map data to graphics primitives
// .SECTION Description
// vlMapper is an abstract class to specify interface between data and
// graphics primitives. Subclasses of vlMapper map data through a
// lookuptable and control the creation of rendering primitives that
// interface to the graphics library. The mapping can be controlled by
// supplying a lookup table and specifying a scalar range to map data
// through.
#ifndef __vlMapper_hh
#define __vlMapper_hh
......@@ -33,24 +39,42 @@ public:
char *GetClassName() {return "vlMapper";};
void PrintSelf(ostream& os, vlIndent indent);
void operator=(const vlMapper& m);
void SetStartRender(void (*f)(void *), void *arg);
void SetEndRender(void (*f)(void *), void *arg);
// Description:
// Method initiates the mapping process. Generally sent by the actor
// as each frame is rendered.
virtual void Render(vlRenderer *) = 0;
// Description:
// Return bounding box of data in terms of (xmin,xmax, ymin,ymax, zmin,zmax).
// Used in the rendering process to automatically create a camera in the
// proper initial configuration.
virtual float *GetBounds() = 0;
void SetStartRender(void (*f)());
void SetEndRender(void (*f)());
// Description:
// Specify a lookup table for the mapper to use.
vlSetObjectMacro(LookupTable,vlLookupTable);
vlGetObjectMacro(LookupTable,vlLookupTable);
// Description:
// Set flag to control whether scalar data is used to color objects.
vlSetMacro(ScalarsVisible,int);
vlGetMacro(ScalarsVisible,int);
vlBooleanMacro(ScalarsVisible,int);
// Description:
// Specify range in terms of (smin,smax) through which to map scalars
// into lookup table.
vlSetVector2Macro(ScalarRange,float)
vlGetVectorMacro(ScalarRange,float)
protected:
void (*StartRender)();
void (*EndRender)();
void (*StartRender)(void *);
void *StartRenderArg;
void (*EndRender)(void *);
void *EndRenderArg;
vlLookupTable *LookupTable;
int ScalarsVisible;
vlTimeStamp BuildTime;
......
......@@ -13,9 +13,12 @@ written consent of the authors.
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
//
// PolyMapper takes PolyData as input
//
// .NAME vlPolyMapper - map vlPolyData to graphics primitives
// .SECTION Description
// vlPolyMapper is a mapper to map polygonal data (i.e., vlPolyData) to
// graphics primitives. It is possible to control which geometric
// primitives are displayed using the boolean variables provided.
#ifndef __vlPolyMapper_h
#define __vlPolyMapper_h
......@@ -33,21 +36,32 @@ public:
void Render(vlRenderer *ren);
float *GetBounds();
// Description:
// Specify the input data to map.
virtual void SetInput(vlPolyData *in);
virtual vlPolyData* GetInput();
// Description:
// Control the visibility of vertices.
vlSetMacro(VertsVisibility,int);
vlGetMacro(VertsVisibility,int);
vlBooleanMacro(VertsVisibility,int);
// Description:
// Control the visibility of lines.
vlSetMacro(LinesVisibility,int);
vlGetMacro(LinesVisibility,int);
vlBooleanMacro(LinesVisibility,int);
// Description:
// Control the visibility of polygons.
vlSetMacro(PolysVisibility,int);
vlGetMacro(PolysVisibility,int);
vlBooleanMacro(PolysVisibility,int);
// Description:
// Control the visibility of triangle strips.
vlSetMacro(StripsVisibility,int);
vlGetMacro(StripsVisibility,int);
vlBooleanMacro(StripsVisibility,int);
......
......@@ -6,7 +6,6 @@
Date: $Date$
Version: $Revision$
Description:
---------------------------------------------------------------------------
This file is part of the Visualization Library. No part of this file
or its contents may be copied, reproduced or altered in any way
......@@ -15,9 +14,12 @@ without the express written consent of the authors.
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
//
// Dynamic, self adjusting short array
//
// .NAME vlShortArray - dynamic, self adjusting short integer array
// .SECTION Description
// vlShortArray is an array of short integer numbers. It provides methods
// for insertion and retrieval of integer values, and will
// automatically resize itself to hold new data.
#ifndef __vlShortArray_h
#define __vlShortArray_h
......@@ -27,36 +29,33 @@ class vlShortArray : public vlObject
{
public:
vlShortArray():Array(NULL),Size(0),MaxId(-1),Extend(1000) {};
void Initialize();
int Allocate(const int sz, const int ext=1000);
void Initialize();
vlShortArray(const int sz, const int ext=1000);
vlShortArray(const vlShortArray& sa);
vlShortArray(const vlShortArray& ia);
~vlShortArray();
short GetValue(const int id) {return this->Array[id];};
short *GetPtr(const int id) {return this->Array + id;};
vlShortArray &InsertValue(const int id, const short i)
{if ( id >= this->Size ) this->Resize(id);
this->Array[id] = i;
if ( id > this->MaxId ) this->MaxId = id;
return *this;
}
int InsertNextValue(const short i)
{this->InsertValue (++this->MaxId,i); return this->MaxId;};
vlShortArray &operator=(const vlShortArray& sa);
vlShortArray &operator+=(const vlShortArray& sa);
void operator+=(const short i) {this->InsertNextValue(i);};
// operator[] can be used on both left and right side of expression;
// Note: if used on lh side, user's responsibility to do range checking
short& operator[](const int i)
{if (i > this->MaxId) this->MaxId = i; return this->Array[i];};
void Squeeze() {this->Resize (this->MaxId+1);};
int GetSize() {return this->Size;};
int GetMaxId() {return this->MaxId;};
short *GetArray() {return this->Array;};
void Reset() {this->MaxId = -1;};
virtual char *GetClassName() {return "vlShortArray";};
void PrintSelf(ostream& os, vlIndent indent);
// access/insertion methods
short GetValue(const int id);
short *GetPtr(const int id);
vlShortArray &InsertValue(const int id, const short i);
int InsertNextValue(const int short);
// special operators
vlShortArray &operator=(const vlShortArray& ia);
void operator+=(const vlShortArray& ia);
void operator+=(const short i) {this->InsertNextValue(i);};
short& operator[](const int i);
// miscellaneous methods
void Squeeze();
int GetSize();
int GetMaxId();
short *GetArray();
void Reset();
private:
short *Array; // pointer to data
int Size; // allocated size of data
......@@ -65,5 +64,61 @@ private:
short *Resize(const int sz); // function to resize data
};
#endif
// Description:
// Get the data at a particular index.
inline short vlShortArray::GetValue(const int id) {return this->Array[id];};
// Description:
// Get the address of a particular data index.
inline short *vlShortArray::GetPtr(const int id) {return this->Array + id;};
// Description:
// Insert data at a specified position in the array.
inline vlShortArray& vlShortArray::InsertValue(const int id, const short i)
{
if ( id >= this->Size ) this->Resize(id);
this->Array[id] = i;
if ( id > this->MaxId ) this->MaxId = id;
return *this;
}
// Description:
// Insert data at the end of the array. Return its location in the array.
inline int vlShortArray::InsertNextValue(const short i)
{
this->InsertValue (++this->MaxId,i);
return this->MaxId;
}
// Description:
// Does insert or get (depending on location on lhs or rhs of statement). Does
// not do automatic resizing - user's responsibility to range check.
inline short& vlShortArray::operator[](const int i)
{
if (i > this->MaxId) this->MaxId = i;
return this->Array[i];
}
// Description:
// Resize object to just fit data requirement. Reclaims extra memory.
inline void vlShortArray::Squeeze() {this->Resize (this->MaxId+1);};
// Description:
// Get the allocated size of the object in terms of number of data items.
inline int vlShortArray::GetSize() {return this->Size;};
// Description:
// Returning the maximum index of data inserted so far.
inline int vlShortArray::GetMaxId() {return this->MaxId;};
// Description:
// Get the pointer to the array. Useful for interfacing to C or
// FORTRAN routines.
inline short *vlShortArray::GetArray() {return this->Array;};