Ejemplo n.º 1
0
 def __init__(self, model):
     '''
     constructor
     '''
     AbstractAstronomicalSource.__init__(self)
     self.zenith = GeocentricCoordinates(0, 0, 0)
     self.nadir = GeocentricCoordinates(0, 0, 0)
     self.north = GeocentricCoordinates(0, 0, 0)
     self.south = GeocentricCoordinates(0, 0, 0)
     self.east = GeocentricCoordinates(0, 0, 0)
     self.west = GeocentricCoordinates(0, 0, 0)
 
     self.line_sources = []
     self.text_sources = []
 
     self.lastUpdateTimeMs = 0
     
     self.model = model
     
     vertices = [self.north, self.east, self.south, self.west, self.north]
     self.line_sources.append(LineSource(vertices, self.LINE_COLOR, 1.5))
     
     self.text_sources.append(TextSource("ZENITH", self.LABEL_COLOR, self.zenith))
     self.text_sources.append(TextSource("NADIR", self.LABEL_COLOR, self.nadir))
     self.text_sources.append(TextSource("NORTH", self.LABEL_COLOR, self.north))
     self.text_sources.append(TextSource("SOUTH", self.LABEL_COLOR, self.south))
     self.text_sources.append(TextSource("EAST", self.LABEL_COLOR, self.east))
     self.text_sources.append(TextSource("WEST", self.LABEL_COLOR, self.west))
Ejemplo n.º 2
0
        def __init__(self, num_RA_sources, num_De_sources):
            '''
            constructor
            '''
            AbstractAstronomicalSource.__init__(self)

            self.LINE_COLOR = 0x14F8EFBC
            # These are great (semi)circles, so only need 3 points.
            self.NUM_DEC_VERTICES = 3
            # every 10 degrees
            self.NUM_RA_VERTICES = 36

            self.line_sources = []
            self.text_sources = []

            for r in range(0, num_RA_sources):
                self.line_sources.append(self.create_ra_line(
                    r, num_RA_sources))
            for d in range(0, num_De_sources):
                self.line_sources.append(
                    self.create_dec_line(d, num_De_sources))

            # North & South pole, hour markers every 2hrs.
            self.text_sources.append(
                TextSource("NP", self.LINE_COLOR, get_instance(0.0, 90.0)))
            self.text_sources.append(
                TextSource("SP", self.LINE_COLOR, get_instance(0.0, -90.0)))

            for index in range(0, 12):
                ra = index * 30.0
                title = str(index * 2) + "h"
                self.text_sources.append(
                    TextSource(title, self.LINE_COLOR, get_instance(ra, 0.0)))
Ejemplo n.º 3
0
 def __init__(self, model, shower):
     '''
     constructor
     '''
     AbstractAstronomicalSource.__init__(self)
     self.image_sources = []
     self.label_sources = []
     
     self.lastUpdateTimeMs = 0
     self.search_names = []
     
     self.model = model
     self.shower = shower
     self.name = shower.name_id
     
     start_date = datetime.fromtimestamp(mktime(shower.start)).strftime('%m/%d')
     end_date = datetime.fromtimestamp(mktime(shower.end)).strftime('%m/%d')
     self.search_names.append(self.name + " (" + start_date + "-" + end_date + ")")
     
     # blank is a 1pxX1px image that should be invisible.
     # We'd prefer not to show any image except on the shower dates, but there
     # appears to be a bug in the renderer/layer interface in that Update values are not
     # respected.  Ditto the label.
     
     self.the_image = ImageSource(shower.radiant, "blank", self.UP, self.SCALE_FACTOR)
     self.image_sources.append(self.the_image)
     self.label = TextSource(self.name, self.LABEL_COLOR, shower.radiant)
     self.label_sources.append(self.label)
Ejemplo n.º 4
0
        def __init__(self, model, shower):
            '''
            constructor
            '''
            AbstractAstronomicalSource.__init__(self)
            self.image_sources = []
            self.label_sources = []

            self.lastUpdateTimeMs = 0
            self.search_names = []

            self.model = model
            self.shower = shower
            self.name = shower.name_id

            start_date = datetime.fromtimestamp(mktime(
                shower.start)).strftime('%m/%d')
            end_date = datetime.fromtimestamp(mktime(
                shower.end)).strftime('%m/%d')
            self.search_names.append(self.name + " (" + start_date + "-" +
                                     end_date + ")")

            # blank is a 1pxX1px image that should be invisible.
            # We'd prefer not to show any image except on the shower dates, but there
            # appears to be a bug in the renderer/layer interface in that Update values are not
            # respected.  Ditto the label.

            self.the_image = ImageSource(shower.radiant, "blank", self.UP,
                                         self.SCALE_FACTOR)
            self.image_sources.append(self.the_image)
            self.label = TextSource(self.name, self.LABEL_COLOR,
                                    shower.radiant)
            self.label_sources.append(self.label)
Ejemplo n.º 5
0
        def __init__(self, num_RA_sources, num_De_sources):
            '''
            constructor
            '''
            AbstractAstronomicalSource.__init__(self)
            
            self.LINE_COLOR = 0x14F8EFBC
            # These are great (semi)circles, so only need 3 points.
            self.NUM_DEC_VERTICES = 3
            # every 10 degrees
            self.NUM_RA_VERTICES = 36

            self.line_sources = []
            self.text_sources = []
            
            for r in range(0, num_RA_sources):
                self.line_sources.append(self.create_ra_line(r, num_RA_sources))
            for d in range(0, num_De_sources):
                self.line_sources.append(self.create_dec_line(d, num_De_sources))
                
            # North & South pole, hour markers every 2hrs.
            self.text_sources.append(TextSource("NP", self.LINE_COLOR, 
                                                get_instance(0.0, 90.0)))
            self.text_sources.append(TextSource("SP", self.LINE_COLOR, 
                                                get_instance(0.0, -90.0)))
            
            for index in range(0, 12):
                ra = index * 30.0
                title = str(index * 2) + "h"
                self.text_sources.append(TextSource(title, self.LINE_COLOR, 
                                                    get_instance(ra, 0.0)))
Ejemplo n.º 6
0
        def __init__(self):
            '''
            constructor
            '''
            AbstractAstronomicalSource.__init__(self)

            self.line_sources = []
            self.text_sources = []

            title = "Ecliptic"
            self.text_sources.append(
                TextSource(title, self.LINE_COLOR,
                           get_instance(90.0, self.EPSILON)))
            self.text_sources.append(
                TextSource(title, self.LINE_COLOR,
                           get_instance(270.0, -self.EPSILON)))

            # Create line source.
            ra = [0.0, 90.0, 180.0, 270.0, 0.0]
            dec = [0.0, self.EPSILON, 0.0, -self.EPSILON, 0.0]

            vertices = []
            for i in range(0, len(ra)):
                vertices.append(get_instance(ra[i], dec[i]))

            self.line_sources.append(LineSource(vertices, self.LINE_COLOR,
                                                1.5))
Ejemplo n.º 7
0
 def __init__(self, astronomical_source_proto):
     '''
     Constructor
     '''
     AbstractAstronomicalSource.__init__(self)
     
     if len(self.strings.keys()) == 0:
         construct_id_to_string_map("assets/Strings.txt", self.strings)
         
     self.astro_source_proto = astronomical_source_proto
     self.set_names(astronomical_source_proto)
Ejemplo n.º 8
0
    def __init__(self, astronomical_source_proto):
        '''
        Constructor
        '''
        AbstractAstronomicalSource.__init__(self)

        if len(self.strings.keys()) == 0:
            construct_id_to_string_map("assets/Strings.txt", self.strings)

        self.astro_source_proto = astronomical_source_proto
        self.set_names(astronomical_source_proto)
Ejemplo n.º 9
0
    def __init__(self, planet, model):
        '''
        Constructor
        '''
        AbstractAstronomicalSource.__init__(self)

        self.point_sources = []
        self.image_sources = []
        self.label_sources = []
        self.planet = planet
        self.model = model
        self.name = planet.name_resource_id
        self.current_coords = GeocentricCoordinates(0, 0, 0)
        self.sun_coords = None
        self.image_id = -1

        self.last_update_time_Ms = 0
Ejemplo n.º 10
0
 def __init__(self, planet, model):
     '''
     Constructor
     '''
     AbstractAstronomicalSource.__init__(self)
     
     self.point_sources = []
     self.image_sources = []
     self.label_sources = []
     self.planet = planet
     self.model = model
     self.name = planet.name_resource_id
     self.current_coords = GeocentricCoordinates(0, 0, 0)
     self.sun_coords = None
     self.image_id = -1
     
     self.last_update_time_Ms  = 0
     
Ejemplo n.º 11
0
 def __init__(self):
     '''
     constructor
     '''
     AbstractAstronomicalSource.__init__(self)
     
     self.line_sources = []
     self.text_sources = []
     
     title = "Ecliptic"
     self.text_sources.append(TextSource(title, self.LINE_COLOR, 
                                         get_instance(90.0, self.EPSILON)))
     self.text_sources.append(TextSource(title, self.LINE_COLOR, 
                                         get_instance(270.0, -self.EPSILON)))
     
     # Create line source.
     ra = [0.0, 90.0, 180.0, 270.0, 0.0]
     dec = [0.0, self.EPSILON, 0.0, -self.EPSILON, 0.0]
     
     vertices = []
     for i in range(0, len(ra)):
         vertices.append(get_instance(ra[i], dec[i]))
     
     self.line_sources.append(LineSource(vertices, self.LINE_COLOR, 1.5))