public NewViewForm()
        {
            InitializeComponent();
            StkObjectsLibrary mStkObjectsLibrary = new StkObjectsLibrary();

            CommonData.CurrentViewObjectData = SmartViewFunctions.GetObjectData();
            _threatNames = new List <string>();

            PopulateComboBoxes();
            PopulateObjects(FocusedItem, true);
            if (FocusedItem.Items.Count != 0)
            {
                FocusedItem.SelectedIndex = 0;
            }
            PopulateObjects(DisplayObject, false);
            if (DisplayObject.Items.Count != 0)
            {
                DisplayObject.SelectedIndex = 0;
            }
            PopulateObjects(ObjectName2D, false);
            if (ObjectName2D.Items.Count != 0)
            {
                ObjectName2D.SelectedIndex = 0;
            }
            DataDisplayOptions.Enabled    = false;
            TTDataDisplayOptions.Enabled  = false;
            GEODataDisplayOptions.Enabled = false;
            GeoBoxOptions.Enabled         = false;
            HideShowOptions.Enabled       = false;
            EllipsoidDefinition.Enabled   = false;
            PopulateObjects(GEODisplayObject, false);

            mStkObjectsLibrary = new StkObjectsLibrary();
        }
 private void Refresh_Click(object sender, EventArgs e)
 {
     if (_selectedView != -1)
     {
         if (StoredViewList.SelectedItems != null && StoredViewList.SelectedItems.Count > 0)
         {
             RemovePlanes();
             if (CommonData.SavedViewList[_selectedView].ViewType == "2D")
             {
                 SmartViewFunctions.Change2DView(CommonData.SavedViewList[_selectedView]);
             }
             else if (CommonData.SavedViewList[_selectedView].ViewType == "3D")
             {
                 SmartViewFunctions.Change3DView(CommonData.SavedViewList[_selectedView]);
             }
             else if (CommonData.SavedViewList[_selectedView].ViewType == "Target/Threat")
             {
                 SmartViewFunctions.ChangeTargetThreatView(CommonData.SavedViewList[_selectedView]);
             }
             else if (CommonData.SavedViewList[_selectedView].ViewType == "GEODrift")
             {
                 SmartViewFunctions.ChangeGeoDriftView(CommonData.SavedViewList[_selectedView]);
             }
         }
     }
 }
        private void RemovePlanes()
        {
            List <ObjectData> data = SmartViewFunctions.GetObjectData();

            foreach (ObjectData item in data)
            {
                if (item.ClassName == "Satellite")
                {
                    IAgStkObject sat  = CommonData.StkRoot.GetObjectFromPath(item.SimplePath);
                    IAgSatellite sat1 = CommonData.StkRoot.GetObjectFromPath(item.SimplePath) as IAgSatellite;
                    try
                    {
                        sat.Vgt.Planes.Remove("ProximityPlane");
                    }
                    catch (Exception)
                    {
                    }
                    try
                    {
                        sat1.VO.Proximity.GeoBox.IsVisible = false;
                    }
                    catch (Exception)
                    {
                    }

                    try
                    {
                        sat1.VO.Proximity.Ellipsoid.IsVisible = false;
                    }
                    catch (Exception)
                    {
                    }
                }
            }
        }
Exemple #4
0
        private void TrimUnselected_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("This will remove all unchecked components from the object's 3D Graphics->Vector list. \n Do you wish to continue?", "Warning", MessageBoxButtons.YesNo);

            if (result == DialogResult.Yes)
            {
                string       parentStr = null;
                int          index;
                IAgStkObject obj;
                dynamic      vo;
                foreach (TreeNode item in AvailableVectorList.Nodes)
                {
                    index     = _data.IndexOf(_data.Where(p => p.SimpleName == item.Text).FirstOrDefault());
                    parentStr = _data[index].SimplePath;
                    obj       = CommonData.StkRoot.GetObjectFromPath(parentStr);
                    vo        = SmartViewFunctions.GetObjectVO(obj);
                    if (vo != null)
                    {
                        IAgVORefCrdnCollection crdns = vo.Vector.RefCrdns;
                        foreach (TreeNode child in item.Nodes)
                        {
                            if (!child.Checked)
                            {
                                crdns.RemoveByName(dict[child.Text], child.Text);
                            }
                        }
                    }
                }
                PopulateList();
            }
        }
        private void SelectView_Click(object sender, EventArgs e)
        {
            if (StoredViewList.SelectedItems != null && StoredViewList.SelectedItems.Count > 0)
            {
                _selectedView = StoredViewList.FocusedItem.Index;
                RemovePlanes();
                CommonData.StkRoot.ExecuteCommand("BatchGraphics * On");

                StoredViewList.Items[StoredViewList.FocusedItem.Index].Selected = true;
                CommonData.SelectedIndex = StoredViewList.FocusedItem.Index;
                if (CommonData.SavedViewList[StoredViewList.FocusedItem.Index].ViewType == "2D")
                {
                    SmartViewFunctions.Change2DView(CommonData.SavedViewList[StoredViewList.FocusedItem.Index]);
                }
                else if (CommonData.SavedViewList[StoredViewList.FocusedItem.Index].ViewType == "3D")
                {
                    SmartViewFunctions.Change3DView(CommonData.SavedViewList[StoredViewList.FocusedItem.Index]);
                }
                else if (CommonData.SavedViewList[StoredViewList.FocusedItem.Index].ViewType == "Target/Threat")
                {
                    SmartViewFunctions.ChangeTargetThreatView(CommonData.SavedViewList[StoredViewList.FocusedItem.Index]);
                }
                else if (CommonData.SavedViewList[StoredViewList.FocusedItem.Index].ViewType == "GEODrift")
                {
                    SmartViewFunctions.ChangeGeoDriftView(CommonData.SavedViewList[StoredViewList.FocusedItem.Index]);
                }

                CommonData.StkRoot.ExecuteCommand("BatchGraphics * Off");
            }
        }
Exemple #6
0
        public Edit2DGenericForm()
        {
            InitializeComponent();
            PopulateObjects(ObjectName2D, false);
            PopulateBoxes();

            if (CommonData.SavedViewList[CommonData.SelectedIndex].ViewObjectData != null && CommonData.SavedViewList[CommonData.SelectedIndex].ViewObjectData.Count > 0)
            {
                CommonData.CurrentViewObjectData = CommonData.SavedViewList[CommonData.SelectedIndex].ViewObjectData;
                List <ObjectData> newData = SmartViewFunctions.GetObjectData();
                int index = 0;
                foreach (ObjectData item in newData)
                {
                    if (!CommonData.CurrentViewObjectData.Any(n => n.SimpleName == item.SimpleName))
                    {
                        index = newData.IndexOf(item);
                        CommonData.CurrentViewObjectData.Insert(index, item);
                    }
                }
            }
            else
            {
                CommonData.CurrentViewObjectData = SmartViewFunctions.GetObjectData();
            }
        }
        public EditTargetThreatForm()
        {
            InitializeComponent();
            _onStart = 1;
            CommonData.CurrentViewObjectData = SmartViewFunctions.GetObjectData();
            _threatNames = new List <string>();

            PopulateComboBoxes();
            _onStart = 0;
        }
 private void PopulateDisplayReports(ComboBox box, ComboBox ddObject)
 {
     if (ddObject.SelectedIndex != -1)
     {
         string className = SmartViewFunctions.GetClassName(ddObject.Text);
         IAgVODataDisplayCollection ddCollection = null;
         if (className == "Satellite")
         {
             IAgSatellite myObject = CommonData.StkRoot.GetObjectFromPath(className + "/" + ddObject.Text) as IAgSatellite;
             ddCollection = myObject.VO.DataDisplay;
         }
         else if (className == "Aircraft")
         {
             IAgAircraft myObject = CommonData.StkRoot.GetObjectFromPath(className + "/" + ddObject.Text) as IAgAircraft;
             ddCollection = myObject.VO.DataDisplay;
         }
         else if (className == "Facility")
         {
             IAgFacility myObject = CommonData.StkRoot.GetObjectFromPath(className + "/" + ddObject.Text) as IAgFacility;
             ddCollection = myObject.VO.DataDisplays;
         }
         else if (className == "Missile")
         {
             IAgMissile myObject = CommonData.StkRoot.GetObjectFromPath(className + "/" + ddObject.Text) as IAgMissile;
             ddCollection = myObject.VO.DataDisplay;
         }
         else if (className == "GroundVehicle")
         {
             IAgGroundVehicle myObject = CommonData.StkRoot.GetObjectFromPath(className + "/" + ddObject.Text) as IAgGroundVehicle;
             ddCollection = myObject.VO.DataDisplay;
         }
         else if (className == "LaunchVehicle")
         {
             IAgLaunchVehicle myObject = CommonData.StkRoot.GetObjectFromPath(className + "/" + ddObject.Text) as IAgLaunchVehicle;
             ddCollection = myObject.VO.DataDisplay;
         }
         else if (className == "Place")
         {
             IAgPlace myObject = CommonData.StkRoot.GetObjectFromPath(className + "/" + ddObject.Text) as IAgPlace;
             ddCollection = myObject.VO.DataDisplays;
         }
         else if (className == "Target")
         {
             IAgTarget myObject = CommonData.StkRoot.GetObjectFromPath(className + "/" + ddObject.Text) as IAgTarget;
             ddCollection = myObject.VO.DataDisplays;
         }
         box.Items.Clear();
         Array reportNames = ddCollection.AvailableData;
         foreach (var name in reportNames)
         {
             box.Items.Add(name);
         }
         box.SelectedIndex = 0;
     }
 }
        private void TypeSelect_SelectedIndexChanged(object sender, EventArgs e)
        {
            WindowSelect.Items.Clear();
            List <string> windowNames = new List <string>();

            if (TypeSelect.SelectedIndex == 0)
            {
                windowNames = SmartViewFunctions.GetWindowNames(1);
                ViewDefinitionBox2D.Enabled = false;
                ViewDefinitionBox2D.Visible = false;
                ViewDefinitionBox3D.Enabled = true;
                ViewDefinitionBox3D.Visible = true;
                UseCurrentViewPoint.Enabled = true;
                UseCurrentViewPoint.Visible = true;
                UseCameraPath.Enabled       = true;
                UseCameraPath.Visible       = true;
                CameraPathName.Enabled      = true;
                CameraPathName.Visible      = true;
                UseVectorHideShow.Visible   = true;
                VectorHideShow.Visible      = true;
            }
            else if (TypeSelect.SelectedIndex == 1)
            {
                windowNames = SmartViewFunctions.GetWindowNames(0);
                ViewDefinitionBox3D.Enabled = false;
                ViewDefinitionBox3D.Visible = false;
                ViewDefinitionBox2D.Enabled = true;
                ViewDefinitionBox2D.Visible = true;
                UseCurrentViewPoint.Enabled = false;
                UseCurrentViewPoint.Visible = false;
                UseCameraPath.Enabled       = false;
                UseCameraPath.Visible       = false;
                CameraPathName.Enabled      = false;
                CameraPathName.Visible      = false;
                UseVectorHideShow.Visible   = false;
                VectorHideShow.Visible      = false;
            }
            foreach (var item in windowNames)
            {
                WindowSelect.Items.Add(item);
            }
            //try/catch for case when no windows of a certain type exist
            try
            {
                WindowSelect.SelectedIndex = 0;
            }
            catch (Exception)
            {
            }
        }
 private void TTDisplayObject_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (TTDisplayObject.SelectedIndex != -1)
     {
         TTDisplayReport.Items.Clear();
         if (TTDisplayObject.SelectedIndex == 0)
         {
             TTDisplayLocation.Enabled = true;
             TTDisplayReport.Items.Add("LLA Position");
             TTDisplayReport.Items.Add("Classical Orbital Elements");
             TTDisplayReport.Items.Add("Inertial Position Velocity");
             TTDisplayReport.Items.Add("Fixed Position Velocity");
         }
         else if (TTDisplayObject.SelectedIndex == 1)
         {
             TTDisplayLocation.Enabled = false;
             TTDisplayReport.Items.Add("RIC");
             TTDisplayReport.Items.Add("LLA Position");
             TTDisplayReport.Items.Add("Classical Orbital Elements");
             TTDisplayReport.Items.Add("Inertial Position Velocity");
             TTDisplayReport.Items.Add("Fixed Position Velocity");
         }
         else
         {
             TTDisplayLocation.Enabled = true;
             string className = SmartViewFunctions.GetClassName(TTDisplayObject.Text);
             IAgVODataDisplayCollection ddCollection = null;
             if (className == "Satellite")
             {
                 IAgSatellite myObject = CommonData.StkRoot.GetObjectFromPath(className + "/" + TTDisplayObject.Text) as IAgSatellite;
                 ddCollection = myObject.VO.DataDisplay;
             }
             Array reportNames = ddCollection.AvailableData;
             foreach (var name in reportNames)
             {
                 TTDisplayReport.Items.Add(name);
                 if (name.ToString() == CommonData.SavedViewList[CommonData.SelectedIndex].TtDataDisplayReportName)
                 {
                     TTDisplayReport.SelectedIndex = TTDisplayReport.Items.Count - 1;
                 }
             }
         }
         if (TTDisplayReport.SelectedIndex == -1)
         {
             TTDisplayReport.SelectedIndex = 0;
         }
     }
 }
Exemple #11
0
        private void RefreshViewPoint_Click(object sender, EventArgs e)
        {
            int windowId = SmartViewFunctions.GetWindowId(WindowSelect.Text, 1);

            if (ViewName3D.Text != null && ViewName3D.Text != "")
            {
                try
                {
                    CommonData.StkRoot.ExecuteCommand("VO * SaveStoredView \"" + ViewName3D.Text + "\" " + windowId.ToString());
                }
                catch (Exception)
                {
                    MessageBox.Show("Could not refresh viewpoint");
                }
            }
        }
Exemple #12
0
        private void PopulateList()
        {
            AvailableVectorList.Nodes.Clear();
            string parentStr        = null;
            string parentSimpleName = null;
            int    parentCount      = 0;
            int    childCount       = 0;
            string name             = null;

            for (int i = 0; i < _data.Count; i++)
            {
                parentStr = _data[i].SimplePath;
                IAgStkObject obj = CommonData.StkRoot.GetObjectFromPath(parentStr);
                dynamic      vo  = SmartViewFunctions.GetObjectVO(obj);
                //Only populate objects that have valid vo properties
                if (vo != null)
                {
                    IAgVORefCrdnCollection vgtComponents = vo.Vector.RefCrdns;
                    //Only populate objects with valid vgt components in object properties list (i.e. 3D Graphics->Vector)
                    if (vgtComponents.Count > 0)
                    {
                        AvailableVectorList.Nodes.Add(_data[i].SimpleName);
                        parentCount++;
                        childCount = 0;
                        //Display all vgt components for the parent object. Add key value pairs into local dictionary and cross reference with existing options in saved view
                        for (int j = 0; j < vgtComponents.Count; j++)
                        {
                            name = vgtComponents[j].Name;
                            AvailableVectorList.Nodes[parentCount - 1].Nodes.Add(name);
                            if (!dict.ContainsKey(name))
                            {
                                dict.Add(name, vgtComponents[j].TypeID);
                            }
                            if (_data[i].ActiveVgtComponents.Keys.Contains(name))
                            {
                                AvailableVectorList.Nodes[parentCount - 1].Nodes[childCount].Checked = true;
                            }
                            else
                            {
                                AvailableVectorList.Nodes[parentCount - 1].Nodes[childCount].Checked = false;
                            }
                            childCount++;
                        }
                    }
                }
            }
        }
Exemple #13
0
 private void DisplayObject_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (DisplayObject.SelectedIndex != -1)
     {
         string className = SmartViewFunctions.GetClassName(DisplayObject.Text);
         IAgVODataDisplayCollection ddCollection = null;
         if (className == "Satellite")
         {
             IAgSatellite myObject = CommonData.StkRoot.GetObjectFromPath(className + "/" + DisplayObject.Text) as IAgSatellite;
             ddCollection = myObject.VO.DataDisplay;
         }
         else if (className == "Aircraft")
         {
             IAgAircraft myObject = CommonData.StkRoot.GetObjectFromPath(className + "/" + DisplayObject.Text) as IAgAircraft;
             ddCollection = myObject.VO.DataDisplay;
         }
         else if (className == "Facility")
         {
             IAgFacility myObject = CommonData.StkRoot.GetObjectFromPath(className + "/" + DisplayObject.Text) as IAgFacility;
             ddCollection = myObject.VO.DataDisplays;
         }
         else if (className == "Missile")
         {
             IAgMissile myObject = CommonData.StkRoot.GetObjectFromPath(className + "/" + DisplayObject.Text) as IAgMissile;
             ddCollection = myObject.VO.DataDisplay;
         }
         else if (className == "GroundVehicle")
         {
             IAgGroundVehicle myObject = CommonData.StkRoot.GetObjectFromPath(className + "/" + DisplayObject.Text) as IAgGroundVehicle;
             ddCollection = myObject.VO.DataDisplay;
         }
         DisplayReport.Items.Clear();
         Array reportNames = ddCollection.AvailableData;
         foreach (var name in reportNames)
         {
             DisplayReport.Items.Add(name);
             if (name.ToString() == CommonData.SavedViewList[CommonData.SelectedIndex].DataDisplayReportName)
             {
                 DisplayReport.SelectedIndex = DisplayReport.Items.Count - 1;
             }
         }
         if (DisplayReport.SelectedIndex == -1)
         {
             DisplayReport.SelectedIndex = 0;
         }
     }
 }
 private void Reset_Click(object sender, EventArgs e)
 {
     RemovePlanes();
     CommonData.StkRoot.ExecuteCommand("BatchGraphics * On");
     foreach (ObjectData item in CommonData.InitialObjectData)
     {
         SmartViewFunctions.SetAllObjectData(item);
         try
         {
             CommonData.StkRoot.ExecuteCommand("VO " + item.SimplePath + " DynDataText RemoveAll");
         }
         catch (Exception)
         {
         }
     }
     CommonData.StkRoot.ExecuteCommand("BatchGraphics * Off");
 }
        private void Unselect_Click(object sender, EventArgs e)
        {
            string className = null;

            if (ThreatList.FocusedItem != null)
            {
                foreach (int index in ThreatList.SelectedIndices)
                {
                    ThreatList.Items[index].Font = new Font(ThreatList.Items[index].Font, FontStyle.Regular);
                    if (_threatNames.Contains(ThreatList.Items[index].SubItems[0].Text))
                    {
                        className = SmartViewFunctions.GetClassName(ThreatList.Items[index].SubItems[0].Text);
                        _threatNames.Remove(className + "/" + ThreatList.Items[index].SubItems[0].Text);
                    }
                }
            }
        }
Exemple #16
0
        public Edit3DGenericForm()
        {
            InitializeComponent();
            current = new ViewData();
            PopulateObjects(FocusedItem, true);
            PopulateDdObjects(DisplayObject, false);
            PopulatePredataObjects(PredataObject, false);
            PopulateComboBoxes();
            current = CommonData.SavedViewList[CommonData.SelectedIndex];
            if (current.UseAnimationTime)
            {
                CurrentTime.Text       = current.AnimationTime;
                UseCurrentTime.Checked = true;
            }
            if (CommonData.SavedViewList[CommonData.SelectedIndex].ViewObjectData != null && CommonData.SavedViewList[CommonData.SelectedIndex].ViewObjectData.Count > 0)
            {
                CommonData.CurrentViewObjectData = CommonData.SavedViewList[CommonData.SelectedIndex].ViewObjectData;
                List <ObjectData> newData = SmartViewFunctions.GetObjectData();
                int index = 0;
                foreach (ObjectData item in newData)
                {
                    if (!CommonData.CurrentViewObjectData.Any(n => n.SimpleName == item.SimpleName))
                    {
                        index = newData.IndexOf(item);
                        CommonData.CurrentViewObjectData.Insert(index, item);
                    }
                }
            }
            else
            {
                CommonData.CurrentViewObjectData = SmartViewFunctions.GetObjectData();
            }

            if (current.UniqueLeadTrail)
            {
                UniqueLeadTrail.Checked = true;
                CustomLeadTrail.Enabled = true;
            }
            else
            {
                UniversalLeadTrail.Checked = true;
                CustomLeadTrail.Enabled    = false;
            }
        }
        public NewViewForm()
        {
            InitializeComponent();
            StkObjectsLibrary mStkObjectsLibrary = new StkObjectsLibrary();

            CommonData.CurrentViewObjectData = SmartViewFunctions.GetObjectData();

            PopulateComboBoxes();
            PopulateObjects(FocusedItem, true);
            ViewName3D.Text = "New View";
            ViewName2D.Text = "New View";
            if (FocusedItem.Items.Count != 0)
            {
                FocusedItem.SelectedIndex = 0;
            }
            PopulateObjects(DisplayObject, false);
            if (DisplayObject.Items.Count != 0)
            {
                DisplayObject.SelectedIndex = 0;
            }
            PopulateObjects(ObjectName2D, false);
            if (ObjectName2D.Items.Count != 0)
            {
                ObjectName2D.SelectedIndex = 0;
            }
            PopulateObjects(PredataObject, false);
            PredataObject.Items.Insert(0, "None");
            PredataObject.SelectedIndex = 0;
            DataDisplayOptions.Enabled  = false;
            HideShowOptions.Enabled     = false;
            VectorHideShow.Enabled      = false;
            CustomLeadTrail.Enabled     = false;
            //initialize some settings in the current view data
            current.EnableProximityBox       = false;
            current.EnableGeoBox             = false;
            current.EnableProximityEllipsoid = false;
            current.SecondaryDataDisplay.DataDisplayActive = false;
            current.ApplyVectorScaling = false;
            current.OverrideTimeStep   = false;
            mStkObjectsLibrary         = new StkObjectsLibrary();
        }
Exemple #18
0
 private void GEODisplayObject_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (GEODisplayObject.SelectedIndex != -1)
     {
         string className = SmartViewFunctions.GetClassName(GEODisplayObject.Text);
         IAgVODataDisplayCollection ddCollection = null;
         IAgSatellite myObject = CommonData.StkRoot.GetObjectFromPath(className + "/" + GEODisplayObject.Text) as IAgSatellite;
         ddCollection = myObject.VO.DataDisplay;
         Array reportNames = ddCollection.AvailableData;
         foreach (var name in reportNames)
         {
             GEODisplayReport.Items.Add(name);
             if (name.ToString() == CommonData.SavedViewList[CommonData.SelectedIndex].GeoDataDisplayReportName)
             {
                 GEODisplayReport.SelectedIndex = GEODisplayReport.Items.Count - 1;
             }
         }
         if (GEODisplayReport.SelectedIndex == -1)
         {
             GEODisplayReport.SelectedIndex = 0;
         }
     }
 }
Exemple #19
0
        private void Apply_Click(object sender, EventArgs e)
        {
            List <ObjectData> data = CommonData.CurrentViewObjectData;

            for (int i = 0; i < ObjectGrid.Rows.Count; i++)
            {
                int index = data.IndexOf(data.Where(p => p.SimpleName == (string)ObjectGrid.Rows[i].Cells[1].Value).FirstOrDefault());
                data[index].ModifyLeadTrail = (bool)ObjectGrid.Rows[i].Cells[0].Value;
                data[index].LeadSetting3D   = SmartViewFunctions.GetLeadTrailObject(ObjectGrid.Rows[i].Cells[2].Value.ToString());
                if (SmartViewFunctions.GetLeadTrailObject(ObjectGrid.Rows[i].Cells[3].Value.ToString()) != AgELeadTrailData.eDataUnknown)
                {
                    data[index].TrailSetting3D = SmartViewFunctions.GetLeadTrailObject(ObjectGrid.Rows[i].Cells[3].Value.ToString());
                }
                else
                {
                    data[index].TrailSetting3D = SmartViewFunctions.GetLeadTrailObject(ObjectGrid.Rows[i].Cells[2].Value.ToString());
                }
                if (data[index].SimplePath.Contains("Satellite"))
                {
                    if (ObjectGrid.Rows[i].Cells[4].Value.ToString().Contains("Inertial"))
                    {
                        data[index].CoordSys = "Inertial";
                    }
                    else if (ObjectGrid.Rows[i].Cells[4].Value.ToString().Contains("Fixed"))
                    {
                        data[index].CoordSys = "Fixed";
                    }
                    else if (ObjectGrid.Rows[i].Cells[4].Value.ToString().Contains("VVLH"))
                    {
                        data[index].CoordSys = "Satellite/" + ObjectGrid.Rows[i].Cells[5].Value.ToString() + " VVLH System";
                    }
                }
            }
            CommonData.CurrentViewObjectData = data;
            this.Close();
        }
Exemple #20
0
        private void Apply_Click(object sender, EventArgs e)
        {
            int check = FieldCheck3D();

            if (check == 0)
            {
                current.WindowName = WindowSelect.Text;
                current.WindowId   = SmartViewFunctions.GetWindowId(WindowSelect.Text, 1);
                current.Name       = ViewName3D.Text;
                current.ViewType   = "3D";
                string className = SmartViewFunctions.GetClassName(FocusedItem.Text);
                current.ViewTarget = className + "/" + FocusedItem.Text;
                current.ViewAxes   = "Inertial";

                if (EnableUniversalOrbitTrack.Checked)
                {
                    if (UniversalLeadTrail.Checked)
                    {
                        current.EnableUniversalOrbitTrack = true;
                        current.UniqueLeadTrail           = false;
                        if (LeadType3D.Text == "Time")
                        {
                            current.LeadType = LeadType3D.Text + " " + OrbitLeadTime.Text;
                            current.LeadTime = OrbitLeadTime.Text;
                        }
                        else
                        {
                            current.LeadType = LeadType3D.Text;
                        }

                        if (TrailType3D.Text == "Time")
                        {
                            current.TrailType = TrailType3D.Text + " " + OrbitTrailTime.Text;
                            current.TrailTime = OrbitTrailTime.Text;
                        }
                        else
                        {
                            current.TrailType = TrailType3D.Text;
                        }
                    }
                    else if (UniqueLeadTrail.Checked)
                    {
                        current.UniqueLeadTrail           = true;
                        current.EnableUniversalOrbitTrack = true;
                    }
                }
                else
                {
                    current.EnableUniversalOrbitTrack = false;
                    current.LeadType  = "None";
                    current.TrailType = "None";
                }

                if (UseDataDisplay.Checked)
                {
                    current.PrimaryDataDisplay.DataDisplayActive   = true;
                    current.PrimaryDataDisplay.DataDisplayLocation = DisplayLocation.Text;
                    className = SmartViewFunctions.GetClassName(DisplayObject.Text);
                    current.PrimaryDataDisplay.DataDisplayObject     = className + "/" + DisplayObject.Text;
                    current.PrimaryDataDisplay.DataDisplayReportName = DisplayReport.Text;
                    className = SmartViewFunctions.GetClassName(PredataObject.Text);
                    current.PrimaryDataDisplay.PredataObject = className + "/" + PredataObject.Text;
                }
                else
                {
                    current.PrimaryDataDisplay.DataDisplayActive   = false;
                    current.PrimaryDataDisplay.DataDisplayLocation = DisplayLocation.Text;
                    className = SmartViewFunctions.GetClassName(DisplayObject.Text);
                    current.PrimaryDataDisplay.DataDisplayObject     = className + "/" + DisplayObject.Text;
                    current.PrimaryDataDisplay.DataDisplayReportName = DisplayReport.Text;
                    current.PrimaryDataDisplay.PredataObject         = PredataObject.Text;
                }

                if (UseCurrentTime.Checked)
                {
                    current.UseAnimationTime = true;
                    current.AnimationTime    = CurrentTime.Text;
                }
                else
                {
                    current.UseAnimationTime = false;
                    IAgScenario scenario = (IAgScenario)(CommonData.StkRoot.CurrentScenario);
                    current.AnimationTime = scenario.StartTime;
                }

                if (UseCurrentViewPoint.Checked)
                {
                    //only refresh view if not previously active. you can also refresh using the 'refresh' button on the screen
                    if (!current.UseStoredView)
                    {
                        current.StoredViewName = ViewName3D.Text;
                        CommonData.StkRoot.ExecuteCommand("VO * SaveStoredView \"" + ViewName3D.Text + "\" " + current.WindowId);
                    }
                    current.UseStoredView = true;
                }
                else
                {
                    current.UseStoredView  = false;
                    current.StoredViewName = "None";
                }

                if (ObjectHideShow.Checked)
                {
                    current.ObjectHideShow = true;
                    List <ObjectData> data = new List <ObjectData>();
                    data = CommonData.CurrentViewObjectData;
                    current.ViewObjectData = data;
                }
                else
                {
                    current.ObjectHideShow = false;
                }

                if (UseVectorHideShow.Checked)
                {
                    current.VectorHideShow = true;
                }
                else
                {
                    current.VectorHideShow = false;
                }

                if (UseCameraPath.Checked)
                {
                    current.UseCameraPath  = true;
                    current.CameraPathName = CameraPathName.Text;
                }
                else
                {
                    current.UseCameraPath = false;
                }

                CommonData.SavedViewList[CommonData.SelectedIndex] = current;
                CommonData.UpdatedView = true;
                try
                {
                    ReadWrite.WriteSavedViews(CommonData.DirectoryStr + "\\StoredViewData.json");
                }
                catch (Exception)
                {
                    MessageBox.Show("Could not Write Stored Views File");
                }
                this.Close();
            }
        }
Exemple #21
0
        private void PopulateComboBoxes()
        {
            ViewName3D.Text = CommonData.SavedViewList[CommonData.SelectedIndex].Name;
            ViewType.Items.Add("Inertial");
            //ViewType.Items.Add("Fixed");
            ViewType.SelectedIndex = 0;

            if (CommonData.SavedViewList[CommonData.SelectedIndex].UseAnimationTime)
            {
                CurrentTime.Text = CommonData.SavedViewList[CommonData.SelectedIndex].AnimationTime;
            }

            DisplayLocation.Items.Add("TopLeft");
            DisplayLocation.Items.Add("TopCenter");
            DisplayLocation.Items.Add("TopRight");
            DisplayLocation.Items.Add("CenterLeft");
            DisplayLocation.Items.Add("Center");
            DisplayLocation.Items.Add("CenterRight");
            DisplayLocation.Items.Add("BottomLeft");
            DisplayLocation.Items.Add("BottomCenter");
            DisplayLocation.Items.Add("BottomRight");
            DisplayLocation.SelectedIndex = 0;
            if (CommonData.SavedViewList[CommonData.SelectedIndex].DataDisplayActive)
            {
                foreach (string item in DisplayLocation.Items)
                {
                    if (CommonData.SavedViewList[CommonData.SelectedIndex].DataDisplayLocation.Contains(item))
                    {
                        DisplayLocation.SelectedItem = item;
                    }
                }
            }
            OrbitTrackBox.Enabled = false;
            if (CommonData.SavedViewList[CommonData.SelectedIndex].EnableUniversalOrbitTrack)
            {
                EnableUniversalOrbitTrack.Checked = true;
            }
            LeadType3D.Items.Add("OnePass");
            LeadType3D.Items.Add("All");
            LeadType3D.Items.Add("Full");
            LeadType3D.Items.Add("Half");
            LeadType3D.Items.Add("Quarter");
            LeadType3D.Items.Add("None");
            LeadType3D.Items.Add("Time");
            LeadType3D.SelectedIndex = 0;
            foreach (string item in LeadType3D.Items)
            {
                if (CommonData.SavedViewList[CommonData.SelectedIndex].LeadType.Contains(item))
                {
                    LeadType3D.SelectedItem = item;
                    if (item == "Time")
                    {
                        OrbitLeadTime.Text = CommonData.SavedViewList[CommonData.SelectedIndex].LeadTime;
                    }
                }
            }

            TrailType3D.Items.Add("SameAsLead");
            TrailType3D.Items.Add("OnePass");
            TrailType3D.Items.Add("All");
            TrailType3D.Items.Add("Full");
            TrailType3D.Items.Add("Half");
            TrailType3D.Items.Add("Quarter");
            TrailType3D.Items.Add("None");
            TrailType3D.Items.Add("Time");
            TrailType3D.SelectedIndex = 0;
            foreach (string item in TrailType3D.Items)
            {
                if (CommonData.SavedViewList[CommonData.SelectedIndex].TrailType.Contains(item))
                {
                    TrailType3D.SelectedItem = item;
                    if (item == "Time")
                    {
                        OrbitTrailTime.Text = CommonData.SavedViewList[CommonData.SelectedIndex].TrailTime;
                    }
                }
            }

            List <string> windowNames = SmartViewFunctions.GetWindowNames(1);

            foreach (var item in windowNames)
            {
                WindowSelect.Items.Add(item);
                if (item.Contains(CommonData.SavedViewList[CommonData.SelectedIndex].WindowName))
                {
                    WindowSelect.SelectedIndex = WindowSelect.Items.Count - 1;
                }
            }

            if (CommonData.SavedViewList[CommonData.SelectedIndex].ObjectHideShow)
            {
                ObjectHideShow.Checked  = true;
                HideShowOptions.Enabled = true;
            }
            else
            {
                HideShowOptions.Enabled = false;
            }

            if (CommonData.SavedViewList[CommonData.SelectedIndex].DataDisplayActive)
            {
                UseDataDisplay.Checked     = true;
                DataDisplayOptions.Enabled = true;
            }
            else
            {
                DataDisplayOptions.Enabled = false;
            }

            if (CommonData.SavedViewList[CommonData.SelectedIndex].UseAnimationTime)
            {
                string currentTime = CommonData.SavedViewList[CommonData.SelectedIndex].AnimationTime;
                UseCurrentTime.Checked = true;
                CurrentTime.Text       = currentTime;
            }
            if (CommonData.SavedViewList[CommonData.SelectedIndex].UseStoredView)
            {
                UseCurrentViewPoint.Checked = true;
            }
        }
Exemple #22
0
        private void Apply_Click(object sender, EventArgs e)
        {
            ViewData current   = new ViewData();
            string   className = null;

            current.WindowName               = WindowSelect.Text;
            current.ViewType                 = "GEODrift";
            current.Name                     = GEOViewName.Text;
            className                        = SmartViewFunctions.GetClassName(GEOViewTarget.Text);
            current.ViewTarget               = className + "/" + GEOViewTarget.Text;
            current.EnableGeoBox             = UseGEOBox.Checked;
            current.GeoLongitude             = GEOLongitude.Text;
            current.GeoNorthSouth            = GeoNorthSouth.Text;
            current.GeoEastWest              = GEOEastWest.Text;
            current.GeoRadius                = GEORadius.Text;
            current.GeoDataDisplayActive     = GEOUseDataDisplay.Checked;
            className                        = SmartViewFunctions.GetClassName(GEODisplayObject.Text);
            current.GeoDataDisplayObject     = className + "/" + GEODisplayObject.Text;
            current.GeoDataDisplayReportName = GEODisplayReport.Text;
            current.GeoDataDisplayLocation   = GEODisplayLocation.Text;

            if (UseCurrentTime.Checked)
            {
                IAgAnimation animationRoot = (IAgAnimation)CommonData.StkRoot;
                double       currentTime   = animationRoot.CurrentTime;
                current.UseAnimationTime = true;
                current.AnimationTime    = CurrentTime.Text;
            }
            else
            {
                current.UseAnimationTime = false;
                IAgScenario scenario = (IAgScenario)(CommonData.StkRoot.CurrentScenario);
                current.AnimationTime = scenario.StartTime;
            }

            if (ObjectHideShow.Checked)
            {
                current.ObjectHideShow = true;
                List <ObjectData> data = new List <ObjectData>();
                data = CommonData.CurrentViewObjectData;
                current.ViewObjectData = data;
            }
            else
            {
                current.ObjectHideShow = false;
            }

            CommonData.SavedViewList[CommonData.SelectedIndex] = current;

            try
            {
                ReadWrite.WriteSavedViews(CommonData.DirectoryStr + "\\StoredViewData.json");
            }
            catch (Exception)
            {
                MessageBox.Show("Could not Write Stored Views File");
            }

            //try
            //{
            //    ReadWrite.WriteObjectData(CommonData.DirectoryStr + "\\StoredObjectData.txt");
            //}
            //catch (Exception)
            //{

            //    MessageBox.Show("Could not Write Object Data File");
            //}
            CommonData.NewView = true;
            this.Close();
        }
Exemple #23
0
        private void PopulateBoxes()
        {
            if (CommonData.SavedViewList[CommonData.SelectedIndex].UseAnimationTime)
            {
                CurrentTime.Text = CommonData.SavedViewList[CommonData.SelectedIndex].AnimationTime;
            }

            TypeSelect2D.Items.Add("ZoomedOut");
            TypeSelect2D.Items.Add("SpecifyCenter");
            TypeSelect2D.Items.Add("ObjectCenter");
            foreach (string item in TypeSelect2D.Items)
            {
                if (item == CommonData.SavedViewList[CommonData.SelectedIndex].ViewType2D)
                {
                    TypeSelect2D.SelectedItem = item;
                }
            }

            GroundTrackBox.Enabled = false;
            if (CommonData.SavedViewList[CommonData.SelectedIndex].EnableUniversalGroundTrack)
            {
                EnableUniversalGroundTrack.Checked = true;
            }
            LeadType2D.Items.Add("OnePass");
            LeadType2D.Items.Add("All");
            LeadType2D.Items.Add("Full");
            LeadType2D.Items.Add("Half");
            LeadType2D.Items.Add("Quarter");
            LeadType2D.Items.Add("None");
            LeadType2D.Items.Add("Time");
            foreach (string item in LeadType2D.Items)
            {
                if (CommonData.SavedViewList[CommonData.SelectedIndex].LeadType.Contains(item))
                {
                    LeadType2D.SelectedItem = item;
                    if (item == "Time")
                    {
                        GroundLeadTime.Text = CommonData.SavedViewList[CommonData.SelectedIndex].LeadTime;
                    }
                }
            }

            TrailType2D.Items.Add("SameAsLead");
            TrailType2D.Items.Add("OnePass");
            TrailType2D.Items.Add("All");
            TrailType2D.Items.Add("Full");
            TrailType2D.Items.Add("Half");
            TrailType2D.Items.Add("Quarter");
            TrailType2D.Items.Add("None");
            TrailType2D.Items.Add("Time");
            foreach (string item in TrailType2D.Items)
            {
                if (CommonData.SavedViewList[CommonData.SelectedIndex].TrailType.Contains(item))
                {
                    TrailType2D.SelectedItem = item;
                    if (item == "Time")
                    {
                        GroundTrailTime.Text = CommonData.SavedViewList[CommonData.SelectedIndex].TrailTime;
                    }
                }
            }

            ViewName2D.Text     = CommonData.SavedViewList[CommonData.SelectedIndex].Name;
            ZoomCenterLong.Text = CommonData.SavedViewList[CommonData.SelectedIndex].ZoomCenterLong;
            ZoomCenterLat.Text  = CommonData.SavedViewList[CommonData.SelectedIndex].ZoomCenterLat;
            ZoomDelta.Text      = CommonData.SavedViewList[CommonData.SelectedIndex].ZoomCenterDelta;

            List <string> windowNames = SmartViewFunctions.GetWindowNames(0);

            foreach (var item in windowNames)
            {
                WindowSelect.Items.Add(item);
                if (item.Contains(CommonData.SavedViewList[CommonData.SelectedIndex].WindowName))
                {
                    WindowSelect.SelectedIndex = WindowSelect.Items.Count - 1;
                }
            }

            if (CommonData.SavedViewList[CommonData.SelectedIndex].ObjectHideShow)
            {
                ObjectHideShow.Checked  = true;
                HideShowOptions.Enabled = true;
            }
            else
            {
                HideShowOptions.Enabled = false;
            }

            if (CommonData.SavedViewList[CommonData.SelectedIndex].UseAnimationTime)
            {
                string currentTime = CommonData.SavedViewList[CommonData.SelectedIndex].AnimationTime;
                UseCurrentTime.Checked = true;
                CurrentTime.Text       = currentTime;
            }
        }
Exemple #24
0
        private void Apply_Click(object sender, EventArgs e)
        {
            ViewData current = new ViewData();

            current.WindowName = WindowSelect.Text;
            current.WindowId   = SmartViewFunctions.GetWindowId(WindowSelect.Text, 0);
            current.Name       = ViewName2D.Text;
            current.ViewType   = "2D";
            current.ViewType2D = TypeSelect2D.Text;
            string className = SmartViewFunctions.GetClassName(ObjectName2D.Text);

            current.ViewTarget      = className + "/" + ObjectName2D.Text;
            current.ZoomCenterLat   = ZoomCenterLat.Text;
            current.ZoomCenterLong  = ZoomCenterLong.Text;
            current.ZoomCenterDelta = ZoomDelta.Text;

            if (EnableUniversalGroundTrack.Checked)
            {
                if (LeadType2D.Text == "Time")
                {
                    current.LeadType = LeadType2D.Text + " " + GroundLeadTime.Text;
                    current.LeadTime = GroundLeadTime.Text;
                }
                else
                {
                    current.LeadType = LeadType2D.Text;
                }

                if (TrailType2D.Text == "Time")
                {
                    current.TrailType = TrailType2D.Text + " " + GroundTrailTime.Text;
                    current.TrailTime = GroundTrailTime.Text;
                }
                else
                {
                    current.TrailType = TrailType2D.Text;
                }
            }
            else
            {
                current.LeadType  = "None";
                current.TrailType = "None";
            }

            if (UseCurrentTime.Checked)
            {
                IAgAnimation animationRoot = (IAgAnimation)CommonData.StkRoot;
                double       currentTime   = animationRoot.CurrentTime;
                current.UseAnimationTime = true;
                current.AnimationTime    = CurrentTime.Text;
            }
            else
            {
                current.UseAnimationTime = false;
                IAgScenario scenario = (IAgScenario)(CommonData.StkRoot.CurrentScenario);
                current.AnimationTime = scenario.StartTime;
            }

            if (ObjectHideShow.Checked)
            {
                current.ObjectHideShow = true;
                List <ObjectData> data = new List <ObjectData>();
                data = CommonData.CurrentViewObjectData;
                current.ViewObjectData = data;
            }
            else
            {
                current.ObjectHideShow = false;
            }

            CommonData.SavedViewList[CommonData.SelectedIndex] = current;
            CommonData.UpdatedView = true;
            try
            {
                ReadWrite.WriteSavedViews(CommonData.DirectoryStr + "\\StoredViewData.json");
            }
            catch (Exception)
            {
                MessageBox.Show("Could not Write Stored Views File");
            }
            this.Close();
        }
        private void PopulateComboBoxes()
        {
            TypeSelect.Items.Add("3D");
            TypeSelect.Items.Add("2D");
            TypeSelect.SelectedIndex = 0;

            DisplayLocation.Items.Add("TopLeft");
            DisplayLocation.Items.Add("TopCenter");
            DisplayLocation.Items.Add("TopRight");
            DisplayLocation.Items.Add("CenterLeft");
            DisplayLocation.Items.Add("Center");
            DisplayLocation.Items.Add("CenterRight");
            DisplayLocation.Items.Add("BottomLeft");
            DisplayLocation.Items.Add("BottomCenter");
            DisplayLocation.Items.Add("BottomRight");
            DisplayLocation.SelectedIndex = 0;

            TypeSelect2D.Items.Add("ZoomedOut");
            TypeSelect2D.Items.Add("SpecifyCenter");
            TypeSelect2D.Items.Add("ObjectCenter");
            TypeSelect2D.SelectedIndex = 0;


            LeadType3D.Items.Add("OnePass");
            LeadType3D.Items.Add("All");
            LeadType3D.Items.Add("Full");
            LeadType3D.Items.Add("Half");
            LeadType3D.Items.Add("Quarter");
            LeadType3D.Items.Add("None");
            LeadType3D.Items.Add("Time");
            LeadType3D.SelectedIndex = 0;

            LeadType2D.Items.Add("OnePass");
            LeadType2D.Items.Add("All");
            LeadType2D.Items.Add("Full");
            LeadType2D.Items.Add("Half");
            LeadType2D.Items.Add("Quarter");
            LeadType2D.Items.Add("None");
            LeadType2D.Items.Add("Time");
            LeadType2D.SelectedIndex = 0;

            TrailType3D.Items.Add("SameAsLead");
            TrailType3D.Items.Add("OnePass");
            TrailType3D.Items.Add("All");
            TrailType3D.Items.Add("Full");
            TrailType3D.Items.Add("Half");
            TrailType3D.Items.Add("Quarter");
            TrailType3D.Items.Add("None");
            TrailType3D.Items.Add("Time");
            TrailType3D.SelectedIndex = 0;

            TrailType2D.Items.Add("SameAsLead");
            TrailType2D.Items.Add("OnePass");
            TrailType2D.Items.Add("All");
            TrailType2D.Items.Add("Full");
            TrailType2D.Items.Add("Half");
            TrailType2D.Items.Add("Quarter");
            TrailType2D.Items.Add("None");
            TrailType2D.Items.Add("Time");
            TrailType2D.SelectedIndex = 0;

            ZoomCenterLong.Text = "0";
            ZoomCenterLat.Text  = "0";
            ZoomDelta.Text      = "10";

            OrbitTrackBox.Enabled  = false;
            GroundTrackBox.Enabled = false;

            List <string> paths = SmartViewFunctions.GetCameraPaths();

            foreach (var item in paths)
            {
                CameraPathName.Items.Add(item);
            }
            if (CameraPathName.Items.Count > 0)
            {
                CameraPathName.SelectedIndex = 0;
            }
        }
        private void Create_Click(object sender, EventArgs e)
        {
            string className;
            int    check;

            if (TypeSelect.SelectedIndex == 0) //3D
            {
                check = FieldCheck3D();
                if (check == 0)
                {
                    current.WindowName     = WindowSelect.Text;
                    current.WindowId       = SmartViewFunctions.GetWindowId(WindowSelect.Text, 1);
                    current.Name           = ViewName3D.Text;
                    current.ViewType       = TypeSelect.Text;
                    current.ViewObjectData = CommonData.CurrentViewObjectData;
                    className          = SmartViewFunctions.GetClassName(FocusedItem.Text);
                    current.ViewTarget = className + "/" + FocusedItem.Text;
                    current.ViewAxes   = "Inertial";

                    if (EnableUniversalOrbitTrack.Checked)
                    {
                        if (UniversalLeadTrail.Checked)
                        {
                            current.EnableUniversalOrbitTrack = true;
                            current.UniqueLeadTrail           = false;
                            if (LeadType3D.Text == "Time")
                            {
                                current.LeadType = LeadType3D.Text;
                                current.LeadTime = OrbitLeadTime.Text;
                            }
                            else
                            {
                                current.LeadType = LeadType3D.Text;
                            }

                            if (TrailType3D.Text == "Time")
                            {
                                current.TrailType = TrailType3D.Text;
                                current.TrailTime = OrbitTrailTime.Text;
                            }
                            else
                            {
                                current.TrailType = TrailType3D.Text;
                            }
                        }
                        else if (UniqueLeadTrail.Checked)
                        {
                            current.UniqueLeadTrail           = true;
                            current.EnableUniversalOrbitTrack = true;
                        }
                    }
                    else
                    {
                        current.EnableUniversalOrbitTrack = false;
                        current.LeadType  = "None";
                        current.TrailType = "None";
                    }

                    //Add required primary data display components
                    if (UseDataDisplay.Checked)
                    {
                        current.PrimaryDataDisplay.DataDisplayActive = true;
                    }
                    else
                    {
                        current.PrimaryDataDisplay.DataDisplayActive = false;
                    }
                    current.PrimaryDataDisplay.DataDisplayLocation = DisplayLocation.Text;
                    className = SmartViewFunctions.GetClassName(DisplayObject.Text);
                    current.PrimaryDataDisplay.DataDisplayObject     = className + "/" + DisplayObject.Text;
                    current.PrimaryDataDisplay.DataDisplayReportName = DisplayReport.Text;
                    className = SmartViewFunctions.GetClassName(PredataObject.Text);
                    current.PrimaryDataDisplay.PredataObject = className + "/" + PredataObject.Text;

                    //Define stored view if required by current view point option
                    if (UseCurrentViewPoint.Checked)
                    {
                        current.UseStoredView  = true;
                        current.StoredViewName = ViewName3D.Text;
                        CommonData.StkRoot.ExecuteCommand("VO * SaveStoredView \"" + ViewName3D.Text + "\" " + current.WindowId);
                    }
                    else
                    {
                        current.UseStoredView  = false;
                        current.StoredViewName = "None";
                    }
                }
            }
            else if (TypeSelect.SelectedIndex == 1) //2D
            {
                check = FieldCheck2D();
                if (check == 0)
                {
                    current.WindowName     = WindowSelect.Text;
                    current.WindowId       = SmartViewFunctions.GetWindowId(WindowSelect.Text, 0);
                    current.ViewObjectData = CommonData.CurrentViewObjectData;
                    current.Name           = ViewName2D.Text;
                    current.ViewType       = TypeSelect.Text;
                    current.ViewType2D     = TypeSelect2D.Text;
                    className               = SmartViewFunctions.GetClassName(ObjectName2D.Text);
                    current.ViewTarget      = className + "/" + ObjectName2D.Text;
                    current.ZoomCenterLat   = ZoomCenterLat.Text;
                    current.ZoomCenterLong  = ZoomCenterLong.Text;
                    current.ZoomCenterDelta = ZoomDelta.Text;

                    if (EnableUniversalGroundTrack.Checked)
                    {
                        if (LeadType2D.Text == "Time")
                        {
                            current.LeadType = LeadType2D.Text + " " + GroundLeadTime.Text;
                            current.LeadTime = GroundLeadTime.Text;
                        }
                        else
                        {
                            current.LeadType = LeadType2D.Text;
                        }

                        if (TrailType2D.Text == "Time")
                        {
                            current.TrailType = TrailType2D.Text + " " + GroundTrailTime.Text;
                            current.TrailTime = GroundTrailTime.Text;
                        }
                        else
                        {
                            current.TrailType = TrailType2D.Text;
                        }
                    }
                    else
                    {
                        current.LeadType  = "None";
                        current.TrailType = "None";
                    }
                }
            }
            if (UseCurrentTime.Checked)
            {
                current.UseAnimationTime = true;
                IAgAnimation animationRoot = (IAgAnimation)CommonData.StkRoot;
                double       currentTime   = animationRoot.CurrentTime;
                string       newTime       = CommonData.StkRoot.ConversionUtility.ConvertDate("EpSec", "UTCG", currentTime.ToString());
                current.AnimationTime = newTime.ToString();
            }
            else
            {
                current.UseAnimationTime = false;
                IAgScenario scenario = (IAgScenario)(CommonData.StkRoot.CurrentScenario);
                current.AnimationTime = scenario.StartTime;
            }
            if (ObjectHideShow.Checked)
            {
                current.ObjectHideShow = true;
                List <ObjectData> data = new List <ObjectData>();
                data = CommonData.CurrentViewObjectData;
                current.ViewObjectData = data;
            }
            else
            {
                current.ObjectHideShow = false;
            }
            if (UseVectorHideShow.Checked)
            {
                current.VectorHideShow = true;
            }
            else
            {
                current.VectorHideShow = false;
            }

            if (UseCameraPath.Checked)
            {
                current.UseCameraPath  = true;
                current.CameraPathName = CameraPathName.Text;
            }
            else
            {
                current.UseCameraPath = false;
            }
            CommonData.SavedViewList.Add(current);
            try
            {
                ReadWrite.WriteSavedViews(CommonData.DirectoryStr + "\\StoredViewData.json");
            }
            catch (Exception)
            {
                MessageBox.Show("Could not Write Stored Views File");
            }

            //try
            //{
            //    ReadWrite.WriteObjectData(CommonData.DirectoryStr + "\\StoredObjectData.txt");
            //}
            //catch (Exception)
            //{

            //    MessageBox.Show("Could not Write Object Data File");
            //}
            CommonData.NewView = true;
            this.Close();
        }
Exemple #27
0
 public EditGeoDriftForm()
 {
     InitializeComponent();
     CommonData.CurrentViewObjectData = SmartViewFunctions.GetObjectData();
     PopulateComboBoxes();
 }
Exemple #28
0
        private void Apply_Click(object sender, EventArgs e)
        {
            int check = FieldCheck3D();

            if (check == 0)
            {
                ViewData current = new ViewData();
                current.WindowName = WindowSelect.Text;
                current.WindowId   = SmartViewFunctions.GetWindowId(WindowSelect.Text, 1);
                current.Name       = ViewName3D.Text;
                current.ViewType   = "3D";
                string className = SmartViewFunctions.GetClassName(FocusedItem.Text);
                current.ViewTarget = className + "/" + FocusedItem.Text;
                current.ViewAxes   = ViewType.Text;

                if (EnableUniversalOrbitTrack.Checked)
                {
                    current.EnableUniversalOrbitTrack = true;
                    if (LeadType3D.Text == "Time")
                    {
                        current.LeadType = LeadType3D.Text + " " + OrbitLeadTime.Text;
                        current.LeadTime = OrbitLeadTime.Text;
                    }
                    else
                    {
                        current.LeadType = LeadType3D.Text;
                    }

                    if (TrailType3D.Text == "Time")
                    {
                        current.TrailType = TrailType3D.Text + " " + OrbitTrailTime.Text;
                        current.TrailTime = OrbitTrailTime.Text;
                    }
                    else
                    {
                        current.TrailType = TrailType3D.Text;
                    }
                }
                else
                {
                    current.LeadType  = "None";
                    current.TrailType = "None";
                }

                if (UseDataDisplay.Checked)
                {
                    current.DataDisplayActive   = true;
                    current.DataDisplayLocation = DisplayLocation.Text;
                    className = SmartViewFunctions.GetClassName(DisplayObject.Text);
                    current.DataDisplayObject     = className + "/" + DisplayObject.Text;
                    current.DataDisplayReportName = DisplayReport.Text;
                }
                else
                {
                    current.DataDisplayActive   = false;
                    current.DataDisplayLocation = DisplayLocation.Text;
                    className = SmartViewFunctions.GetClassName(DisplayObject.Text);
                    current.DataDisplayObject     = className + "/" + DisplayObject.Text;
                    current.DataDisplayReportName = DisplayReport.Text;
                }

                if (UseCurrentTime.Checked)
                {
                    IAgAnimation animationRoot = (IAgAnimation)CommonData.StkRoot;
                    double       currentTime   = animationRoot.CurrentTime;
                    current.UseAnimationTime = true;
                    current.AnimationTime    = CurrentTime.Text;
                }
                else
                {
                    current.UseAnimationTime = false;
                    IAgScenario scenario = (IAgScenario)(CommonData.StkRoot.CurrentScenario);
                    current.AnimationTime = scenario.StartTime;
                }

                if (UseCurrentViewPoint.Checked)
                {
                    current.UseStoredView  = true;
                    current.StoredViewName = ViewName3D.Text;
                    CommonData.StkRoot.ExecuteCommand("VO * SaveStoredView \"" + ViewName3D.Text + "\" " + current.WindowId);
                }
                else
                {
                    current.UseStoredView  = false;
                    current.StoredViewName = "None";
                }

                if (ObjectHideShow.Checked)
                {
                    current.ObjectHideShow = true;
                    List <ObjectData> data = new List <ObjectData>();
                    data = CommonData.CurrentViewObjectData;
                    current.ViewObjectData = data;
                }
                else
                {
                    current.ObjectHideShow = false;
                }

                CommonData.SavedViewList[CommonData.SelectedIndex] = current;
                CommonData.UpdatedView = true;
                try
                {
                    ReadWrite.WriteSavedViews(CommonData.DirectoryStr + "\\StoredViewData.json");
                }
                catch (Exception)
                {
                    MessageBox.Show("Could not Write Stored Views File");
                }
                this.Close();
            }
        }
        private void PopulateComboBoxes()
        {
            TTViewName.Text = CommonData.SavedViewList[CommonData.SelectedIndex].Name;
            List <string> windowNames = SmartViewFunctions.GetWindowNames(1);

            foreach (var item in windowNames)
            {
                WindowSelect.Items.Add(item);
                if (item.Contains(CommonData.SavedViewList[CommonData.SelectedIndex].WindowName))
                {
                    WindowSelect.SelectedIndex = WindowSelect.Items.Count - 1;
                }
            }

            foreach (ObjectData item in CommonData.CurrentViewObjectData)
            {
                if (item.ClassName == "Satellite")
                {
                    TargetSatellite.Items.Add(item.SimpleName);
                    if (CommonData.SavedViewList[CommonData.SelectedIndex].TargetSatellite.Contains(item.SimpleName))
                    {
                        TargetSatellite.SelectedItem = item.SimpleName;
                    }
                }
            }
            if (TargetSatellite.SelectedIndex == -1)
            {
                TargetSatellite.SelectedIndex = 0;
            }

            TTDisplayObject.Items.Add("Target Satellite");
            TTDisplayObject.Items.Add("All Threats (Up to 4)");
            if (CommonData.SavedViewList[CommonData.SelectedIndex].TtDataDisplayObject == "AllThreat")
            {
                TTDisplayObject.SelectedIndex = TTDisplayObject.Items.Count - 1;
            }
            foreach (ObjectData item in CommonData.CurrentViewObjectData)
            {
                if (item.ClassName == "Satellite")
                {
                    if (item.SimpleName != TargetSatellite.Text)
                    {
                        TTDisplayObject.Items.Add(item.SimpleName);
                        if (CommonData.SavedViewList[CommonData.SelectedIndex].TtDataDisplayObject.Contains(item.SimpleName))
                        {
                            TTDisplayObject.SelectedIndex = CommonData.CurrentViewObjectData.IndexOf(item);
                        }
                    }
                }
            }
            if (TTDisplayObject.SelectedIndex == -1)
            {
                TTDisplayObject.SelectedIndex = 0;
            }

            ThreatList.Items.Clear();
            foreach (ObjectData item in CommonData.CurrentViewObjectData)
            {
                if (item.ClassName == "Satellite" && item.SimpleName != TargetSatellite.Text)
                {
                    ListViewItem listItem = new ListViewItem();
                    listItem.Text = item.SimpleName;
                    int    index     = ThreatList.Items.IndexOf(listItem);
                    string className = SmartViewFunctions.GetClassName(item.SimpleName);
                    if (index == -1)
                    {
                        if (CommonData.SavedViewList[CommonData.SelectedIndex].ThreatSatNames.Contains(className + "/" + item.SimpleName))
                        {
                            listItem.Font = new Font(listItem.Font, FontStyle.Bold);
                            _threatNames.Add(className + "/" + item.SimpleName);
                        }

                        ThreatList.Items.Add(listItem);
                    }
                }
            }

            TTDisplayLocation.Items.Add("TopLeft");
            TTDisplayLocation.Items.Add("TopCenter");
            TTDisplayLocation.Items.Add("TopRight");
            TTDisplayLocation.Items.Add("CenterLeft");
            TTDisplayLocation.Items.Add("Center");
            TTDisplayLocation.Items.Add("CenterRight");
            TTDisplayLocation.Items.Add("BottomLeft");
            TTDisplayLocation.Items.Add("BottomCenter");
            TTDisplayLocation.Items.Add("BottomRight");
            TTDisplayLocation.SelectedIndex = 0;

            if (CommonData.SavedViewList[CommonData.SelectedIndex].EnableProximityBox)
            {
                UseProxBox.Checked = true;
            }

            if (CommonData.SavedViewList[CommonData.SelectedIndex].TtDataDisplayActive)
            {
                TTDataDisplayOptions.Enabled = true;
                TTUseDataDisplay.Checked     = true;
            }
            else
            {
                TTDataDisplayOptions.Enabled = false;
                TTUseDataDisplay.Checked     = false;
            }

            if (CommonData.SavedViewList[CommonData.SelectedIndex].ObjectHideShow)
            {
                ObjectHideShow.Checked  = true;
                HideShowOptions.Enabled = true;
            }
            else
            {
                HideShowOptions.Enabled = false;
            }

            if (CommonData.SavedViewList[CommonData.SelectedIndex].UseAnimationTime)
            {
                string currentTime = CommonData.SavedViewList[CommonData.SelectedIndex].AnimationTime;
                UseCurrentTime.Checked = true;
                CurrentTime.Text       = currentTime;
            }

            if (CommonData.SavedViewList[CommonData.SelectedIndex].EnableProximityEllipsoid)
            {
                EnableEllipsoid.Checked = true;
                EllipsoidX.Text         = CommonData.SavedViewList[CommonData.SelectedIndex].EllipsoidX;
                EllipsoidY.Text         = CommonData.SavedViewList[CommonData.SelectedIndex].EllipsoidY;
                EllipsoidZ.Text         = CommonData.SavedViewList[CommonData.SelectedIndex].EllipsoidZ;
            }
            else
            {
                EllipsoidDefinition.Enabled = false;
                EllipsoidX.Text             = "100";
                EllipsoidY.Text             = "100";
                EllipsoidZ.Text             = "100";
            }
        }
        private void Apply_Click(object sender, EventArgs e)
        {
            ViewData current = new ViewData();

            current.WindowName     = WindowSelect.Text;
            current.ViewType       = "Target/Threat";
            current.ThreatSatNames = _threatNames;
            string className = SmartViewFunctions.GetClassName(TargetSatellite.Text);

            current.TargetSatellite = className + "/" + TargetSatellite.Text;
            current.Name            = TTViewName.Text;

            if (TTUseDataDisplay.Checked)
            {
                current.TtDataDisplayActive   = true;
                current.TtDataDisplayLocation = TTDisplayLocation.Text;
                if (TTDisplayObject.SelectedIndex == 0)
                {
                    className = SmartViewFunctions.GetClassName(TargetSatellite.Text);
                    current.TtDataDisplayObject     = className + "/" + TargetSatellite.Text;
                    current.TtDataDisplayReportName = TTDisplayReport.Text;
                }
                else if (TTDisplayObject.SelectedIndex == 1)
                {
                    current.TtDataDisplayObject     = "AllThreat";
                    current.TtDataDisplayReportName = TTDisplayReport.Text;
                }
                else
                {
                    className = SmartViewFunctions.GetClassName(TTDisplayObject.Text);
                    current.TtDataDisplayObject     = className + "/" + TTDisplayObject.Text;
                    current.TtDataDisplayReportName = TTDisplayReport.Text;
                }
            }
            else
            {
                current.TtDataDisplayActive   = false;
                current.TtDataDisplayLocation = TTDisplayLocation.Text;
                className = SmartViewFunctions.GetClassName(TTDisplayObject.Text);
                current.TtDataDisplayObject     = className + "/" + TTDisplayObject.Text;
                current.TtDataDisplayReportName = TTDisplayReport.Text;
            }

            if (UseProxBox.Checked)
            {
                current.EnableProximityBox = true;
            }
            else
            {
                current.EnableProximityBox = false;
            }

            if (EnableEllipsoid.Checked)
            {
                current.EnableProximityEllipsoid = true;
                current.EllipsoidX = EllipsoidX.Text;
                current.EllipsoidY = EllipsoidY.Text;
                current.EllipsoidZ = EllipsoidZ.Text;
            }
            else
            {
                current.EnableProximityEllipsoid = false;
                current.EllipsoidX = "100";
                current.EllipsoidY = "100";
                current.EllipsoidZ = "100";
            }

            if (UseCurrentTime.Checked)
            {
                IAgAnimation animationRoot = (IAgAnimation)CommonData.StkRoot;
                double       currentTime   = animationRoot.CurrentTime;
                current.UseAnimationTime = true;
                current.AnimationTime    = CurrentTime.Text;
            }
            else
            {
                current.UseAnimationTime = false;
                IAgScenario scenario = (IAgScenario)(CommonData.StkRoot.CurrentScenario);
                current.AnimationTime = scenario.StartTime;
            }

            if (ObjectHideShow.Checked)
            {
                current.ObjectHideShow = true;
                List <ObjectData> data = new List <ObjectData>();
                data = CommonData.CurrentViewObjectData;
                current.ViewObjectData = data;
            }
            else
            {
                current.ObjectHideShow = false;
            }
            CommonData.SavedViewList[CommonData.SelectedIndex] = current;

            try
            {
                ReadWrite.WriteSavedViews(CommonData.DirectoryStr + "\\StoredViewData.json");
            }
            catch (Exception)
            {
                MessageBox.Show("Could not Write Stored Views File");
            }

            //try
            //{
            //    ReadWrite.WriteObjectData(CommonData.DirectoryStr + "\\StoredObjectData.txt");
            //}
            //catch (Exception)
            //{

            //    MessageBox.Show("Could not Write Object Data File");
            //}
            CommonData.UpdatedView = true;
            this.Close();
        }