Exemple #1
0
def double_star_chart_pdf(double_star_id, ra, dec):
    double_star = DoubleStar.query.filter_by(id=double_star_id).first()
    if double_star is None:
        abort(404)

    img_bytes = common_chart_pdf_img(double_star.ra_first, double_star.dec_first, ra, dec)

    return send_file(img_bytes, mimetype='application/pdf')
Exemple #2
0
def star_chart_pdf(star_id, ra, dec):
    star = Star.query.filter_by(id=star_id).first()
    if star is None:
        abort(404)

    img_bytes = common_chart_pdf_img(star.ra, star.dec, ra, dec)

    return send_file(img_bytes, mimetype='application/pdf')
Exemple #3
0
def chart_pdf(dso_id, ra, dec):
    dso, orig_dso = _find_dso(dso_id)
    if dso is None:
        abort(404)

    img_bytes = common_chart_pdf_img(dso.ra,
                                     dso.dec,
                                     ra,
                                     dec,
                                     dso_names=[dso.name])

    return send_file(img_bytes, mimetype='application/pdf')
Exemple #4
0
def dso_list_chart_pdf(dso_list_id, ra, dec):
    highlights_dso_list = _find_highlights_dso_list(dso_list_id)
    if highlights_dso_list is None:
        abort(404)

    img_bytes = common_chart_pdf_img(None,
                                     None,
                                     ra,
                                     dec,
                                     highlights_dso_list=highlights_dso_list)

    return send_file(img_bytes, mimetype='application/pdf')
Exemple #5
0
def news_chart_pdf(news_id, ra, dec):
    news = News.query.filter_by(id=news_id).first()
    if news is None:
        abort(404)
    if not news.is_released and (current_user.is_anonymous
                                 or not current_user.is_editor):
        abort(404)

    news_ra = to_float(request.args.get('obj_ra'), None)
    news_dec = to_float(request.args.get('obj_dec'), None)

    img_bytes = common_chart_pdf_img(news_ra, news_dec, ra, dec)

    return send_file(img_bytes, mimetype='application/pdf')
Exemple #6
0
def session_plan_chart_pdf(session_plan_id, ra, dec):
    session_plan = SessionPlan.query.filter_by(id=session_plan_id).first()
    _check_session_plan(session_plan, allow_public=True)

    highlights_dso_list = [
        x.deepskyObject for x in session_plan.session_plan_items
        if session_plan
    ]

    img_bytes = common_chart_pdf_img(None,
                                     None,
                                     ra,
                                     dec,
                                     highlights_dso_list=highlights_dso_list)

    return send_file(img_bytes, mimetype='application/pdf')
Exemple #7
0
def comet_chart_pdf(comet_id, ra, dec):
    comet = _find_comet(comet_id)
    if comet is None:
        abort(404)

    comet_ra = to_float(request.args.get('obj_ra'), None)
    comet_dec = to_float(request.args.get('obj_dec'), None)

    trajectory_b64 = request.args.get('trajectory')
    if trajectory_b64:
        trajectory_json = base64.b64decode(trajectory_b64)
        trajectory = json.loads(trajectory_json)
    else:
        trajectory = None

    img_bytes = common_chart_pdf_img(comet_ra, comet_dec, ra, dec, trajectory=trajectory)

    return send_file(img_bytes, mimetype='application/pdf')
Exemple #8
0
def wish_list_chart_pdf(ra, dec):
    wish_list = WishList.create_get_wishlist_by_user_id(current_user.id)
    if wish_list is None:
        abort(404)

    highlights_dso_list = [
        x.deepskyObject for x in wish_list.wish_list_items
        if wish_list.wish_list_items
    ]

    flags = request.args.get('json')
    visible_objects = [] if flags else None
    img_bytes = common_chart_pdf_img(None,
                                     None,
                                     ra,
                                     dec,
                                     highlights_dso_list=highlights_dso_list)

    return send_file(img_bytes, mimetype='application/pdf')
Exemple #9
0
def minor_planet_chart_pdf(minor_planet_id, ra, dec):
    minor_planet = MinorPlanet.query.filter_by(id=minor_planet_id).first()
    if minor_planet is None:
        abort(404)

    minor_planet_ra = to_float(request.args.get('obj_ra'), None)
    minor_planet_dec = to_float(request.args.get('obj_dec'), None)

    trajectory_b64 = request.args.get('trajectory')
    if trajectory_b64:
        trajectory_json = base64.b64decode(trajectory_b64)
        trajectory = json.loads(trajectory_json)
    else:
        trajectory = None

    img_bytes = common_chart_pdf_img(minor_planet_ra,
                                     minor_planet_dec,
                                     ra,
                                     dec,
                                     trajectory=trajectory)

    return send_file(img_bytes, mimetype='application/pdf')
Exemple #10
0
def chart_pdf(ra, dec):
    img_bytes = common_chart_pdf_img(None, None, ra, dec)
    return send_file(img_bytes, mimetype='application/pdf')