Search in sources :

Example 1 with TableRegionType

use of eu.transkribus.core.model.beans.pagecontent.TableRegionType in project TranskribusCore by Transkribus.

the class PageXmlUtils method getTextRegions.

public static List<TextRegionType> getTextRegions(PcGtsType pc) {
    List<TrpRegionType> regions = pc.getPage().getTextRegionOrImageRegionOrLineDrawingRegion();
    List<TextRegionType> tRegions = new ArrayList<>();
    if (regions == null || regions.isEmpty()) {
        return tRegions;
    }
    for (RegionType r : regions) {
        if (r == null)
            continue;
        if (TextRegionType.class.isAssignableFrom(r.getClass())) {
            tRegions.add((TextRegionType) r);
        }
        if (TableRegionType.class.isAssignableFrom(r.getClass())) {
            TableRegionType table = (TableRegionType) r;
            tRegions.addAll(table.getTableCell());
        }
    }
    return tRegions;
}
Also used : TrpTextRegionType(eu.transkribus.core.model.beans.pagecontent_trp.TrpTextRegionType) TextRegionType(eu.transkribus.core.model.beans.pagecontent.TextRegionType) TrpTextRegionType(eu.transkribus.core.model.beans.pagecontent_trp.TrpTextRegionType) TrpRegionType(eu.transkribus.core.model.beans.pagecontent_trp.TrpRegionType) RegionType(eu.transkribus.core.model.beans.pagecontent.RegionType) TextRegionType(eu.transkribus.core.model.beans.pagecontent.TextRegionType) TableRegionType(eu.transkribus.core.model.beans.pagecontent.TableRegionType) TrpRegionType(eu.transkribus.core.model.beans.pagecontent_trp.TrpRegionType) TableRegionType(eu.transkribus.core.model.beans.pagecontent.TableRegionType) ArrayList(java.util.ArrayList)

Aggregations

RegionType (eu.transkribus.core.model.beans.pagecontent.RegionType)1 TableRegionType (eu.transkribus.core.model.beans.pagecontent.TableRegionType)1 TextRegionType (eu.transkribus.core.model.beans.pagecontent.TextRegionType)1 TrpRegionType (eu.transkribus.core.model.beans.pagecontent_trp.TrpRegionType)1 TrpTextRegionType (eu.transkribus.core.model.beans.pagecontent_trp.TrpTextRegionType)1 ArrayList (java.util.ArrayList)1