Beispiel #1
0
        /// <summary>
        /// Merge all the specified ROIs to a single rect.
        /// </summary>
        /// <param name="rois">The rois to merge</param>
        /// <returns>A rectangle of the merged rois</returns>
        public static TIS_RECT MergerRoisRect(params ITisROIParams[] rois)
        {
            TIS_RECT result = new TIS_RECT();

            try
            {
                Rectangle rct = Rectangle.Empty;

                foreach (ITisROIParams roi in rois)
                {
                    if (rct.IsEmpty)
                    {
                        rct = new Rectangle(roi.Miscellaneous.RegionLeft, roi.Miscellaneous.RegionTop, roi.Miscellaneous.RegionRight - roi.Miscellaneous.RegionLeft, roi.Miscellaneous.RegionBottom - roi.Miscellaneous.RegionTop);
                    }
                    else
                    {
                        rct.Intersect(new Rectangle(roi.Miscellaneous.RegionLeft, roi.Miscellaneous.RegionTop, roi.Miscellaneous.RegionRight - roi.Miscellaneous.RegionLeft, roi.Miscellaneous.RegionBottom - roi.Miscellaneous.RegionTop));
                    }
                }

                result.Left   = rct.Left;
                result.Top    = rct.Top;
                result.Right  = rct.Right;
                result.Bottom = rct.Bottom;
            }
            catch (Exception ex)
            {
                ILog.LogError(ex);
            }
            return(result);
        }
Beispiel #2
0
            /// <summary>
            /// Add a field to the List of fields of the field array.
            /// </summary>
            /// <param name="field">The Field settings to create a CCField from.</param>
            /// <returns>A CCField when successfull, null when failed.</returns>
            public virtual CCField AddField(ITisFieldParams field, TIS_RECT fieldRect)
            {
                try
                {
                    if (fields == null)
                    {
                        fields = new List <CCField>();
                    }

                    //-- Add a new field --\\
                    foreach (CCField cf in fields)
                    {
                        if (String.Compare(cf.Name, field.Name, true) == 0)
                        {
                            return(cf);
                        }
                    }

                    fields.Add(new CCField(this.ParentCreator, field.Name, String.Empty, 0, fieldRect, null, null, null));

                    this.SetParents();
                    return(fields[fields.Count - 1]);
                }
                catch (Exception ex)
                {
                    ILog.LogError(ex, false);
                    throw ex;
                }
            }
Beispiel #3
0
 /// <summary>
 /// Rectangle extended cosntructor.
 /// </summary>
 /// <param name="rct">The rectangle to initialize the class with.</param>
 public FieldRect(TIS_RECT rct)
     : this()
 {
     this.Left   = rct.Left;
     this.Top    = rct.Top;
     this.Width  = rct.Right - rct.Left;
     this.Height = rct.Bottom - rct.Top;
 }
Beispiel #4
0
            /// <summary>
            /// Add a field to the groups' List of fields.
            /// </summary>
            /// <param name="fieldName">The name of the Field to create.</param>
            /// <returns>A CCField when successfull, null when failed.</returns>
            public virtual CCField AddField(ITisFieldParams field, TIS_RECT fieldRect)
            {
                try
                {
                    if (fields == null)
                    {
                        fields = new List <CCField>();
                    }

                    //-- Add a new field --\\
                    foreach (CCField cf in fields)
                    {
                        if (String.Compare(cf.Name, field.Name, true) == 0)
                        {
                            return(cf);
                        }
                    }

                    if (field.ParentFieldTableExists)
                    {
                        // TODO: finish testing here.
                        //\\ bool createTable = true;
                        // CCTable = this.tables.IndexOf(
                        foreach (CCTable tbl in this.tables)
                        {
                            if (String.Compare(tbl.Name, field.ParentFieldTable.Name, true) == 0)
                            {
                                CCFieldArray cfa = tbl.AddFieldArray(field.Name);
                                cfa.AddField(field, fieldRect);
                            }
                        }
                    }
                    else
                    {
                        fields.Add(new CCField(this.ParentCreator, field.Name, String.Empty, 0, fieldRect, null, null, null));
                    }

                    fields[fields.Count - 1].CCParent = this;

                    this.SetParents();
                    return(fields[fields.Count - 1]);
                }
                catch (Exception ex)
                {
                    ILog.LogError(ex, false);
                    throw ex;
                }
            }
Beispiel #5
0
            /// <summary>
            /// Add a field to the groups' List of fields.
            /// </summary>
            /// <param name="fieldName">The name of the Field to create.</param>
            /// <returns>A CCField when successfull, null when failed.</returns>
            public virtual CCField AddField(String fieldName, String contents, short confidence, TIS_RECT fieldRect)
            {
                try
                {
                    if (fields == null)
                    {
                        fields = new List <CCField>();
                    }

                    //-- Add a new field --\\
                    foreach (CCField cf in fields)
                    {
                        if (String.Compare(cf.Name, fieldName, true) == 0)
                        {
                            return(cf);
                        }
                    }

                    CCField fld = new CCField(this.ParentCreator, fieldName, contents, confidence, fieldRect, null, null, null);
                    fields.Add(fld);

                    this.SetParents();
                    return(fld);
                }
                catch (Exception ex)
                {
                    ILog.LogError(ex, false);
                    throw ex;
                }
            }
Beispiel #6
0
            public CCField(CCreator parent, String name, String contents, short confidence, TIS_RECT fieldRect, Dictionary <String, String> specialTags, Dictionary <String, String> namedTags, Dictionary <String, String> userTags) :
#endif
                base(parent, name ?? String.Empty, specialTags, namedTags, userTags)
            {
                this.Contents   = contents ?? String.Empty;
                this.Confidence = confidence;
                this.Rect       = new FieldRect(fieldRect);
            }
Beispiel #7
0
 internal CCField(CCreator parent, String name, String contents, short confidence, TIS_RECT fieldRect, Dictionary <String, String> specialTags, Dictionary <String, String> namedTags, Dictionary <String, String> userTags) :
Beispiel #8
0
 public CCField(String name, String contents, short confidence, TIS_RECT fieldRect, Dictionary <String, String> specialTags, Dictionary <String, String> namedTags, Dictionary <String, String> userTags) :
     this(null, name ?? String.Empty, contents ?? String.Empty, confidence, fieldRect, specialTags, namedTags, userTags)
 {
 }