タイムアウト時間 (msec) [初期値:0.0、範囲:0.0 以上] ※ 0.0 を指定した場合はタイムアウトは行いません。

Namespace: FVIL.DM
Assembly: FVILbasic (in FVILbasic.dll) Version: 3.1.0.0 (3.1.0.17)

Syntax

C#
public static double DefaultTimeout { get; set; }
Visual Basic
Public Shared Property DefaultTimeout As Double
	Get
	Set

Return Value

Type: Double
取得した値を返します。

Remarks

既定のタイムアウト時間の取得または設定を行います。
この設定値は、CFviDM.Execute で使用されています。
アプリケーション内で共通になります。インスタンス毎には設定できません。

設定に失敗した場合は例外を発行します。 例外の原因と発生位置を特定するには、発行された例外クラスの ErrorCode メンバと Function メンバを参照してください。

エラーコード:

ErrorCode メンバ内容
11FVIL.ErrorCode.INVALID_PARAMETER引数に指定された値が不正です。

関連する FIE 関数:

fnFIE_dm_set_timeout
fnFIE_dm_get_timeout

Examples

ソースコード:
C# Copy imageCopy
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using fvalgcli;

namespace User.SampleCode
{
    public partial class DM
    {
        [FvPluginExecute]
        public void DefaultTimeout()
        {
            var timer = new FVIL.CFviTimeCounter();
            double msec;

            // 1) インスタンスの準備.
            var src = new FVIL.Data.CFviImage(Defs.TestImageDir + "/DM-3-U8.png");
            var result = new FVIL.DM.CFviDMResult();
            var parser = new FVIL.DM.CFviDM(src, result);

            // 2) 処理対象画像の有効性検査.
            if (FVIL.ErrorCode._SUCCESS != FVIL.DM.CFviDM.CheckValidity(src)) return;

            try
            {
                // 3) パラメータ設定.
                parser.Param.CellWidthMax = 15;
                parser.Param.CellWidthMin = 4;
                parser.Param.ColorType = FVIL.DM.ColorType.Dark;
                parser.Param.MinVar = 1000;
                parser.Param.SizeMax = 64;
                parser.Param.SizeMin = 10;
                parser.Param.SlantAllowance = 10;

                // タイムアウトの取得:
                Console.WriteLine("DefaultTimeout = {0}", FVIL.DM.CFviDMParam.DefaultTimeout);

                // 4-1) 画像処理実行.
                {
                    timer.Start();
                    parser.Execute();
                    msec = timer.Stop();

                    Console.WriteLine("DM");
                    Console.WriteLine("execute. {0} msec", msec.ToString("0.###"));
                    Console.WriteLine("Result.Count = {0}", parser.Result.Count);

                    for (int i = 0; i < parser.Result.Count; i++)
                    {
                        var data0 = new FVIL.DM.CFviDMData(parser.Result[i]);
                        Console.WriteLine("DMData[{0}]", i);
                        Console.WriteLine("      Index = {0}", data0.Index);
                        Console.WriteLine("      Center = ({0:f},{1:f})", data0.Center.X, data0.Center.Y);
                        Console.WriteLine("      (Width, Height) = ({0:f},{1:f})", data0.Size.Width, data0.Size.Height);
                        Console.WriteLine("      CellWidth = {0:f}", data0.CellWidth);
                        Console.WriteLine("      CellHeight = {0:f}", data0.CellHeight);
                        Console.WriteLine("      Text = {0}", data0.Text);
                    }
                }

                // タイムアウトの設定と取得:
                FVIL.DM.CFviDMParam.DefaultTimeout = 10;
                Console.WriteLine("DefaultTimeout = {0}", FVIL.DM.CFviDMParam.DefaultTimeout);

                // 4-2) 画像処理実行.
                {
                    timer.Start();
                    parser.Execute();
                    msec = timer.Stop();

                    Console.WriteLine("DM");
                    Console.WriteLine("execute. {0} msec", msec.ToString("0.###"));
                    Console.WriteLine("Result.Count = {0}", parser.Result.Count);

                    for (int i = 0; i < parser.Result.Count; i++)
                    {
                        var data0 = new FVIL.DM.CFviDMData(parser.Result[i]);
                        Console.WriteLine("DMData[{0}]", i);
                        Console.WriteLine("      Index = {0}", data0.Index);
                        Console.WriteLine("      Center = ({0:f},{1:f})", data0.Center.X, data0.Center.Y);
                        Console.WriteLine("      (Width, Height) = ({0:f},{1:f})", data0.Size.Width, data0.Size.Height);
                        Console.WriteLine("      CellWidth = {0:f}", data0.CellWidth);
                        Console.WriteLine("      CellHeight = {0:f}", data0.CellHeight);
                        Console.WriteLine("      Text = {0}", data0.Text);
                    }
                }

                // タイムアウトの設定と取得: (既定値に戻す)
                FVIL.DM.CFviDMParam.DefaultTimeout = 0;
                Console.WriteLine("DefaultTimeout = {0}", FVIL.DM.CFviDMParam.DefaultTimeout);
            }
            catch (System.Exception ex)
            {
                Assert.Fail("{0}", ex.Message);
            }
            finally
            {
                src.Dispose();
                result.Dispose();
                parser.Dispose();
            }
        }
    }
}

出力結果:
Copy imageCopy
User.SampleCode.DM.DefaultTimeout
DefaultTimeout = 0
DM
execute. 39.477 msec
Result.Count = 3
DMData[0]
      Index = 0
      Center = (549.89,201.41)
      (Width, Height) = (18.00,18.00)
      CellWidth = 6.44
      CellHeight = 6.38
      Text = 0A313107211228R50T0G
DMData[1]
      Index = 1
      Center = (843.57,180.36)
      (Width, Height) = (20.00,20.00)
      CellWidth = 5.06
      CellHeight = 5.15
      Text = 0A53039BA2178_Mda725K2NH
DMData[2]
      Index = 2
      Center = (168.22,157.05)
      (Width, Height) = (22.00,22.00)
      CellWidth = 5.03
      CellHeight = 5.06
      Text = R6059100462309EBW42680002DCB0000W0000000000
DefaultTimeout = 10
DM
execute. 10.204 msec
Result.Count = 0
DefaultTimeout = 0


ソースコード:
Visual Basic Copy imageCopy
Imports System.Collections.Generic
Imports System.Text
Imports System.Drawing
Imports fvalgcli

Namespace SampleCode
    Public Partial Class DM
        <FvPluginExecute> _
        Public Sub DefaultTimeout()
            Dim timer As New FVIL.CFviTimeCounter()
            Dim msec As Double

            ' 1) インスタンスの準備.
            Dim src As New FVIL.Data.CFviImage(Defs.TestImageDir & "/DM-3-U8.png")
            Dim result As New FVIL.DM.CFviDMResult()
            Dim parser As New FVIL.DM.CFviDM(src, result)

            ' 2) 処理対象画像の有効性検査.
            If FVIL.ErrorCode._SUCCESS <> FVIL.DM.CFviDM.CheckValidity(src) Then
                Return
            End If

            Try
                ' 3) パラメータ設定.
                parser.Param.CellWidthMax = 15
                parser.Param.CellWidthMin = 4
                parser.Param.ColorType = FVIL.DM.ColorType.Dark
                parser.Param.MinVar = 1000
                parser.Param.SizeMax = 64
                parser.Param.SizeMin = 10
                parser.Param.SlantAllowance = 10

                ' タイムアウトの取得:
                Console.WriteLine("DefaultTimeout = {0}", FVIL.DM.CFviDMParam.DefaultTimeout)

                ' 4-1) 画像処理実行.
                If True Then
                    timer.Start()
                    parser.Execute()
                    msec = timer.[Stop]()

                    Console.WriteLine("DM")
                    Console.WriteLine("execute. {0} msec", msec.ToString("0.###"))
                    Console.WriteLine("Result.Count = {0}", parser.Result.Count)

                    For i As Integer = 0 To parser.Result.Count - 1
                        Dim data0 As New FVIL.DM.CFviDMData(parser.Result(i))
                        Console.WriteLine("DMData[{0}]", i)
                        Console.WriteLine("      Index = {0}", data0.Index)
                        Console.WriteLine("      Center = ({0:f},{1:f})", data0.Center.X, data0.Center.Y)
                        Console.WriteLine("      (Width, Height) = ({0:f},{1:f})", data0.Size.Width, data0.Size.Height)
                        Console.WriteLine("      CellWidth = {0:f}", data0.CellWidth)
                        Console.WriteLine("      CellHeight = {0:f}", data0.CellHeight)
                        Console.WriteLine("      Text = {0}", data0.Text)
                    Next
                End If

                ' タイムアウトの設定と取得:
                FVIL.DM.CFviDMParam.DefaultTimeout = 10
                Console.WriteLine("DefaultTimeout = {0}", FVIL.DM.CFviDMParam.DefaultTimeout)

                ' 4-2) 画像処理実行.
                If True Then
                    timer.Start()
                    parser.Execute()
                    msec = timer.[Stop]()

                    Console.WriteLine("DM")
                    Console.WriteLine("execute. {0} msec", msec.ToString("0.###"))
                    Console.WriteLine("Result.Count = {0}", parser.Result.Count)

                    For i As Integer = 0 To parser.Result.Count - 1
                        Dim data0 As New FVIL.DM.CFviDMData(parser.Result(i))
                        Console.WriteLine("DMData[{0}]", i)
                        Console.WriteLine("      Index = {0}", data0.Index)
                        Console.WriteLine("      Center = ({0:f},{1:f})", data0.Center.X, data0.Center.Y)
                        Console.WriteLine("      (Width, Height) = ({0:f},{1:f})", data0.Size.Width, data0.Size.Height)
                        Console.WriteLine("      CellWidth = {0:f}", data0.CellWidth)
                        Console.WriteLine("      CellHeight = {0:f}", data0.CellHeight)
                        Console.WriteLine("      Text = {0}", data0.Text)
                    Next
                End If

                ' タイムアウトの設定と取得: (既定値に戻す)
                FVIL.DM.CFviDMParam.DefaultTimeout = 0
                Console.WriteLine("DefaultTimeout = {0}", FVIL.DM.CFviDMParam.DefaultTimeout)
            Catch ex As System.Exception
                Assert.Fail("{0}", ex.Message)
            Finally
                src.Dispose()
                result.Dispose()
                parser.Dispose()
            End Try
        End Sub
    End Class
End Namespace

出力結果:
Copy imageCopy
User.SampleCode.DM.DefaultTimeout
DefaultTimeout = 0
DM
execute. 39.477 msec
Result.Count = 3
DMData[0]
      Index = 0
      Center = (549.89,201.41)
      (Width, Height) = (18.00,18.00)
      CellWidth = 6.44
      CellHeight = 6.38
      Text = 0A313107211228R50T0G
DMData[1]
      Index = 1
      Center = (843.57,180.36)
      (Width, Height) = (20.00,20.00)
      CellWidth = 5.06
      CellHeight = 5.15
      Text = 0A53039BA2178_Mda725K2NH
DMData[2]
      Index = 2
      Center = (168.22,157.05)
      (Width, Height) = (22.00,22.00)
      CellWidth = 5.03
      CellHeight = 5.06
      Text = R6059100462309EBW42680002DCB0000W0000000000
DefaultTimeout = 10
DM
execute. 10.204 msec
Result.Count = 0
DefaultTimeout = 0

Exceptions

ExceptionCondition
FVIL..::..CFviExceptionこの例外の原因については、上記のエラーコード表をご参照ください。

See Also