// clang-format off
#if 1
bool canRead(vtkResourceStream* stream) const override
{
  vtkF3DOCCTReader::FILE_FORMAT format;
  bool ret = vtkF3DOCCTReader::CanReadFile(stream, format);
  ret &= (format == vtkF3DOCCTReader::FILE_FORMAT::XBF);
  return ret;
}
#endif

void applyCustomReader(
  vtkAlgorithm* algo, const std::string& vtkNotUsed(fileName), vtkResourceStream*) const override
{
  std::string optName = "XBF.linear_deflection";
  std::string str = this->ReaderOptions.at(optName);
  double linearDeflect = F3DUtils::ParseToDouble(str, 0.1, optName);

  optName = "XBF.angular_deflection";
  str = this->ReaderOptions.at(optName);
  double angularDeflect = F3DUtils::ParseToDouble(str, 0.5, optName);

  optName = "XBF.relative_deflection";
  str = this->ReaderOptions.at(optName);
  bool relativeDeflect = (F3DUtils::ParseToDouble(str, 0, optName) != 0);

  optName = "XBF.read_wire";
  str = this->ReaderOptions.at(optName);
  bool readWire = (F3DUtils::ParseToDouble(str, 1, optName) != 0);

  vtkF3DOCCTReader* occtReader = vtkF3DOCCTReader::SafeDownCast(algo);
  occtReader->RelativeDeflectionOn();
  occtReader->SetLinearDeflection(linearDeflect);
  occtReader->SetAngularDeflection(angularDeflect);
  occtReader->SetRelativeDeflection(relativeDeflect);
  occtReader->SetReadWire(readWire);

  occtReader->SetFileFormat(vtkF3DOCCTReader::FILE_FORMAT::XBF);
}
// clang-format on
