Commit d10d7093 authored by Berk Geveci's avatar Berk Geveci
Browse files

More progress. Everything compiles now

parent 56788e10
......@@ -38,9 +38,7 @@ int TestHistogram2D(int, char * [])
vtkNew<vtkImageData> data;
data->SetExtent(0, size-1, 0, size-1, 0, 0);
data->SetNumberOfScalarComponents(1);
data->SetScalarTypeToDouble();
data->AllocateScalars();
data->AllocateScalars(VTK_DOUBLE, 1);
data->SetOrigin(100.0, 0.0, 0.0);
data->SetSpacing(2.0, 1.0, 1.0);
......
......@@ -170,9 +170,7 @@ void vtkColorLegend::ComputeTexture()
this->ImageData->SetExtent(0, 0,
0, dimension-1,
0, 0);
this->ImageData->SetNumberOfScalarComponents(3);
this->ImageData->SetScalarTypeToUnsignedChar();
this->ImageData->AllocateScalars();
this->ImageData->AllocateScalars(VTK_UNSIGNED_CHAR, 3);
for (int i = 0; i < dimension; ++i)
{
......
......@@ -106,9 +106,7 @@ void vtkColorTransferFunctionItem::ComputeTexture()
this->Texture->SetExtent(0, dimension-1,
0, 0,
0, 0);
this->Texture->SetNumberOfScalarComponents(4);
this->Texture->SetScalarTypeToUnsignedChar();
this->Texture->AllocateScalars();
this->Texture->AllocateScalars(VTK_UNSIGNED_CHAR, 4);
for (int i = 0; i < dimension; ++i)
{
......
......@@ -96,9 +96,7 @@ void vtkLookupTableItem::ComputeTexture()
this->Texture->SetExtent(0, dimension - 1,
0,0,
0,0);
this->Texture->SetNumberOfScalarComponents(4);
this->Texture->SetScalarTypeToUnsignedChar();
this->Texture->AllocateScalars();
this->Texture->AllocateScalars(VTK_UNSIGNED_CHAR, 4);
// TODO: Support log scale ?
double bounds[4];
this->GetBounds(bounds);
......
......@@ -108,9 +108,7 @@ void vtkPiecewiseFunctionItem::ComputeTexture()
this->Texture->SetExtent(0, dimension-1,
0, 0,
0, 0);
this->Texture->SetNumberOfScalarComponents(4);
this->Texture->SetScalarTypeToUnsignedChar();
this->Texture->AllocateScalars();
this->Texture->AllocateScalars(VTK_UNSIGNED_CHAR, 4);
this->PiecewiseFunction->GetTable(bounds[0], bounds[1], dimension, values);
unsigned char* ptr =
......
......@@ -126,9 +126,7 @@ void vtkPlotHistogram2D::GenerateHistogram()
this->Output = vtkSmartPointer<vtkImageData>::New();
}
this->Output->SetExtent(this->Input->GetExtent());
this->Output->SetNumberOfScalarComponents(4);
this->Output->SetScalarTypeToUnsignedChar();
this->Output->AllocateScalars();
this->Output->AllocateScalars(VTK_UNSIGNED_CHAR, 4);
int dimension = this->Input->GetDimensions()[0] * this->Input->GetDimensions()[1];
double *input = reinterpret_cast<double *>(this->Input->GetScalarPointer());
......
......@@ -228,8 +228,6 @@ void vtkPlotPoints::GeneraterMarker(int width, bool highlight)
if (!this->Marker)
{
this->Marker = vtkImageData::New();
this->Marker->SetScalarTypeToUnsignedChar();
this->Marker->SetNumberOfScalarComponents(4);
}
else
{
......@@ -247,8 +245,6 @@ void vtkPlotPoints::GeneraterMarker(int width, bool highlight)
if (!this->HighlightMarker)
{
this->HighlightMarker = vtkImageData::New();
this->HighlightMarker->SetScalarTypeToUnsignedChar();
this->HighlightMarker->SetNumberOfScalarComponents(4);
data = this->HighlightMarker;
}
else
......@@ -264,7 +260,7 @@ void vtkPlotPoints::GeneraterMarker(int width, bool highlight)
}
data->SetExtent(0, width-1, 0, width-1, 0, 0);
data->AllocateScalars();
data->AllocateScalars(VTK_UNSIGNED_CHAR, 4);
unsigned char* image =
static_cast<unsigned char*>(data->GetScalarPointer());
......
......@@ -122,7 +122,6 @@ int ComparePointLocators(vtkAbstractPointLocator* locator1, vtkAbstractPointLoca
}
}
sgrid->SetPoints(points);
sgrid->Update();
points->Delete();
locator1->SetDataSet(sgrid);
......
......@@ -1338,6 +1338,17 @@ void vtkAlgorithm::Update()
this->GetExecutive()->Update();
}
//----------------------------------------------------------------------------
void vtkAlgorithm::PropagateUpdateExtent()
{
vtkStreamingDemandDrivenPipeline* sddp =
vtkStreamingDemandDrivenPipeline::SafeDownCast(this->GetExecutive());
if (sddp)
{
sddp->PropagateUpdateExtent(-1);
}
}
//----------------------------------------------------------------------------
void vtkAlgorithm::UpdateInformation()
{
......@@ -1532,3 +1543,53 @@ double vtkAlgorithm::ComputePriority()
return sddp->ComputePriority(0);
}
//-------------------------------------------------------------
int vtkAlgorithm::SetUpdateExtentToWholeExtent(
int port, int connection)
{
if (this->GetInputInformation(port, connection))
{
return
vtkStreamingDemandDrivenPipeline::SetUpdateExtentToWholeExtent(
this->GetInputInformation(port, connection));
}
else
{
return 0;
}
}
//-------------------------------------------------------------
int vtkAlgorithm::SetUpdateExtentToWholeExtent()
{
return this->SetUpdateExtentToWholeExtent(0, 0);
}
//-------------------------------------------------------------
void vtkAlgorithm::SetUpdateExtent(int port, int connection,
int piece,
int numPieces,
int ghostLevel)
{
if (this->GetInputInformation(port, connection))
{
vtkStreamingDemandDrivenPipeline::SetUpdateExtent(
this->GetInputInformation(port, connection),
piece,
numPieces,
ghostLevel);
}
}
//-------------------------------------------------------------
void vtkAlgorithm::SetUpdateExtent(int port,
int connection,
int extent[6])
{
if (this->GetInputInformation(port, connection))
{
vtkStreamingDemandDrivenPipeline::SetUpdateExtent(
this->GetInputInformation(port, connection),
extent);
}
}
......@@ -371,9 +371,13 @@ public:
virtual void Update();
// Description:
// Backward compatibility method to invoke UpdateInformation on executive.
// Bring the algorithm's information up-to-date.
virtual void UpdateInformation();
// Description::
// Propagate meta-data upstream.
virtual void PropagateUpdateExtent();
// Description:
// Bring this algorithm's outputs up-to-date.
virtual void UpdateWholeExtent();
......@@ -427,6 +431,47 @@ public:
static vtkInformationIntegerKey* PRESERVES_ATTRIBUTES();
static vtkInformationIntegerKey* PRESERVES_RANGES();
// Description:
// If the whole input extent is required to generate the requested output
// extent, this method can be called to set the input update extent to the
// whole input extent. This method assumes that the whole extent is known
// (that UpdateInformation has been called).
// This function has no effect is input connection is not established.
int SetUpdateExtentToWholeExtent(int port, int connection);
// Description:
// Convenience function equivalent to SetUpdateExtentToWholeExtent(0, 0)
// This function has no effect is input connection is not established.
int SetUpdateExtentToWholeExtent();
// Description:
// Set the update extent in terms of piece and ghost levels.
// This function has no effect is input connection is not established.
void SetUpdateExtent(int port, int connection,
int piece,int numPieces, int ghostLevel);
// Description:
// Convenience function equivalent to SetUpdateExtent(0, 0, piece,
// numPieces, ghostLevel)
// This function has no effect is input connection is not established.
void SetUpdateExtent(int piece,int numPieces, int ghostLevel)
{
this->SetUpdateExtent(0, 0, piece, numPieces, ghostLevel);
}
// Description:
// Set the update extent for data objects that use 3D extents
// This function has no effect is input connection is not established.
void SetUpdateExtent(int port, int connection, int extent[6]);
// Description:
// Convenience function equivalent to SetUpdateExtent(0, 0, extent)
// This function has no effect is input connection is not established.
void SetUpdateExtent(int extent[6])
{
this->SetUpdateExtent(0, 0, extent);
}
protected:
vtkAlgorithm();
~vtkAlgorithm();
......
......@@ -752,7 +752,7 @@ void vtkDataObject::InternalDataObjectCopy(vtkDataObject *src)
//----------------------------------------------------------------------------
// This should be a pure virutal method.
void vtkDataObject::Crop()
void vtkDataObject::Crop(const int* updateExtent)
{
}
......
......@@ -249,7 +249,7 @@ public:
// Description:
// This method crops the data object (if necesary) so that the extent
// matches the update extent.
virtual void Crop();
virtual void Crop(const int* updateExtent);
//BTX
// Description:
......
......@@ -78,9 +78,9 @@ vtkInformationKeyMacro(vtkStreamingDemandDrivenPipeline, PREVIOUS_FAST_PATH_ID_T
class vtkStreamingDemandDrivenPipelineToDataObjectFriendship
{
public:
static void Crop(vtkDataObject* obj)
static void Crop(vtkDataObject* obj, const int* extent)
{
obj->Crop();
obj->Crop(extent);
}
};
......@@ -270,7 +270,8 @@ int vtkStreamingDemandDrivenPipeline
if(info->Has(EXACT_EXTENT()) && info->Get(EXACT_EXTENT()))
{
vtkDataObject* data = info->Get(vtkDataObject::DATA_OBJECT());
vtkStreamingDemandDrivenPipelineToDataObjectFriendship::Crop(data);
vtkStreamingDemandDrivenPipelineToDataObjectFriendship::Crop(
data, info->Get(UPDATE_EXTENT()));
}
// Clear combined update extent, since the update cycle has completed
if (info->Has(COMBINED_UPDATE_EXTENT()))
......
......@@ -371,8 +371,7 @@ void vtkGeoAlignedImageSource::CropImageForNode(vtkGeoImageNode* node, vtkImageD
vtkSmartPointer<vtkImageData> cropped = vtkSmartPointer<vtkImageData>::New();
cropped->ShallowCopy(image);
cropped->SetUpdateExtent(ext);
cropped->Crop();
cropped->Crop(ext);
// Now set the longitude and latitude range based on the actual image size.
double lonRange[2];
......
......@@ -160,8 +160,7 @@ void vtkGeoImageNode::CropImageForTile(
this->Image = vtkSmartPointer<vtkImageData>::New();
}
this->Image->ShallowCopy(image);
this->Image->SetUpdateExtent(ext);
this->Image->Crop();
this->Image->Crop(ext);
// Now set the longitude and latitude range based on the actual image size.
this->LongitudeRange[0] = origin[0] + ext[0]*spacing[0];
......
......@@ -118,8 +118,6 @@ public:
static void CheckWinding(vtkUnstructuredGrid *data)
{
data->Update();
vtkPoints *points = data->GetPoints();
vtkCellArray *cells = data->GetCells();
......
......@@ -124,9 +124,10 @@ class BoxClipTriangulateFailed { };
//-----------------------------------------------------------------------------
static void CheckWinding(vtkUnstructuredGrid *data)
static void CheckWinding(vtkBoxClipDataSet* alg)
{
data->Update();
alg->Update();
vtkUnstructuredGrid* data = alg->GetOutput();
vtkPoints *points = data->GetPoints();
......@@ -307,7 +308,7 @@ static void Check3DPrimitive(int type, vtkIdType numcells,
iren->Start();
#endif
CheckWinding(output);
CheckWinding(clipper);
VTK_CREATE(vtkDataSetSurfaceFilter, surface);
surface->SetInput(output);
......
......@@ -151,7 +151,6 @@ int TestBareScalarsToColors(int argc, char *argv[])
vtkNew<vtkImageData> image;
image->SetDimensions(80, 80, 1);
image->SetScalarTypeToUnsignedChar();
vtkUnsignedCharArray *colors =
table2->MapScalars(outputs[i], VTK_COLOR_MODE_DEFAULT, outputc);
image->GetPointData()->SetScalars(colors);
......
......@@ -156,7 +156,6 @@ int TestExtraction(int argc, char *argv[])
sampleData->SetSpacing(1.0,1.0,1.0);
sampleData->SetOrigin(0.0,0.0,0.0);
sampleData->SetDimensions(XCELLS+1,YCELLS+1,ZCELLS+1);
sampleData->SetWholeExtent(0,XCELLS+1,0,YCELLS+1,0,ZCELLS+1);
sampleData->AllocateScalars();
vtkIdTypeArray *pia = vtkIdTypeArray::New();
......
......@@ -135,7 +135,6 @@ int TestMapVectorsAsRGBColors(int argc, char *argv[])
vtkSmartPointer<vtkImageData> image =
vtkSmartPointer<vtkImageData>::New();
image->SetDimensions(80, 80, 1);
image->SetScalarTypeToUnsignedChar();
vtkUnsignedCharArray *colors =
table2->MapScalars(outputs[i], VTK_COLOR_MODE_DEFAULT, outputc);
image->GetPointData()->SetScalars(colors);
......
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