public Main() { InitializeComponent(); m_insight3D = new Insight3D(); m_insight3D.Dock = DockStyle.Fill; m_insight3DPanel.Controls.Add(m_insight3D); // We don't have a call placed yet. m_hangUpButton.Enabled = false; m_callPlaced = false; // Load a texture which we will use for our phone locations. m_phoneTexture = SceneManager.Textures.FromUri(Path.Combine(Application.StartupPath, "Data/Markers/facility.png")); // Create a ServiceProviderDisplay to be used for visualization. m_display = new ServiceProviderDisplay(); // Create the font to use for labeling. We are using the same font as the control, only smaller. m_labelFont = new Font(Font.FontFamily, 10, Font.Style, Font.Unit, Font.GdiCharSet, Font.GdiVerticalFont); // The call will be taking place at a frequency of 1620.5e6. m_intendedSignal = new IntendedSignalByFrequency(1620.5e6); // Create the transmitting phone that we will use for our call and add it to the display. m_transmittingPhone = CreateTransmittingPhone(); m_display.ServiceProviders.Add(m_transmittingPhone); // Do the same for the receiving phone. m_receivingPhone = CreateReceivingPhone(); m_display.ServiceProviders.Add(m_receivingPhone); // Create an instance of IridiumSatellite for each of the three satellites we will // be using and add them to the display. // IridiumSatellite is a Platform-based class that adds default graphics and a // Transceiver object for communication. var analysisDate = new JulianDate(new GregorianDate(2011, 8, 2, 18, 1, 0)); var iridium49Tles = TwoLineElementSetHelper.GetTles("25108", analysisDate); var iridium49 = new IridiumSatellite("Iridium 49", iridium49Tles, m_labelFont, m_intendedSignal.TargetFrequency); m_display.ServiceProviders.Add(iridium49); var iridium58Tles = TwoLineElementSetHelper.GetTles("25274", analysisDate); var iridium58 = new IridiumSatellite("Iridium 58", iridium58Tles, m_labelFont, m_intendedSignal.TargetFrequency); m_display.ServiceProviders.Add(iridium58); var iridium4Tles = TwoLineElementSetHelper.GetTles("24796", analysisDate); var iridium4 = new IridiumSatellite("Iridium 4", iridium4Tles, m_labelFont, m_intendedSignal.TargetFrequency); m_display.ServiceProviders.Add(iridium4); // If the TLE epoch is too far from our expected analysis date, then we are // offline and loading cached data. Adjust the analysis date to match. if (iridium49Tles[0].Epoch.DaysDifference(analysisDate) > 5) { analysisDate = iridium49Tles[0].Epoch; } // Iridium 49 will be the receiving end of our caller's "uplink". // Modify the receiving antenna to be isotropic. iridium49.Transceiver.InputAntennaGainPattern = new IsotropicGainPattern(); // Iridium 4 will be the transmitting end of our call receiver's "downlink". // Modify the transmitting antenna to be isotropic. iridium4.Transceiver.OutputAntennaGainPattern = new IsotropicGainPattern(); // Now that we've created all of our definition objects, we need to build // the links between them that make up our communication system. m_communicationSystem = new CommunicationSystem(); // Add a link for each hop in the chain. // This could have been accomplished with a single call to AddChain. // However, since we plan on further configuring each of the individual links // generated for us, we add them one at a time. var linkCollection = m_communicationSystem.Links; m_callerToIridium49UpLink = linkCollection.Add("Uplink to Iridium 49", m_transmittingPhone, iridium49.Transceiver); m_iridium49To58Crosslink = linkCollection.Add("Iridium 49 -> Iridium 58", iridium49.Transceiver, iridium58.Transceiver); m_iridium58To4Crosslink = linkCollection.Add("Iridium 58 -> Iridium 4", iridium58.Transceiver, iridium4.Transceiver); m_iridium4ToReceiverDownLink = linkCollection.Add("Downlink from Iridium 4", iridium4.Transceiver, m_receivingPhone); // Now that we have the links, we can add an AccessConstraintsExtension to them so // that each link is only valid if they have line of sight to each other. var earth = CentralBodiesFacet.GetFromContext().Earth; var callerToIridium49Constraint = new CentralBodyObstructionConstraint(m_callerToIridium49UpLink, earth); m_callerToIridium49UpLink.Extensions.Add(new AccessConstraintsExtension(callerToIridium49Constraint)); var iridium49To58Constraint = new CentralBodyObstructionConstraint(m_iridium49To58Crosslink, earth); m_iridium49To58Crosslink.Extensions.Add(new AccessConstraintsExtension(iridium49To58Constraint)); var iridium58To4Constraint = new CentralBodyObstructionConstraint(m_iridium58To4Crosslink, earth); m_iridium58To4Crosslink.Extensions.Add(new AccessConstraintsExtension(iridium58To4Constraint)); var iridium4ToReceiverConstraint = new CentralBodyObstructionConstraint(m_iridium4ToReceiverDownLink, earth); m_iridium4ToReceiverDownLink.Extensions.Add(new AccessConstraintsExtension(iridium4ToReceiverConstraint)); m_linkComboBox.DisplayMember = "Name"; m_linkComboBox.Items.Add(m_callerToIridium49UpLink); m_linkComboBox.Items.Add(m_iridium49To58Crosslink); m_linkComboBox.Items.Add(m_iridium58To4Crosslink); m_linkComboBox.Items.Add(m_iridium4ToReceiverDownLink); m_linkComboBox.SelectedItem = m_iridium4ToReceiverDownLink; // Even though we haven't added any link graphics yet, we will later, so add them // to the display now. m_display.ServiceProviders.Add(m_callerToIridium49UpLink); m_display.ServiceProviders.Add(m_iridium49To58Crosslink); m_display.ServiceProviders.Add(m_iridium58To4Crosslink); m_display.ServiceProviders.Add(m_iridium4ToReceiverDownLink); // While we have set the location for our two phones and the satellite // transceivers, what we haven't done is assign their orientations. This can be // done automatically using the ConfigureAntennaTargeting method. Note that // ConfigureAntennaTargeting is a best effort method and returns status information // in regards to any problems it encounters. We don't check them here // simply because we know it will succeed. m_communicationSystem.ConfigureAntennaTargeting(); // Now that our initial configuration is complete, make sure we call ApplyChanges // on the display so that the visualization is created. m_display.ApplyChanges(); // Update the display to the current time. m_display.Update(SceneManager.Time); // Set up the animation time for our call. var animation = new SimulationAnimation { StartTime = analysisDate, EndTime = analysisDate.AddMinutes(15.0), TimeStep = Duration.FromSeconds(0.5), StartCycle = SimulationAnimationCycle.Loop, EndCycle = SimulationAnimationCycle.Loop }; SceneManager.Animation = animation; // Subscribe to the time changed event so we can update our display. SceneManager.TimeChanged += SceneManagerTimeChanged; // Reset to the beginning. animation.Reset(); // Configure the animation toolbar that overlays the 3D view. OverlayToolbar animationToolbar = new OverlayToolbar(m_insight3D); animationToolbar.Overlay.Origin = ScreenOverlayOrigin.BottomCenter; // Zoom to a location that includes both the caller and receiver. m_insight3D.Scene.Camera.ViewExtent(earth, Trig.DegreesToRadians(39.6333), Trig.DegreesToRadians(11.1333), Trig.DegreesToRadians(77.5833), Trig.DegreesToRadians(12.9833)); // Move the camera further back so that all satellites are visible. m_insight3D.Scene.Camera.Distance += 5000000.0; // Turn off lighting since it's the middle of the night and we want to be able to see everything, m_insight3D.Scene.Lighting.Enabled = false; // Create our link budget overlay helper which will display // the complete link budget for a selected link on top of the display. m_linkBudgetOverlayHelper = new LinkBudgetOverlayHelper(m_labelFont); //Hide it until the call is initiated m_linkBudgetOverlayHelper.Overlay.Display = false; // Add the actual overlay to Insight3D SceneManager.ScreenOverlays.Add(m_linkBudgetOverlayHelper.Overlay); }