VintaSoft Barcode .NET SDK 15.3: Руководство для .NET разработчика
Vintasoft.Barcode.QualityTests Namespace / ISO15415QualityTestManager Class
Члены типа Объект Синтаксис Пример Иерархия Требования Смотрите также
В этом разделе
    Класс ISO15415QualityTestManager
    В этом разделе
    Предоставляет менеджер теста качества печати штрих-кодов ISO/IEC 15415 для двумерных штрих-кодов.
    Объектная модель
    ISO15415QualityTestSettings BarcodeReader ISO15415QualityTestManager
    Синтаксис
    'Declaration
    
    Public Class ISO15415QualityTestManager
    
    
    public class ISO15415QualityTestManager
    
    
    public __gc class ISO15415QualityTestManager
    
    
    public ref class ISO15415QualityTestManager
    
    
    Пример

    Вот пример, демонстрирующий, как проверить качество печати двумерных штрих-кодов:

       
       
    Imports System.IO   
       
    Imports Vintasoft.Barcode   
    Imports Vintasoft.Barcode.QualityTests   
       
    ''' <summary>
    ''' Shows how to test print quality of 2D barcodes using ISO15415QualityTestManger class.
    ''' </summary>
    Class ISO15415QualityTestManagerExample   
        ''' <summary>
        ''' Runs the quality test.
        ''' </summary>
        Public Shared Sub Test(barcode As BarcodeType, files As String())   
            Using testManager As New ISO15415QualityTestManager(barcode)   
                ' apertue factor = 0.8
                testManager.ApertureFactor = 0.8   
       
                ' barcode cell size (pixels) = undefined
                testManager.BarcodeCellAvgSize = 0   
       
                For Each file As String In files   
                    Console.Write(Path.GetFileName(file) & ": ")   
                    Dim results As ISO15415QualityTest() = testManager.ExecuteTest(file)   
       
                    If results.Length > 1 Then   
                        Throw New Exception("Unexpected barcode count.")   
                    End If   
       
                    If results.Length = 0 Then   
                        Console.WriteLine("No barcode found.")   
                    Else   
                        Dim result As ISO15415QualityTest = results(0)   
                        Console.Write("Found = " & result.BarcodeInfo.Value & "; ")   
                        Console.WriteLine("Scan Grade = " & GradeToString(result.ScanGrade))   
                    End If   
                Next   
            End Using   
        End Sub   
       
        ''' <summary>
        ''' Converts ISO15415 quality grade into string value.
        ''' </summary>
        Private Shared Function GradeToString(grade As ISO15415QualityGrade) As String   
            Return String.Format("{0}({1})", CInt(grade).ToString(), grade)   
        End Function   
    End Class
    
    
    
    using System;
    
    using System.IO;
    
    using Vintasoft.Barcode;
    using Vintasoft.Barcode.QualityTests;
    
    /// <summary>
    /// Shows how to test print quality of 2D barcodes using ISO15415QualityTestManger class.
    /// </summary>
    class ISO15415QualityTestManagerExample
    {
        /// <summary>
        /// Runs the quality test.
        /// </summary>
        public static void Test(BarcodeType barcode, string[] files)
        {
            using (ISO15415QualityTestManager testManager = new ISO15415QualityTestManager(barcode))
            {
                // apertue factor = 0.8
                testManager.ApertureFactor = 0.8;
                
                // barcode cell size (pixels) = undefined
                testManager.BarcodeCellAvgSize = 0;
                
                foreach (string file in files)
                {
                    Console.Write(Path.GetFileName(file) + ": ");
                    ISO15415QualityTest[] results = testManager.ExecuteTest(file);
                    
                    if (results.Length > 1)
                        throw new Exception("Unexpected barcode count.");
    
                    if (results.Length == 0)
                    {
                        Console.WriteLine("No barcode found.");
                    }
                    else
                    {
                        ISO15415QualityTest result = results[0];
                        Console.Write("Found = " + result.BarcodeInfo.Value + "; ");
                        Console.WriteLine("Scan Grade = " + GradeToString(result.ScanGrade));
                    }
                }
            }
        }    
       
        /// <summary>
        /// Converts ISO15415 quality grade into string value.
        /// </summary>
        private static string GradeToString(ISO15415QualityGrade grade)
        {
            return string.Format("{0}({1})", ((int)grade).ToString(), grade);
        }
    }
    
    

    Иерархия наследования

    System.Object
       Vintasoft.Barcode.QualityTests.ISO15415QualityTestManager

    Требования

    Целевые платформы: .NET 10; .NET 9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

    Смотрите также