@@ 12432-12524 (lines=93) @@ | ||
12429 | # end class UnknownRegionType |
|
12430 | ||
12431 | ||
12432 | class NoiseRegionType(RegionType): |
|
12433 | """NoiseRegionType -- |
|
12434 | Noise regions are regions where no real data lies, only |
|
12435 | false data created by artifacts on the document or |
|
12436 | scanner noise. |
|
12437 | ||
12438 | """ |
|
12439 | __hash__ = GeneratedsSuper.__hash__ |
|
12440 | member_data_items_ = [ |
|
12441 | ] |
|
12442 | subclass = None |
|
12443 | superclass = RegionType |
|
12444 | def __init__(self, id=None, custom=None, comments=None, continuation=None, AlternativeImage=None, Coords=None, UserDefined=None, Labels=None, Roles=None, TextRegion=None, ImageRegion=None, LineDrawingRegion=None, GraphicRegion=None, TableRegion=None, ChartRegion=None, SeparatorRegion=None, MathsRegion=None, ChemRegion=None, MusicRegion=None, AdvertRegion=None, NoiseRegion=None, UnknownRegion=None, CustomRegion=None, gds_collector_=None, **kwargs_): |
|
12445 | self.gds_collector_ = gds_collector_ |
|
12446 | self.gds_elementtree_node_ = None |
|
12447 | self.original_tagname_ = None |
|
12448 | self.parent_object_ = kwargs_.get('parent_object_') |
|
12449 | self.ns_prefix_ = "pc" |
|
12450 | super(globals().get("NoiseRegionType"), self).__init__(id, custom, comments, continuation, AlternativeImage, Coords, UserDefined, Labels, Roles, TextRegion, ImageRegion, LineDrawingRegion, GraphicRegion, TableRegion, ChartRegion, SeparatorRegion, MathsRegion, ChemRegion, MusicRegion, AdvertRegion, NoiseRegion, UnknownRegion, CustomRegion, **kwargs_) |
|
12451 | def factory(*args_, **kwargs_): |
|
12452 | if CurrentSubclassModule_ is not None: |
|
12453 | subclass = getSubclassFromModule_( |
|
12454 | CurrentSubclassModule_, NoiseRegionType) |
|
12455 | if subclass is not None: |
|
12456 | return subclass(*args_, **kwargs_) |
|
12457 | if NoiseRegionType.subclass: |
|
12458 | return NoiseRegionType.subclass(*args_, **kwargs_) |
|
12459 | else: |
|
12460 | return NoiseRegionType(*args_, **kwargs_) |
|
12461 | factory = staticmethod(factory) |
|
12462 | def get_ns_prefix_(self): |
|
12463 | return self.ns_prefix_ |
|
12464 | def set_ns_prefix_(self, ns_prefix): |
|
12465 | self.ns_prefix_ = ns_prefix |
|
12466 | def has__content(self): |
|
12467 | if ( |
|
12468 | super(NoiseRegionType, self).has__content() |
|
12469 | ): |
|
12470 | return True |
|
12471 | else: |
|
12472 | return False |
|
12473 | def export(self, outfile, level, namespaceprefix_='', namespacedef_='xmlns:pc="http://schema.primaresearch.org/PAGE/gts/pagecontent/2019-07-15"', name_='NoiseRegionType', pretty_print=True): |
|
12474 | imported_ns_def_ = GenerateDSNamespaceDefs_.get('NoiseRegionType') |
|
12475 | if imported_ns_def_ is not None: |
|
12476 | namespacedef_ = imported_ns_def_ |
|
12477 | if pretty_print: |
|
12478 | eol_ = '\n' |
|
12479 | else: |
|
12480 | eol_ = '' |
|
12481 | if self.original_tagname_ is not None and name_ == 'NoiseRegionType': |
|
12482 | name_ = self.original_tagname_ |
|
12483 | if UseCapturedNS_ and self.ns_prefix_: |
|
12484 | namespaceprefix_ = self.ns_prefix_ + ':' |
|
12485 | showIndent(outfile, level, pretty_print) |
|
12486 | outfile.write('<%s%s%s' % (namespaceprefix_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) |
|
12487 | already_processed = set() |
|
12488 | self._exportAttributes(outfile, level, already_processed, namespaceprefix_, name_='NoiseRegionType') |
|
12489 | if self.has__content(): |
|
12490 | outfile.write('>%s' % (eol_, )) |
|
12491 | self._exportChildren(outfile, level + 1, namespaceprefix_, namespacedef_, name_='NoiseRegionType', pretty_print=pretty_print) |
|
12492 | showIndent(outfile, level, pretty_print) |
|
12493 | outfile.write('</%s%s>%s' % (namespaceprefix_, name_, eol_)) |
|
12494 | else: |
|
12495 | outfile.write('/>%s' % (eol_, )) |
|
12496 | def _exportAttributes(self, outfile, level, already_processed, namespaceprefix_='', name_='NoiseRegionType'): |
|
12497 | super(NoiseRegionType, self)._exportAttributes(outfile, level, already_processed, namespaceprefix_, name_='NoiseRegionType') |
|
12498 | def _exportChildren(self, outfile, level, namespaceprefix_='', namespacedef_='xmlns:pc="http://schema.primaresearch.org/PAGE/gts/pagecontent/2019-07-15"', name_='NoiseRegionType', fromsubclass_=False, pretty_print=True): |
|
12499 | super(NoiseRegionType, self)._exportChildren(outfile, level, namespaceprefix_, namespacedef_, name_, True, pretty_print=pretty_print) |
|
12500 | def to_etree(self, parent_element=None, name_='NoiseRegionType', mapping_=None, reverse_mapping_=None, nsmap_=None): |
|
12501 | element = super(NoiseRegionType, self).to_etree(parent_element, name_, mapping_, reverse_mapping_, nsmap_) |
|
12502 | if mapping_ is not None: |
|
12503 | mapping_[id(self)] = element |
|
12504 | if reverse_mapping_ is not None: |
|
12505 | reverse_mapping_[element] = self |
|
12506 | return element |
|
12507 | def build(self, node, gds_collector_=None): |
|
12508 | self.gds_collector_ = gds_collector_ |
|
12509 | if SaveElementTreeNode: |
|
12510 | self.gds_elementtree_node_ = node |
|
12511 | already_processed = set() |
|
12512 | self.ns_prefix_ = node.prefix |
|
12513 | self._buildAttributes(node, node.attrib, already_processed) |
|
12514 | for child in node: |
|
12515 | nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] |
|
12516 | self._buildChildren(child, node, nodeName_, gds_collector_=gds_collector_) |
|
12517 | return self |
|
12518 | def _buildAttributes(self, node, attrs, already_processed): |
|
12519 | super(NoiseRegionType, self)._buildAttributes(node, attrs, already_processed) |
|
12520 | def _buildChildren(self, child_, node, nodeName_, fromsubclass_=False, gds_collector_=None): |
|
12521 | super(NoiseRegionType, self)._buildChildren(child_, node, nodeName_, True) |
|
12522 | pass |
|
12523 | def __hash__(self): |
|
12524 | return hash(self.id) |
|
12525 | # end class NoiseRegionType |
|
12526 | ||
12527 | ||
@@ 12338-12428 (lines=91) @@ | ||
12335 | # end class CustomRegionType |
|
12336 | ||
12337 | ||
12338 | class UnknownRegionType(RegionType): |
|
12339 | """UnknownRegionType -- |
|
12340 | To be used if the region type cannot be ascertained. |
|
12341 | ||
12342 | """ |
|
12343 | __hash__ = GeneratedsSuper.__hash__ |
|
12344 | member_data_items_ = [ |
|
12345 | ] |
|
12346 | subclass = None |
|
12347 | superclass = RegionType |
|
12348 | def __init__(self, id=None, custom=None, comments=None, continuation=None, AlternativeImage=None, Coords=None, UserDefined=None, Labels=None, Roles=None, TextRegion=None, ImageRegion=None, LineDrawingRegion=None, GraphicRegion=None, TableRegion=None, ChartRegion=None, SeparatorRegion=None, MathsRegion=None, ChemRegion=None, MusicRegion=None, AdvertRegion=None, NoiseRegion=None, UnknownRegion=None, CustomRegion=None, gds_collector_=None, **kwargs_): |
|
12349 | self.gds_collector_ = gds_collector_ |
|
12350 | self.gds_elementtree_node_ = None |
|
12351 | self.original_tagname_ = None |
|
12352 | self.parent_object_ = kwargs_.get('parent_object_') |
|
12353 | self.ns_prefix_ = "pc" |
|
12354 | super(globals().get("UnknownRegionType"), self).__init__(id, custom, comments, continuation, AlternativeImage, Coords, UserDefined, Labels, Roles, TextRegion, ImageRegion, LineDrawingRegion, GraphicRegion, TableRegion, ChartRegion, SeparatorRegion, MathsRegion, ChemRegion, MusicRegion, AdvertRegion, NoiseRegion, UnknownRegion, CustomRegion, **kwargs_) |
|
12355 | def factory(*args_, **kwargs_): |
|
12356 | if CurrentSubclassModule_ is not None: |
|
12357 | subclass = getSubclassFromModule_( |
|
12358 | CurrentSubclassModule_, UnknownRegionType) |
|
12359 | if subclass is not None: |
|
12360 | return subclass(*args_, **kwargs_) |
|
12361 | if UnknownRegionType.subclass: |
|
12362 | return UnknownRegionType.subclass(*args_, **kwargs_) |
|
12363 | else: |
|
12364 | return UnknownRegionType(*args_, **kwargs_) |
|
12365 | factory = staticmethod(factory) |
|
12366 | def get_ns_prefix_(self): |
|
12367 | return self.ns_prefix_ |
|
12368 | def set_ns_prefix_(self, ns_prefix): |
|
12369 | self.ns_prefix_ = ns_prefix |
|
12370 | def has__content(self): |
|
12371 | if ( |
|
12372 | super(UnknownRegionType, self).has__content() |
|
12373 | ): |
|
12374 | return True |
|
12375 | else: |
|
12376 | return False |
|
12377 | def export(self, outfile, level, namespaceprefix_='', namespacedef_='xmlns:pc="http://schema.primaresearch.org/PAGE/gts/pagecontent/2019-07-15"', name_='UnknownRegionType', pretty_print=True): |
|
12378 | imported_ns_def_ = GenerateDSNamespaceDefs_.get('UnknownRegionType') |
|
12379 | if imported_ns_def_ is not None: |
|
12380 | namespacedef_ = imported_ns_def_ |
|
12381 | if pretty_print: |
|
12382 | eol_ = '\n' |
|
12383 | else: |
|
12384 | eol_ = '' |
|
12385 | if self.original_tagname_ is not None and name_ == 'UnknownRegionType': |
|
12386 | name_ = self.original_tagname_ |
|
12387 | if UseCapturedNS_ and self.ns_prefix_: |
|
12388 | namespaceprefix_ = self.ns_prefix_ + ':' |
|
12389 | showIndent(outfile, level, pretty_print) |
|
12390 | outfile.write('<%s%s%s' % (namespaceprefix_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) |
|
12391 | already_processed = set() |
|
12392 | self._exportAttributes(outfile, level, already_processed, namespaceprefix_, name_='UnknownRegionType') |
|
12393 | if self.has__content(): |
|
12394 | outfile.write('>%s' % (eol_, )) |
|
12395 | self._exportChildren(outfile, level + 1, namespaceprefix_, namespacedef_, name_='UnknownRegionType', pretty_print=pretty_print) |
|
12396 | showIndent(outfile, level, pretty_print) |
|
12397 | outfile.write('</%s%s>%s' % (namespaceprefix_, name_, eol_)) |
|
12398 | else: |
|
12399 | outfile.write('/>%s' % (eol_, )) |
|
12400 | def _exportAttributes(self, outfile, level, already_processed, namespaceprefix_='', name_='UnknownRegionType'): |
|
12401 | super(UnknownRegionType, self)._exportAttributes(outfile, level, already_processed, namespaceprefix_, name_='UnknownRegionType') |
|
12402 | def _exportChildren(self, outfile, level, namespaceprefix_='', namespacedef_='xmlns:pc="http://schema.primaresearch.org/PAGE/gts/pagecontent/2019-07-15"', name_='UnknownRegionType', fromsubclass_=False, pretty_print=True): |
|
12403 | super(UnknownRegionType, self)._exportChildren(outfile, level, namespaceprefix_, namespacedef_, name_, True, pretty_print=pretty_print) |
|
12404 | def to_etree(self, parent_element=None, name_='UnknownRegionType', mapping_=None, reverse_mapping_=None, nsmap_=None): |
|
12405 | element = super(UnknownRegionType, self).to_etree(parent_element, name_, mapping_, reverse_mapping_, nsmap_) |
|
12406 | if mapping_ is not None: |
|
12407 | mapping_[id(self)] = element |
|
12408 | if reverse_mapping_ is not None: |
|
12409 | reverse_mapping_[element] = self |
|
12410 | return element |
|
12411 | def build(self, node, gds_collector_=None): |
|
12412 | self.gds_collector_ = gds_collector_ |
|
12413 | if SaveElementTreeNode: |
|
12414 | self.gds_elementtree_node_ = node |
|
12415 | already_processed = set() |
|
12416 | self.ns_prefix_ = node.prefix |
|
12417 | self._buildAttributes(node, node.attrib, already_processed) |
|
12418 | for child in node: |
|
12419 | nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] |
|
12420 | self._buildChildren(child, node, nodeName_, gds_collector_=gds_collector_) |
|
12421 | return self |
|
12422 | def _buildAttributes(self, node, attrs, already_processed): |
|
12423 | super(UnknownRegionType, self)._buildAttributes(node, attrs, already_processed) |
|
12424 | def _buildChildren(self, child_, node, nodeName_, fromsubclass_=False, gds_collector_=None): |
|
12425 | super(UnknownRegionType, self)._buildChildren(child_, node, nodeName_, True) |
|
12426 | pass |
|
12427 | def __hash__(self): |
|
12428 | return hash(self.id) |
|
12429 | # end class UnknownRegionType |
|
12430 | ||
12431 |