internal static SelectionMark DeserializeSelectionMark(JsonElement element)
        {
            IReadOnlyList <float> boundingBox = default;
            float confidence             = default;
            FormSelectionMarkState state = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("boundingBox"))
                {
                    List <float> array = new List <float>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(item.GetSingle());
                    }
                    boundingBox = array;
                    continue;
                }
                if (property.NameEquals("confidence"))
                {
                    confidence = property.Value.GetSingle();
                    continue;
                }
                if (property.NameEquals("state"))
                {
                    state = property.Value.GetString().ToFormSelectionMarkState();
                    continue;
                }
            }
            return(new SelectionMark(boundingBox, confidence, state));
        }
Exemple #2
0
        internal SelectionMark(IEnumerable <float> boundingBox, float confidence, FormSelectionMarkState state)
        {
            if (boundingBox == null)
            {
                throw new ArgumentNullException(nameof(boundingBox));
            }

            BoundingBox = boundingBox.ToList();
            Confidence  = confidence;
            State       = state;
        }
Exemple #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FieldValue"/> structure.
 /// </summary>
 /// <param name="value">The actual field value.</param>
 internal FieldValue(FormSelectionMarkState value)
     : this()
 {
     ValueType          = FieldValueType.SelectionMark;
     ValueSelectionMark = value;
 }
 internal FormSelectionMark(FieldBoundingBox boundingBox, int pageNumber, string text, float confidence, FormSelectionMarkState state)
     : base(boundingBox, pageNumber, text)
 {
     Confidence = confidence;
     State      = state;
 }
 public static string ToSerialString(this FormSelectionMarkState value) => value switch
 {
Exemple #6
0
 internal SelectionMark(IReadOnlyList <float> boundingBox, float confidence, FormSelectionMarkState state)
 {
     BoundingBox = boundingBox;
     Confidence  = confidence;
     State       = state;
 }