Issue 495: Renamed DATAMATRIX to DATA_MATRIX for consistency.

git-svn-id: https://zxing.googlecode.com/svn/trunk@1508 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
dswitkin@google.com 2010-08-05 15:22:30 +00:00
parent 17b9952822
commit 2cb4f5f82b
7 changed files with 24 additions and 23 deletions

View file

@ -33,7 +33,7 @@ public final class BarcodeFormat {
public static final BarcodeFormat QR_CODE = new BarcodeFormat("QR_CODE"); public static final BarcodeFormat QR_CODE = new BarcodeFormat("QR_CODE");
/** DataMatrix 2D barcode format. */ /** DataMatrix 2D barcode format. */
public static final BarcodeFormat DATAMATRIX = new BarcodeFormat("DATAMATRIX"); public static final BarcodeFormat DATA_MATRIX = new BarcodeFormat("DATA_MATRIX");
/** UPC-E 1D format. */ /** UPC-E 1D format. */
public static final BarcodeFormat UPC_E = new BarcodeFormat("UPC_E"); public static final BarcodeFormat UPC_E = new BarcodeFormat("UPC_E");
@ -58,7 +58,7 @@ public final class BarcodeFormat {
/** Code 93 1D format. */ /** Code 93 1D format. */
public static final BarcodeFormat CODE_93 = new BarcodeFormat("CODE_93"); public static final BarcodeFormat CODE_93 = new BarcodeFormat("CODE_93");
/** CODABAR 1D format. */ /** CODABAR 1D format. */
public static final BarcodeFormat CODABAR = new BarcodeFormat("CODABAR"); public static final BarcodeFormat CODABAR = new BarcodeFormat("CODABAR");
@ -70,7 +70,7 @@ public final class BarcodeFormat {
/** PDF417 format. */ /** PDF417 format. */
public static final BarcodeFormat PDF417 = new BarcodeFormat("PDF417"); public static final BarcodeFormat PDF417 = new BarcodeFormat("PDF417");
/** RSS EXPANDED */ /** RSS EXPANDED */
public static final BarcodeFormat RSS_EXPANDED = new BarcodeFormat("RSS_EXPANDED"); public static final BarcodeFormat RSS_EXPANDED = new BarcodeFormat("RSS_EXPANDED");

View file

@ -104,7 +104,7 @@ public final class MultiFormatReader implements Reader {
formats.contains(BarcodeFormat.CODE_93) || formats.contains(BarcodeFormat.CODE_93) ||
formats.contains(BarcodeFormat.CODE_128) || formats.contains(BarcodeFormat.CODE_128) ||
formats.contains(BarcodeFormat.ITF) || formats.contains(BarcodeFormat.ITF) ||
formats.contains(BarcodeFormat.RSS14) || formats.contains(BarcodeFormat.RSS14) ||
formats.contains(BarcodeFormat.RSS_EXPANDED); formats.contains(BarcodeFormat.RSS_EXPANDED);
// Put 1D readers upfront in "normal" mode // Put 1D readers upfront in "normal" mode
if (addOneDReader && !tryHarder) { if (addOneDReader && !tryHarder) {
@ -113,7 +113,7 @@ public final class MultiFormatReader implements Reader {
if (formats.contains(BarcodeFormat.QR_CODE)) { if (formats.contains(BarcodeFormat.QR_CODE)) {
readers.addElement(new QRCodeReader()); readers.addElement(new QRCodeReader());
} }
if (formats.contains(BarcodeFormat.DATAMATRIX)) { if (formats.contains(BarcodeFormat.DATA_MATRIX)) {
readers.addElement(new DataMatrixReader()); readers.addElement(new DataMatrixReader());
} }
if (formats.contains(BarcodeFormat.PDF417)) { if (formats.contains(BarcodeFormat.PDF417)) {
@ -129,13 +129,13 @@ public final class MultiFormatReader implements Reader {
readers.addElement(new MultiFormatOneDReader(hints)); readers.addElement(new MultiFormatOneDReader(hints));
} }
readers.addElement(new QRCodeReader()); readers.addElement(new QRCodeReader());
// TODO re-enable once Data Matrix is ready // TODO re-enable once Data Matrix is ready
// readers.addElement(new DataMatrixReader()); // readers.addElement(new DataMatrixReader());
// TODO: Enable once PDF417 has passed QA // TODO: Enable once PDF417 has passed QA
//readers.addElement(new PDF417Reader()); //readers.addElement(new PDF417Reader());
if (tryHarder) { if (tryHarder) {
readers.addElement(new MultiFormatOneDReader(hints)); readers.addElement(new MultiFormatOneDReader(hints));
} }

View file

@ -42,7 +42,7 @@ import java.util.Hashtable;
public final class DataMatrixReader implements Reader { public final class DataMatrixReader implements Reader {
private static final ResultPoint[] NO_POINTS = new ResultPoint[0]; private static final ResultPoint[] NO_POINTS = new ResultPoint[0];
private final Decoder decoder = new Decoder(); private final Decoder decoder = new Decoder();
/** /**
@ -70,7 +70,8 @@ public final class DataMatrixReader implements Reader {
decoderResult = decoder.decode(detectorResult.getBits()); decoderResult = decoder.decode(detectorResult.getBits());
points = detectorResult.getPoints(); points = detectorResult.getPoints();
} }
Result result = new Result(decoderResult.getText(), decoderResult.getRawBytes(), points, BarcodeFormat.DATAMATRIX); Result result = new Result(decoderResult.getText(), decoderResult.getRawBytes(), points,
BarcodeFormat.DATA_MATRIX);
if (decoderResult.getByteSegments() != null) { if (decoderResult.getByteSegments() != null) {
result.putMetadata(ResultMetadataType.BYTE_SEGMENTS, decoderResult.getByteSegments()); result.putMetadata(ResultMetadataType.BYTE_SEGMENTS, decoderResult.getByteSegments());
} }
@ -90,7 +91,7 @@ public final class DataMatrixReader implements Reader {
* around it. This is a specialized method that works exceptionally fast in this special * around it. This is a specialized method that works exceptionally fast in this special
* case. * case.
* *
* @see com.google.zxing.qrcode.QRCodeReader#extractPureBits(BitMatrix) * @see com.google.zxing.qrcode.QRCodeReader#extractPureBits(BitMatrix)
*/ */
private static BitMatrix extractPureBits(BitMatrix image) throws NotFoundException { private static BitMatrix extractPureBits(BitMatrix image) throws NotFoundException {
@ -132,7 +133,7 @@ public final class DataMatrixReader implements Reader {
int dimension = 2 + ((rowEndOfSymbol - x) / moduleSize); int dimension = 2 + ((rowEndOfSymbol - x) / moduleSize);
y += moduleSize; y += moduleSize;
// Push in the "border" by half the module width so that we start // Push in the "border" by half the module width so that we start
// sampling in the middle of the module. Just in case the image is a // sampling in the middle of the module. Just in case the image is a
// little off, this will help recover. // little off, this will help recover.

View file

@ -26,7 +26,7 @@ public final class DataMatrixBlackBox1TestCase extends AbstractBlackBoxTestCase
public DataMatrixBlackBox1TestCase() { public DataMatrixBlackBox1TestCase() {
// TODO use MultiFormatReader here once Data Matrix decoder is done // TODO use MultiFormatReader here once Data Matrix decoder is done
super("test/data/blackbox/datamatrix-1", new DataMatrixReader(), BarcodeFormat.DATAMATRIX); super("test/data/blackbox/datamatrix-1", new DataMatrixReader(), BarcodeFormat.DATA_MATRIX);
addTest(7, 7, 0.0f); addTest(7, 7, 0.0f);
addTest(7, 7, 90.0f); addTest(7, 7, 90.0f);
addTest(6, 6, 180.0f); addTest(6, 6, 180.0f);

View file

@ -26,7 +26,7 @@ public final class DataMatrixBlackBox2TestCase extends AbstractBlackBoxTestCase
public DataMatrixBlackBox2TestCase() { public DataMatrixBlackBox2TestCase() {
// TODO use MultiFormatReader here once Data Matrix decoder is done // TODO use MultiFormatReader here once Data Matrix decoder is done
super("test/data/blackbox/datamatrix-2", new DataMatrixReader(), BarcodeFormat.DATAMATRIX); super("test/data/blackbox/datamatrix-2", new DataMatrixReader(), BarcodeFormat.DATA_MATRIX);
addTest(4, 4, 0.0f); addTest(4, 4, 0.0f);
addTest(1, 1, 90.0f); addTest(1, 1, 90.0f);
addTest(3, 3, 180.0f); addTest(3, 3, 180.0f);

View file

@ -114,14 +114,14 @@ public final class CommandLineRunner {
vector.addElement(BarcodeFormat.UPC_E); vector.addElement(BarcodeFormat.UPC_E);
vector.addElement(BarcodeFormat.EAN_13); vector.addElement(BarcodeFormat.EAN_13);
vector.addElement(BarcodeFormat.EAN_8); vector.addElement(BarcodeFormat.EAN_8);
vector.addElement(BarcodeFormat.RSS14); vector.addElement(BarcodeFormat.RSS14);
if (!productsOnly) { if (!productsOnly) {
vector.addElement(BarcodeFormat.CODE_39); vector.addElement(BarcodeFormat.CODE_39);
vector.addElement(BarcodeFormat.CODE_93); vector.addElement(BarcodeFormat.CODE_93);
vector.addElement(BarcodeFormat.CODE_128); vector.addElement(BarcodeFormat.CODE_128);
vector.addElement(BarcodeFormat.ITF); vector.addElement(BarcodeFormat.ITF);
vector.addElement(BarcodeFormat.QR_CODE); vector.addElement(BarcodeFormat.QR_CODE);
vector.addElement(BarcodeFormat.DATAMATRIX); vector.addElement(BarcodeFormat.DATA_MATRIX);
vector.addElement(BarcodeFormat.PDF417); vector.addElement(BarcodeFormat.PDF417);
//vector.addElement(BarcodeFormat.CODABAR); //vector.addElement(BarcodeFormat.CODABAR);
} }
@ -239,7 +239,7 @@ public final class CommandLineRunner {
System.out.println(uri.toString() + " (format: " + result.getBarcodeFormat() + System.out.println(uri.toString() + " (format: " + result.getBarcodeFormat() +
", type: " + parsedResult.getType() + "):\nRaw result:\n" + result.getText() + ", type: " + parsedResult.getType() + "):\nRaw result:\n" + result.getText() +
"\nParsed result:\n" + parsedResult.getDisplayResult()); "\nParsed result:\n" + parsedResult.getDisplayResult());
System.out.println("Also, there were " + result.getResultPoints().length + " result points."); System.out.println("Also, there were " + result.getResultPoints().length + " result points.");
for (int i = 0; i < result.getResultPoints().length; i++) { for (int i = 0; i < result.getResultPoints().length; i++) {
ResultPoint rp = result.getResultPoints()[i]; ResultPoint rp = result.getResultPoints()[i];

View file

@ -107,13 +107,13 @@ public final class DecodeServlet extends HttpServlet {
possibleFormats.add(BarcodeFormat.EAN_8); possibleFormats.add(BarcodeFormat.EAN_8);
possibleFormats.add(BarcodeFormat.EAN_13); possibleFormats.add(BarcodeFormat.EAN_13);
possibleFormats.add(BarcodeFormat.CODE_39); possibleFormats.add(BarcodeFormat.CODE_39);
possibleFormats.add(BarcodeFormat.CODE_93); possibleFormats.add(BarcodeFormat.CODE_93);
possibleFormats.add(BarcodeFormat.CODE_128); possibleFormats.add(BarcodeFormat.CODE_128);
//possibleFormats.add(BarcodeFormat.CODABAR); //possibleFormats.add(BarcodeFormat.CODABAR);
possibleFormats.add(BarcodeFormat.ITF); possibleFormats.add(BarcodeFormat.ITF);
possibleFormats.add(BarcodeFormat.RSS14); possibleFormats.add(BarcodeFormat.RSS14);
possibleFormats.add(BarcodeFormat.QR_CODE); possibleFormats.add(BarcodeFormat.QR_CODE);
possibleFormats.add(BarcodeFormat.DATAMATRIX); possibleFormats.add(BarcodeFormat.DATA_MATRIX);
possibleFormats.add(BarcodeFormat.PDF417); possibleFormats.add(BarcodeFormat.PDF417);
HINTS.put(DecodeHintType.POSSIBLE_FORMATS, possibleFormats); HINTS.put(DecodeHintType.POSSIBLE_FORMATS, possibleFormats);
HINTS_PURE = new Hashtable<DecodeHintType, Object>(HINTS); HINTS_PURE = new Hashtable<DecodeHintType, Object>(HINTS);
@ -286,11 +286,11 @@ public final class DecodeServlet extends HttpServlet {
} }
if (image == null) { if (image == null) {
response.sendRedirect("badimage.jspx"); response.sendRedirect("badimage.jspx");
return; return;
} }
if (image.getHeight() <= 1 || image.getWidth() <= 1 || if (image.getHeight() <= 1 || image.getWidth() <= 1 ||
image.getHeight() * image.getWidth() > MAX_PIXELS) { image.getHeight() * image.getWidth() > MAX_PIXELS) {
log.fine("Dimensions too large: " + image.getWidth() + 'x' + image.getHeight()); log.fine("Dimensions too large: " + image.getWidth() + 'x' + image.getHeight());
response.sendRedirect("badimage.jspx"); response.sendRedirect("badimage.jspx");
return; return;
} }