예제 #1
0
파일: models.py 프로젝트: ccnmtl/blackrock
 def set_suggested_lat_lon_from_mag_north(self,
                                          heading_degrees_from_mag_north,
                                          distance):
     self.set_transect_bearing_wrt_magnetic_north(
         heading_degrees_from_mag_north)
     trig_radians_angle = positive_radians(
         degrees_to_radians(self.transect_bearing))
     square_center = self.expedition.grid_square.center
     center_point = [square_center.lat(), square_center.lon()]
     suggested_location = list(
         walk_transect(center_point, distance, trig_radians_angle))
     self.set_suggested_lat_long(suggested_location)
예제 #2
0
파일: models.py 프로젝트: Valmach/blackrock
 def set_suggested_lat_lon_from_mag_north(self,
                                          heading_degrees_from_mag_north,
                                          distance):
     self.set_transect_bearing_wrt_magnetic_north(
         heading_degrees_from_mag_north)
     trig_radians_angle = positive_radians(
         degrees_to_radians(self.transect_bearing))
     square_center = self.expedition.grid_square.center
     center_point = [square_center.lat(), square_center.lon()]
     suggested_location = list(
         walk_transect(center_point, distance, trig_radians_angle))
     self.set_suggested_lat_long(suggested_location)
예제 #3
0
파일: models.py 프로젝트: ccnmtl/blackrock
 def transect_endpoints(self):
     trig_radians_angle = positive_radians(
         degrees_to_radians(self.transect_bearing))
     side_of_square = 250.0  # meters. #TODO move this to settings.
     transect_length = length_of_transect(
         trig_radians_angle, side_of_square)
     square_center = self.expedition.grid_square.center
     center_point = [square_center.lat(), square_center.lon()]
     result = {}
     result['center'] = [square_center.lat(), square_center.lon()]
     result['edge'] = list(
         walk_transect(center_point, transect_length, trig_radians_angle))
     return result
예제 #4
0
파일: models.py 프로젝트: Valmach/blackrock
 def transect_endpoints(self):
     trig_radians_angle = positive_radians(
         degrees_to_radians(self.transect_bearing))
     side_of_square = 250.0  # meters. #TODO move this to settings.
     transect_length = length_of_transect(trig_radians_angle,
                                          side_of_square)
     square_center = self.expedition.grid_square.center
     center_point = [square_center.lat(), square_center.lon()]
     result = {}
     result['center'] = [square_center.lat(), square_center.lon()]
     result['edge'] = list(
         walk_transect(center_point, transect_length, trig_radians_angle))
     return result
예제 #5
0
    def transects(self):
        result = []
        points_and_letters = dict(
            (t, t.team_letter) for t in self.traplocation_set.all())
        team_letters = sorted(list(set(points_and_letters.values())))
        the_id = 0
        for letter in team_letters:
            the_other_id = 0
            the_id = the_id + 1
            the_points = [
                point for point, x in points_and_letters.iteritems()
                if x == letter
            ]
            a_point = the_points[0]
            transect_points = [a.recreate_point_obj() for a in the_points]

            for p in transect_points:
                the_other_id = the_other_id + 1
                p['transect_id'] = the_id
                p['point_index_2'] = the_other_id

            side_of_square = 250.0  # meters. #TODO move this to settings.
            trig_radians_angle = positive_radians(
                degrees_to_radians(a_point.transect_bearing))
            transect_length = length_of_transect(trig_radians_angle,
                                                 side_of_square)

            magnetic_north = a.transect_bearing_wrt_magnetic_north()

            transect_info = {
                'transect_id': the_id,
                'team_letter': letter,
                'heading': a_point.transect_bearing,
                'heading_radians': trig_radians_angle,
                'length': transect_length,
                'edge': a_point.transect_endpoints()['edge'],
                'heading_wrt_magnetic_north': magnetic_north,
                'points': transect_points,
            }
            result.append(transect_info)
        return result
예제 #6
0
파일: models.py 프로젝트: ccnmtl/blackrock
    def transects(self):
        result = []
        points_and_letters = dict((t, t.team_letter)
                                  for t in self.traplocation_set.all())
        team_letters = sorted(list(set(points_and_letters.values())))
        the_id = 0
        for letter in team_letters:
            the_other_id = 0
            the_id = the_id + 1
            the_points = [
                point for point, x in points_and_letters.items()
                if x == letter]
            a_point = the_points[0]
            transect_points = [a.recreate_point_obj() for a in the_points]

            for p in transect_points:
                the_other_id = the_other_id + 1
                p['transect_id'] = the_id
                p['point_index_2'] = the_other_id

            side_of_square = 250.0  # meters. #TODO move this to settings.
            trig_radians_angle = positive_radians(
                degrees_to_radians(a_point.transect_bearing))
            transect_length = length_of_transect(
                trig_radians_angle, side_of_square)

            magnetic_north = a.transect_bearing_wrt_magnetic_north()

            transect_info = {
                'transect_id': the_id,
                'team_letter': letter,
                'heading': a_point.transect_bearing,
                'heading_radians': trig_radians_angle,
                'length': transect_length,
                'edge': a_point.transect_endpoints()['edge'],
                'heading_wrt_magnetic_north': magnetic_north,
                'points': transect_points,
            }
            result.append(transect_info)
        return result
예제 #7
0
 def test_neg_positive_radians(self):
     self.positive_radians = positive_radians(-19)
     self.assertEquals(self.positive_radians, -19 + 2 * pi)
예제 #8
0
 def test_positive_radians(self):
     self.positive_radians = positive_radians(19)
     self.assertEquals(self.positive_radians, 19)