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

Class barBoundingBox


Bounding box is a clever class that stores bounding box and implements simple operations that may be performed on bounding boxes such as extracting bounding box from SVG path definition, merging, printing etc.

Nested Classes [hide private]
Instance Methods [hide private]
 
__init__(self, initialBoundaries=None)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
(int, int, int, int) or (float, float, float, float)
__merge(self, listOfBoundaries)
Merge given boundaries.
 
extend(self, extIterable)
Modify bounding box boundaries by values in given iterable.
barBoundingBox
__add__(self, obj)
Merge two bounding box objects into one.
 
__iter__(self)
 
__getitem__(self, index)
barBoundingBox
__mul__(self, number)
Returns: bounding box with boundaries multiplied by given factor
 
__str__(self)
An alias for self.getXMLelement().toxml()
 
__eq__(self, other)
 
__ne__(self, other)

Inherited from barObject: getElementById, getXMLelement, writeXMLtoFile

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

Class Methods [hide private]
barBoundingBox
fromPathDefinition(cls, svgPathDefinition)
Create bounding box based on SVG path definition.
barBoundingBox
fromPathElement(self, svgPathElement)
Create bounding box based on SVG 'path' element.
Static Methods [hide private]

Inherited from barObject (private): _getAttributesDict

Instance Variables [hide private]
(int, int, int, int) or (float, float, float, float) boundaries
bounding box coordinates (in following order: top, left, bottom, right)
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, initialBoundaries=None)
(Constructor)

 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Parameters:
  • initialBoundaries ((int, int, int, int) or (float, float, float, float)) - initial boundaries.
Overrides: object.__init__

fromPathDefinition(cls, svgPathDefinition)
Class Method

 

Create bounding box based on SVG path definition.

Parameters:
  • svgPathDefinition (str) - definition of the path in SVG manner
Returns: barBoundingBox
created bounding box

fromPathElement(self, svgPathElement)
Class Method

 

Create bounding box based on SVG 'path' element.

Parameters:
  • svgPathElement (xml.dom.minidom.Node) - SVG path element
Returns: barBoundingBox
created bounding box

__merge(self, listOfBoundaries)

 

Merge given boundaries.

Parameters:
  • listOfBoundaries ([(int, int, int, int) or (float, float, float, float), ...]) - boundaries to be merged
Returns: (int, int, int, int) or (float, float, float, float)
merged boundaries

extend(self, extIterable)

 

Modify bounding box boundaries by values in given iterable.

Parameters:
  • extIterable (sequence([int, int, int, int]) or sequence([float, float, float, float])) - extension list

__add__(self, obj)
(Addition operator)

 

Merge two bounding box objects into one.

Returns: barBoundingBox
merged bounding boxes

__mul__(self, number)

 
Parameters:
  • number (int or float) - boundaries multiplication factor
Returns: barBoundingBox
bounding box with boundaries multiplied by given factor

Attention: boundaries of returned bounding box are rounded.

__str__(self)
(Informal representation operator)

 

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

Overrides: object.__str__
(inherited documentation)