float GetVisualSize()
    {
        if (Satellite.Primary == null)
        {
            return(SystemMap.RootVisualSize);
        }

        if (SystemMapObject.IsFocused)
        {
            return(SystemMap.FocusedObjectVisualSize);
        }

        Satellite primary = (Satellite.Motion as SatelliteMotion).Primary;

        IEnumerable <Satellite> satellites;

        if (Satellite.IsNaturalSatellite())
        {
            satellites = primary.Satellites
                         .Where(satellite => satellite.IsNaturalSatellite());
        }
        else
        {
            satellites = primary.Satellites
                         .Where(satellite => !satellite.IsNaturalSatellite());
        }

        float largest_radius  = satellites.Max(satellite => satellite.Radius);
        float smallest_radius = satellites.Min(satellite => satellite.Radius);

        float relative_size = 1;

        if (satellites.Count() > 1)
        {
            float smallest_normalized_size;
            if (Satellite.IsNaturalSatellite())
            {
                smallest_normalized_size =
                    The.SystemMap.SmallestNaturalSatelliteVisualSize /
                    The.SystemMap.LargestNaturalSatelliteVisualSize;
            }
            else
            {
                smallest_normalized_size =
                    The.SystemMap.SmallestArtificialSatelliteVisualSize /
                    The.SystemMap.LargestArtificialSatelliteVisualSize;
            }

            relative_size =
                (smallest_normalized_size - 1) *
                Mathf.Log(Satellite.Radius / largest_radius) /
                Mathf.Log(smallest_radius / largest_radius) +
                1;
        }

        return(relative_size *
               (Satellite.IsNaturalSatellite() ?
                The.SystemMap.LargestNaturalSatelliteVisualSize :
                The.SystemMap.LargestArtificialSatelliteVisualSize));
    }
Exemplo n.º 2
0
    public static Visitable Place(this Satellite satellite)
    {
        if (satellite.IsStation())
        {
            return(satellite.Station());
        }
        else if (satellite.IsNaturalSatellite())
        {
            return(satellite.NaturalSatellite());
        }

        return(null);
    }