//Creates a set of groups inside this container based on heuristics. //This will ensure that elements consecutive in markup that also seem to be //spatially consecutive don't get separated private void _CreateGroups(FixedSOMContainer container) { if (container.SemanticBoxes.Count > 0) { List <FixedSOMSemanticBox> groups = new List <FixedSOMSemanticBox>(); FixedSOMGroup currentGroup = new FixedSOMGroup(_fixedSOMPage); FixedSOMPageElement currentPageElement = container.SemanticBoxes[0] as FixedSOMPageElement; Debug.Assert(currentPageElement != null); FixedSOMPageElement nextPageElement = null; currentGroup.AddContainer(currentPageElement); groups.Add(currentGroup); for (int i = 1; i < container.SemanticBoxes.Count; i++) { nextPageElement = container.SemanticBoxes[i] as FixedSOMPageElement; Debug.Assert(nextPageElement != null); if (!(_IsSpatiallyCombinable(currentPageElement, nextPageElement, 0, 30) && nextPageElement.BoundingRect.Top >= currentPageElement.BoundingRect.Top)) { currentGroup = new FixedSOMGroup(_fixedSOMPage); groups.Add(currentGroup); } currentGroup.AddContainer(nextPageElement); currentPageElement = nextPageElement; } container.SemanticBoxes = groups; } }
//-------------------------------------------------------------------- // // Public Methods // //--------------------------------------------------------------------- #region Public Methods #if DEBUG public override void Render(DrawingContext dc, string label, DrawDebugVisual debugVisuals) { switch (debugVisuals) { case DrawDebugVisual.None: case DrawDebugVisual.Glyphs: //Handled in FixedPage //Nothing to do break; default: int groupIndex = 0; int boxIndex = 0; for (int i = 0; i < _semanticBoxes.Count; i++) { FixedSOMGroup group = _semanticBoxes[i] as FixedSOMGroup; if (group != null) { if (debugVisuals == DrawDebugVisual.Groups) { group.Render(dc, groupIndex.ToString(), debugVisuals); groupIndex++; } List <FixedSOMSemanticBox> groupBoxes = group.SemanticBoxes; for (int j = 0; j < groupBoxes.Count; j++) { groupBoxes[j].Render(dc, boxIndex.ToString(), debugVisuals); boxIndex++; } } else { _semanticBoxes[i].Render(dc, boxIndex.ToString(), debugVisuals); boxIndex++; } } break; } }
// Token: 0x06002E06 RID: 11782 RVA: 0x000CFE64 File Offset: 0x000CE064 private void _CreateGroups(FixedSOMContainer container) { if (container.SemanticBoxes.Count > 0) { List <FixedSOMSemanticBox> list = new List <FixedSOMSemanticBox>(); FixedSOMGroup fixedSOMGroup = new FixedSOMGroup(this._fixedSOMPage); FixedSOMPageElement fixedSOMPageElement = container.SemanticBoxes[0] as FixedSOMPageElement; fixedSOMGroup.AddContainer(fixedSOMPageElement); list.Add(fixedSOMGroup); for (int i = 1; i < container.SemanticBoxes.Count; i++) { FixedSOMPageElement fixedSOMPageElement2 = container.SemanticBoxes[i] as FixedSOMPageElement; if (!this._IsSpatiallyCombinable(fixedSOMPageElement, fixedSOMPageElement2, 0.0, 30.0) || fixedSOMPageElement2.BoundingRect.Top < fixedSOMPageElement.BoundingRect.Top) { fixedSOMGroup = new FixedSOMGroup(this._fixedSOMPage); list.Add(fixedSOMGroup); } fixedSOMGroup.AddContainer(fixedSOMPageElement2); fixedSOMPageElement = fixedSOMPageElement2; } container.SemanticBoxes = list; } }
//Creates a set of groups inside this container based on heuristics. //This will ensure that elements consecutive in markup that also seem to be //spatially consecutive don't get separated private void _CreateGroups(FixedSOMContainer container) { if (container.SemanticBoxes.Count > 0) { List<FixedSOMSemanticBox> groups = new List<FixedSOMSemanticBox>(); FixedSOMGroup currentGroup = new FixedSOMGroup(_fixedSOMPage); FixedSOMPageElement currentPageElement = container.SemanticBoxes[0] as FixedSOMPageElement; Debug.Assert(currentPageElement != null); FixedSOMPageElement nextPageElement = null; currentGroup.AddContainer(currentPageElement); groups.Add(currentGroup); for (int i=1; i<container.SemanticBoxes.Count; i++) { nextPageElement = container.SemanticBoxes[i] as FixedSOMPageElement; Debug.Assert(nextPageElement != null); if (!( _IsSpatiallyCombinable(currentPageElement, nextPageElement, 0, 30) && nextPageElement.BoundingRect.Top >= currentPageElement.BoundingRect.Top)) { currentGroup = new FixedSOMGroup(_fixedSOMPage); groups.Add(currentGroup); } currentGroup.AddContainer(nextPageElement); currentPageElement = nextPageElement; } container.SemanticBoxes = groups; } }
int IComparable.CompareTo(object comparedObj) { int result = Int32.MinValue; FixedSOMGroup compared = comparedObj as FixedSOMGroup; Debug.Assert(compared != null); if (compared == null) { throw new ArgumentException(SR.Get(SRID.UnexpectedParameterType, comparedObj.GetType(), typeof(FixedSOMGroup)), "comparedObj"); } bool RTL = this.IsRTL && compared.IsRTL; SpatialComparison compareHor = base._CompareHorizontal(compared, RTL); SpatialComparison compareVer = base._CompareVertical(compared); Debug.Assert(compareHor != SpatialComparison.None); Debug.Assert(compareVer != SpatialComparison.None); switch (compareVer) { case SpatialComparison.Before: result = -1; break; case SpatialComparison.After: result = 1; break; case SpatialComparison.OverlapBefore: if ((int)compareHor <= (int)SpatialComparison.Equal) { result = -1; } else { result = 1; } break; case SpatialComparison.OverlapAfter: if ((int)compareHor >= (int)SpatialComparison.Equal) { result = 1; } else { result = -1; } break; case SpatialComparison.Equal: switch (compareHor) { case SpatialComparison.After: case SpatialComparison.OverlapAfter: result = 1; break; case SpatialComparison.Before: case SpatialComparison.OverlapBefore: result = -1; break; case SpatialComparison.Equal: result = 0; break; default: Debug.Assert(false); break; } break; default: //Shouldn't happen Debug.Assert(false); break; } return(result); }
// Token: 0x06002DC2 RID: 11714 RVA: 0x000CDD74 File Offset: 0x000CBF74 int IComparable.CompareTo(object comparedObj) { int result = int.MinValue; FixedSOMGroup fixedSOMGroup = comparedObj as FixedSOMGroup; if (fixedSOMGroup == null) { throw new ArgumentException(SR.Get("UnexpectedParameterType", new object[] { comparedObj.GetType(), typeof(FixedSOMGroup) }), "comparedObj"); } bool rtl = this.IsRTL && fixedSOMGroup.IsRTL; FixedSOMSemanticBox.SpatialComparison spatialComparison = base._CompareHorizontal(fixedSOMGroup, rtl); switch (base._CompareVertical(fixedSOMGroup)) { case FixedSOMSemanticBox.SpatialComparison.Before: result = -1; break; case FixedSOMSemanticBox.SpatialComparison.OverlapBefore: if (spatialComparison <= FixedSOMSemanticBox.SpatialComparison.Equal) { result = -1; } else { result = 1; } break; case FixedSOMSemanticBox.SpatialComparison.Equal: switch (spatialComparison) { case FixedSOMSemanticBox.SpatialComparison.Before: case FixedSOMSemanticBox.SpatialComparison.OverlapBefore: result = -1; break; case FixedSOMSemanticBox.SpatialComparison.Equal: result = 0; break; case FixedSOMSemanticBox.SpatialComparison.OverlapAfter: case FixedSOMSemanticBox.SpatialComparison.After: result = 1; break; } break; case FixedSOMSemanticBox.SpatialComparison.OverlapAfter: if (spatialComparison >= FixedSOMSemanticBox.SpatialComparison.Equal) { result = 1; } else { result = -1; } break; case FixedSOMSemanticBox.SpatialComparison.After: result = 1; break; } return(result); }