Updated cloud io functionality - removed dependency from VTK legacy

This commit is contained in:
Anatoly Baksheev
2014-02-02 19:00:54 +04:00
parent 63dbe66b41
commit eb8728d727
10 changed files with 313 additions and 24 deletions

View File

@@ -61,10 +61,22 @@ void cv::viz::vtkXYZWriter::WriteData()
if (!input)
return;
// OpenVTKFile() will report any errors that happen
ostream *outfilep = this->OpenVTKFile();
if (!outfilep)
if (!this->FileName )
{
vtkErrorMacro(<< "No FileName specified! Can't write!");
this->SetErrorCode(vtkErrorCode::NoFileNameError);
return;
}
vtkDebugMacro(<<"Opening vtk file for writing...");
ostream *outfilep = new ofstream(this->FileName, ios::out);
if (outfilep->fail())
{
vtkErrorMacro(<< "Unable to open file: "<< this->FileName);
this->SetErrorCode(vtkErrorCode::CannotOpenFileError);
delete outfilep;
return;
}
ostream &outfile = *outfilep;
@@ -76,7 +88,8 @@ void cv::viz::vtkXYZWriter::WriteData()
}
// Close the file
this->CloseVTKFile(outfilep);
vtkDebugMacro(<<"Closing vtk file\n");
delete outfilep;
// Delete the file if an error occurred
if (this->ErrorCode == vtkErrorCode::OutOfDiskSpaceError)
@@ -86,8 +99,24 @@ void cv::viz::vtkXYZWriter::WriteData()
}
}
int cv::viz::vtkXYZWriter::FillInputPortInformation(int, vtkInformation *info)
{
info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkPolyData");
return 1;
}
void cv::viz::vtkXYZWriter::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os,indent);
os << indent << "DecimalPrecision: " << this->DecimalPrecision << "\n";
}
vtkPolyData* cv::viz::vtkXYZWriter::GetInput()
{
return vtkPolyData::SafeDownCast(this->Superclass::GetInput());
}
vtkPolyData* cv::viz::vtkXYZWriter::GetInput(int port)
{
return vtkPolyData::SafeDownCast(this->Superclass::GetInput(port));
}