Commit 5dbee87f authored by Ken Martin's avatar Ken Martin
Browse files

Approximate VTK 2.1 release

The VTK 2.1 release tag in CVS was moved file-wise as fixes were made.
Therefore the true history of the 'branch' is gone.  This commit was
manufactured during conversion from CVS to represent the version as a
merge from all the commits whose files have the tag.
...@@ -33,7 +33,6 @@ vtkImageSource \ ...@@ -33,7 +33,6 @@ vtkImageSource \
vtkLocator \ vtkLocator \
vtkMapper2D \ vtkMapper2D \
vtkPointSet \ vtkPointSet \
vtkProp2D \
vtkViewport \ vtkViewport \
vtkWindow vtkWindow
......
...@@ -38,6 +38,7 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. ...@@ -38,6 +38,7 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
=========================================================================*/ =========================================================================*/
#include "vtkActor2D.h" #include "vtkActor2D.h"
#include "vtkProperty2D.h" #include "vtkProperty2D.h"
#include "vtkMapper2D.h" #include "vtkMapper2D.h"
...@@ -48,13 +49,52 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. ...@@ -48,13 +49,52 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
// orientation 0, scale (1,1), layer 0, visibility on // orientation 0, scale (1,1), layer 0, visibility on
vtkActor2D::vtkActor2D() vtkActor2D::vtkActor2D()
{ {
this->Orientation = 0.0;
this->Scale[0] = 1.0;
this->Scale[1] = 1.0;
this->LayerNumber = 0;
this->Visibility = 1; // ON
this->SelfCreatedProperty = 0;
this->Property = (vtkProperty2D*) NULL;
this->Mapper = (vtkMapper2D*) NULL; this->Mapper = (vtkMapper2D*) NULL;
this->PositionCoordinate = vtkCoordinate::New();
this->PositionCoordinate->SetCoordinateSystem(VTK_VIEWPORT);
} }
// Description: // Description:
// Destroy an actor2D. // Destroy an actor2D. If the actor2D created it's own
// property, that property is deleted.
vtkActor2D::~vtkActor2D() vtkActor2D::~vtkActor2D()
{ {
if (this->SelfCreatedProperty) this->Property->Delete();
this->PositionCoordinate->Delete();
this->PositionCoordinate = NULL;
}
void vtkActor2D::PrintSelf(ostream& os, vtkIndent indent)
{
this->vtkReferenceCount::PrintSelf(os,indent);
os << indent << "Orientation: " << this->Orientation << "\n";
os << indent << "Scale: (" << this->Scale[0] << ", " << this->Scale[1] << ")\n";
os << indent << "Layer Number: " << this->LayerNumber << "\n";
os << indent << "Visibility: " << (this->Visibility ? "On\n" : "Off\n");
os << indent << "PositionCoordinate: " << this->PositionCoordinate << "\n";
this->PositionCoordinate->PrintSelf(os, indent.GetNextIndent());
os << indent << "Self Created Property: " << (this->SelfCreatedProperty ? "Yes\n" : "No\n");
os << indent << "Property: " << this->Property << "\n";
if (this->Property) this->Property->PrintSelf(os, indent.GetNextIndent());
os << indent << "Mapper: " << this->Mapper << "\n";
if (this->Mapper) this->Mapper->PrintSelf(os, indent.GetNextIndent());
}
// Description:
// Set the actor2D's position in display coordinates.
void vtkActor2D::SetDisplayPosition(int XPos, int YPos)
{
this->PositionCoordinate->SetCoordinateSystem(VTK_DISPLAY);
this->PositionCoordinate->SetValue((float)XPos,(float)YPos,0.0);
} }
// Description: // Description:
...@@ -83,11 +123,38 @@ void vtkActor2D::Render (vtkViewport* viewport) ...@@ -83,11 +123,38 @@ void vtkActor2D::Render (vtkViewport* viewport)
} }
void vtkActor2D::PrintSelf(ostream& os, vtkIndent indent) // Description:
// Returns an actor2D's property2D. Creates a property if one
// doesn't already exist.
vtkProperty2D *vtkActor2D::GetProperty()
{ {
this->vtkProp2D::PrintSelf(os,indent); if (this->Property == NULL)
{
this->Property = vtkProperty2D::New();
this->SelfCreatedProperty = 1;
this->Modified();
}
return this->Property;
}
os << indent << "Mapper: " << this->Mapper << "\n";
if (this->Mapper) this->Mapper->PrintSelf(os, indent.GetNextIndent()); unsigned long int vtkActor2D::GetMTime()
{
unsigned long mTime=this->vtkObject::GetMTime();
unsigned long time;
time = this->PositionCoordinate->GetMTime();
mTime = ( time > mTime ? time : mTime );
if ( this->Property != NULL )
{
time = this->Property->GetMTime();
mTime = ( time > mTime ? time : mTime );
}
return mTime;
} }
...@@ -38,25 +38,33 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. ...@@ -38,25 +38,33 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
=========================================================================*/ =========================================================================*/
// .NAME vtkActor2D - a actor that draws data into the viewport overlay plane // .NAME vtkActor2D
// .SECTION Description // .SECTION Description
// vtkActor2D is similar to vtkActor, but it is made to be used with // vtkActor2D is similar to vtkActor, but it is made to be used with
// two dimensional images and annotation. vtkActor2D has a position // two dimensional images and annotation. vtkActor2D has a position,
// (inherited from vtkProp) but does not use a transformation matrix // orientation, and scale, but does not use a transformation matrix
// like vtkActor. vtkActor2D has a reference to a vtkMapper2D object // like vtkActor. vtkActor2D also has a layer property which allows two
// which does the rendering. // dimensional actors to be rendered on top of each other in a certain
// order. vtkActor2D has a reference to a vtkMapper2D object which does
// the rendering.
// .SECTION See Also // .SECTION See Also
// vtkProp2D vtkMapper2D vtkProperty2D // vtkProperty2D vtkMapper2D
#ifndef __vtkActor2D_h #ifndef __vtkActor2D_h
#define __vtkActor2D_h #define __vtkActor2D_h
#include "vtkProp2D.h" #include "vtkReferenceCount.h"
#include "vtkCoordinate.h"
class vtkMapper2D; class vtkMapper2D;
class vtkProperty2D;
class VTK_EXPORT vtkActor2D : public vtkProp2D
class VTK_EXPORT vtkActor2D : public vtkReferenceCount
{ {
public: public:
vtkActor2D(); vtkActor2D();
~vtkActor2D(); ~vtkActor2D();
...@@ -64,16 +72,46 @@ public: ...@@ -64,16 +72,46 @@ public:
void PrintSelf(ostream& os, vtkIndent indent); void PrintSelf(ostream& os, vtkIndent indent);
const char *GetClassName() {return "vtkActor2D";}; const char *GetClassName() {return "vtkActor2D";};
virtual void Render(vtkViewport *viewport); void Render(vtkViewport *viewport);
// Description:
// Set/Get the vtkMapper2D which defines the data to be drawn.
vtkSetObjectMacro(Mapper, vtkMapper2D); vtkSetObjectMacro(Mapper, vtkMapper2D);
vtkGetObjectMacro(Mapper, vtkMapper2D);
vtkSetVector2Macro(Scale, float);
vtkGetVectorMacro(Scale, float, 2);
vtkSetMacro(Orientation, float);
vtkGetMacro(Orientation, float);
vtkSetMacro(LayerNumber, int);
vtkGetMacro(LayerNumber, int);
vtkSetMacro(Visibility, int);
vtkGetMacro(Visibility, int);
vtkBooleanMacro(Visibility, int);
vtkProperty2D* GetProperty();
vtkSetObjectMacro(Property, vtkProperty2D);
// Description:
// Get the PositionCoordinate instance of vtkCoordinate
// This is used for for complicated or relative positioning
vtkViewportCoordinateMacro(Position);
void SetDisplayPosition(int,int);
unsigned long int GetMTime();//overload superclasses' implementation
protected: protected:
vtkMapper2D *Mapper; float Orientation;
float Scale[2];
int LayerNumber;
int Visibility;
int SelfCreatedProperty;
vtkProperty2D *Property;
vtkMapper2D *Mapper;
vtkCoordinate *PositionCoordinate;
}; };
#endif #endif
......
...@@ -180,20 +180,21 @@ float *vtkCell::GetBounds () ...@@ -180,20 +180,21 @@ float *vtkCell::GetBounds ()
{ {
float *x; float *x;
int i, j; int i, j;
static float bounds[6];
this->Bounds[0] = this->Bounds[2] = this->Bounds[4] = VTK_LARGE_FLOAT; bounds[0] = bounds[2] = bounds[4] = VTK_LARGE_FLOAT;
this->Bounds[1] = this->Bounds[3] = this->Bounds[5] = -VTK_LARGE_FLOAT; bounds[1] = bounds[3] = bounds[5] = -VTK_LARGE_FLOAT;
for (i=0; i<this->Points.GetNumberOfPoints(); i++) for (i=0; i<this->Points.GetNumberOfPoints(); i++)
{ {
x = this->Points.GetPoint(i); x = this->Points.GetPoint(i);
for (j=0; j<3; j++) for (j=0; j<3; j++)
{ {
if ( x[j] < this->Bounds[2*j] ) this->Bounds[2*j] = x[j]; if ( x[j] < bounds[2*j] ) bounds[2*j] = x[j];
if ( x[j] > this->Bounds[2*j+1] ) this->Bounds[2*j+1] = x[j]; if ( x[j] > bounds[2*j+1] ) bounds[2*j+1] = x[j];
} }
} }
return this->Bounds; return bounds;
} }
// Description: // Description:
...@@ -201,8 +202,8 @@ float *vtkCell::GetBounds () ...@@ -201,8 +202,8 @@ float *vtkCell::GetBounds ()
// user provided array. // user provided array.
void vtkCell::GetBounds(float bounds[6]) void vtkCell::GetBounds(float bounds[6])
{ {
this->GetBounds(); float *b=this->GetBounds();
for (int i=0; i < 6; i++) bounds[i] = this->Bounds[i]; for (int i=0; i < 6; i++) bounds[i] = b[i];
} }
// Description: // Description:
...@@ -213,28 +214,17 @@ float vtkCell::GetLength2 () ...@@ -213,28 +214,17 @@ float vtkCell::GetLength2 ()
float *bounds; float *bounds;
int i; int i;
this->GetBounds(); bounds = this->GetBounds();
for (i=0; i<3; i++) for (i=0; i<3; i++)
{ {
diff = this->Bounds[2*i+1] - this->Bounds[2*i]; diff = bounds[2*i+1] - bounds[2*i];
l += diff * diff; l += diff * diff;
} }
return l; return l;
} }
// Description:
// Return center of the cell in parametric coordinates.
// Note that the parametric center is not always located
// at (0.5,0.5,0.5). The return value is the subId that
// the center is in (if a composite cell). If you want the
// center in x-y-z space, invoke the EvaluateLocation() method.
int vtkCell::GetParametricCenter(float pcoords[3])
{
pcoords[0] = pcoords[1] = pcoords[2] = 0.5;
return 0;
}
void vtkCell::PrintSelf(ostream& os, vtkIndent indent) void vtkCell::PrintSelf(ostream& os, vtkIndent indent)
{ {
int numIds=this->PointIds.GetNumberOfIds(); int numIds=this->PointIds.GetNumberOfIds();
......
...@@ -106,8 +106,8 @@ public: ...@@ -106,8 +106,8 @@ public:
virtual int GetCellDimension() = 0; virtual int GetCellDimension() = 0;
// Description: // Description:
// Return the interpolation order of the cell. Usually linear. // Return the interpolation order of the cell.
virtual int GetInterpolationOrder() {return 1;}; virtual int GetInterpolationOrder() {return 1;}; //usually linear
// Description: // Description:
// Get the point coordinates for the cell. // Get the point coordinates for the cell.
...@@ -243,7 +243,6 @@ public: ...@@ -243,7 +243,6 @@ public:
void GetBounds(float bounds[6]); void GetBounds(float bounds[6]);
float *GetBounds(); float *GetBounds();
float GetLength2(); float GetLength2();
virtual int GetParametricCenter(float pcoords[3]);
// Quick intersection of cell bounding box. Returns != 0 for hit. // Quick intersection of cell bounding box. Returns != 0 for hit.
static char HitBBox(float bounds[6], float origin[3], float dir[3], static char HitBBox(float bounds[6], float origin[3], float dir[3],
...@@ -253,9 +252,6 @@ public: ...@@ -253,9 +252,6 @@ public:
vtkPoints Points; vtkPoints Points;
vtkIdList PointIds; vtkIdList PointIds;
protected:
float Bounds[6];
}; };
#endif #endif
......
...@@ -90,9 +90,7 @@ public: ...@@ -90,9 +90,7 @@ public:
int InsertNextCell(vtkCell *cell); int InsertNextCell(vtkCell *cell);
int InsertNextCell(int npts, int* pts); int InsertNextCell(int npts, int* pts);
int InsertNextCell(vtkIdList &pts); int InsertNextCell(vtkIdList &pts);
int InsertNextCell(int npts); //this and next two methods work together
// this and next two methods work together
int InsertNextCell(int npts);
void InsertCellPoint(int id); void InsertCellPoint(int id);
void UpdateCellCount(int npts); void UpdateCellCount(int npts);
......
...@@ -58,7 +58,6 @@ public: ...@@ -58,7 +58,6 @@ public:
const char *GetClassName() {return "vtkCellData";}; const char *GetClassName() {return "vtkCellData";};
void PrintSelf(ostream& os, vtkIndent indent); void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Set cell data to null values // Set cell data to null values
void NullCell(int cellId); void NullCell(int cellId);
}; };
......
...@@ -114,17 +114,7 @@ void vtkDataObject::PrintSelf(ostream& os, vtkIndent indent) ...@@ -114,17 +114,7 @@ void vtkDataObject::PrintSelf(ostream& os, vtkIndent indent)
{ {
vtkObject::PrintSelf(os,indent); vtkObject::PrintSelf(os,indent);
if ( this->Source )
{
os << indent << "Source: " << this->Source << "\n";
}
else
{
os << indent << "Source: (none)\n";
}
os << indent << "Release Data: " << (this->ReleaseDataFlag ? "On\n" : "Off\n"); os << indent << "Release Data: " << (this->ReleaseDataFlag ? "On\n" : "Off\n");
os << indent << "Data Released: " << (this->DataReleased ? "True\n" : "False\n");
os << indent << "Global Release Data: " os << indent << "Global Release Data: "
<< (vtkDataObjectGlobalReleaseDataFlag ? "On\n" : "Off\n"); << (vtkDataObjectGlobalReleaseDataFlag ? "On\n" : "Off\n");
......
...@@ -40,6 +40,7 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. ...@@ -40,6 +40,7 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
=========================================================================*/ =========================================================================*/
// .NAME vtkDataSetAttributes - represent and manipulate attribute data in a dataset // .NAME vtkDataSetAttributes - represent and manipulate attribute data in a dataset
// .SECTION Description // .SECTION Description
// vtkDataSetAttributes is a class that is used to represent and manipulate // vtkDataSetAttributes is a class that is used to represent and manipulate
// attribute data (e.g., scalars, vectors, normals, texture coordinates, // attribute data (e.g., scalars, vectors, normals, texture coordinates,
// tensors, and field data) Special methods are provided to work with filter // tensors, and field data) Special methods are provided to work with filter
......
...@@ -39,6 +39,8 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. ...@@ -39,6 +39,8 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
=========================================================================*/ =========================================================================*/
#include "vtkIdList.h" #include "vtkIdList.h"
#include "vtkCell.h"
vtkIdList::vtkIdList(const int sz, const int ext) vtkIdList::vtkIdList(const int sz, const int ext)
{ {
......
...@@ -101,30 +101,12 @@ void vtkImageCache::PrintSelf(ostream& os, vtkIndent indent) ...@@ -101,30 +101,12 @@ void vtkImageCache::PrintSelf(ostream& os, vtkIndent indent)
os << indent << "MemoryLimit: " << this->MemoryLimit << endl; os << indent << "MemoryLimit: " << this->MemoryLimit << endl;
os << indent << "NumberOfScalarComponents: " << os << indent << "NumberOfScalarComponents: " <<
this->NumberOfScalarComponents << endl; this->NumberOfScalarComponents << endl;
os << indent << "Source: (" << this->Source << ").\n";
if ( this->Source )
{
os << indent << "Source: (" << this->Source << ").\n";
}
else
{
os << indent << "Source: (none).\n";
}
os << indent << "ReleaseDataFlag: " << this->ReleaseDataFlag << "\n"; os << indent << "ReleaseDataFlag: " << this->ReleaseDataFlag << "\n";
os << indent << "Data Released: " << this->DataReleased << "\n";
os << indent << "ScalarType: "<<vtkImageScalarTypeNameMacro(this->ScalarType) os << indent << "ScalarType: "<<vtkImageScalarTypeNameMacro(this->ScalarType)
<< "\n"; << "\n";
os << indent << "ImageToStructuredPoints: ("
if ( this->ImageToStructuredPoints ) << this->ImageToStructuredPoints << ")\n";
{
os << indent << "ImageToStructuredPoints: ("
<< this->ImageToStructuredPoints << ")\n";
}
else
{
os << indent << "ImageToStructuredPoints: (none)\n";
}
os << indent << "Spacing: (" << this->Spacing[0]; os << indent << "Spacing: (" << this->Spacing[0];
for (idx = 1; idx < 3; ++idx) for (idx = 1; idx < 3; ++idx)
......
...@@ -78,7 +78,7 @@ vtkImageSource::~vtkImageSource() ...@@ -78,7 +78,7 @@ vtkImageSource::~vtkImageSource()
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void vtkImageSource::PrintSelf(ostream& os, vtkIndent indent) void vtkImageSource::PrintSelf(ostream& os, vtkIndent indent)
{ {
vtkProcessObject::PrintSelf(os,indent); vtkObject::PrintSelf(os,indent);
os << indent << "AbortExecute: " << (this->AbortExecute ? "On\n" : "Off\n"); os << indent << "AbortExecute: " << (this->AbortExecute ? "On\n" : "Off\n");
os << indent << "Progress: " << this->Progress << "\n"; os << indent << "Progress: " << this->Progress << "\n";
......
...@@ -107,46 +107,50 @@ void vtkLine::EvaluateLocation(int& vtkNotUsed(subId), float pcoords[3], ...@@ -107,46 +107,50 @@ void vtkLine::EvaluateLocation(int& vtkNotUsed(subId), float pcoords[3],
int vtkLine::Intersection (float a1[3], float a2[3], float b1[3], float b2[3], int vtkLine::Intersection (float a1[3], float a2[3], float b1[3], float b2[3],
float& u, float& v) float& u, float& v)
{ {
double a21[3], b21[3], b1a1[3]; float a21[3], b21[3], b1a1[3];
double sys[2][2], c[2], det; float sys[2][2], c[2], det;
double *A[2], row1[2], row2[2];
int i; int i;
// Initialize //
// Initialize
//
u = v = 0.0; u = v = 0.0;
//
// Determine line vectors. // Determine line vectors.
//
for (i=0; i<3; i++) for (i=0; i<3; i++)
{ {
a21[i] = a2[i] - a1[i]; a21[i] = a2[i] - a1[i];
b21[i] = b2[i] - b1[i]; b21[i] = b2[i] - b1[i];
b1a1[i] = b1[i] - a1[i]; b1a1[i] = b1[i] - a1[i];
} }
//
// Compute the system (least squares) matrix. // Compute the system (least squares) matrix.
A[0] = row1; //
A[1] = row2; sys[0][0] = vtkMath::Dot ( a21, a21 );
row1[0] = vtkMath::Dot ( a21, a21 ); sys[0][1] = -vtkMath::Dot ( a21, b21 );
row1[1] = -vtkMath::Dot ( a21, b21 ); sys[1][0] = sys[0][1];
row2[0] = row1[1]; sys[1][1] = vtkMath::Dot ( b21, b21 );
row2[1] = vtkMath::Dot ( b21, b21 ); //
// Compute the least squares system constant term.
// Compute the least squares system constant term. //
c[0] = vtkMath::Dot ( a21, b1a1 ); c[0] = vtkMath::Dot ( a21, b1a1 );
c[1] = -vtkMath::Dot ( b21, b1a1 ); c[1] = -vtkMath::Dot ( b21, b1a1 );
//
// Solve the system of equations // Solve the system of equations
if ( vtkMath::SolveLinearSystem(A,c,2) == 0 ) //
if ( (det=vtkMath::Determinant2x2(sys[0],sys[1])) <= VTK_TOL )
{ {
return ON_LINE; return ON_LINE;
} }
else else
{ {
u = c[0]; u = vtkMath::Determinant2x2(c,sys[1]) / det;
v = c[1]; v = vtkMath::Determinant2x2(sys[0],c) / det;
} }