Commit 65c179a5 authored by Bill Lorensen's avatar Bill Lorensen
Browse files

ENH: style.

parent 5f189a18
......@@ -59,16 +59,28 @@ vtkPolyDataMapper *vtkPolyDataMapper::New()
char *temp = vtkRenderWindow::GetRenderLibrary();
#ifdef VTK_USE_SBR
if (!strcmp("Starbase",temp)) return vtkStarbasePolyDataMapper::New();
if (!strcmp("Starbase",temp))
{
return vtkStarbasePolyDataMapper::New();
}
#endif
#ifdef VTK_USE_OGLR
if (!strcmp("OpenGL",temp)) return vtkOpenGLPolyDataMapper::New();
if (!strcmp("OpenGL",temp))
{
return vtkOpenGLPolyDataMapper::New();
}
#endif
#ifdef _WIN32
if (!strcmp("Win32OpenGL",temp)) return vtkOpenGLPolyDataMapper::New();
if (!strcmp("Win32OpenGL",temp))
{
return vtkOpenGLPolyDataMapper::New();
}
#endif
#ifdef VTK_USE_XGLR
if (!strcmp("XGL",temp)) return vtkXGLPolyDataMapper::New();
if (!strcmp("XGL",temp))
{
return vtkXGLPolyDataMapper::New();
}
#endif
return new vtkPolyDataMapper;
......
......@@ -113,7 +113,10 @@ void vtkPolyDataNormals::Execute()
if ( numStrips > 0 ) //have to decompose strips into triangles
{
vtkTriangleStrip *strip = vtkTriangleStrip::New();
if ( numPolys > 0 ) polys = new vtkCellArray(*(inPolys));
if ( numPolys > 0 )
{
polys = new vtkCellArray(*(inPolys));
}
else
{
polys = vtkCellArray::New();
......@@ -154,7 +157,10 @@ void vtkPolyDataNormals::Execute()
if ( this->Consistency || this->Splitting )
{
Visited = new int[numPolys];
for ( i=0; i < numPolys; i++) Visited[i] = 0;
for ( i=0; i < numPolys; i++)
{
Visited[i] = 0;
}
Mark = 1;
}
else
......@@ -211,7 +217,10 @@ void vtkPolyDataNormals::Execute()
for (cellId=0, newPolys->InitTraversal(); newPolys->GetNextCell(npts,pts);
cellId++ )
{
if ((cellId % 1000) == 0) this->UpdateProgress ((float) cellId / (float) numPolys);
if ((cellId % 1000) == 0)
{
this->UpdateProgress ((float) cellId / (float) numPolys);
}
poly->ComputeNormal(inPts, npts, pts, n);
PolyNormals->SetNormal(cellId,n);
}
......@@ -228,7 +237,10 @@ void vtkPolyDataNormals::Execute()
//
Map = vtkIdList::New();
Map->SetNumberOfIds(numPts);
for (i=0; i < numPts; i++) Map->SetId(i,i);
for (i=0; i < numPts; i++)
{
Map->SetId(i,i);
}
for (ptId=0; ptId < OldMesh->GetNumberOfPoints(); ptId++)
{
......@@ -238,7 +250,9 @@ void vtkPolyDataNormals::Execute()
for (j=0; j < cellIds->GetNumberOfIds(); j++)
{
if ( Visited[cellIds->GetId(j)] != Mark )
{
this->MarkAndReplace (cellIds->GetId(j), ptId, replacementPoint);
}
replacementPoint = Map->GetNumberOfIds();
}
......@@ -275,14 +289,23 @@ void vtkPolyDataNormals::Execute()
// Finally, traverse all elements, computing polygon normals and
// accumalating them at the vertices.
//
if ( Visited ) delete [] Visited;
if ( Visited )
{
delete [] Visited;
}
if ( this->FlipNormals && ! this->Consistency ) flipDirection = -1.0;
if ( this->FlipNormals && ! this->Consistency )
{
flipDirection = -1.0;
}
newNormals = vtkNormals::New();
newNormals->SetNumberOfNormals(numNewPts);
n[0] = n[1] = n[2] = 0.0;
for (i=0; i < numNewPts; i++) newNormals->SetNormal(i,n);
for (i=0; i < numNewPts; i++)
{
newNormals->SetNormal(i,n);
}
for (cellId=0, newPolys->InitTraversal(); newPolys->GetNextCell(npts,pts);
cellId++ )
......@@ -303,7 +326,10 @@ void vtkPolyDataNormals::Execute()
length = vtkMath::Norm(vertNormal);
if (length != 0.0)
{
for (j=0; j < 3; j++) n[j] = vertNormal[j] / length * flipDirection;
for (j=0; j < 3; j++)
{
n[j] = vertNormal[j] / length * flipDirection;
}
}
newNormals->SetNormal(i,n);
}
......@@ -382,8 +408,12 @@ void vtkPolyDataNormals::TraverseAndOrder (int cellId)
neighbor = cellIds->GetId(k);
NewMesh->GetCellPoints(neighbor,numNeiPts,neiPts);
for (l=0; l < numNeiPts; l++)
{
if (neiPts[l] == p2)
{
break;
}
}
//
// Have to reverse ordering if neighbor not consistent
//
......@@ -442,8 +472,12 @@ void vtkPolyDataNormals::MarkAndReplace (int cellId, int n,
// routine.
//
for (spot=0; spot < numOldPts; spot++)
{
if ( oldPts[spot] == n )
{
break;
}
}
if ( spot == 0 )
{
......@@ -473,7 +507,9 @@ void vtkPolyDataNormals::MarkAndReplace (int cellId, int n,
neiNormal = PolyNormals->GetNormal(cellIds->GetId(0));
if ( vtkMath::Dot(thisNormal,neiNormal) > CosAngle )
{
this->MarkAndReplace (cellIds->GetId(0), n, replacementPoint);
}
}
}
......
......@@ -161,11 +161,19 @@ void vtkPolyDataReader::Execute()
vtkDebugMacro(<<"Reading vtk polygonal data...");
if ( this->Debug ) this->Reader->DebugOn();
else this->Reader->DebugOff();
if ( this->Debug )
{
this->Reader->DebugOn();
}
else
{
this->Reader->DebugOff();
}
if ( !(this->Reader->OpenVTKFile()) || !this->Reader->ReadHeader())
return;
{
return;
}
//
// Read polygonal data specific stuff
//
......@@ -199,7 +207,10 @@ void vtkPolyDataReader::Execute()
//
while (1)
{
if (!this->Reader->ReadString(line)) break;
if (!this->Reader->ReadString(line))
{
break;
}
if ( ! strncmp(this->Reader->LowerCase(line),"points",6) )
{
......
......@@ -61,17 +61,31 @@ void vtkPolyDataWriter::WriteData()
vtkDebugMacro(<<"Writing vtk polygonal data...");
if ( !(fp=this->OpenVTKFile()) || !this->WriteHeader(fp) )
return;
{
return;
}
//
// Write polygonal data specific stuff
//
fprintf(fp,"DATASET POLYDATA\n");
this->WritePoints(fp, input->GetPoints());
if (input->GetVerts()) this->WriteCells(fp, input->GetVerts(),"VERTICES");
if (input->GetLines()) this->WriteCells(fp, input->GetLines(),"LINES");
if (input->GetPolys()) this->WriteCells(fp, input->GetPolys(),"POLYGONS");
if (input->GetStrips()) this->WriteCells(fp, input->GetStrips(),"TRIANGLE_STRIPS");
if (input->GetVerts())
{
this->WriteCells(fp, input->GetVerts(),"VERTICES");
}
if (input->GetLines())
{
this->WriteCells(fp, input->GetLines(),"LINES");
}
if (input->GetPolys())
{
this->WriteCells(fp, input->GetPolys(),"POLYGONS");
}
if (input->GetStrips())
{
this->WriteCells(fp, input->GetStrips(),"TRIANGLE_STRIPS");
}
this->WriteCellData(fp, input);
this->WritePointData(fp, input);
......
......@@ -117,7 +117,10 @@ void vtkProbeFilter::Update()
}
// prevent chasing our tail
if (this->Updating) return;
if (this->Updating)
{
return;
}
this->Updating = 1;
this->Source->Update();
......@@ -128,23 +131,44 @@ void vtkProbeFilter::Update()
this->Input->GetMTime() > this->ExecuteTime ||
this->GetMTime() > this->ExecuteTime )
{
if ( this->Input->GetDataReleased() ) this->Input->ForceUpdate();
if ( this->Source->GetDataReleased() ) this->Source->ForceUpdate();
if ( this->Input->GetDataReleased() )
{
this->Input->ForceUpdate();
}
if ( this->Source->GetDataReleased() )
{
this->Source->ForceUpdate();
}
if ( this->StartMethod ) (*this->StartMethod)(this->StartMethodArg);
if ( this->StartMethod )
{
(*this->StartMethod)(this->StartMethodArg);
}
((vtkDataSet *)this->Output)->CopyStructure((vtkDataSet *)this->Input);
// reset AbortExecute flag and Progress
this->AbortExecute = 0;
this->Progress = 0.0;
this->Execute();
this->ExecuteTime.Modified();
if ( !this->AbortExecute ) this->UpdateProgress(1.0);
if ( !this->AbortExecute )
{
this->UpdateProgress(1.0);
}
this->SetDataReleased(0);
if ( this->EndMethod ) (*this->EndMethod)(this->EndMethodArg);
if ( this->EndMethod )
{
(*this->EndMethod)(this->EndMethodArg);
}
}
if ( this->Source->ShouldIReleaseData() ) this->Source->ReleaseData();
if ( this->Input->ShouldIReleaseData() ) this->Input->ReleaseData();
if ( this->Source->ShouldIReleaseData() )
{
this->Source->ReleaseData();
}
if ( this->Input->ShouldIReleaseData() )
{
this->Input->ReleaseData();
}
}
void vtkProbeFilter::PrintSelf(ostream& os, vtkIndent indent)
......
......@@ -119,20 +119,29 @@ void vtkProgrammableAttributeDataFilter::Update()
}
// prevent chasing our tail
if (this->Updating) return;
if (this->Updating)
{
return;
}
// Update the inputs
this->Updating = 1;
mtime = this->GetMTime();
this->Input->Update();
if (this->Input->GetMTime() > mtime ) mtime = this->Input->GetMTime();
if (this->Input->GetMTime() > mtime )
{
mtime = this->Input->GetMTime();
}
for (this->InputList->InitTraversal(); (ds = this->InputList->GetNextItem()); )
{
ds->Update();
dsMtime = ds->GetMTime();
if ( dsMtime > mtime ) mtime = dsMtime;
if ( dsMtime > mtime )
{
mtime = dsMtime;
}
}
this->Updating = 0;
......@@ -146,19 +155,31 @@ void vtkProgrammableAttributeDataFilter::Update()
for ( this->InputList->InitTraversal(); (ds=this->InputList->GetNextItem()); )
{
if ( ds->GetDataReleased() ) ds->ForceUpdate();
if ( ds->GetDataReleased() )
{
ds->ForceUpdate();
}
}
if ( this->StartMethod ) (*this->StartMethod)(this->StartMethodArg);
if ( this->StartMethod )
{
(*this->StartMethod)(this->StartMethodArg);
}
((vtkDataSet *)this->Output)->CopyStructure((vtkDataSet *)this->Input);
// reset AbortExecute flag and Progress
this->AbortExecute = 0;
this->Progress = 0.0;
this->Execute();
this->ExecuteTime.Modified();
if ( !this->AbortExecute ) this->UpdateProgress(1.0);
if ( !this->AbortExecute )
{
this->UpdateProgress(1.0);
}
this->SetDataReleased(0);
if ( this->EndMethod ) (*this->EndMethod)(this->EndMethodArg);
if ( this->EndMethod )
{
(*this->EndMethod)(this->EndMethodArg);
}
}
if ( this->Input->ShouldIReleaseData() )
......@@ -167,7 +188,12 @@ void vtkProgrammableAttributeDataFilter::Update()
}
for (this->InputList->InitTraversal(); (ds = this->InputList->GetNextItem()); )
if ( ds->ShouldIReleaseData() ) ds->ReleaseData();
{
if ( ds->ShouldIReleaseData() )
{
ds->ReleaseData();
}
}
}
void vtkProgrammableAttributeDataFilter::Execute()
......
......@@ -154,7 +154,10 @@ void vtkProgrammableGlyphFilter::Execute()
if ( ! (this->PointId % 10000) )
{
this->UpdateProgress ((float)this->PointId/numPts);
if (this->GetAbortExecute()) break;
if (this->GetAbortExecute())
{
break;
}
}
input->GetPoint(this->PointId, this->Point);
......@@ -252,36 +255,61 @@ void vtkProgrammableGlyphFilter::Update()
}
// prevent chasing our tail
if (this->Updating) return;
if (this->Updating)
{
return;
}
this->Updating = 1;
this->Input->Update();
if ( this->Source ) this->Source->Update();
if ( this->Source )
{
this->Source->Update();
}
this->Updating = 0;
if (this->Input->GetMTime() > this->ExecuteTime ||
(this->Source && this->Source->GetMTime() > this->ExecuteTime) ||
this->GetMTime() > this->ExecuteTime )
{
if ( this->Input->GetDataReleased() ) this->Input->ForceUpdate();
if ( this->Input->GetDataReleased() )
{
this->Input->ForceUpdate();
}
if ( this->Source && this->Source->GetDataReleased() )
{
this->Source->ForceUpdate();
}
if ( this->StartMethod ) (*this->StartMethod)(this->StartMethodArg);
if ( this->StartMethod )
{
(*this->StartMethod)(this->StartMethodArg);
}
this->Output->Initialize(); //clear output
// reset AbortExecute flag and Progress
this->AbortExecute = 0;
this->Progress = 0.0;
this->Execute();
this->ExecuteTime.Modified();
if ( !this->AbortExecute ) this->UpdateProgress(1.0);
if ( !this->AbortExecute )
{
this->UpdateProgress(1.0);
}
this->SetDataReleased(0);
if ( this->EndMethod ) (*this->EndMethod)(this->EndMethodArg);
if ( this->EndMethod )
{
(*this->EndMethod)(this->EndMethodArg);
}
}
if ( this->Input->ShouldIReleaseData() ) this->Input->ReleaseData();
if ( this->Input->ShouldIReleaseData() )
{
this->Input->ReleaseData();
}
if ( this->Source && this->Source->ShouldIReleaseData() )
{
this->Source->ReleaseData();
}
}
// Specify function to be called before object executes.
......
......@@ -81,11 +81,15 @@ vtkProjectedPolyDataRayBounder *vtkProjectedPolyDataRayBounder::New()
#ifdef VTK_USE_OGLR
if (!strcmp("OpenGL",temp))
{
return vtkOpenGLProjectedPolyDataRayBounder::New();
}
#endif
#ifdef _WIN32
if (!strcmp("Win32OpenGL",temp))
{
return vtkOpenGLProjectedPolyDataRayBounder::New();
}
#endif
vtkGenericWarningMacro( <<
......
......@@ -112,7 +112,10 @@ vtkProp& vtkProp::operator=(const vtkProp& prop)
this->Pickable = prop.Pickable;
this->Dragable = prop.Dragable;
for (i=0; i < 6; i++) this->Bounds[i] = prop.Bounds[i];
for (i=0; i < 6; i++)
{
this->Bounds[i] = prop.Bounds[i];
}
return *this;
}
......@@ -268,7 +271,10 @@ vtkMatrix4x4 *vtkProp::GetMatrixPointer()
void vtkProp::GetBounds(float bounds[6])
{
this->GetBounds();
for (int i=0; i<6; i++) bounds[i] = this->Bounds[i];
for (int i=0; i<6; i++)
{
bounds[i] = this->Bounds[i];
}
}
// Get the center of the bounding box in world coordinates.
......@@ -351,11 +357,16 @@ void vtkProp::PrintSelf(ostream& os, vtkIndent indent)
vtkObject::PrintSelf(os,indent);
os << indent << "Dragable: " << (this->Dragable ? "On\n" : "Off\n");
os << indent << "Pickable: " << (this->Pickable ? "On\n" : "Off\n");
if ( this->PickMethod ) os << indent << "Pick Method defined\n";
else os << indent <<"No Pick Method\n";
if ( this->PickMethod )
{
os << indent << "Pick Method defined\n";
}
else
{
os << indent <<"No Pick Method\n";
}
if ( this->UserMatrix )
{
......
......@@ -231,8 +231,13 @@ class VTK_EXPORT vtkProp : public vtkObject
// Description:
// Method invokes PickMethod() if one defined
virtual void Pick() {
if (this->PickMethod) (*this->PickMethod)(this->PickMethodArg);};
virtual void Pick()
{
if (this->PickMethod)
{
(*this->PickMethod)(this->PickMethodArg);
}
};
// Description:
// For legacy compatibility. Do not use.
......
......@@ -132,16 +132,28 @@ vtkProperty *vtkProperty::New()
char *temp = vtkRenderWindow::GetRenderLibrary();
#ifdef VTK_USE_SBR
if (!strcmp("Starbase",temp)) return vtkStarbaseProperty::New();
if (!strcmp("Starbase",temp))
{
return vtkStarbaseProperty::New();
}
#endif
#ifdef VTK_USE_OGLR
if (!strcmp("OpenGL",temp)) return vtkOpenGLProperty::New();
if (!strcmp("OpenGL",temp))
{
return vtkOpenGLProperty::New();
}
#endif
#ifdef _WIN32
if (!strcmp("Win32OpenGL",temp)) return vtkOpenGLProperty::New();
if (!strcmp("Win32OpenGL",temp))
{
return vtkOpenGLProperty::New();
}
#endif
#ifdef VTK_USE_XGLR
if (!strcmp("XGL",temp)) return vtkXGLProperty::New();
if (!strcmp("XGL",temp))
{
return vtkXGLProperty::New();
}
#endif
return new vtkProperty;
......
......@@ -63,13 +63,20 @@ void vtkQuadric::SetCoefficients(float a[10])
float *c=this->Coefficients;
for (i=0; i < 10; i++ )
{
if ( a[i] != c[i] )
{
break;
}
}
if ( i < 10 )
{
this->Modified();
for (i=0; i < 10; i++ ) c[i] = a[i];
for (i=0; i < 10; i++ )
{
c[i] = a[i];
}
}
}
......
......@@ -50,7 +50,7 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#include "vtkVolumeRayCastMapper.h"
// Swap two values
#define SWAP_VALUES( A, B, T ) T=A; A=B; B=T
#define VTK_SWAP_VALUES( A, B, T ) T=A; A=B; B=T
// Constructor for vtkRayCaster