コード例 #1
0
    def get_sky_objects(self, zoom, x, y):
        bounds = calculate_bounds(zoom, x, y)
        key = "%d-%d-%d" % (zoom, x, y)
        data = self.cache.get_multi(['tiles', key], namespace=self.cache_namespace)

        if key in data:
            result = (Star(star, star, AzAlt(az, alt), mag) for (az, alt, mag, star) in data[key])
        else:
            result = ()

        return bounds, result
コード例 #2
0
    def get_coords(self, zoom, x, y):
        bounds = calculate_bounds(zoom, x, y)
        az1, dec1, az2, dec2 = bounds

        mid_az = (az2 - az1) / 2.0 + az1
        mid_dec = (dec1 - dec2) / 2.0 + dec2
        assert get_tile_coords((mid_az, mid_dec), zoom) == (x, y), get_tile_coords((mid_az, mid_dec), zoom)

        radec = self.projector.unproject(AzAlt(mid_az, mid_dec))
        #assert self.projector.project(radec) == AzAlt(mid_az, mid_dec), (self.projector.project(radec), AzAlt(mid_az, mid_dec))

        cx, cy = get_tile_coords(radec, zoom)

        return cx, cy, az1, az2, bounds, radec
コード例 #3
0
    def get_sky_objects(self, zoom, x, y):
        bounds = calculate_bounds(zoom, x, y)
        (nw_ra, nw_dec, se_ra, se_dec) = bounds

        found_stars = []
        for star in self.stars:
            if within_bounds(star.radec, bounds):
                found_stars.append(star)

        for line in self.lines:
            point1, point2 = line.point1, line.point2

            if within_bounds(point1, bounds) or within_bounds(point2, bounds):
                # fixes for wrap arounds
                if not within_bounds(point1, bounds):
                    point1 = fix_wrap_around(point2, point1)
                elif not within_bounds(point2, bounds):
                    point2 = fix_wrap_around(point1, point2)

                found_stars.append(Line(point1, point2))

            else:
                case1 = point1, fix_wrap_around(point1, point2)
                case2 = point2, fix_wrap_around(point2, point1)

                found = None
                for case in [case1, case2]:
                    found = check_if_line_goes_through(bounds, case)
                    if found:
                        break

                if found:
                    found_stars.append(found)


        return bounds, found_stars