Package mapnik :: Class Envelope

Class Envelope

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


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


Following operators are defined for Envelope:

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__( (Envelope)arg1, (Envelope)arg2) -> object :
 
__div__(...)
__div__( (Envelope)arg1, (float)arg2) -> object :
 
__eq__(...)
__eq__( (Envelope)arg1, (Envelope)arg2) -> object :
 
__getinitargs__(...)
__getinitargs__( (Envelope)arg1) -> tuple :
 
__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__( (Envelope)arg1, (float)arg2) -> object :
 
__reduce__(...)
helper for pickle
 
__repr__(self)
repr(x)
 
__rmul__(...)
__rmul__( (Envelope)arg1, (float)arg2) -> object :
 
__sub__(...)
__sub__( (Envelope)arg1, (Envelope)arg2) -> object :
 
center(...)
center( (Envelope)arg1) -> Coord : Returns the coordinates of the center of the bounding box.
 
contains(...)
contains( (Envelope)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( (Envelope)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( (Envelope)arg1, (float)new_height) -> None : Sets the height to new_height of the envelope preserving its center.
 
intersect(...)
intersect( (Envelope)arg1, (Envelope)other) -> Envelope : Returns the overlap of this envelope and the other envelope as a new envelope.
 
intersects(...)
intersects( (Envelope)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.
 
width(...)
width( (Envelope)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__, __getattribute__, __hash__, __reduce_ex__, __setattr__, __str__

Class Variables
  __instance_size__ = 40
  __safe_for_unpickling__ = True
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__( (Envelope)arg1, (Envelope)arg2) -> object :

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

__div__(...)

 

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

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

__eq__(...)
(Equality operator)

 

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

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

__getinitargs__(...)

 

__getinitargs__( (Envelope)arg1) -> tuple :

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

__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 Envelope(0, 0, -1, -1).
    

    C++ signature :
        void __init__(_object*)

__init__( (object)arg1, (Coord)ll, (Coord)ur) -> None :
    Equivalent to Envelope(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__( (Envelope)arg1, (float)arg2) -> object :

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

__reduce__(...)

 

helper for pickle

Overrides: object.__reduce__
(inherited documentation)

__repr__(self)
(Representation operator)

 

repr(x)

Overrides: object.__repr__
(inherited documentation)

__rmul__(...)

 

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

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

__sub__(...)
(Subtraction operator)

 

__sub__( (Envelope)arg1, (Envelope)arg2) -> object :

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

center(...)

 

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

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

center( (Envelope)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 = Envelope(0, 0, 100, 100)
    >>> e.center(60, 60)
    >>> e.center()
    Coord(60.0,60.0)
    >>> (e.width(), e.height())
    (100.0, 100.0)
    >>> e
    Envelope(10.0, 10.0, 110.0, 110.0)
    

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

contains(...)

 

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

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

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

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

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

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

expand_to_include(...)

 

expand_to_include( (Envelope)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::Envelope<double> {lvalue},double,double)

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

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

expand_to_include( (Envelope)arg1, (Envelope)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::Envelope<double> {lvalue},mapnik::Envelope<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)

height(...)

 

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

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

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

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

intersect(...)

 

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

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

intersects(...)

 

intersects( (Envelope)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::Envelope<double> {lvalue},double,double)

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

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

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

    C++ signature :
        bool intersects(mapnik::Envelope<double> {lvalue},mapnik::Envelope<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).

width(...)

 

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

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

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

    C++ signature :
        double width(mapnik::Envelope<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(...)