Exemplo n.º 1
0
        public Example002()
        {
            InitializeComponent();

            insight3D      = new Insight3D();
            insight3D.Dock = DockStyle.Fill;
            this.Controls.Add(insight3D);
        }
        /// <summary>
        /// Positions the camera to view a given extent on the surface from a given azimuth and elevation angle.
        /// </summary>
        public static void ViewExtent(Insight3D insight3D, CentralBody centralBody,
                                      double west, double south, double east, double north,
                                      double azimuthAngle, double elevationAngle)
        {
            var camera = insight3D.Scene.Camera;

            camera.ViewExtent(centralBody, west, south, east, north);
            var offset = new Cartesian(new AzimuthElevationRange(azimuthAngle, elevationAngle, camera.Distance));

            camera.Position = camera.ReferencePoint + offset;
        }
        /// <summary>
        /// Positions the camera to view a given bounding sphere from a given azimuth and elevation angle.
        /// </summary>
        public static void ViewBoundingSphere(Insight3D insight3D, CentralBody centralBody, BoundingSphere sphere,
                                              double azimuthAngle, double elevationAngle)
        {
            var boundingSphereCenter = new PointFixedOffset(centralBody.FixedFrame, sphere.Center);
            var boundingSphereAxes   = new AxesEastNorthUp(centralBody, boundingSphereCenter);

            var camera = insight3D.Scene.Camera;
            var offset = new Cartesian(new AzimuthElevationRange(azimuthAngle, elevationAngle, camera.DistancePerRadius * sphere.Radius));

            camera.ViewOffset(boundingSphereAxes, boundingSphereCenter, offset);
        }
        public LotsOfSatellites()
        {
            InitializeComponent();

            m_insight3D      = new Insight3D();
            m_insight3D.Dock = DockStyle.Fill;
            m_insight3DPanel.Controls.Add(m_insight3D);

            m_animation            = new SimulationAnimation();
            SceneManager.Animation = m_animation;

            SceneManager.TimeChanged += OnTimeChanged;
        }
Exemplo n.º 5
0
            /// <summary>
            /// Initializes a new instance.
            /// </summary>
            public OverlayButtonHolder(Insight3D insight3D, Action action, string enabledImage, string disabledImage, int xOffset, double panelWidth)
            {
                m_insight3D     = insight3D;
                m_action        = action;
                m_enabled       = true;
                m_enabledImage  = enabledImage;
                m_disabledImage = disabledImage;
                m_xOffset       = xOffset;

                m_overlay = new TextureScreenOverlay
                {
                    X            = xOffset / panelWidth,
                    XUnit        = ScreenOverlayUnit.Fraction,
                    Width        = ButtonSize / panelWidth,
                    WidthUnit    = ScreenOverlayUnit.Fraction,
                    Height       = 1.0,
                    HeightUnit   = ScreenOverlayUnit.Fraction,
                    Translucency = MouseExitTranslucency,
                    Texture      = SceneManager.Textures.FromUri(disabledImage)
                };
            }
 /// <summary>
 /// Positions the camera to view a given extent on the surface from a given azimuth and elevation angle.
 /// </summary>
 public static void ViewExtent(Insight3D insight3D, CentralBody centralBody, CartographicExtent extent,
                               double azimuthAngle, double elevationAngle)
 {
     ViewExtent(insight3D, centralBody, extent.WestLongitude, extent.SouthLatitude, extent.EastLongitude, extent.NorthLatitude, azimuthAngle, elevationAngle);
 }
 /// <summary>
 /// Positions the camera to view a given bounding sphere.
 /// </summary>
 public static void ViewBoundingSphere(Insight3D insight3D, CentralBody centralBody, BoundingSphere sphere)
 {
     ViewBoundingSphere(insight3D, centralBody, sphere, Trig.DegreesToRadians(-90.0), Trig.DegreesToRadians(-30.0));
 }
Exemplo n.º 8
0
        /// <summary>
        /// Construct a default instance.
        /// </summary>
        public Main()
        {
            InitializeComponent();

            m_insight3D      = new Insight3D();
            m_insight3D.Dock = DockStyle.Fill;
            m_insight3DPanel.Controls.Add(m_insight3D);

            m_defaultStart = GregorianDate.Now;
            m_defaultEnd   = m_defaultStart.AddDays(1);

            m_animation            = new SimulationAnimation();
            SceneManager.Animation = m_animation;

            m_display = new ServiceProviderDisplay();

            m_forceModelSettings = new ForceModelSettings(s_jplData, GetDataFilePath("EarthGravityFile_EGM2008.grv"));
            m_integratorSettings = new IntegratorSettings();
            m_area.Text          = "20";
            m_mass.Text          = "500";

            // Create overlay toolbar and panels
            m_overlayToolbar = new OverlayToolbar(m_insight3D);
            m_overlayToolbar.Overlay.Origin = ScreenOverlayOrigin.BottomCenter;

            // Initialize the text panel
            TextureScreenOverlay textPanel = new TextureScreenOverlay(0, 0, 220, 35)
            {
                Origin             = ScreenOverlayOrigin.TopRight,
                BorderSize         = 0,
                BorderColor        = Color.Transparent,
                BorderTranslucency = 1.0f,
                Color        = Color.Transparent,
                Translucency = 1.0f
            };

            SceneManager.ScreenOverlays.Add(textPanel);

            m_dateTimeFont = new Font("Courier New", 12, FontStyle.Bold);
            Size textSize = Insight3DHelper.MeasureString(m_defaultStart.ToString(), m_dateTimeFont);

            m_textOverlay = new TextureScreenOverlay(0, 0, textSize.Width, textSize.Height)
            {
                Origin     = ScreenOverlayOrigin.Center,
                BorderSize = 0
            };
            textPanel.Overlays.Add(m_textOverlay);

            // Show label for the moon
            m_insight3D.Scene.CentralBodies[CentralBodiesFacet.GetFromContext().Moon].ShowLabel = true;

            // Set the name for the element that will get propagated
            m_elementID = "Satellite";

            // Subscribe to the time changed event
            SceneManager.TimeChanged += OnTimeChanged;

            // Set the start and stop times
            m_start.CustomFormat = DateFormat;
            m_end.CustomFormat   = DateFormat;

            m_start.Text = m_defaultStart.ToString(DateFormat);
            m_end.Text   = m_defaultEnd.ToString(DateFormat);

            m_animation.Time      = m_defaultStart.ToJulianDate();
            m_animation.StartTime = m_defaultStart.ToJulianDate();
            m_animation.EndTime   = m_defaultEnd.ToJulianDate();

            // Dynamically set the camera's position and direction so that the camera will always be pointed at the daylit portion of the earth.
            EarthCentralBody       earth               = CentralBodiesFacet.GetFromContext().Earth;
            SunCentralBody         sun                 = CentralBodiesFacet.GetFromContext().Sun;
            VectorTrueDisplacement earthToSunVector    = new VectorTrueDisplacement(earth.CenterOfMassPoint, sun.CenterOfMassPoint);
            VectorEvaluator        earthToSunEvaluator = earthToSunVector.GetEvaluator();
            Cartesian     earthToSunCartesian          = earthToSunEvaluator.Evaluate(new JulianDate(m_defaultStart));
            UnitCartesian earthToSunUnitCartesian      = new UnitCartesian(earthToSunCartesian);
            UnitCartesian cameraDirection              = new UnitCartesian(earthToSunUnitCartesian.Invert());
            Cartesian     cameraPosition               = new Cartesian(earthToSunUnitCartesian.X * 50000000, earthToSunUnitCartesian.Y * 50000000, earthToSunUnitCartesian.Z * 50000000);

            m_insight3D.Scene.Camera.Position  = cameraPosition;
            m_insight3D.Scene.Camera.Direction = cameraDirection;
        }
Exemplo n.º 9
0
        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);
        }
Exemplo n.º 10
0
 /// <summary>
 /// Initializes a new instance.
 /// </summary>
 public OverlayButtonHolder(Insight3D insight3D, Action action, string image, int xOffset, double panelWidth, double scale, double rotate)
     : this(insight3D, action, image, xOffset, panelWidth)
 {
     m_overlay.Scale         = scale;
     m_overlay.RotationAngle = rotate;
 }
Exemplo n.º 11
0
 /// <summary>
 /// Initializes a new instance.
 /// </summary>
 public OverlayButtonHolder(Insight3D insight3D, Action action, string image, int xOffset, double panelWidth)
     : this(insight3D, action, image, image, xOffset, panelWidth)
 {
 }
Exemplo n.º 12
0
        /// <summary>
        /// Initializes a new instance.
        /// </summary>
        public OverlayToolbar(Insight3D insight3D)
        {
            m_insight3D     = insight3D;
            m_buttonHolders = new List <OverlayButtonHolder>();

            insight3D.MouseOptions.ZoomComplete += OnZoomComplete;
            insight3D.MouseDown             += OnMouseDown;
            insight3D.MouseMove             += OnMouseMove;
            insight3D.MouseUp               += OnMouseUp;
            insight3D.MouseClick            += OnMouseClick;
            insight3D.MouseDoubleClick      += OnMouseDoubleClick;
            SceneManager.Animation.Stopped  += OnAnimationStopped;
            SceneManager.Animation.Started  += OnAnimationStarted;
            SceneManager.Animation.Paused   += OnAnimationPaused;
            SceneManager.Animation.HasReset += OnAnimationHasReset;

            m_overlay = new TextureScreenOverlay(0.0, 0.0, DefaultPanelWidth, ButtonSize)
            {
                Origin             = ScreenOverlayOrigin.BottomLeft,
                BorderSize         = 2,
                Color              = Color.Transparent,
                BorderColor        = Color.Transparent,
                Translucency       = PanelTranslucencyRegular,
                BorderTranslucency = PanelBorderTranslucencyRegular
            };
            SceneManager.ScreenOverlays.Add(m_overlay);

            // ShowHide button
            AddButton(GetTexturePath("visible.png"), GetTexturePath("invisible.png"), ShowHide);

            // Reset button
            AddButton(GetTexturePath("reset.png"), Reset);

            // DecreaseDelta button
            m_decreaseDeltaButton = AddButton(GetTexturePath("decreasedelta.png"), DecreaseDelta);

            // StepBack button
            m_stepReverseButton = AddButton(GetTexturePath("stepreverse.png"), StepReverse);

            // PlayBack button
            AddButton(GetTexturePath("playreverse.png"), PlayReverse);

            // Pause button
            AddButton(GetTexturePath("pause.png"), Pause);

            // Play button
            AddButton(GetTexturePath("playforward.png"), PlayForward);

            // StepForward button
            m_stepForwardButton = AddButton(GetTexturePath("stepforward.png"), StepForward);

            // IncreaseDelta button
            m_increaseDeltaButton = AddButton(GetTexturePath("increasedelta.png"), IncreaseDelta);

            // Zoom button
            AddButton(GetTexturePath("zoompressed.png"), GetTexturePath("zoom.png"), Zoom);
            m_zoomButton = m_buttonHolders[m_buttonHolders.Count - 1];

            // Pan button
            AddButton(GetTexturePath("panpressed.png"), GetTexturePath("pan.png"), Pan);

            // Home button
            AddButton(GetTexturePath("home.png"), Home);

            // Moon Button
            AddButton(GetTexturePath("moon.png"), Moon);

            // Scale button
            m_scaleButton = new OverlayButtonHolder(m_insight3D, Scale, GetTexturePath("scale.png"), 0, m_overlay.Width, 0.5, 0.0);
            m_scaleButton.Overlay.Origin = ScreenOverlayOrigin.TopRight;
            m_overlay.Overlays.Add(m_scaleButton.Overlay);
            m_buttonHolders.Add(m_scaleButton);

            // Rotate button
            m_rotateButton = new OverlayButtonHolder(m_insight3D, Rotate, GetTexturePath("rotate.png"), 0, m_overlay.Width, 0.5, 0.0);
            m_rotateButton.Overlay.Origin = ScreenOverlayOrigin.BottomRight;
            m_overlay.Overlays.Add(m_rotateButton.Overlay);
            m_buttonHolders.Add(m_rotateButton);

            DockBottom();
        }