| 259 | |
| 260 | private: |
| 261 | void InsertField() |
| 262 | { |
| 263 | vtkIdType fieldIndex = this->CurrentFieldIndex; |
| 264 | if (this->CurrentRecordIndex == ColumnNamesOnLine) |
| 265 | { |
| 266 | fieldIndex -= SkipColumnNames; |
| 267 | } |
| 268 | |
| 269 | if (fieldIndex >= this->OutputTable->GetNumberOfColumns() && |
| 270 | ColumnNamesOnLine == this->CurrentRecordIndex) |
| 271 | { |
| 272 | vtkDoubleArray* array = vtkDoubleArray::New(); |
| 273 | |
| 274 | array->SetName(this->CurrentField.c_str()); |
| 275 | this->OutputTable->AddColumn(array); |
| 276 | array->Delete(); |
| 277 | } |
| 278 | else if (fieldIndex < this->OutputTable->GetNumberOfColumns()) |
| 279 | { |
| 280 | // Handle case where input file has header information ... |
| 281 | vtkIdType recordIndex; |
| 282 | recordIndex = this->CurrentRecordIndex - HeaderLines; |
| 283 | vtkDoubleArray* array = |
| 284 | vtkArrayDownCast<vtkDoubleArray>(this->OutputTable->GetColumn(fieldIndex)); |
| 285 | |
| 286 | vtkStdString str = this->CurrentField; |
| 287 | bool ok; |
| 288 | double doubleValue = vtkVariant(str).ToDouble(&ok); |
| 289 | if (ok) |
| 290 | { |
| 291 | array->InsertValue(recordIndex, doubleValue); |
| 292 | } |
| 293 | else |
| 294 | { |
| 295 | array->InsertValue(recordIndex, std::numeric_limits<double>::quiet_NaN()); |
| 296 | } |
| 297 | } |
| 298 | } |
| 299 | |
| 300 | vtkIdType MaxRecords; |
| 301 | vtkIdType MaxRecordIndex; |
no test coverage detected