Package mapnik :: Module _mapnik :: Class LabelCollisionDetector

Class LabelCollisionDetector

 object --+    
          |    
??.instance --+
              |
             LabelCollisionDetector

Object to detect collisions between labels, used in the rendering process.

Instance Methods
 
__init__(...)
__init__( (object)arg1, (Box2d)arg2) -> object : Creates an empty collision detection object with a given extent.
 
__reduce__(...)
helper for pickle
 
boxes(...)
boxes( (LabelCollisionDetector)arg1) -> list : Returns a list of all the label boxes inside the detector.
 
extent(...)
extent( (LabelCollisionDetector)arg1) -> Box2d : Returns the total extent (bounding box) of all labels inside the detector.
 
insert(...)
insert( (LabelCollisionDetector)arg1, (Box2d)arg2) -> None : Insert a 2d box into the collision detector.

Inherited from unreachable.instance: __new__

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

Properties

Inherited from object: __class__

Method Details

__init__(...)
(Constructor)

 

__init__( (object)arg1, (Box2d)arg2) -> object :
    Creates an empty collision detection object with a given extent. Note that the constructor from Map objects is a sensible default and usually what you want to do.
    
    Example:
    >>> m = Map(size_x, size_y)
    >>> buf_sz = m.buffer_size
    >>> extent = mapnik.Box2d(-buf_sz, -buf_sz, m.width + buf_sz, m.height + buf_sz)
    >>> detector = mapnik.LabelCollisionDetector(extent)

    C++ signature :
        void* __init__(boost::python::api::object,mapnik::box2d<double>)

__init__( (object)arg1, (Map)arg2) -> object :
    Creates an empty collision detection object matching the given Map object. The created detector will have the same size, including the buffer, as the map object. This is usually what you want to do.
    
    Example:
    >>> m = Map(size_x, size_y)
    >>> detector = mapnik.LabelCollisionDetector(m)

    C++ signature :
        void* __init__(boost::python::api::object,mapnik::Map)

Overrides: object.__init__

__reduce__(...)

 

helper for pickle

Overrides: object.__reduce__
(inherited documentation)

boxes(...)

 

boxes( (LabelCollisionDetector)arg1) -> list :
    Returns a list of all the label boxes inside the detector.

    C++ signature :
        boost::python::list boxes(boost::shared_ptr<mapnik::label_collision_detector4>)

extent(...)

 

extent( (LabelCollisionDetector)arg1) -> Box2d :
    Returns the total extent (bounding box) of all labels inside the detector.
    
    Example:
    >>> detector.extent()
    Box2d(573.252589209,494.789179821,584.261023823,496.83610261)

    C++ signature :
        mapnik::box2d<double> extent(mapnik::label_collision_detector4 {lvalue})

insert(...)

 

insert( (LabelCollisionDetector)arg1, (Box2d)arg2) -> None :
    Insert a 2d box into the collision detector. This can be used to ensure that some space is left clear on the map for later overdrawing, for example by non-Mapnik processes.
    
    Example:
    >>> m = Map(size_x, size_y)
    >>> detector = mapnik.LabelCollisionDetector(m)>>> detector.insert(mapnik.Box2d(196, 254, 291, 389))

    C++ signature :
        void insert(mapnik::label_collision_detector4 {lvalue},mapnik::box2d<double>)