当前位置: 首页>>代码示例>>Java>>正文


Java ExpandedProductParsedResult类代码示例

本文整理汇总了Java中com.google.zxing.client.result.ExpandedProductParsedResult的典型用法代码示例。如果您正苦于以下问题:Java ExpandedProductParsedResult类的具体用法?Java ExpandedProductParsedResult怎么用?Java ExpandedProductParsedResult使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ExpandedProductParsedResult类属于com.google.zxing.client.result包,在下文中一共展示了ExpandedProductParsedResult类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleButtonPress

import com.google.zxing.client.result.ExpandedProductParsedResult; //导入依赖的package包/类
@Override
public void handleButtonPress(int index) {
    ParsedResult rawResult = getResult();
    String productID;
    if (rawResult instanceof ProductParsedResult) {
        productID = ((ProductParsedResult) rawResult).getNormalizedProductID();
    } else if (rawResult instanceof ExpandedProductParsedResult) {
        productID = ((ExpandedProductParsedResult) rawResult).getRawText();
    } else {
        throw new IllegalArgumentException(rawResult.getClass().toString());
    }
    switch (index) {
        case 0:
            openProductSearch(productID);
            break;
        case 1:
            webSearch(productID);
            break;
        case 2:
            openURL(fillInCustomSearchURL(productID));
            break;
    }
}
 
开发者ID:yakovenkodenis,项目名称:Discounty,代码行数:24,代码来源:ProductResultHandler.java

示例2: assertCorrectImage2result

import com.google.zxing.client.result.ExpandedProductParsedResult; //导入依赖的package包/类
private static void assertCorrectImage2result(String fileName, ExpandedProductParsedResult expected)
    throws IOException, NotFoundException {
  Path path = AbstractBlackBoxTestCase.buildTestBase("src/test/resources/blackbox/rssexpanded-1/").resolve(fileName);

  BufferedImage image = ImageIO.read(path.toFile());
  BinaryBitmap binaryMap = new BinaryBitmap(new GlobalHistogramBinarizer(new BufferedImageLuminanceSource(image)));
  int rowNumber = binaryMap.getHeight() / 2;
  BitArray row = binaryMap.getBlackRow(rowNumber, null);

  Result theResult;
  try {
    RSSExpandedReader rssExpandedReader = new RSSExpandedReader();
    theResult = rssExpandedReader.decodeRow(rowNumber, row, null);
  } catch (ReaderException re) {
    fail(re.toString());
    return;
  }

  assertSame(BarcodeFormat.RSS_EXPANDED, theResult.getBarcodeFormat());

  ParsedResult result = ResultParser.parseResult(theResult);

  assertEquals(expected, result);
}
 
开发者ID:srowen,项目名称:zxing-bsplus,代码行数:25,代码来源:RSSExpandedImage2resultTestCase.java

示例3: assertCorrectImage2result

import com.google.zxing.client.result.ExpandedProductParsedResult; //导入依赖的package包/类
private static void assertCorrectImage2result(String path, ExpandedProductParsedResult expected)
    throws IOException, NotFoundException {
  RSSExpandedReader rssExpandedReader = new RSSExpandedReader();

  File file = new File(path);
  if (!file.exists()) {
    // Support running from project root too
    file = new File("core", path);
  }

  BufferedImage image = ImageIO.read(file);
  BinaryBitmap binaryMap = new BinaryBitmap(new GlobalHistogramBinarizer(new BufferedImageLuminanceSource(image)));
  int rowNumber = binaryMap.getHeight() / 2;
  BitArray row = binaryMap.getBlackRow(rowNumber, null);

  Result theResult = rssExpandedReader.decodeRow(rowNumber, row, null);

  assertSame(BarcodeFormat.RSS_EXPANDED, theResult.getBarcodeFormat());

  ParsedResult result = ResultParser.parseResult(theResult);

  assertEquals(expected, result);
}
 
开发者ID:da-baumann,项目名称:dev,代码行数:24,代码来源:RSSExpandedImage2resultTestCase.java

示例4: getProductIDFromResult

import com.google.zxing.client.result.ExpandedProductParsedResult; //导入依赖的package包/类
private static String getProductIDFromResult(ParsedResult rawResult) {
  if (rawResult instanceof ProductParsedResult) {
    return ((ProductParsedResult) rawResult).getNormalizedProductID();
  }
  if (rawResult instanceof ExpandedProductParsedResult) {
    return ((ExpandedProductParsedResult) rawResult).getRawText();
  }
  throw new IllegalArgumentException(rawResult.getClass().toString());
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:10,代码来源:ProductResultHandler.java

示例5: getProductIDFromResult

import com.google.zxing.client.result.ExpandedProductParsedResult; //导入依赖的package包/类
private static String getProductIDFromResult(ParsedResult rawResult) {
    if (rawResult instanceof ProductParsedResult) {
        return ((ProductParsedResult) rawResult).getNormalizedProductID();
    }
    if (rawResult instanceof ExpandedProductParsedResult) {
        return ((ExpandedProductParsedResult) rawResult).getRawText();
    }
    throw new IllegalArgumentException(rawResult.getClass().toString());
}
 
开发者ID:xiong-it,项目名称:ZXingAndroidExt,代码行数:10,代码来源:ProductResultHandler.java

示例6: getProductIDFromResult

import com.google.zxing.client.result.ExpandedProductParsedResult; //导入依赖的package包/类
private static String getProductIDFromResult(ParsedResult rawResult) {
	if (rawResult instanceof ProductParsedResult) {
		return ((ProductParsedResult) rawResult).getNormalizedProductID();
	}
	if (rawResult instanceof ExpandedProductParsedResult) {
		return ((ExpandedProductParsedResult) rawResult).getRawText();
	}
	throw new IllegalArgumentException(rawResult.getClass().toString());
}
 
开发者ID:xiong-it,项目名称:PortraitZXing,代码行数:10,代码来源:ProductResultHandler.java

示例7: testDecodeRow2result_2

import com.google.zxing.client.result.ExpandedProductParsedResult; //导入依赖的package包/类
@Test
public void testDecodeRow2result_2() throws Exception {
  // (01)90012345678908(3103)001750
  ExpandedProductParsedResult expected =
      new ExpandedProductParsedResult("(01)90012345678908(3103)001750",
                                      "90012345678908",
                                      null, null, null, null, null, null,
                                      "001750",
                                      ExpandedProductParsedResult.KILOGRAM,
                                      "3", null, null, null, new HashMap<String,String>());

  assertCorrectImage2result("2.png", expected);
}
 
开发者ID:srowen,项目名称:zxing-bsplus,代码行数:14,代码来源:RSSExpandedImage2resultTestCase.java

示例8: testDecodeRow2result_2

import com.google.zxing.client.result.ExpandedProductParsedResult; //导入依赖的package包/类
@Test
public void testDecodeRow2result_2() throws Exception {
  // (01)90012345678908(3103)001750
  String path = "test/data/blackbox/rssexpanded-1/2.jpg";
  ExpandedProductParsedResult expected =
      new ExpandedProductParsedResult("90012345678908",
                                      null, null, null, null, null, null,
                                      "001750",
                                      ExpandedProductParsedResult.KILOGRAM,
                                      "3", null, null, null, new HashMap<String,String>());

  assertCorrectImage2result(path, expected);
}
 
开发者ID:da-baumann,项目名称:dev,代码行数:14,代码来源:RSSExpandedImage2resultTestCase.java

示例9: testDecodeRow2result_2

import com.google.zxing.client.result.ExpandedProductParsedResult; //导入依赖的package包/类
@Test
public void testDecodeRow2result_2() throws Exception {
  // (01)90012345678908(3103)001750
  String path = "test/data/blackbox/rssexpanded-1/2.png";
  ExpandedProductParsedResult expected =
      new ExpandedProductParsedResult("(01)90012345678908(3103)001750",
                                      "90012345678908",
                                      null, null, null, null, null, null,
                                      "001750",
                                      ExpandedProductParsedResult.KILOGRAM,
                                      "3", null, null, null, new HashMap<String,String>());

  assertCorrectImage2result(path, expected);
}
 
开发者ID:yinglovezhuzhu,项目名称:ZxingCore,代码行数:15,代码来源:RSSExpandedImage2resultTestCase.java

示例10: assertCorrectImage2result

import com.google.zxing.client.result.ExpandedProductParsedResult; //导入依赖的package包/类
private static void assertCorrectImage2result(String path, ExpandedProductParsedResult expected)
    throws IOException, NotFoundException {

  File file = new File(path);
  if (!file.exists()) {
    // Support running from project root too
    file = new File("core", path);
  }

  BufferedImage image = ImageIO.read(file);
  BinaryBitmap binaryMap = new BinaryBitmap(new GlobalHistogramBinarizer(new BufferedImageLuminanceSource(image)));
  int rowNumber = binaryMap.getHeight() / 2;
  BitArray row = binaryMap.getBlackRow(rowNumber, null);

  Result theResult;
  try {
    RSSExpandedReader rssExpandedReader = new RSSExpandedReader();
    theResult = rssExpandedReader.decodeRow(rowNumber, row, null);
  } catch (ReaderException re) {
    fail(re.toString());
    return;
  }

  assertSame(BarcodeFormat.RSS_EXPANDED, theResult.getBarcodeFormat());

  ParsedResult result = ResultParser.parseResult(theResult);

  assertEquals(expected, result);
}
 
开发者ID:yinglovezhuzhu,项目名称:ZxingCore,代码行数:30,代码来源:RSSExpandedImage2resultTestCase.java


注:本文中的com.google.zxing.client.result.ExpandedProductParsedResult类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。