Ejemplo n.º 1
0
    def resize(self, new_width, new_height):
        """ 
        Redo the corner points of this box to reflect new C{width} and 
        C{height}, maintaining the same center point as this box currently 
        has.

        @param new_width: new width of box
        @type new_width: C{float}
        @param new_height: new height of box
        @type new_height: C{float}
        """
        mid_lat = (self.min_lat + self.max_lat) / 2.0
        mid_lon = (self.min_lon + self.max_lon) / 2.0
        
        dist = new_height / 2.0
        self.min_lat, lon = pt_dist_from_pt(mid_lat, mid_lon, dist, 180) # down
        self.max_lat, lon = pt_dist_from_pt(mid_lat, mid_lon, dist, 0) # up

        dist = new_width / 2.0
        lat, self.min_lon = pt_dist_from_pt(mid_lat, mid_lon, dist, 270) # left
        lat, self.max_lon = pt_dist_from_pt(mid_lat, mid_lon, dist, 90) # right
Ejemplo n.º 2
0
    def pt_dist_from(self, distance, true_course):
        """ 
        Calculate a point C{distance} statute miles from this point
        along a course C{true_course} degrees

        Some useful C{true_course} values:
          - 0.0 - north
          - 90.0 - east
          - 180.0 - south
          - 270.0 - west

        @param distance: distance from this point in statute miles
        @type distance: C{float}
        @param true_course: true course from this point in degrees
        @type true_course: C{float}

        @return: Point object representing calculated point
        @rtype: L{Point}
        """
        return pt_dist_from_pt(self.lat, self.lon, distance, true_course)