def draw_solarsystem(self, dt, draw_orbits=True, orbit_stroke=0.7, planet_scaler=2, planet_min=5, planet_max=15): """ Draws the solar system for a given time""" if draw_orbits: for planet in solarsystem.planets: orbit = solarsystem.get_orbit( planet.eph, dt, dt + datetime.timedelta(days=planet.year)) self.draw_line(orbit, orbit_stroke, (0.373, 0.435, 0.569), 0.5) # Draw the Planets for planet in solarsystem.planets: position = solarsystem.position(planet.eph, dt) size = planet.radius * planet_scaler if size < planet_min: size = planet_min if size > planet_max: size = planet_max self.draw_object(position, size, planet.color_rgb, 1) # The Sun self.draw_object((0, 0, 0), planet_max + 2, (0.918, 1, 0.180), 1)
def draw_solarsystem(self, dt, draw_orbits=True, orbit_stroke=0.7, planet_scaler=2, planet_min=5, planet_max=15): if draw_orbits: for planet in solarsystem.planets: orbit = solarsystem.get_orbit(planet.eph, dt, dt + datetime.timedelta(days = planet.year)) self.draw_orbit(orbit, stroke=orbit_stroke) for planet in solarsystem.planets: position = solarsystem.position(planet.eph, dt) size = planet.radius*planet_scaler if size < planet_min: size = planet_min if size > planet_max: size = planet_max self.draw_object(position, size, planet.color, 1) self.draw_object((0,0,0), planet_max+2, "#eaff2e", 1)
def draw_ephemobject(self, obj, dt, size=0.7, label_size=7, label=None, label_offset=10): position = solarsystem.position(obj, dt) self.draw_object(position, size, (1, 1, 1), 1) if label != None: self.draw_text(position, label, (0.8, 0.8, 0.8), label_size, label_offset=label_offset)
def draw_ephemobject(self, obj, dt, size=0.7, label_size=7, label=None, label_offset=10): position = solarsystem.position(obj, dt) self.draw_object(position, size, "#ffffff", 1) if label != None: self.draw_label(position, label, "#dddddd", label_size, label_offset=10)
def draw_solarsystem(self, dt, draw_orbits=True, orbit_stroke=0.7, planet_scaler=2, planet_min=5, planet_max=15): """ Draws the solar system for a given time""" if draw_orbits: for planet in solarsystem.planets: orbit = solarsystem.get_orbit(planet.eph, dt, dt + datetime.timedelta(days = planet.year)) self.draw_line(orbit, orbit_stroke, (0.373,0.435,0.569), 0.5) # Draw the Planets for planet in solarsystem.planets: position = solarsystem.position(planet.eph, dt) size = planet.radius*planet_scaler if size < planet_min: size = planet_min if size > planet_max: size = planet_max self.draw_object(position, size, planet.color_rgb, 1) # The Sun self.draw_object((0,0,0), planet_max+2, (0.918, 1, 0.180), 1)
def draw_solarsystem(self, dt, draw_orbits=True, orbit_stroke=0.7, planet_scaler=2, planet_min=5, planet_max=15): if draw_orbits: for planet in solarsystem.planets: orbit = solarsystem.get_orbit( planet.eph, dt, dt + datetime.timedelta(days=planet.year)) self.draw_orbit(orbit, stroke=orbit_stroke) for planet in solarsystem.planets: position = solarsystem.position(planet.eph, dt) size = planet.radius * planet_scaler if size < planet_min: size = planet_min if size > planet_max: size = planet_max self.draw_object(position, size, planet.color, 1) self.draw_object((0, 0, 0), planet_max + 2, "#eaff2e", 1)
def draw_ephemobject(self, obj, dt, size=0.7, label_size=7, label=None, label_offset=10): position = solarsystem.position(obj, dt) self.draw_object(position, size, (1,1,1), 1) if label != None: self.draw_text(position, label, (0.8,0.8,0.8), label_size, label_offset=label_offset)
#!/usr/bin/env python import drawing import datetime import solarsystem import json import ephem import config now = datetime.datetime.utcnow() p = solarsystem.position(ephem.Sun(), now) png = drawing.DrawPNG(720, 720, 1.95, center=(0, 0)) png.draw_solarsystem(now, orbit_stroke=1.4, planet_scaler=3, planet_min=1.5, planet_max=7) spacecraft = solarsystem.spacecraft() for craft in config.spacecraft: #orbit_past = spacecraft.get_past_orbit(craft, now) #png.draw_line(orbit_past, 1, (0.6,0.6,0.6), 0.5) scraft = spacecraft.get_location(craft, now) png.draw_object(scraft, 1, (0.95, 0.95, 0.95), 1) png.draw_text(scraft, config.spacecraft[craft]["label"], (0.95, 0.95, 0.95), 9, label_offset=5)