Commit f6277674 authored by Will Schroeder's avatar Will Schroeder
Browse files

ENH: Changed meory model.

parent 6c315de0
......@@ -37,8 +37,10 @@ public:
char *GetClassName() {return "vlAppendFilter";};
void PrintSelf(ostream& os, vlIndent indent);
void AddInput(vlDataSet *);
void RemoveInput(vlDataSet *);
void AddInput(vlDataSet *in);
void AddInput(vlDataSet& in) {this->AddInput(&in);};
void RemoveInput(vlDataSet *in);
void RemoveInput(vlDataSet& in) {this->RemoveInput(&in);};
vlDataSetCollection *GetInput() {return &(this->Input);};
// filter interface
......
......@@ -38,7 +38,9 @@ public:
void PrintSelf(ostream& os, vlIndent indent);
void AddInput(vlPolyData *);
void AddInput(vlPolyData& in) {this->AddInput(&in);};
void RemoveInput(vlPolyData *);
void RemoveInput(vlPolyData& in) {this->RemoveInput(&in);};
vlPolyDataCollection *GetInput() {return &(this->Input);};
// filter interface
......
......@@ -39,8 +39,10 @@ public:
char *GetClassName() {return "vlBooleanStructuredPoints";};
void PrintSelf(ostream& os, vlIndent indent);
void AddInput(vlStructuredPoints *);
void RemoveInput(vlStructuredPoints *);
void AddInput(vlStructuredPoints *in);
void AddInput(vlStructuredPoints &in) {this->AddInput(&in);};
void RemoveInput(vlStructuredPoints *in);
void RemoveInput(vlStructuredPoints &in) {this->RemoveInput(&in);};
vlStructuredPointsCollection *GetInput() {return &(this->Input);};
// filter interface
......
......@@ -42,18 +42,21 @@ public:
vlSetClampMacro(Tolerance,float,0.0,1.0);
vlGetMacro(Tolerance,float);
// Description:
// Specify a spatial locator for speeding the search process. By
// default an instance of vlLocator is used.
vlSetObjectMacro(Locator,vlLocator);
void SetLocator(vlLocator *locator);
void SetLocator(vlLocator& locator) {this->SetLocator(&locator);};
vlGetObjectMacro(Locator,vlLocator);
// Description:
// Create default locator. Used to create one when none is specified.
virtual void CreateDefaultLocator();
protected:
// Usual data generation method
void Execute();
float Tolerance;
vlLocator *Locator;
int SelfCreatedLocator;
};
#endif
......
......@@ -22,13 +22,6 @@ vlAppendFilter::vlAppendFilter()
vlAppendFilter::~vlAppendFilter()
{
vlDataSet *ds;
for ( int i=0; i < this->Input.GetNumberOfItems(); i++ )
{
ds = this->Input.GetItem(i+1);
ds->UnRegister(this);
}
}
// Description:
......@@ -38,7 +31,6 @@ void vlAppendFilter::AddInput(vlDataSet *ds)
if ( ! this->Input.IsItemPresent(ds) )
{
this->Modified();
ds->Register(this);
this->Input.AddItem(ds);
}
}
......@@ -50,7 +42,6 @@ void vlAppendFilter::RemoveInput(vlDataSet *ds)
if ( this->Input.IsItemPresent(ds) )
{
this->Modified();
ds->UnRegister(this);
this->Input.RemoveItem(ds);
}
}
......
......@@ -22,13 +22,6 @@ vlAppendPolyData::vlAppendPolyData()
vlAppendPolyData::~vlAppendPolyData()
{
vlDataSet *ds;
for ( int i=0; i < this->Input.GetNumberOfItems(); i++ )
{
ds = this->Input.GetItem(i+1);
ds->UnRegister(this);
}
}
// Description:
......@@ -38,7 +31,6 @@ void vlAppendPolyData::AddInput(vlPolyData *ds)
if ( ! this->Input.IsItemPresent(ds) )
{
this->Modified();
ds->Register(this);
this->Input.AddItem(ds);
}
}
......@@ -50,7 +42,6 @@ void vlAppendPolyData::RemoveInput(vlPolyData *ds)
if ( this->Input.IsItemPresent(ds) )
{
this->Modified();
ds->UnRegister(this);
this->Input.RemoveItem(ds);
}
}
......
......@@ -37,13 +37,6 @@ vlBooleanStructuredPoints::vlBooleanStructuredPoints()
vlBooleanStructuredPoints::~vlBooleanStructuredPoints()
{
vlStructuredPoints *ds;
for ( int i=0; i < this->Input.GetNumberOfItems(); i++ )
{
ds = this->Input.GetItem(i+1);
ds->UnRegister(this);
}
}
// Description:
......@@ -53,7 +46,6 @@ void vlBooleanStructuredPoints::AddInput(vlStructuredPoints *sp)
if ( ! this->Input.IsItemPresent(sp) )
{
this->Modified();
sp->Register(this);
this->Input.AddItem(sp);
}
}
......@@ -65,7 +57,6 @@ void vlBooleanStructuredPoints::RemoveInput(vlStructuredPoints *sp)
if ( this->Input.IsItemPresent(sp) )
{
this->Modified();
sp->UnRegister(this);
this->Input.RemoveItem(sp);
}
}
......
......@@ -21,11 +21,13 @@ vlCleanPolyData::vlCleanPolyData()
{
this->Tolerance = 0.0;
this->Locator = NULL;
this->SelfCreatedLocator = 0;
}
vlCleanPolyData::~vlCleanPolyData()
{
if ( this->Locator ) this->Locator->UnRegister(this);
if ( this->SelfCreatedLocator && this->Locator != NULL)
delete this->Locator;
}
void vlCleanPolyData::Execute()
......@@ -57,11 +59,7 @@ void vlCleanPolyData::Execute()
pd = this->Input->GetPointData();
this->PointData.CopyAllocate(pd);
if ( this->Locator == NULL )
{
this->Locator = new vlLocator;
this->Locator->Register(this);
}
if ( this->Locator == NULL ) this->CreateDefaultLocator();
this->Locator->SetPoints(inPts);
......@@ -186,6 +184,27 @@ void vlCleanPolyData::Execute()
}
// Description:
// Specify a spatial locator for speeding the search process. By
// default an instance of vlLocator is used.
void vlCleanPolyData::SetLocator(vlLocator *locator)
{
if ( this->Locator != locator )
{
if ( this->SelfCreatedLocator ) delete this->Locator;
this->SelfCreatedLocator = 0;
this->Locator = locator;
this->Modified();
}
}
void vlCleanPolyData::CreateDefaultLocator()
{
if ( this->SelfCreatedLocator ) delete this->Locator;
this->Locator = new vlLocator;
this->SelfCreatedLocator = 1;
}
void vlCleanPolyData::PrintSelf(ostream& os, vlIndent indent)
{
if (this->ShouldIPrint(vlCleanPolyData::GetClassName()))
......
......@@ -22,12 +22,10 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
vlCutter::vlCutter(vlImplicitFunction *cf)
{
this->CutFunction = cf;
if ( cf ) this->CutFunction->Register(this);
}
vlCutter::~vlCutter()
{
if ( this->CutFunction ) this->CutFunction->UnRegister(this);
}
// Description:
......
......@@ -20,12 +20,11 @@ vlDataSetToDataSetFilter::vlDataSetToDataSetFilter()
{
// prevents dangling reference to DataSet
this->DataSet = new vlPolyData;
this->DataSet->Register(this);
}
vlDataSetToDataSetFilter::~vlDataSetToDataSetFilter()
{
this->DataSet->UnRegister(this);
delete this->DataSet;
}
void vlDataSetToDataSetFilter::Update()
......@@ -41,10 +40,9 @@ void vlDataSetToDataSetFilter::Initialize()
{
if ( this->Input )
{
this->DataSet->UnRegister(this);
delete this->DataSet;
// copies input geometry to internal data set
this->DataSet = this->Input->MakeObject();
this->DataSet->Register(this);
}
else
{
......
......@@ -37,10 +37,6 @@ vlGlyph3D::vlGlyph3D()
vlGlyph3D::~vlGlyph3D()
{
if (this->Source)
{
this->Source->UnRegister(this);
}
}
void vlGlyph3D::PrintSelf(ostream& os, vlIndent indent)
......
......@@ -22,17 +22,10 @@ vlMergeFilter::vlMergeFilter()
{
// prevents dangling reference to DataSet
this->Geometry = new vlPolyData;
this->Geometry->Register(this);
}
vlMergeFilter::~vlMergeFilter()
{
this->Geometry->UnRegister(this);
if ( this->Scalars ) this->Scalars->UnRegister(this);
if ( this->Vectors ) this->Vectors->UnRegister(this);
if ( this->Normals ) this->Normals->UnRegister(this);
if ( this->TCoords ) this->TCoords->UnRegister(this);
}
void vlMergeFilter::Update()
......@@ -48,10 +41,9 @@ void vlMergeFilter::Initialize()
{
if ( this->Geometry )
{
this->Geometry->UnRegister(this);
delete this->Geometry;
// copies input geometry to internal data set
this->Geometry = this->Geometry->MakeObject();
this->Geometry->Register(this);
}
else
{
......
......@@ -63,10 +63,9 @@ void vlProbeFilter::Initialize()
{
if ( this->Source )
{
if (this->DataSet) this->DataSet->UnRegister(this);
if (this->DataSet) delete this->DataSet;
// copies SOURCE geometry to internal data set
this->DataSet = this->Source->MakeObject();
this->DataSet->Register(this);
}
else
{
......
......@@ -20,19 +20,17 @@ vlPointSetToPointSetFilter::vlPointSetToPointSetFilter()
{
// prevents dangling reference to PointSet
this->PointSet = new vlPolyData;
this->PointSet->Register(this);
}
vlPointSetToPointSetFilter::~vlPointSetToPointSetFilter()
{
this->PointSet->UnRegister(this);
delete this->PointSet;
}
vlDataSet* vlPointSetToPointSetFilter::MakeObject()
{
vlPointSetToPointSetFilter *o = new vlPointSetToPointSetFilter();
o->PointSet = this->PointSet;
o->PointSet->Register(o);
o->SetPoints(this->GetPoints());
return o;
}
......@@ -47,10 +45,9 @@ void vlPointSetToPointSetFilter::Initialize()
if ( this->Input != NULL )
{
vlDataSet *ds=this->Input->MakeObject();
this->PointSet->UnRegister(this);
delete this->PointSet;
// copies input geometry to internal data set
this->PointSet = ds;
this->PointSet->Register(this);
}
else
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment