コード例 #1
0
        /// <summary>
        /// Creates a new instance of our receiving phone
        /// with default configuration and graphics.
        /// </summary>
        /// <returns>A new SimpleReceiver.</returns>
        private SimpleReceiver CreateReceivingPhone()
        {
            var earth = CentralBodiesFacet.GetFromContext().Earth;

            // Create a receiving phone with a gain of 100 and a noisefactor of 2 - adding 290 Kelvin worth of noise to the call.
            // Even though we are using a static location for our receiver,
            // it can easily be changed to a moving one by simply modifying the
            // LocationPoint to something else, for example a route generated
            // with the Route Design Library.
            double longitude = Trig.DegreesToRadians(77.5833);
            double latitude  = Trig.DegreesToRadians(12.9833);
            var    phone     = new SimpleReceiver
            {
                Name            = "Bangalore, India",
                LocationPoint   = new PointCartographic(earth, new Cartographic(longitude, latitude, 0)),
                Gain            = 100.0,
                NoiseFactor     = 2.0,
                TargetFrequency = m_intendedSignal.TargetFrequency
            };

            //Add a default marker
            phone.Extensions.Add(new MarkerGraphicsExtension(new MarkerGraphics
            {
                Texture = new ConstantGraphicsParameter <Texture2D>(m_phoneTexture)
            }));

            //Add a label based on the name and show just below the marker.
            var textGraphics = new TextGraphics
            {
                Color             = new ConstantGraphicsParameter <Color>(Color.Yellow),
                Font              = new ConstantGraphicsParameter <Font>(m_labelFont),
                Outline           = new ConstantGraphicsParameter <bool>(true),
                OutlineColor      = new ConstantGraphicsParameter <Color>(Color.Black),
                Text              = new ConstantGraphicsParameter <string>(phone.Name),
                Origin            = new ConstantGraphicsParameter <Origin>(Origin.TopCenter),
                PixelOffset       = new ConstantGraphicsParameter <PointF>(new PointF(0, -m_phoneTexture.Template.Height / 2)),
                DisplayParameters =
                {
                    MaximumDistance = new ConstantGraphicsParameter <double>(75000000.0)
                }
            };

            if (TextureFilter2D.Supported(TextureWrap.ClampToEdge))
            {
                textGraphics.TextureFilter = new ConstantGraphicsParameter <TextureFilter2D>(TextureFilter2D.NearestClampToEdge);
            }

            phone.Extensions.Add(new TextGraphicsExtension(textGraphics));

            return(phone);
        }
コード例 #2
0
        /// <summary>
        /// Creates a new instance of our transmitting phone
        /// with default configuration and graphics.
        /// </summary>
        /// <returns>A new SimpleDigitalTransmitter.</returns>
        private SimpleDigitalTransmitter CreateTransmittingPhone()
        {
            var earth = CentralBodiesFacet.GetFromContext().Earth;

            // Create a new SimpleDigitalTransmitter and assign its basic properties.
            // Even though we are using a static location for our transmitter,
            // it can easily be changed to a moving one by simply modifying the
            // LocationPoint to something else, for example a route generated
            // with the Route Design Library.
            double longitude = Trig.DegreesToRadians(39.6333);
            double latitude  = Trig.DegreesToRadians(11.1333);
            var    phone     = new SimpleDigitalTransmitter
            {
                Name             = "Dessie, Ethiopia",
                LocationPoint    = new PointCartographic(earth, new Cartographic(longitude, latitude, 0.0)),
                CarrierFrequency = m_intendedSignal.TargetFrequency,
                EffectiveIsotropicRadiatedPower = CommunicationAnalysis.FromDecibels(m_transmitPowerTrackBar.Value),
                DataRate = 50000.0
            };

            //Add a default marker
            phone.Extensions.Add(new MarkerGraphicsExtension(new MarkerGraphics
            {
                Texture = new ConstantGraphicsParameter <Texture2D>(m_phoneTexture)
            }));

            //Add a label based on the name and show just below the marker.
            var textGraphics = new TextGraphics
            {
                Color             = new ConstantGraphicsParameter <Color>(Color.Yellow),
                Font              = new ConstantGraphicsParameter <Font>(m_labelFont),
                Outline           = new ConstantGraphicsParameter <bool>(true),
                OutlineColor      = new ConstantGraphicsParameter <Color>(Color.Black),
                Text              = new ConstantGraphicsParameter <string>(phone.Name),
                Origin            = new ConstantGraphicsParameter <Origin>(Origin.TopCenter),
                PixelOffset       = new ConstantGraphicsParameter <PointF>(new PointF(0, -m_phoneTexture.Template.Height / 2)),
                DisplayParameters =
                {
                    MaximumDistance = new ConstantGraphicsParameter <double>(75000000.0)
                }
            };

            if (TextureFilter2D.Supported(TextureWrap.ClampToEdge))
            {
                textGraphics.TextureFilter = new ConstantGraphicsParameter <TextureFilter2D>(TextureFilter2D.NearestClampToEdge);
            }

            phone.Extensions.Add(new TextGraphicsExtension(textGraphics));

            return(phone);
        }
コード例 #3
0
        /// <summary>
        /// Creates a new instance. Font, Name and LinkScalars properties must be specified.
        /// </summary>
        public LinkBudgetOverlayHelper(Font font)
        {
            m_font = font;

            // GraphicsParameterFormatter is part of Platform.Graphics and
            // optimizes dynamic text generation by only recalculating
            // values as they are needed. For example, if a field is not,
            // time varying, it will never evaluate it more than once.
            m_formatter = new GraphicsParameterFormatter
            {
                // Specify a format string that provides the output we want.
                FormatString = @"Name: {0}
Effective Isotropic Radiated Power: {1:0.000} dBW
Received Isotropic Power: {2:0.000} dBW
Power At Receiver Output: {3:0.000} dBW
Received Power Flux Density: {4:0.000} dBW/m^2
Propagation Loss: {5:0.000} dB
Carrier To Noise Density: {6:0.000} dB*Hz
Carrier To Noise: {7:0.000} dB
Energy Per Bit To Noise Density: {8:0.000} dB
Bit Error Rate: {9:0.###E+000}"
            };

            // Create a screen overlay with a translucent background to make the
            // text easier to read.
            m_overlay = new ScreenOverlay(0.0, 0.0, 1.0, 1.0)
            {
                Color        = Color.Black,
                Translucency = 0.5f,
                Origin       = ScreenOverlayOrigin.TopLeft
            };

            // Create a child overlay for our background to write text on.
            m_textOverlay = new TextureScreenOverlay(0.0, 0.0, 1.0, 1.0)
            {
                Origin = ScreenOverlayOrigin.Center,
                Color  = Color.Yellow
            };
            m_overlay.Overlays.Add(m_textOverlay);

            if (TextureFilter2D.Supported(TextureWrap.ClampToEdge))
            {
                m_textOverlay.TextureFilter = TextureFilter2D.NearestClampToEdge;
            }
        }
コード例 #4
0
        /// <summary>
        /// Creates a new instance with the provided properties.
        /// </summary>
        public IridiumSatellite(string name, IEnumerable <TwoLineElementSet> tles, Font font, double targetFrequency)
        {
            var earth = CentralBodiesFacet.GetFromContext().Earth;

            //Set the name and create the point from the TLE.
            Name            = name;
            LocationPoint   = new Sgp4Propagator(tles).CreatePoint();
            OrientationAxes = new AxesVehicleVelocityLocalHorizontal(earth.InertialFrame, LocationPoint);

            //Create a transceiver modeled after Iridium specs.
            m_transceiver = new Transceiver
            {
                Name              = Name + " Transceiver",
                Modulation        = new ModulationQpsk(),
                OutputGain        = 100.0,
                OutputNoiseFactor = 1.2,
                CarrierFrequency  = targetFrequency,
                Filter            = new RectangularFilter
                {
                    Frequency           = targetFrequency,
                    UpperBandwidthLimit = 20.0e6,
                    LowerBandwidthLimit = -20.0e6
                },
                InputAntennaGainPattern  = new GaussianGainPattern(1.0, 0.55, 0.001),
                OutputAntennaGainPattern = new GaussianGainPattern(1.0, 0.55, 0.001)
            };
            m_transceiver.InputAntenna.LocationPoint  = new PointFixedOffset(ReferenceFrame, new Cartesian(0, -1.0, 0));
            m_transceiver.OutputAntenna.LocationPoint = new PointFixedOffset(ReferenceFrame, new Cartesian(0, +1.0, 0));

            // setup Marker graphics for the satellites
            var satelliteTexture = SceneManager.Textures.FromUri(Path.Combine(Application.StartupPath, "Data/Markers/smallsatellite.png"));

            m_markerGraphicsExtension = new MarkerGraphicsExtension(new MarkerGraphics
            {
                Texture           = new ConstantGraphicsParameter <Texture2D>(satelliteTexture),
                DisplayParameters = new DisplayParameters
                {
                    // hide marker when camera is closer than the below distance
                    MinimumDistance = new ConstantGraphicsParameter <double>(17500000.0)
                }
            });
            Extensions.Add(m_markerGraphicsExtension);

            // setup Model graphics for the satellites
            var modelUri = new Uri(Path.Combine(Application.StartupPath, "Data/Models/iridium.mdl"));

            m_modelGraphicsExtension = new ModelGraphicsExtension(new ModelGraphics
            {
                Uri               = new ConstantGraphicsParameter <Uri>(modelUri),
                Scale             = new ConstantGraphicsParameter <double>(50000.0),
                DisplayParameters = new DisplayParameters
                {
                    // hide model when camera is further than the marker minimum distance above
                    MaximumDistance = m_markerGraphicsExtension.MarkerGraphics.DisplayParameters.MinimumDistance
                }
            });
            Extensions.Add(m_modelGraphicsExtension);

            // setup text graphics for the satellites
            m_textGraphicsExtension = new TextGraphicsExtension(new TextGraphics
            {
                Color        = new ConstantGraphicsParameter <Color>(Color.Red),
                Font         = new ConstantGraphicsParameter <Font>(font),
                Outline      = new ConstantGraphicsParameter <bool>(true),
                OutlineColor = new ConstantGraphicsParameter <Color>(Color.Black),
                Text         = new ConstantGraphicsParameter <string>(Name),
                Origin       = new ConstantGraphicsParameter <Origin>(Origin.TopCenter),
                PixelOffset  = new ConstantGraphicsParameter <PointF>(new PointF(0, -satelliteTexture.Template.Height / 2))
            });
            if (TextureFilter2D.Supported(TextureWrap.ClampToEdge))
            {
                m_textGraphicsExtension.TextGraphics.TextureFilter = new ConstantGraphicsParameter <TextureFilter2D>(TextureFilter2D.NearestClampToEdge);
            }

            Extensions.Add(m_textGraphicsExtension);
        }