Package bar :: Module base :: Class barObject
[hide private]
[frames] | no frames]

Class barObject


Parental class for BAR elements.

The general assumption is that every BAR element should have XML representation thus this class holds placeholdes for XML import / export methods but they are not always implemented in subclasses. Every element should also implement the __str__ method, but (again) some subclases do not have this function implemented.

This class have aslo some supplementary function as _getAttributesDict and getElementById which appears to be useful.

Nested Classes [hide private]
class _clsBoundingBox
bounding box representation class used by the class objects
class _clsPath
path representation class used by the class objects
class _clsGenericStructure
structure (set of paths) representation class used by the class objects
class _clsStructureLabel
generic label representation class used by the class objects
class _clsRegularLabel
regular label representation used by the class objects
class _clsSpotLabel
spot label representation used by the class objects
class _clsCommentLabel
comment label representation used by the class objects
class _clsMetadataElement
meta data element representation class used by the class objects
class _clsBregmaMetadataElement
bregma meta data element representation class used by the class objects
  _clsTransfMatrixMetadataElement
transformation matrix meta data element representation class used by the class objects
Instance Methods [hide private]
 
__str__(self)
An alias for self.getXMLelement().toxml()
 
getXMLelement(self)
A stub of method.
 
writeXMLtoFile(self, outputFilename, indent='\t', addindent='\t', newl='\n', encoding='utf-8')
Write XML representation of the object to file.
 
getElementById(self, domElement, tagName, id)
Stupid walkaround of faulty DOM getElementById.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Static Methods [hide private]
{str : str, ...}
_getAttributesDict(xmlElement)
Extract attributes from xmlElement.
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__str__(self)
(Informal representation operator)

 

An alias for self.getXMLelement().toxml()

Overrides: object.__str__

getXMLelement(self)

 

A stub of method. Raise NotImplementedError.

writeXMLtoFile(self, outputFilename, indent='\t', addindent='\t', newl='\n', encoding='utf-8')

 

Write XML representation of the object to file.

Parameters:
  • outputFilename (str) - filename to save the file
  • indent (str) - indentation delimiter
  • addindent (str) - additional indentation delimiter
  • newl (str) - newline delimiter
  • encoding () - output xml file encoding
Returns:
None

_getAttributesDict(xmlElement)
Static Method

 

Extract attributes from xmlElement.

Parameters:
  • xmlElement (xml.dom.minidom.Node) - svg from which all attributes will be extrated
Returns: {str : str, ...}
attribute to value mapping

getElementById(self, domElement, tagName, id)

 

Stupid walkaround of faulty DOM getElementById.

Parameters:
  • domElement (xml.dom.minidom.Node) - XML element
  • tagName (str) - requested XML element name
  • id (str) - requested XML element id

Attention: Do not use until there is not other way.