Java Code Examples for com.google.zxing.pdf417.PDF417Common#MIN_ROWS_IN_BARCODE

The following examples show how to use com.google.zxing.pdf417.PDF417Common#MIN_ROWS_IN_BARCODE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DetectionResultRowIndicatorColumn.java    From ZXing-Orient with Apache License 2.0 4 votes vote down vote up
BarcodeMetadata getBarcodeMetadata() {
  Codeword[] codewords = getCodewords();
  BarcodeValue barcodeColumnCount = new BarcodeValue();
  BarcodeValue barcodeRowCountUpperPart = new BarcodeValue();
  BarcodeValue barcodeRowCountLowerPart = new BarcodeValue();
  BarcodeValue barcodeECLevel = new BarcodeValue();
  for (Codeword codeword : codewords) {
    if (codeword == null) {
      continue;
    }
    codeword.setRowNumberAsRowIndicatorColumn();
    int rowIndicatorValue = codeword.getValue() % 30;
    int codewordRowNumber = codeword.getRowNumber();
    if (!isLeft) {
      codewordRowNumber += 2;
    }
    switch (codewordRowNumber % 3) {
      case 0:
        barcodeRowCountUpperPart.setValue(rowIndicatorValue * 3 + 1);
        break;
      case 1:
        barcodeECLevel.setValue(rowIndicatorValue / 3);
        barcodeRowCountLowerPart.setValue(rowIndicatorValue % 3);
        break;
      case 2:
        barcodeColumnCount.setValue(rowIndicatorValue + 1);
        break;
    }
  }
  // Maybe we should check if we have ambiguous values?
  if ((barcodeColumnCount.getValue().length == 0) ||
      (barcodeRowCountUpperPart.getValue().length == 0) ||
      (barcodeRowCountLowerPart.getValue().length == 0) ||
      (barcodeECLevel.getValue().length == 0) ||
      barcodeColumnCount.getValue()[0] < 1 ||
      barcodeRowCountUpperPart.getValue()[0] + barcodeRowCountLowerPart.getValue()[0] < PDF417Common.MIN_ROWS_IN_BARCODE ||
      barcodeRowCountUpperPart.getValue()[0] + barcodeRowCountLowerPart.getValue()[0] > PDF417Common.MAX_ROWS_IN_BARCODE) {
    return null;
  }
  BarcodeMetadata barcodeMetadata = new BarcodeMetadata(barcodeColumnCount.getValue()[0],
      barcodeRowCountUpperPart.getValue()[0], barcodeRowCountLowerPart.getValue()[0], barcodeECLevel.getValue()[0]);
  removeIncorrectCodewords(codewords, barcodeMetadata);
  return barcodeMetadata;
}
 
Example 2
Source File: DetectionResultRowIndicatorColumn.java    From analyzer-of-android-for-Apache-Weex with Apache License 2.0 4 votes vote down vote up
BarcodeMetadata getBarcodeMetadata() {
  Codeword[] codewords = getCodewords();
  BarcodeValue barcodeColumnCount = new BarcodeValue();
  BarcodeValue barcodeRowCountUpperPart = new BarcodeValue();
  BarcodeValue barcodeRowCountLowerPart = new BarcodeValue();
  BarcodeValue barcodeECLevel = new BarcodeValue();
  for (Codeword codeword : codewords) {
    if (codeword == null) {
      continue;
    }
    codeword.setRowNumberAsRowIndicatorColumn();
    int rowIndicatorValue = codeword.getValue() % 30;
    int codewordRowNumber = codeword.getRowNumber();
    if (!isLeft) {
      codewordRowNumber += 2;
    }
    switch (codewordRowNumber % 3) {
      case 0:
        barcodeRowCountUpperPart.setValue(rowIndicatorValue * 3 + 1);
        break;
      case 1:
        barcodeECLevel.setValue(rowIndicatorValue / 3);
        barcodeRowCountLowerPart.setValue(rowIndicatorValue % 3);
        break;
      case 2:
        barcodeColumnCount.setValue(rowIndicatorValue + 1);
        break;
    }
  }
  // Maybe we should check if we have ambiguous values?
  if ((barcodeColumnCount.getValue().length == 0) ||
      (barcodeRowCountUpperPart.getValue().length == 0) ||
      (barcodeRowCountLowerPart.getValue().length == 0) ||
      (barcodeECLevel.getValue().length == 0) ||
      barcodeColumnCount.getValue()[0] < 1 ||
      barcodeRowCountUpperPart.getValue()[0] + barcodeRowCountLowerPart.getValue()[0] < PDF417Common.MIN_ROWS_IN_BARCODE ||
      barcodeRowCountUpperPart.getValue()[0] + barcodeRowCountLowerPart.getValue()[0] > PDF417Common.MAX_ROWS_IN_BARCODE) {
    return null;
  }
  BarcodeMetadata barcodeMetadata = new BarcodeMetadata(barcodeColumnCount.getValue()[0],
      barcodeRowCountUpperPart.getValue()[0], barcodeRowCountLowerPart.getValue()[0], barcodeECLevel.getValue()[0]);
  removeIncorrectCodewords(codewords, barcodeMetadata);
  return barcodeMetadata;
}
 
Example 3
Source File: DetectionResultRowIndicatorColumn.java    From weex with Apache License 2.0 4 votes vote down vote up
BarcodeMetadata getBarcodeMetadata() {
  Codeword[] codewords = getCodewords();
  BarcodeValue barcodeColumnCount = new BarcodeValue();
  BarcodeValue barcodeRowCountUpperPart = new BarcodeValue();
  BarcodeValue barcodeRowCountLowerPart = new BarcodeValue();
  BarcodeValue barcodeECLevel = new BarcodeValue();
  for (Codeword codeword : codewords) {
    if (codeword == null) {
      continue;
    }
    codeword.setRowNumberAsRowIndicatorColumn();
    int rowIndicatorValue = codeword.getValue() % 30;
    int codewordRowNumber = codeword.getRowNumber();
    if (!isLeft) {
      codewordRowNumber += 2;
    }
    switch (codewordRowNumber % 3) {
      case 0:
        barcodeRowCountUpperPart.setValue(rowIndicatorValue * 3 + 1);
        break;
      case 1:
        barcodeECLevel.setValue(rowIndicatorValue / 3);
        barcodeRowCountLowerPart.setValue(rowIndicatorValue % 3);
        break;
      case 2:
        barcodeColumnCount.setValue(rowIndicatorValue + 1);
        break;
    }
  }
  // Maybe we should check if we have ambiguous values?
  if ((barcodeColumnCount.getValue().length == 0) ||
      (barcodeRowCountUpperPart.getValue().length == 0) ||
      (barcodeRowCountLowerPart.getValue().length == 0) ||
      (barcodeECLevel.getValue().length == 0) ||
      barcodeColumnCount.getValue()[0] < 1 ||
      barcodeRowCountUpperPart.getValue()[0] + barcodeRowCountLowerPart.getValue()[0] < PDF417Common.MIN_ROWS_IN_BARCODE ||
      barcodeRowCountUpperPart.getValue()[0] + barcodeRowCountLowerPart.getValue()[0] > PDF417Common.MAX_ROWS_IN_BARCODE) {
    return null;
  }
  BarcodeMetadata barcodeMetadata = new BarcodeMetadata(barcodeColumnCount.getValue()[0],
      barcodeRowCountUpperPart.getValue()[0], barcodeRowCountLowerPart.getValue()[0], barcodeECLevel.getValue()[0]);
  removeIncorrectCodewords(codewords, barcodeMetadata);
  return barcodeMetadata;
}
 
Example 4
Source File: DetectionResultRowIndicatorColumn.java    From barcodescanner-lib-aar with MIT License 4 votes vote down vote up
BarcodeMetadata getBarcodeMetadata() {
  Codeword[] codewords = getCodewords();
  BarcodeValue barcodeColumnCount = new BarcodeValue();
  BarcodeValue barcodeRowCountUpperPart = new BarcodeValue();
  BarcodeValue barcodeRowCountLowerPart = new BarcodeValue();
  BarcodeValue barcodeECLevel = new BarcodeValue();
  for (Codeword codeword : codewords) {
    if (codeword == null) {
      continue;
    }
    codeword.setRowNumberAsRowIndicatorColumn();
    int rowIndicatorValue = codeword.getValue() % 30;
    int codewordRowNumber = codeword.getRowNumber();
    if (!isLeft) {
      codewordRowNumber += 2;
    }
    switch (codewordRowNumber % 3) {
      case 0:
        barcodeRowCountUpperPart.setValue(rowIndicatorValue * 3 + 1);
        break;
      case 1:
        barcodeECLevel.setValue(rowIndicatorValue / 3);
        barcodeRowCountLowerPart.setValue(rowIndicatorValue % 3);
        break;
      case 2:
        barcodeColumnCount.setValue(rowIndicatorValue + 1);
        break;
    }
  }
  // Maybe we should check if we have ambiguous values?
  if ((barcodeColumnCount.getValue().length == 0) ||
      (barcodeRowCountUpperPart.getValue().length == 0) ||
      (barcodeRowCountLowerPart.getValue().length == 0) ||
      (barcodeECLevel.getValue().length == 0) ||
      barcodeColumnCount.getValue()[0] < 1 ||
      barcodeRowCountUpperPart.getValue()[0] + barcodeRowCountLowerPart.getValue()[0] < PDF417Common.MIN_ROWS_IN_BARCODE ||
      barcodeRowCountUpperPart.getValue()[0] + barcodeRowCountLowerPart.getValue()[0] > PDF417Common.MAX_ROWS_IN_BARCODE) {
    return null;
  }
  BarcodeMetadata barcodeMetadata = new BarcodeMetadata(barcodeColumnCount.getValue()[0],
      barcodeRowCountUpperPart.getValue()[0], barcodeRowCountLowerPart.getValue()[0], barcodeECLevel.getValue()[0]);
  removeIncorrectCodewords(codewords, barcodeMetadata);
  return barcodeMetadata;
}