Package sabx10 :: Package osm :: Module bounds :: Class Cluster
[hide private]
[frames] | no frames]

Class Cluster

source code

  object --+        
           |        
oxm.geom.Box --+    
               |    
          Bounds --+
                   |
      object --+   |
               |   |
  oxm.geom.Point --+
                   |
                  Cluster

Keeps track of a cluster of points and the bounding box surrounding them.

Instance Methods [hide private]
 
__init__(self, lat, lon)
The bounding box starts out as just a single point.
source code
 
expand_to_point(self, lat, lon)
Expand the bounding box to include the given point, and include the new point in the point count.
source code
 
distance_from(self, pt)
How far away from the center of this box is the given point?
source code
 
set_pixel_size(self)
Adjust the size of the cluster's bounding box and update it's center point to reflect this.
source code

Inherited from Bounds: calc_sep_dist, expand_to_good_size

Inherited from oxm.geom.Box: area, expand_to_box, height, is_pt_in_box, resize, width

Inherited from oxm.geom.Point: calculate_distance, pt_dist_from

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

Instance Variables [hide private]
Point center
Point denoting center of the box
int index
index of this Cluster
int point_count
how many points this box encompasses

Inherited from Bounds: pix_height, pix_width

Inherited from oxm.geom.Box: max_lat, max_lon, min_lat, min_lon

Inherited from oxm.geom.Point: ele, id, lat, lon, usgs

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, lat, lon)
(Constructor)

source code 

The bounding box starts out as just a single point.

Parameters:
  • lat (float) - latitude of starting point
  • lon (float) - longitude of starting point
Overrides: object.__init__

expand_to_point(self, lat, lon)

source code 

Expand the bounding box to include the given point, and include the new point in the point count.

Parameters:
  • lat (float) - latitude of new point
  • lon (float) - longitude of new point
Overrides: oxm.geom.Box.expand_to_point

distance_from(self, pt)

source code 

How far away from the center of this box is the given point?

Parameters:

set_pixel_size(self)

source code 

Adjust the size of the cluster's bounding box and update it's center point to reflect this. A Cluster's bounding box size is simply half the width and half the height of the overall desired width and height. This is because clustered points are drawn as simple PNGs that should fit four on a page in a grid, and half width and half height yield a quarter of the area of the full page.

Overrides: Bounds.set_pixel_size