Ejemplo n.º 1
0
    def add_ground_station(
        self,
        pos,
        id_description=None,
        label_fill_color=None,
        label_font=None,
        label_outline_color=None,
        label_text=None,
        label_show=True,
    ):
        """
        Adds a ground station

        Parameters
        ----------
        orbit: poliastro.Orbit
            Orbit to be added
        pos: list [~astropy.units]
            coordinates of ground station
            [u v] ellipsoidal coordinates (0 elevation)

        Id parameters:
        -------------

        id_description: str
            Set ground station description

        Label parameters
        ----------

        label_fill_color: list (int)
            Fill Color in rgba format
        label_outline_color: list (int)
            Outline Color in rgba format
        label_font: str
            Set label font style and size (CSS syntax)
        label_text: str
            Set label text
        label_show: bool
            Indicates whether the label is visible
        """
        if (len(pos) == 2 and isinstance(pos[0], u.quantity.Quantity)
                and isinstance(pos[0], u.quantity.Quantity)):
            u0, v0 = pos

            if self.cust_prop[0]:
                a, b = (
                    self.cust_prop[0][0],
                    self.cust_prop[0][2],
                )  # get semi-major and semi-minor axises
            else:
                a, b = Earth.R.to(u.m).value, Earth.R_polar.to(u.m).value
            pos = list(
                map(lambda x: x.value, ellipsoidal_to_cartesian(a, b, u0, v0)))
        else:
            raise TypeError(
                "Invalid coordinates. Coordinates must be of the form [u, v] where u, v are astropy units"
            )

        pckt = Packet(
            id="GS" + str(self.gs_n),
            description=id_description,
            availability=TimeInterval(start=self.start_epoch,
                                      end=self.end_epoch),
            position=Position(cartesian=pos),
            label=Label(
                show=label_show,
                text=label_text,
                font=label_font
                if label_font is not None else "11pt Lucida Console",
                fillColor=Color(rgba=label_fill_color)
                if label_fill_color is not None else None,
                outlineColor=Color(rgba=label_outline_color)
                if label_outline_color is not None else None,
            ),
            billboard=Billboard(image=PIC_GROUNDSTATION, show=True),
        )

        self.packets.append(pckt)
        self.gs_n += 1
Ejemplo n.º 2
0
    def add_ground_station(
        self,
        pos,
        id_name=None,
        id_description=None,
        label_fill_color=None,
        label_font=None,
        label_outline_color=None,
        label_text=None,
        label_show=True,
    ):
        """
        Adds a ground station

        Parameters
        ----------
        orbit: poliastro.Orbit
            Orbit to be added
        pos: list [~astropy.units]
            coordinates of ground station
            [u v] ellipsoidal coordinates (0 elevation)

        Id parameters:
        -------------

        id_name: str
            Set ground station name
        id_description: str
            Set ground station description

        Label parameters
        ----------

        label_fill_color: list (int)
            Fill Color in rgba format
        label_outline_color: list (int)
            Outline Color in rgba format
        label_font: str
            Set label font style and size (CSS syntax)
        label_text: str
            Set label text
        label_show: bool
            Indicates whether the label is visible
        """
        if (len(pos) == 2 and isinstance(pos[0], u.quantity.Quantity)
                and isinstance(pos[0], u.quantity.Quantity)):
            u0, v0 = pos
            if self.cust_prop[0]:
                a, b = self.cust_prop[
                    0][:1]  # get semi-major and semi-minor axises
            else:
                a, b = 6378137.0, 6378137.0
            pos = list(
                map(lambda x: x.value, ellipsoidal_to_cartesian(a, b, u0, v0)))
        else:
            raise TypeError(
                "Invalid coordinates. Coordinates must be of the form [u, v] where u, v are astropy units"
            )

        self._init_ground_station_packet_(self.gs_n, pos)
        self._change_ground_station_params_(
            id_name=id_name,
            id_description=id_description,
            label_fill_color=label_fill_color,
            label_font=label_font,
            label_outline_color=label_outline_color,
            label_text=label_text,
            label_show=label_show,
        )
        self.gs_n += 1