likely fix to row indicator problem now a trait

This commit is contained in:
Henry Schimke
2022-12-20 17:43:22 -06:00
parent 925d9338e5
commit a6b9c3efc0
4 changed files with 179 additions and 149 deletions

View File

@@ -18,7 +18,10 @@ use std::fmt::Display;
use crate::pdf417::pdf_417_common;
use super::{BarcodeMetadata, BoundingBox, Codeword, DetectionRXingResultColumn};
use super::{
BarcodeMetadata, BoundingBox, Codeword, DetectionRXingResultColumn,
DetectionRXingResultRowIndicatorColumn,
};
const ADJUST_ROW_NUMBER_SKIP: u32 = 2;
@@ -50,10 +53,9 @@ impl<'a> DetectionRXingResult<'_> {
}
pub fn getDetectionRXingResultColumns(&mut self) -> &Vec<Option<DetectionRXingResultColumn>> {
self.adjustIndicatorColumnRowNumbers(&self.detectionRXingResultColumns[0]);
self.adjustIndicatorColumnRowNumbers(
&self.detectionRXingResultColumns[self.barcodeColumnCount + 1],
);
self.adjustIndicatorColumnRowNumbers(0);
let pos = self.barcodeColumnCount + 1;
self.adjustIndicatorColumnRowNumbers(pos);
let mut unadjustedCodewordCount = pdf_417_common::MAX_CODEWORDS_IN_BARCODE;
let mut previousUnadjustedCount;
loop {
@@ -67,15 +69,18 @@ impl<'a> DetectionRXingResult<'_> {
}
fn adjustIndicatorColumnRowNumbers(
&self,
detectionRXingResultColumn: &Option<DetectionRXingResultColumn>,
&mut self,
pos: usize,
// detectionRXingResultColumn: &mut Option<DetectionRXingResultColumn>,
) {
if let Some(col) = detectionRXingResultColumn {
if self.detectionRXingResultColumns[pos].is_some() {
// if (detectionRXingResultColumn != null) {
// ((DetectionRXingResultRowIndicatorColumn) detectionRXingResultColumn)
// .adjustCompleteIndicatorColumnRowNumbers(barcodeMetadata);
// }
col.as_row_indicator()
self.detectionRXingResultColumns[pos]
.as_mut()
.unwrap()
.adjustCompleteIndicatorColumnRowNumbers(&self.barcodeMetadata);
}
}