//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; } }
// Token: 0x06002DF5 RID: 11765 RVA: 0x000CE7E8 File Offset: 0x000CC9E8 public FixedSOMPage ConstructPageStructure(List <FixedNode> fixedNodes) { foreach (FixedNode fixedNode in fixedNodes) { DependencyObject element = this._fixedPage.GetElement(fixedNode); if (element is Glyphs) { this._ProcessGlyphsElement(element as Glyphs, fixedNode); } else if (element is Image || (element is Path && (element as Path).Fill is ImageBrush)) { this._ProcessImage(element, fixedNode); } } foreach (FixedSOMSemanticBox fixedSOMSemanticBox in this._fixedSOMPage.SemanticBoxes) { FixedSOMContainer fixedSOMContainer = fixedSOMSemanticBox as FixedSOMContainer; fixedSOMContainer.SemanticBoxes.Sort(); } this._DetectTables(); this._CombinePass(); this._CreateGroups(this._fixedSOMPage); this._fixedSOMPage.SemanticBoxes.Sort(); return(this._fixedSOMPage); }
// Token: 0x06002E2A RID: 11818 RVA: 0x000D0AAD File Offset: 0x000CECAD public void AddContainer(FixedSOMContainer container) { if (!this._containsTable || !this._AddToInnerTable(container)) { base.Add(container); } if (container is FixedSOMTable) { this._containsTable = true; } }
// Token: 0x06002E2C RID: 11820 RVA: 0x000D0B2C File Offset: 0x000CED2C private bool _AddToInnerTable(FixedSOMContainer container) { foreach (FixedSOMSemanticBox fixedSOMSemanticBox in this._semanticBoxes) { FixedSOMTable fixedSOMTable = fixedSOMSemanticBox as FixedSOMTable; if (fixedSOMTable != null && fixedSOMTable.AddContainer(container)) { return(true); } } return(false); }
public void AddContainer(FixedSOMContainer container) { //Check nested tables first if (!(_containsTable && _AddToInnerTable(container))) { base.Add(container); } if (container is FixedSOMTable) { _containsTable = true; } }
public bool AddContainer(FixedSOMContainer container) { Rect bounds = container.BoundingRect; //Allow couple pixels margin double verticalOverlap = bounds.Height * 0.2; double horizontalOverlap = bounds.Width * 0.2; bounds.Inflate(-horizontalOverlap, -verticalOverlap); if (this.BoundingRect.Contains(bounds)) { foreach (FixedSOMTableRow row in this.SemanticBoxes) { if (row.BoundingRect.Contains(bounds)) { foreach (FixedSOMTableCell cell in row.SemanticBoxes) { if (cell.BoundingRect.Contains(bounds)) { cell.AddContainer(container); FixedSOMFixedBlock block = container as FixedSOMFixedBlock; if (block != null) { if (block.IsRTL) { _RTLCount++; } else { _LTRCount++; } } return(true); } } } } } return(false); }
// Token: 0x06002E21 RID: 11809 RVA: 0x000D05D4 File Offset: 0x000CE7D4 public bool AddContainer(FixedSOMContainer container) { Rect boundingRect = container.BoundingRect; double num = boundingRect.Height * 0.2; double num2 = boundingRect.Width * 0.2; boundingRect.Inflate(-num2, -num); if (base.BoundingRect.Contains(boundingRect)) { foreach (FixedSOMSemanticBox fixedSOMSemanticBox in base.SemanticBoxes) { FixedSOMTableRow fixedSOMTableRow = (FixedSOMTableRow)fixedSOMSemanticBox; if (fixedSOMTableRow.BoundingRect.Contains(boundingRect)) { foreach (FixedSOMSemanticBox fixedSOMSemanticBox2 in fixedSOMTableRow.SemanticBoxes) { FixedSOMTableCell fixedSOMTableCell = (FixedSOMTableCell)fixedSOMSemanticBox2; if (fixedSOMTableCell.BoundingRect.Contains(boundingRect)) { fixedSOMTableCell.AddContainer(container); FixedSOMFixedBlock fixedSOMFixedBlock = container as FixedSOMFixedBlock; if (fixedSOMFixedBlock != null) { if (fixedSOMFixedBlock.IsRTL) { this._RTLCount++; } else { this._LTRCount++; } } return(true); } } } } return(false); } return(false); }
public bool AddContainer(FixedSOMContainer container) { Rect bounds = container.BoundingRect; //Allow couple pixels margin double verticalOverlap = bounds.Height * 0.2; double horizontalOverlap = bounds.Width * 0.2; bounds.Inflate(-horizontalOverlap,-verticalOverlap); if (this.BoundingRect.Contains(bounds)) { foreach (FixedSOMTableRow row in this.SemanticBoxes) { if (row.BoundingRect.Contains(bounds)) { foreach (FixedSOMTableCell cell in row.SemanticBoxes) { if (cell.BoundingRect.Contains(bounds)) { cell.AddContainer(container); FixedSOMFixedBlock block = container as FixedSOMFixedBlock; if (block != null) { if (block.IsRTL) { _RTLCount++; } else { _LTRCount++; } } return true; } } } } } return false; }
// Token: 0x06002E1D RID: 11805 RVA: 0x000D04A4 File Offset: 0x000CE6A4 private void _ConstructFixedNodes() { this._fixedNodes = new List <FixedNode>(); foreach (FixedSOMSemanticBox fixedSOMSemanticBox in this._semanticBoxes) { FixedSOMElement fixedSOMElement = fixedSOMSemanticBox as FixedSOMElement; if (fixedSOMElement != null) { this._fixedNodes.Add(fixedSOMElement.FixedNode); } else { FixedSOMContainer fixedSOMContainer = fixedSOMSemanticBox as FixedSOMContainer; List <FixedNode> fixedNodes = fixedSOMContainer.FixedNodes; foreach (FixedNode item in fixedNodes) { this._fixedNodes.Add(item); } } } }
public FixedSOMPage ConstructPageStructure(List <FixedNode> fixedNodes) { Debug.Assert(_fixedPage != null); foreach (FixedNode node in fixedNodes) { DependencyObject obj = _fixedPage.GetElement(node); Debug.Assert(obj != null); if (obj is Glyphs) { _ProcessGlyphsElement(obj as Glyphs, node); } else if (obj is Image || obj is Path && ((obj as Path).Fill is ImageBrush)) { _ProcessImage(obj, node); } } //Inner sorting of all page elements foreach (FixedSOMSemanticBox box in _fixedSOMPage.SemanticBoxes) { FixedSOMContainer container = box as FixedSOMContainer; container.SemanticBoxes.Sort(); } _DetectTables(); _CombinePass(); _CreateGroups(_fixedSOMPage); _fixedSOMPage.SemanticBoxes.Sort(); return(_fixedSOMPage); }
void _ConstructFixedNodes() { _fixedNodes = new List <FixedNode>(); foreach (FixedSOMSemanticBox box in _semanticBoxes) { FixedSOMElement element = box as FixedSOMElement; if (element != null) { _fixedNodes.Add(element.FixedNode); } else { FixedSOMContainer container = box as FixedSOMContainer; Debug.Assert(container != null); List <FixedNode> nodes = container.FixedNodes; foreach (FixedNode node in nodes) { _fixedNodes.Add(node); } } } }
// 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; } }
private bool _AddToInnerTable(FixedSOMContainer container) { foreach (FixedSOMSemanticBox box in _semanticBoxes) { FixedSOMTable table = box as FixedSOMTable; if (table != null && table.AddContainer(container)) { return true; } } return false; }