Package mapnik :: Class Box2d

Class Box2d

 object --+    
          |    
??.instance --+
              |
             Box2d
Known Subclasses:


Represents a spatial envelope (i.e. bounding box).


Following operators are defined for Box2d:

Addition:
e1 + e2 is equvalent to e1.expand_to_include(e2) but yields
a new envelope instead of modifying e1

Subtraction:
Currently e1 - e2 returns e1.

Multiplication and division with floats:
Multiplication and division change the width and height of the envelope
by the given factor without modifying its center..

That is, e1 * x is equivalent to:
       e1.width(x * e1.width())
       e1.height(x * e1.height()),
except that a new envelope is created instead of modifying e1.

e1 / x is equivalent to e1 * (1.0/x).

Equality: two envelopes are equal if their corner points are equal.

Instance Methods
 
__add__(...)
__add__( (Box2d)arg1, (Box2d)arg2) -> object :
 
__deepcopy__(...)
__deepcopy__( (Box2d)arg1, (dict)arg2) -> Box2d :
 
__div__(...)
__div__( (Box2d)arg1, (float)arg2) -> object :
 
__eq__(...)
__eq__( (Box2d)arg1, (Box2d)arg2) -> object :
 
__getinitargs__(...)
__getinitargs__( (Box2d)arg1) -> tuple :
 
__getitem__(...)
__getitem__( (Box2d)arg1, (int)arg2) -> float :
 
__init__(...)
__init__( (object)arg1, (float)minx, (float)miny, (float)maxx, (float)maxy) -> None : Constructs a new envelope from the coordinates of its lower left and upper right corner points.
 
__mul__(...)
__mul__( (Box2d)arg1, (float)arg2) -> object :
 
__ne__(...)
__ne__( (Box2d)arg1, (Box2d)arg2) -> object :
 
__reduce__(...)
helper for pickle
 
__repr__(self)
repr(x)
 
__rmul__(...)
__rmul__( (Box2d)arg1, (float)arg2) -> object :
 
_c___repr__(x)
repr(x)
 
center(...)
center( (Box2d)arg1) -> Coord : Returns the coordinates of the center of the bounding box.
 
clip(...)
clip( (Box2d)arg1, (Box2d)other) -> None : Clip the envelope based on the bounds of another envelope.
 
contains(...)
contains( (Box2d)arg1, (float)x, (float)y) -> bool : Returns True iff this envelope contains the point given by x and y.
 
expand_to_include(...)
expand_to_include( (Box2d)arg1, (float)x, (float)y) -> None : Expands this envelope to include the point given by x and y.
 
forward(self, projection)
Projects the envelope from the geographic space into the cartesian space by projecting its corner points.
 
height(...)
height( (Box2d)arg1, (float)new_height) -> None : Sets the height to new_height of the envelope preserving its center.
 
intersect(...)
intersect( (Box2d)arg1, (Box2d)other) -> Box2d : Returns the overlap of this envelope and the other envelope as a new envelope.
 
intersects(...)
intersects( (Box2d)arg1, (float)x, (float)y) -> bool : Returns True iff this envelope intersects the point given by x and y.
 
inverse(self, projection)
Projects the envelope from the cartesian space into the geographic space by projecting its corner points.
 
pad(...)
pad( (Box2d)arg1, (float)padding) -> None : Pad the envelope based on a padding value.
 
valid(...)
valid( (Box2d)arg1) -> bool :
 
width(...)
width( (Box2d)arg1, (float)new_width) -> None : Sets the width to new_width of the envelope preserving its center.

Inherited from unreachable.instance: __new__

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

Static Methods
 
from_string(...)
from_string( (str)arg1) -> Box2d :
Class Variables
  __instance_size__ = 48
  __safe_for_unpickling__ = True
  _c___doc__ = None
  _c___module__ = 'mapnik._mapnik'
Properties
  maxx
X coordinate for the upper right corner
  maxy
Y coordinate for the upper right corner
  minx
X coordinate for the lower left corner
  miny
Y coordinate for the lower left corner

Inherited from object: __class__

Method Details

__add__(...)
(Addition operator)

 

__add__( (Box2d)arg1, (Box2d)arg2) -> object :

    C++ signature :
        _object* __add__(mapnik::box2d<double> {lvalue},mapnik::box2d<double>)

__deepcopy__(...)

 

__deepcopy__( (Box2d)arg1, (dict)arg2) -> Box2d :

    C++ signature :
        mapnik::box2d<double> __deepcopy__(mapnik::box2d<double> {lvalue},boost::python::dict)

__div__(...)

 

__div__( (Box2d)arg1, (float)arg2) -> object :

    C++ signature :
        _object* __div__(mapnik::box2d<double> {lvalue},float)

__eq__(...)
(Equality operator)

 

__eq__( (Box2d)arg1, (Box2d)arg2) -> object :

    C++ signature :
        _object* __eq__(mapnik::box2d<double> {lvalue},mapnik::box2d<double>)

__getinitargs__(...)

 

__getinitargs__( (Box2d)arg1) -> tuple :

    C++ signature :
        boost::python::tuple __getinitargs__(mapnik::box2d<double>)

__getitem__(...)
(Indexing operator)

 

__getitem__( (Box2d)arg1, (int)arg2) -> float :

    C++ signature :
        double __getitem__(mapnik::box2d<double> {lvalue},int)

__init__(...)
(Constructor)

 

__init__( (object)arg1, (float)minx, (float)miny, (float)maxx, (float)maxy) -> None :
    Constructs a new envelope from the coordinates
    of its lower left and upper right corner points.
    

    C++ signature :
        void __init__(_object*,double,double,double,double)

__init__( (object)arg1) -> None :
    Equivalent to Box2d(0, 0, -1, -1).
    

    C++ signature :
        void __init__(_object*)

__init__( (object)arg1, (Coord)ll, (Coord)ur) -> None :
    Equivalent to Box2d(ll.x, ll.y, ur.x, ur.y).
    

    C++ signature :
        void __init__(_object*,mapnik::coord<double, 2>,mapnik::coord<double, 2>)

Overrides: object.__init__

__mul__(...)

 

__mul__( (Box2d)arg1, (float)arg2) -> object :

    C++ signature :
        _object* __mul__(mapnik::box2d<double> {lvalue},float)

__ne__(...)

 

__ne__( (Box2d)arg1, (Box2d)arg2) -> object :

    C++ signature :
        _object* __ne__(mapnik::box2d<double> {lvalue},mapnik::box2d<double>)

__reduce__(...)

 

helper for pickle

Overrides: object.__reduce__
(inherited documentation)

__repr__(self)
(Representation operator)

 

repr(x)

Overrides: object.__repr__
(inherited documentation)

__rmul__(...)

 

__rmul__( (Box2d)arg1, (float)arg2) -> object :

    C++ signature :
        _object* __rmul__(mapnik::box2d<double> {lvalue},float)

center(...)

 

center( (Box2d)arg1) -> Coord :
    Returns the coordinates of the center of the bounding box.
    
    Example:
    >>> e = Box2d(0, 0, 100, 100)
    >>> e.center()
    Coord(50, 50)
    

    C++ signature :
        mapnik::coord<double, 2> center(mapnik::box2d<double> {lvalue})

center( (Box2d)arg1, (float)x, (float)y) -> None :
    Moves the envelope so that the given coordinates become its new center.
    The width and the height are preserved.
    
     Example:
    >>> e = Box2d(0, 0, 100, 100)
    >>> e.center(60, 60)
    >>> e.center()
    Coord(60.0,60.0)
    >>> (e.width(), e.height())
    (100.0, 100.0)
    >>> e
    Box2d(10.0, 10.0, 110.0, 110.0)
    

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

center( (Box2d)arg1, (Coord)Coord) -> None :
    Moves the envelope so that the given coordinates become its new center.
    The width and the height are preserved.
    
     Example:
    >>> e = Box2d(0, 0, 100, 100)
    >>> e.center(Coord60, 60)
    >>> e.center()
    Coord(60.0,60.0)
    >>> (e.width(), e.height())
    (100.0, 100.0)
    >>> e
    Box2d(10.0, 10.0, 110.0, 110.0)
    

    C++ signature :
        void center(mapnik::box2d<double> {lvalue},mapnik::coord<double, 2>)

clip(...)

 

clip( (Box2d)arg1, (Box2d)other) -> None :
    Clip the envelope based on the bounds of another envelope.
    
     Example:
    >>> e = Box2d(0, 0, 100, 100)
    >>> c = Box2d(-50, -50, 50, 50)
    >>> e.clip(c)
    >>> e
    Box2d(0.0,0.0,50.0,50.0
    

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

contains(...)

 

contains( (Box2d)arg1, (float)x, (float)y) -> bool :
    Returns True iff this envelope contains the point
    given by x and y.
    

    C++ signature :
        bool contains(mapnik::box2d<double> {lvalue},double,double)

contains( (Box2d)arg1, (Coord)p) -> bool :
    Equivalent to contains(p.x, p.y)
    

    C++ signature :
        bool contains(mapnik::box2d<double> {lvalue},mapnik::coord<double, 2>)

contains( (Box2d)arg1, (Box2d)other) -> bool :
    Equivalent to:
      contains(other.minx, other.miny) and contains(other.maxx, other.maxy)
    

    C++ signature :
        bool contains(mapnik::box2d<double> {lvalue},mapnik::box2d<double>)

expand_to_include(...)

 

expand_to_include( (Box2d)arg1, (float)x, (float)y) -> None :
    Expands this envelope to include the point given by x and y.
    
    Example:
    

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

expand_to_include( (Box2d)arg1, (Coord)p) -> None :
    Equivalent to expand_to_include(p.x, p.y)
    

    C++ signature :
        void expand_to_include(mapnik::box2d<double> {lvalue},mapnik::coord<double, 2>)

expand_to_include( (Box2d)arg1, (Box2d)other) -> None :
    Equivalent to:
      expand_to_include(other.minx, other.miny)
      expand_to_include(other.maxx, other.maxy)
    

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

forward(self, projection)

 

Projects the envelope from the geographic space
into the cartesian space by projecting its corner
points.

See also:
   Coord.forward(self, projection)

from_string(...)
Static Method

 

from_string( (str)arg1) -> Box2d :

    C++ signature :
        mapnik::box2d<double> from_string(std::string)

height(...)

 

height( (Box2d)arg1, (float)new_height) -> None :
    Sets the height to new_height of the envelope preserving its center.
    
     Example:
    >>> e = Box2d(0, 0, 100, 100)
    >>> e.height(120)
    >>> e.center()
    Coord(50.0,50.0)
    >>> e
    Box2d(0.0, -10.0, 100.0, 110.0)
    

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

height( (Box2d)arg1) -> float :
    Returns the height of this envelope.
    

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

intersect(...)

 

intersect( (Box2d)arg1, (Box2d)other) -> Box2d :
    Returns the overlap of this envelope and the other envelope
    as a new envelope.
    
    Example:
    >>> e1 = Box2d(0, 0, 100, 100)
    >>> e2 = Box2d(50, 50, 150, 150)
    >>> e1.intersect(e2)
    Box2d(50.0, 50.0, 100.0, 100.0)
    

    C++ signature :
        mapnik::box2d<double> intersect(mapnik::box2d<double> {lvalue},mapnik::box2d<double>)

intersects(...)

 

intersects( (Box2d)arg1, (float)x, (float)y) -> bool :
    Returns True iff this envelope intersects the point
    given by x and y.
    
    Note: For points, intersection is equivalent
    to containment, i.e. the following holds:
       e.contains(x, y) == e.intersects(x, y)
    

    C++ signature :
        bool intersects(mapnik::box2d<double> {lvalue},double,double)

intersects( (Box2d)arg1, (Coord)p) -> bool :
    Equivalent to contains(p.x, p.y)
    

    C++ signature :
        bool intersects(mapnik::box2d<double> {lvalue},mapnik::coord<double, 2>)

intersects( (Box2d)arg1, (Box2d)other) -> bool :
    Returns True iff this envelope intersects the other envelope,
    This relationship is symmetric.
    Example:
    >>> e1 = Box2d(0, 0, 100, 100)
    >>> e2 = Box2d(50, 50, 150, 150)
    >>> e1.intersects(e2)
    True
    >>> e1.contains(e2)
    False
    

    C++ signature :
        bool intersects(mapnik::box2d<double> {lvalue},mapnik::box2d<double>)

inverse(self, projection)

 

Projects the envelope from the cartesian space
into the geographic space by projecting its corner
points.

See also:
  Coord.inverse(self, projection).

pad(...)

 

pad( (Box2d)arg1, (float)padding) -> None :
    Pad the envelope based on a padding value.
    
     Example:
    >>> e = Box2d(0, 0, 100, 100)
    >>> e.pad(10)
    >>> e
    Box2d(-10.0,-10.0,110.0,110.0
    

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

valid(...)

 

valid( (Box2d)arg1) -> bool :

    C++ signature :
        bool valid(mapnik::box2d<double> {lvalue})

width(...)

 

width( (Box2d)arg1, (float)new_width) -> None :
    Sets the width to new_width of the envelope preserving its center.
    
     Example:
    >>> e = Box2d(0, 0, 100, 100)
    >>> e.width(120)
    >>> e.center()
    Coord(50.0,50.0)
    >>> e
    Box2d(-10.0, 0.0, 110.0, 100.0)
    

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

width( (Box2d)arg1) -> float :
    Returns the width of this envelope.
    

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


Property Details

maxx

X coordinate for the upper right corner

Get Method:
unreachable(...)

maxy

Y coordinate for the upper right corner

Get Method:
unreachable(...)

minx

X coordinate for the lower left corner

Get Method:
unreachable(...)

miny

Y coordinate for the lower left corner

Get Method:
unreachable(...)