Commit 2bccf55e authored by Brad King's avatar Brad King
Browse files

ENH: vtkDataArray::MakeObject() method is now deprecated.

parent 71382535
......@@ -78,23 +78,6 @@ int doArrayTest (ostream& strm, T *ptr, A *array, V value, int size)
ptr->SetVoidArray(array, size, 1);
strm << "OK" << endl;
strm << "\tMakeObject...";
if (ptr2 = ptr->SafeDownCast(ptr->MakeObject()))
{
if (ptr2->GetNumberOfComponents() == 10) strm << "OK" << endl;
else
{
errors++;
strm << "FAILED" << endl;
}
ptr2->Delete();
}
else
{
errors++;
strm << "FAILED" << endl;
}
strm << "CreateDefaultLookupTable" << endl;
ptr->CreateDefaultLookupTable();
strm << *ptr;
......
......@@ -18,16 +18,9 @@
#include "vtkBitArray.h"
#include "vtkObjectFactory.h"
vtkCxxRevisionMacro(vtkBitArray, "1.53");
vtkCxxRevisionMacro(vtkBitArray, "1.54");
vtkStandardNewMacro(vtkBitArray);
vtkDataArray *vtkBitArray::MakeObject()
{
vtkDataArray *a = vtkBitArray::New();
a->SetNumberOfComponents(this->NumberOfComponents);
return a;
}
// Instantiate object.
vtkBitArray::vtkBitArray(vtkIdType numComp)
{
......
......@@ -44,7 +44,6 @@ public:
void Initialize();
// satisfy vtkDataArray API
vtkDataArray *MakeObject();
int GetDataType() {return VTK_BIT;};
int GetDataTypeSize() { return 0; }
......
......@@ -18,16 +18,9 @@
#include "vtkCharArray.h"
#include "vtkObjectFactory.h"
vtkCxxRevisionMacro(vtkCharArray, "1.35");
vtkCxxRevisionMacro(vtkCharArray, "1.36");
vtkStandardNewMacro(vtkCharArray);
vtkDataArray *vtkCharArray::MakeObject()
{
vtkDataArray *a = vtkCharArray::New();
a->SetNumberOfComponents(this->NumberOfComponents);
return a;
}
// Instantiate object.
vtkCharArray::vtkCharArray(vtkIdType numComp)
{
......
......@@ -42,10 +42,6 @@ public:
// Description:
// Release storage and reset array to initial state.
void Initialize();
// Description:
// Create the same type object as this (virtual constructor).
vtkDataArray *MakeObject();
// Description:
// Get the data type.
......
......@@ -33,7 +33,7 @@
#include "vtkIdList.h"
#include "vtkMath.h"
vtkCxxRevisionMacro(vtkDataArray, "1.52");
vtkCxxRevisionMacro(vtkDataArray, "1.53");
// Construct object with default tuple dimension (number of components) of 1.
vtkDataArray::vtkDataArray(vtkIdType numComp)
......@@ -991,3 +991,14 @@ void vtkDataArray::PrintSelf(ostream& os, vtkIndent indent)
os << indent << "LookupTable: (none)\n";
}
}
//----------------------------------------------------------------------------
#ifndef VTK_REMOVE_LEGACY_CODE
vtkDataArray* vtkDataArray::MakeObject()
{
VTK_LEGACY_METHOD(MakeObject, "4.2");
vtkDataArray* a = this->NewInstance();
a->SetNumberOfComponents(this->NumberOfComponents);
return a;
}
#endif
......@@ -64,11 +64,11 @@ public:
virtual int Allocate(const vtkIdType sz, const vtkIdType ext=1000) = 0;
virtual void Initialize() = 0;
#ifndef VTK_REMOVE_LEGACY_CODE
// Description:
// Virtual constructor creates an object of the same type as this one.
// The created object also has the same number of components. You are
// responsible for freeing the object.
virtual vtkDataArray *MakeObject() = 0;
// For legacy compatibility. Do not use.
virtual vtkDataArray* MakeObject();
#endif
// Description:
// Return the underlying data type. An integer indicating data type is
......
......@@ -33,7 +33,7 @@
#include "vtkIdTypeArray.h"
#include "vtkObjectFactory.h"
vtkCxxRevisionMacro(vtkDataSetAttributes, "1.67");
vtkCxxRevisionMacro(vtkDataSetAttributes, "1.68");
vtkStandardNewMacro(vtkDataSetAttributes);
//--------------------------------------------------------------------------
......@@ -106,7 +106,7 @@ void vtkDataSetAttributes::DeepCopy(vtkFieldData *fd)
for ( int i=0; i < numArrays; i++ )
{
data = fd->GetArray(i);
newData = data->MakeObject(); //instantiate same type of object
newData = data->NewInstance(); //instantiate same type of object
newData->DeepCopy(data);
newData->SetName(data->GetName());
if ((attributeType=dsa->IsArrayAnAttribute(i)) != -1)
......@@ -473,7 +473,8 @@ void vtkDataSetAttributes::CopyAllocate(vtkDataSetAttributes* pd,
{
// Create all required arrays
da = pd->GetArray(i);
newDA = da->MakeObject();
newDA = da->NewInstance();
newDA->SetNumberOfComponents(da->GetNumberOfComponents());
newDA->SetName(da->GetName());
if ( sze > 0 )
{
......
......@@ -18,16 +18,9 @@
#include "vtkDoubleArray.h"
#include "vtkObjectFactory.h"
vtkCxxRevisionMacro(vtkDoubleArray, "1.45");
vtkCxxRevisionMacro(vtkDoubleArray, "1.46");
vtkStandardNewMacro(vtkDoubleArray);
vtkDataArray *vtkDoubleArray::MakeObject()
{
vtkDataArray *a = vtkDoubleArray::New();
a->SetNumberOfComponents(this->NumberOfComponents);
return a;
}
// Instantiate object.
vtkDoubleArray::vtkDoubleArray(vtkIdType numComp)
{
......
......@@ -43,10 +43,6 @@ public:
// Release storage and reset array to initial state.
void Initialize();
// Description:
// Create the same type object as this (virtual constructor).
vtkDataArray *MakeObject();
// Description:
// Get the data type.
int GetDataType() {return VTK_DOUBLE;};
......
......@@ -18,7 +18,7 @@
#include "vtkFieldData.h"
#include "vtkObjectFactory.h"
vtkCxxRevisionMacro(vtkFieldData, "1.45");
vtkCxxRevisionMacro(vtkFieldData, "1.46");
vtkStandardNewMacro(vtkFieldData);
vtkFieldData::BasicIterator::BasicIterator(const int* list,
......@@ -244,7 +244,8 @@ vtkFieldData *vtkFieldData::MakeObject()
for ( i=0; i < this->GetNumberOfArrays(); i++ )
{
data = this->Data[i]->MakeObject();
data = this->Data[i]->NewInstance();
data->SetNumberOfComponents(this->Data[i]->GetNumberOfComponents());
data->SetName(this->Data[i]->GetName());
f->SetArray(i, data);
data->Delete();
......@@ -383,7 +384,7 @@ void vtkFieldData::DeepCopy(vtkFieldData *f)
for ( int i=0; i < f->GetNumberOfArrays(); i++ )
{
data = f->GetArray(i);
newData = data->MakeObject(); //instantiate same type of object
newData = data->NewInstance(); //instantiate same type of object
newData->DeepCopy(data);
newData->SetName(data->GetName());
this->AddArray(newData);
......
......@@ -18,16 +18,9 @@
#include "vtkFloatArray.h"
#include "vtkObjectFactory.h"
vtkCxxRevisionMacro(vtkFloatArray, "1.55");
vtkCxxRevisionMacro(vtkFloatArray, "1.56");
vtkStandardNewMacro(vtkFloatArray);
vtkDataArray *vtkFloatArray::MakeObject()
{
vtkDataArray *a = vtkFloatArray::New();
a->SetNumberOfComponents(this->NumberOfComponents);
return a;
}
// Instantiate object with 1 components.
vtkFloatArray::vtkFloatArray(vtkIdType numComp)
{
......
......@@ -42,10 +42,6 @@ public:
// Release storage and reset array to initial state.
void Initialize();
// Description:
// Create the same type object as this (virtual constructor).
vtkDataArray *MakeObject();
// Description:
// Get the data type.
int GetDataType()
......
......@@ -18,16 +18,9 @@
#include "vtkIdTypeArray.h"
#include "vtkObjectFactory.h"
vtkCxxRevisionMacro(vtkIdTypeArray, "1.5");
vtkCxxRevisionMacro(vtkIdTypeArray, "1.6");
vtkStandardNewMacro(vtkIdTypeArray);
vtkDataArray *vtkIdTypeArray::MakeObject()
{
vtkDataArray *a = vtkIdTypeArray::New();
a->SetNumberOfComponents(this->NumberOfComponents);
return a;
}
// Instantiate object.
vtkIdTypeArray::vtkIdTypeArray(vtkIdType numComp)
{
......
......@@ -43,10 +43,6 @@ public:
// Release storage and reset array to initial state.
void Initialize();
// Description:
// Create the same type object as this (virtual constructor).
vtkDataArray *MakeObject();
// Description:
// Get the data type.
int GetDataType()
......
......@@ -18,16 +18,9 @@
#include "vtkIntArray.h"
#include "vtkObjectFactory.h"
vtkCxxRevisionMacro(vtkIntArray, "1.64");
vtkCxxRevisionMacro(vtkIntArray, "1.65");
vtkStandardNewMacro(vtkIntArray);
vtkDataArray *vtkIntArray::MakeObject()
{
vtkDataArray *a = vtkIntArray::New();
a->SetNumberOfComponents(this->NumberOfComponents);
return a;
}
// Instantiate object.
vtkIntArray::vtkIntArray(vtkIdType numComp)
{
......
......@@ -43,10 +43,6 @@ public:
// Release storage and reset array to initial state.
void Initialize();
// Description:
// Create the same type object as this (virtual constructor).
vtkDataArray *MakeObject();
// Description:
// Get the data type.
int GetDataType()
......
......@@ -18,16 +18,9 @@
#include "vtkLongArray.h"
#include "vtkObjectFactory.h"
vtkCxxRevisionMacro(vtkLongArray, "1.33");
vtkCxxRevisionMacro(vtkLongArray, "1.34");
vtkStandardNewMacro(vtkLongArray);
vtkDataArray *vtkLongArray::MakeObject()
{
vtkDataArray *a = vtkLongArray::New();
a->SetNumberOfComponents(this->NumberOfComponents);
return a;
}
// Instantiate object.
vtkLongArray::vtkLongArray(vtkIdType numComp)
{
......
......@@ -51,10 +51,6 @@ public:
// Resize the array while conserving the data.
virtual void Resize(vtkIdType numTuples);
// Description:
// Create the same type object as this (virtual constructor).
vtkDataArray *MakeObject();
// Description:
// Get the data type.
int GetDataType() {return VTK_LONG;};
......
......@@ -21,7 +21,7 @@
#include "vtkObjectFactory.h"
#include "vtkFloatArray.h"
vtkCxxRevisionMacro(vtkPolyLine, "1.71");
vtkCxxRevisionMacro(vtkPolyLine, "1.72");
vtkStandardNewMacro(vtkPolyLine);
vtkPolyLine::vtkPolyLine()
......@@ -354,7 +354,8 @@ void vtkPolyLine::Contour(float value, vtkDataArray *cellScalars,
vtkCellData *outCd)
{
int i, numLines=this->Points->GetNumberOfPoints() - 1;
vtkDataArray *lineScalars=cellScalars->MakeObject();
vtkDataArray *lineScalars=cellScalars->NewInstance();
lineScalars->SetNumberOfComponents(cellScalars->GetNumberOfComponents());
lineScalars->SetNumberOfTuples(2);
for ( i=0; i < numLines; i++)
......
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