public void WaypointsToGreatArc(IAgAircraft aircraft, List <Waypoint> waypoints, bool useTakeoffLanding)
        {
            //Set propagator to GreatArc
            aircraft.SetRouteType(AgEVePropagatorType.ePropagatorGreatArc);
            IAgVePropagatorGreatArc route = aircraft.Route as IAgVePropagatorGreatArc;

            route.ArcGranularity = 51.333;

            //Set Ref type to WayPtAltRefMSL
            route.SetAltitudeRefType(AgEVeAltitudeRef.eWayPtAltRefMSL);
            route.Method = AgEVeWayPtCompMethod.eDetermineTimeAccFromVel;

            route.Waypoints.RemoveAll();

            if (useTakeoffLanding)
            {
                waypoints[0].Altitude = waypoints[0].SurfaceAltitude;
                waypoints[waypoints.Count - 1].Altitude = waypoints[waypoints.Count - 1].SurfaceAltitude;
            }

            foreach (Waypoint waypoint in waypoints)
            {
                IAgVeWaypointsElement thisWaypoint = route.Waypoints.Add();
                thisWaypoint.Latitude   = waypoint.Latitude;
                thisWaypoint.Longitude  = waypoint.Longitude;
                thisWaypoint.Altitude   = waypoint.Altitude;
                thisWaypoint.Speed      = waypoint.Speed;
                thisWaypoint.TurnRadius = waypoint.TurnRadius;
            }

            route.Propagate();
        }
示例#2
0
        public static IAgVORefCrdnAngle DisplayAngle(string angleName, IAgStkObject stkObject, Color vectorColor)
        {
            IAgAircraft _aircraft = stkObject as IAgAircraft;
            IAgCrdn     _angleVGT = stkObject.Vgt.Angles[angleName] as IAgCrdn;

            IAgVORefCrdnCollection refCrdns = GetRefCrdns(stkObject); //_aircraft.VO.Vector.RefCrdns;

            List <string> displayVectors = new List <string>();

            foreach (IAgVORefCrdn item in refCrdns)
            {
                displayVectors.Add(item.Name);
            }

            IAgVORefCrdnAngle _angleVO;

            if (displayVectors.Contains(_angleVGT.QualifiedPath))
            {
                _angleVO = refCrdns.GetCrdnByName(
                    AgEGeometricElemType.eAngleElem, _angleVGT.QualifiedPath) as IAgVORefCrdnAngle;
            }
            else
            {
                _angleVO = refCrdns.Add(
                    AgEGeometricElemType.eAngleElem, _angleVGT.QualifiedPath) as IAgVORefCrdnAngle;
            }

            _angleVO.AngleValueVisible = true;
            _angleVO.Color             = vectorColor;
            _angleVO.LabelVisible      = true;

            return(_angleVO);
        }
示例#3
0
        public static void VectorChangeColor(string vectorName, IAgStkObject stkObject, Color SelectedColor)
        {
            IAgAircraft        _aircraft  = stkObject as IAgAircraft;
            IAgCrdn            _vectorVGT = stkObject.Vgt.Vectors[vectorName] as IAgCrdn;
            IAgVORefCrdnVector _vectorVO  = _aircraft.VO.Vector.RefCrdns.Add(AgEGeometricElemType.eVectorElem, _vectorVGT.QualifiedPath) as IAgVORefCrdnVector;

            _vectorVO.Color = SelectedColor;
        }
示例#4
0
        public static List <AgELeadTrailData> GetLeadTrailData(string objectPath, string className)
        {
            List <AgELeadTrailData> leadTrailData = new List <AgELeadTrailData>();

            if (className == "Satellite")
            {
                IAgSatellite mySat = CommonData.StkRoot.GetObjectFromPath(objectPath) as IAgSatellite;
                leadTrailData.Add(mySat.VO.Pass.TrackData.PassData.Orbit.LeadDataType);
                leadTrailData.Add(mySat.VO.Pass.TrackData.PassData.Orbit.TrailDataType);
                leadTrailData.Add(mySat.Graphics.PassData.GroundTrack.LeadDataType);
                leadTrailData.Add(mySat.Graphics.PassData.GroundTrack.TrailDataType);
            }
            else if (className == "Aircraft")
            {
                IAgAircraft myAircraft = CommonData.StkRoot.GetObjectFromPath(objectPath) as IAgAircraft;
                leadTrailData.Add(myAircraft.VO.Route.TrackData.LeadDataType);
                leadTrailData.Add(myAircraft.VO.Route.TrackData.TrailDataType);
                leadTrailData.Add(myAircraft.Graphics.PassData.Route.LeadDataType);
                leadTrailData.Add(myAircraft.Graphics.PassData.Route.TrailDataType);
            }
            else if (className == "Missile")
            {
                IAgMissile myMissile = CommonData.StkRoot.GetObjectFromPath(objectPath) as IAgMissile;
                leadTrailData.Add(myMissile.VO.Trajectory.TrackData.PassData.Trajectory.LeadDataType);
                leadTrailData.Add(myMissile.VO.Trajectory.TrackData.PassData.Trajectory.TrailDataType);
                leadTrailData.Add(myMissile.Graphics.PassData.Trajectory.LeadDataType);
                leadTrailData.Add(myMissile.Graphics.PassData.Trajectory.TrailDataType);
            }
            else if (className == "GroundVehicle")
            {
                IAgGroundVehicle myGv = CommonData.StkRoot.GetObjectFromPath(objectPath) as IAgGroundVehicle;
                leadTrailData.Add(myGv.VO.Route.TrackData.LeadDataType);
                leadTrailData.Add(myGv.VO.Route.TrackData.TrailDataType);
                leadTrailData.Add(myGv.Graphics.PassData.Route.LeadDataType);
                leadTrailData.Add(myGv.Graphics.PassData.Route.TrailDataType);
            }
            else if (className == "Ship")
            {
                IAgShip myShip = CommonData.StkRoot.GetObjectFromPath(objectPath) as IAgShip;
                leadTrailData.Add(myShip.VO.Route.TrackData.LeadDataType);
                leadTrailData.Add(myShip.VO.Route.TrackData.TrailDataType);
                leadTrailData.Add(myShip.Graphics.PassData.Route.LeadDataType);
                leadTrailData.Add(myShip.Graphics.PassData.Route.TrailDataType);
            }
            else if (className == "LaunchVehicle")
            {
                IAgLaunchVehicle myLv = CommonData.StkRoot.GetObjectFromPath(objectPath) as IAgLaunchVehicle;
                leadTrailData.Add(myLv.VO.Trajectory.TrackData.PassData.Trajectory.LeadDataType);
                leadTrailData.Add(myLv.VO.Trajectory.TrackData.PassData.Trajectory.TrailDataType);
                leadTrailData.Add(myLv.Graphics.PassData.GroundTrack.LeadDataType);
                leadTrailData.Add(myLv.Graphics.PassData.GroundTrack.TrailDataType);
            }
            else
            {
            }

            return(leadTrailData);
        }
示例#5
0
        private void button_LoadAC_Click(object sender, EventArgs e)
        {
            IAgAircraft newAircraft = CreateRoute();

            if (checkBox_UseEndurance.Checked)
            {
                routeBuilder.CheckFlightEndurance(newAircraft,
                                                  combobox_Units.Text, double.Parse(textBox_Endurance.Text));
            }
        }
示例#6
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;
     }
 }
示例#7
0
 public static void VectorChangeSize(string vectorName, double ScaleValue, IAgStkObject stkObject)
 {
     if (stkObject.ClassName == "Aircraft")
     {
         IAgAircraft _aircraft = stkObject as IAgAircraft;
         IAgCrdn     vector    = stkObject.Vgt.Vectors[vectorName] as IAgCrdn;
         IAgVOVector vectorVO  = _aircraft.VO.Vector;
         vectorVO.ScaleRelativeToModel = true;
         vectorVO.VectorSizeScale      = ScaleValue;
     }
 }
示例#8
0
        public static void SetLeadTrailData(ObjectData stkObject)
        {
            List <string> leadTrailData = new List <string>();

            if (stkObject.ClassName == "Satellite")
            {
                IAgSatellite mySat = CommonData.StkRoot.GetObjectFromPath(stkObject.SimplePath) as IAgSatellite;
                mySat.VO.Pass.TrackData.PassData.Orbit.SetLeadDataType(stkObject.LeadSetting3D);
                mySat.VO.Pass.TrackData.PassData.Orbit.SetTrailDataType(stkObject.TrailSetting3D);
                mySat.Graphics.PassData.GroundTrack.SetLeadDataType(stkObject.LeadSetting2D);
                mySat.Graphics.PassData.GroundTrack.SetTrailDataType(stkObject.TrailSetting2D);
            }
            else if (stkObject.ClassName == "Aircraft")
            {
                IAgAircraft myAircraft = CommonData.StkRoot.GetObjectFromPath(stkObject.SimplePath) as IAgAircraft;
                myAircraft.VO.Route.TrackData.SetLeadDataType(stkObject.LeadSetting3D);
                myAircraft.VO.Route.TrackData.SetTrailDataType(stkObject.TrailSetting3D);
                myAircraft.Graphics.PassData.Route.SetLeadDataType(stkObject.LeadSetting2D);
                myAircraft.Graphics.PassData.Route.SetTrailDataType(stkObject.TrailSetting2D);
            }
            else if (stkObject.ClassName == "Missile")
            {
                IAgMissile myMissile = CommonData.StkRoot.GetObjectFromPath(stkObject.SimplePath) as IAgMissile;
                myMissile.VO.Trajectory.TrackData.PassData.Trajectory.SetLeadDataType(stkObject.LeadSetting3D);
                myMissile.VO.Trajectory.TrackData.PassData.Trajectory.SetTrailDataType(stkObject.TrailSetting3D);
                myMissile.Graphics.PassData.Trajectory.SetLeadDataType(stkObject.LeadSetting2D);
                myMissile.Graphics.PassData.Trajectory.SetTrailDataType(stkObject.TrailSetting2D);
            }
            else if (stkObject.ClassName == "GroundVehicle")
            {
                IAgGroundVehicle myGv = CommonData.StkRoot.GetObjectFromPath(stkObject.SimplePath) as IAgGroundVehicle;
                myGv.VO.Route.TrackData.SetLeadDataType(stkObject.LeadSetting3D);
                myGv.VO.Route.TrackData.SetTrailDataType(stkObject.TrailSetting3D);
                myGv.Graphics.PassData.Route.SetLeadDataType(stkObject.LeadSetting2D);
                myGv.Graphics.PassData.Route.SetTrailDataType(stkObject.TrailSetting2D);
            }
            else if (stkObject.ClassName == "Ship")
            {
                IAgShip myShip = CommonData.StkRoot.GetObjectFromPath(stkObject.SimplePath) as IAgShip;
                myShip.VO.Route.TrackData.SetLeadDataType(stkObject.LeadSetting3D);
                myShip.VO.Route.TrackData.SetTrailDataType(stkObject.TrailSetting3D);
                myShip.Graphics.PassData.Route.SetLeadDataType(stkObject.LeadSetting2D);
                myShip.Graphics.PassData.Route.SetTrailDataType(stkObject.TrailSetting2D);
            }
            else if (stkObject.ClassName == "LaunchVehicle")
            {
                IAgLaunchVehicle myLv = CommonData.StkRoot.GetObjectFromPath(stkObject.SimplePath) as IAgLaunchVehicle;
                myLv.VO.Trajectory.TrackData.PassData.Trajectory.SetLeadDataType(stkObject.LeadSetting3D);
                myLv.VO.Trajectory.TrackData.PassData.Trajectory.SetTrailDataType(stkObject.TrailSetting3D);
                myLv.Graphics.PassData.GroundTrack.SetLeadDataType(stkObject.LeadSetting2D);
                myLv.Graphics.PassData.GroundTrack.SetTrailDataType(stkObject.TrailSetting2D);
            }
        }
        public void CheckFlightEndurance(IAgAircraft flight, string enduranceUnit, double enduranceValue)
        {
            if (enduranceUnit.Equals("mi") || enduranceUnit.Equals("km") || enduranceUnit.Equals("nm"))
            {
                root.UnitPreferences["Distance"].SetCurrentUnit(enduranceUnit);
            }
            else
            {
                root.UnitPreferences["Time"].SetCurrentUnit(enduranceUnit);
            }
            bool tooLong = true;

            root.BeginUpdate();
            while (tooLong)
            {
                IAgDataPrvTimeVar dpDistance = ((IAgStkObject)flight).DataProviders["Distance"] as IAgDataPrvTimeVar;
                string            evalTime   = (flight.Route as IAgVePropagatorGreatArc).StopTime.ToString();
                evalTime = evalTime.Substring(0, evalTime.IndexOf("."));

                IAgDrResult dpResult = dpDistance.ExecSingle(evalTime);

                Array distance = dpResult.DataSets.GetDataSetByName("Dist from start").GetValues();
                Array duration = dpResult.DataSets.GetDataSetByName("Time from start").GetValues();

                double distanceTraveled = (double)distance.GetValue(0);
                double timeTraveled     = (double)duration.GetValue(0);

                if (enduranceUnit.Equals("mi") || enduranceUnit.Equals("km") || enduranceUnit.Equals("nm"))
                {
                    if (distanceTraveled < enduranceValue)
                    {
                        tooLong = false;
                    }
                }
                else if (timeTraveled < enduranceValue)
                {
                    tooLong = false;
                }

                if (tooLong)
                {
                    IAgVePropagatorGreatArc route = (IAgVePropagatorGreatArc)flight.Route;
                    route.Waypoints.RemoveAt(route.Waypoints.Count - 2);
                    route.Propagate();
                }
            }
            root.UnitPreferences.ResetUnits();
            root.EndUpdate();
        }
示例#10
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;
         }
     }
 }
示例#11
0
        public static IAgVORefCrdnCollection GetRefCrdns(IAgStkObject stkObject)
        {
            switch (stkObject.ClassType)
            {
            case AgESTKObjectType.eAircraft:
                IAgAircraft _aircraft = stkObject as IAgAircraft;
                return(_aircraft.VO.Vector.RefCrdns);

            case AgESTKObjectType.eFacility:
                IAgFacility fac = stkObject as IAgFacility;
                return(fac.VO.Vector.RefCrdns);

            case AgESTKObjectType.eGroundVehicle:
                IAgGroundVehicle gv = stkObject as IAgGroundVehicle;
                return(gv.VO.Vector.RefCrdns);

            case AgESTKObjectType.eMissile:
                IAgMissile miss = stkObject as IAgMissile;
                return(miss.VO.Vector.RefCrdns);

            case AgESTKObjectType.ePlace:
                IAgPlace place = stkObject as IAgPlace;
                return(place.VO.Vector.RefCrdns);

            case AgESTKObjectType.eSatellite:
                IAgSatellite sat = stkObject as IAgSatellite;
                return(sat.VO.Vector.RefCrdns);

            case AgESTKObjectType.eSensor:
                IAgSensor sensor = stkObject as IAgSensor;
                return(sensor.VO.Vector.RefCrdns);

            case AgESTKObjectType.eShip:
                IAgShip ship = stkObject as IAgShip;
                return(ship.VO.Vector.RefCrdns);

            case AgESTKObjectType.eTarget:
                IAgTarget target = stkObject as IAgTarget;
                return(target.VO.Vector.RefCrdns);

            default:
                return(null);
            }
        }
示例#12
0
        public IAgAircraft CreateAircraft(string seed, bool createSensor, double sensorFOV, double speedKnots)
        {
            string      aircraftName = uniqueName(seed, AgESTKObjectType.eAircraft);
            IAgAircraft aircraft     = root.CurrentScenario.Children.New(AgESTKObjectType.eAircraft, aircraftName) as IAgAircraft;

            root.ExecuteCommand("SetAttitude */Aircraft/" + aircraftName + " Profile AircraftCoordTurn 10");
            IAgVOModel acModel = aircraft.VO.Model;

            acModel.ModelType = AgEModelType.eModelFile;
            IAgVOModelFile modelFile = acModel.ModelData as IAgVOModelFile;

            if (speedKnots < 200)
            {
                modelFile.Filename = installDir + @"STKData\VO\Models\Air\single_engine.mdl";
            }
            else if (speedKnots > 200 & speedKnots < 500)
            {
                modelFile.Filename = installDir + @"STKData\VO\Models\Air\uav.mdl";
            }
            else if (speedKnots > 300 & speedKnots < 500)
            {
                modelFile.Filename = installDir + @"STKData\VO\Models\Air\e-3a_sentry_awacs.mdl";
            }
            else if (speedKnots > 500 & speedKnots < 1200)
            {
                modelFile.Filename = installDir + @"STKData\VO\Models\Air\f-117a_nighthawk.mdl";
            }
            else
            {
                modelFile.Filename = installDir + @"STKData\VO\Models\Air\f-35_jsf_stovl.mdl";
            }

            if (createSensor)
            {
                IAgSensor sensor = ((IAgStkObject)aircraft).Children.New(AgESTKObjectType.eSensor, "Sensor_" + sensorFOV.ToString() + "deg") as IAgSensor;
                sensor.SetPatternType(AgESnPattern.eSnSimpleConic);
                AgSnSimpleConicPattern conic = sensor.Pattern as AgSnSimpleConicPattern;
                conic.ConeAngle = sensorFOV;
            }

            return(aircraft);
        }
示例#13
0
        /// <summary>
        /// 读出当前sc文件中已经存在的SARSYS
        /// </summary>
        public void readsarsys()
        {

            AGI.STKX.IAgExecCmdResult resultmsg = rootapp.ExecuteCommand("GetDescription * long");


            dimensions = root.UnitPreferences;
            scene = (IAgScenario)root.CurrentScenario;
            tdrs = (IAgSatellite)root.CurrentScenario.Children["TDRS"];
            
            twobody = (IAgVePropagatorTwoBody)tdrs.Propagator;
            classical = (IAgOrbitStateClassical)twobody.InitialState.Representation.ConvertTo(AgEOrbitStateType.eOrbitStateClassical);

            cruise = (IAgAircraft)root.CurrentScenario.Children["Cruise"];
            greatArc = (IAgVePropagatorGreatArc)cruise.Route;

            radar_t = (IAgSensor)root.CurrentScenario.Children["TDRS"].Children["radar_t"];

            radar_r = (IAgSensor)root.CurrentScenario.Children["Cruise"].Children["radar_r"];

            target = (IAgSensor)root.CurrentScenario.Children["TDRS"].Children["target"];

            simstarttime = scene.StartTime;
            simstoptime = scene.StopTime;
            simstep = scene.Animation.AnimStepValue;
            IAgClassicalSizeShapeSemimajorAxis semi = (IAgClassicalSizeShapeSemimajorAxis)classical.SizeShape;
            sasem = semi.SemiMajorAxis;
            saecc = semi.Eccentricity;
            saaop = classical.Orientation.ArgOfPerigee;
            sainc = classical.Orientation.Inclination;
            salan = ((IAgOrientationAscNodeLAN)classical.Orientation.AscNode).Value;
            satra = ((IAgClassicalLocationTrueAnomaly)classical.Location).Value;
            racoang = ((IAgSnSimpleConicPattern)radar_t.Pattern).ConeAngle;

            IAgSnPtFixed fixedPt = (IAgSnPtFixed)radar_t.Pointing;
            IAgOrientationAzEl azEl = (IAgOrientationAzEl)fixedPt.Orientation.ConvertTo(AgEOrientationType.eAzEl);
            raeleva = azEl.Elevation;

            plwaypoints = new double[5 * greatArc.Waypoints.Count];
            for(int ii=0;ii<greatArc.Waypoints.Count;ii++)
            {
                plwaypoints[ii * 5] = greatArc.Waypoints[ii].Latitude;
                plwaypoints[ii * 5 + 1] = greatArc.Waypoints[ii].Longitude;
                plwaypoints[ii * 5 + 2] = greatArc.Waypoints[ii].Altitude;
                plwaypoints[ii * 5 + 3] = greatArc.Waypoints[ii].Speed;
                plwaypoints[ii * 5 + 4] = greatArc.Waypoints[ii].TurnRadius;
            }




        }
示例#14
0
        private int DetermineNumPasses(SwathWidthType swathType, double swathParameter, double altitude, double regionWidth, IAgAircraft aircraft)
        {
            int    numPasses;
            double swathWidth;

            switch (swathType)
            {
            case SwathWidthType.NumberOfPasses:
                numPasses = (int)swathParameter;
                break;

            case SwathWidthType.SensorFOV:
                swathWidth = altitude * Math.Tan((Math.PI / 180.0) * swathParameter) * 1000 * 2 * .9;
                if (aircraft != null)
                {
                    IAgSensor sensor = ((IAgStkObject)aircraft).Children.New(AgESTKObjectType.eSensor, "Sensor") as IAgSensor;
                    sensor.SetPatternType(AgESnPattern.eSnSimpleConic);
                    IAgSnSimpleConicPattern simplecone = sensor.Pattern as IAgSnSimpleConicPattern;
                    simplecone.ConeAngle = swathParameter;
                }
                numPasses = (int)(regionWidth / swathWidth);
                break;

            case SwathWidthType.GroundElev:
                swathWidth = altitude / Math.Tan((Math.PI / 180.0) * swathParameter) * 1000 * 2 * .9;
                numPasses  = (int)(regionWidth / swathWidth);

                break;

            case SwathWidthType.SlantRange:
                swathWidth = Math.Sqrt((swathParameter * swathParameter) - (altitude * altitude)) * 1000 * 2 * .9;
                numPasses  = (int)(regionWidth / swathWidth);

                break;

            default:
                numPasses = 10;
                break;
            }

            return(numPasses);
        }
示例#15
0
        private void createVectorButton_Click(object sender, EventArgs e)
        {
            //Create vector between objects
            string accessFromName = cbAccessFrom.GetItemText(cbAccessFrom.SelectedItem);
            string accessToName   = cbAccessTo.GetItemText(cbAccessTo.SelectedItem);

            IAgStkObject fromObj = CommonData.StkRoot.GetObjectFromPath(accessFromName);
            IAgStkObject toObj   = CommonData.StkRoot.GetObjectFromPath(accessToName);

            IAgCrdnVectorGroup        vectors = fromObj.Vgt.Vectors;
            IAgCrdnVectorDisplacement vector  = null;
            string vectorName = "From" + fromObj.InstanceName + "To" + toObj.InstanceName;

            if (vectors.Contains(vectorName))
            {
                vector = (IAgCrdnVectorDisplacement)vectors[vectorName];
            }
            else
            {
                vector = (IAgCrdnVectorDisplacement)vectors.Factory.Create(vectorName, "description", AGI.STKVgt.AgECrdnVectorType.eCrdnVectorTypeDisplacement);
            }
            vector.Destination.SetPoint(toObj.Vgt.Points["Center"]);
            vector.Origin.SetPoint(fromObj.Vgt.Points["Center"]);

            // Visualize

            //if (fromObj.ClassName == "Facility")
            //{
            //    fromObj2 = fromObj as IAgFacility;
            //}
            //else if (fromObj.ClassName == "Satellite")
            //{
            //    fromObj2 = fromObj as IAgSatellite;
            //}
            //else if (fromObj.ClassName == "Sensor")
            //{
            //    fromObj2 = fromObj as IAgSensor;
            //}
            //else if (fromObj.ClassName == "Aircraft")
            //{
            //    fromObj2 = fromObj as IAgAircraft;
            //}
            //else
            //{
            //    return;
            //}

            try
            {
                IAgFacility        fromObj2        = fromObj as IAgFacility;
                IAgVORefCrdnVector boresightVector = fromObj2.VO.Vector.RefCrdns.Add(AgEGeometricElemType.eVectorElem, fromObj.ClassName + "/" + fromObj.InstanceName + " " + vectorName + " Vector") as IAgVORefCrdnVector;
                fromObj2.VO.Vector.VectorSizeScale = 4.0;
            }
            catch
            {
            }

            try
            {
                IAgSatellite       fromObj2        = fromObj as IAgSatellite;
                IAgVORefCrdnVector boresightVector = fromObj2.VO.Vector.RefCrdns.Add(AgEGeometricElemType.eVectorElem, fromObj.ClassName + "/" + fromObj.InstanceName + " " + vectorName + " Vector") as IAgVORefCrdnVector;
                fromObj2.VO.Vector.VectorSizeScale = 4.0;
            }
            catch
            {
            }

            try
            {
                IAgAircraft        fromObj2        = fromObj as IAgAircraft;
                IAgVORefCrdnVector boresightVector = fromObj2.VO.Vector.RefCrdns.Add(AgEGeometricElemType.eVectorElem, fromObj.ClassName + "/" + fromObj.InstanceName + " " + vectorName + " Vector") as IAgVORefCrdnVector;
                fromObj2.VO.Vector.VectorSizeScale = 4.0;
            }
            catch
            {
            }

            try
            {
                IAgSensor          fromObj2        = fromObj as IAgSensor;
                IAgVORefCrdnVector boresightVector = fromObj2.VO.Vector.RefCrdns.Add(AgEGeometricElemType.eVectorElem, fromObj.ClassName + "/" + fromObj.InstanceName + " " + vectorName + " Vector") as IAgVORefCrdnVector;
                fromObj2.VO.Vector.VectorSizeScale = 4.0;
            }
            catch
            {
            }
        }
示例#16
0
        public static bool GetObjectVisibility(string className, string simplePath)
        {
            bool visible = false;

            if (className == "Satellite")
            {
                IAgSatellite myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgSatellite;
                visible = myObject.Graphics.IsObjectGraphicsVisible;
            }
            else if (className == "Aircraft")
            {
                IAgAircraft myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgAircraft;
                visible = myObject.Graphics.IsObjectGraphicsVisible;
            }
            else if (className == "Facility")
            {
                IAgFacility myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgFacility;
                visible = myObject.Graphics.IsObjectGraphicsVisible;
            }
            else if (className == "Missile")
            {
                IAgMissile myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgMissile;
                visible = myObject.Graphics.IsObjectGraphicsVisible;
            }
            else if (className == "GroundVehicle")
            {
                IAgGroundVehicle myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgGroundVehicle;
                visible = myObject.Graphics.IsObjectGraphicsVisible;
            }
            else if (className == "Sensor")
            {
                IAgSensor myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgSensor;
                visible = myObject.Graphics.IsObjectGraphicsVisible;
            }
            else if (className == "Transmitter")
            {
                IAgTransmitter myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgTransmitter;
                visible = myObject.Graphics.Show;
            }
            else if (className == "Receiver")
            {
                IAgReceiver myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgReceiver;
                visible = myObject.Graphics.Show;
            }
            else if (className == "CoverageDefinition")
            {
                IAgCoverageDefinition myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgCoverageDefinition;
                visible = myObject.Graphics.IsObjectGraphicsVisible;
            }
            else if (className == "FigureOfMerit")
            {
                IAgFigureOfMerit myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgFigureOfMerit;
                visible = myObject.Graphics.IsObjectGraphicsVisible;
            }
            else if (className == "CommSystem")
            {
                IAgCommSystem myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgCommSystem;
                visible = myObject.Graphics.Show;
            }
            else if (className == "Chain")
            {
                IAgChain myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgChain;
                visible = myObject.Graphics.IsObjectGraphicsVisible;
            }
            else if (className == "Place")
            {
                IAgPlace myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgPlace;
                visible = myObject.Graphics.IsObjectGraphicsVisible;
            }
            else if (className == "AreaTarget")
            {
                IAgAreaTarget myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgAreaTarget;
                visible = myObject.Graphics.IsObjectGraphicsVisible;
            }

            return(visible);
        }
示例#17
0
        public static void SetObjectVisibility(ObjectData objectData)
        {
            string className  = objectData.ClassName;
            string simplePath = objectData.SimplePath;

            if (className == "Satellite")
            {
                IAgSatellite myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgSatellite;
                if (objectData.HideShow)
                {
                    myObject.Graphics.IsObjectGraphicsVisible = true;
                }
                else
                {
                    myObject.Graphics.IsObjectGraphicsVisible = false;
                }
            }
            else if (className == "Aircraft")
            {
                IAgAircraft myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgAircraft;
                if (objectData.HideShow)
                {
                    myObject.Graphics.IsObjectGraphicsVisible = true;
                }
                else
                {
                    myObject.Graphics.IsObjectGraphicsVisible = false;
                }
            }
            else if (className == "Facility")
            {
                IAgFacility myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgFacility;
                if (objectData.HideShow)
                {
                    myObject.Graphics.IsObjectGraphicsVisible = true;
                }
                else
                {
                    myObject.Graphics.IsObjectGraphicsVisible = false;
                }
            }
            else if (className == "Missile")
            {
                IAgMissile myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgMissile;
                if (objectData.HideShow)
                {
                    myObject.Graphics.IsObjectGraphicsVisible = true;
                }
                else
                {
                    myObject.Graphics.IsObjectGraphicsVisible = false;
                }
            }
            else if (className == "GroundVehicle")
            {
                IAgGroundVehicle myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgGroundVehicle;
                if (objectData.HideShow)
                {
                    myObject.Graphics.IsObjectGraphicsVisible = true;
                }
                else
                {
                    myObject.Graphics.IsObjectGraphicsVisible = false;
                }
            }
            else if (className == "Sensor")
            {
                IAgSensor myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgSensor;
                if (objectData.HideShow)
                {
                    myObject.Graphics.IsObjectGraphicsVisible = true;
                }
                else
                {
                    myObject.Graphics.IsObjectGraphicsVisible = false;
                }
            }
            else if (className == "Transmitter")
            {
                IAgTransmitter myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgTransmitter;
                //Try/Catch for when object above it is already turned off
                try
                {
                    if (objectData.HideShow)
                    {
                        myObject.Graphics.Show = true;
                    }
                    else
                    {
                        myObject.Graphics.Show = false;
                    }
                }
                catch (Exception e)
                {
                }
            }
            else if (className == "Receiver")
            {
                IAgReceiver myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgReceiver;
                //Try/Catch for when object above it is already turned off
                try
                {
                    if (objectData.HideShow)
                    {
                        myObject.Graphics.Show = true;
                    }
                    else
                    {
                        myObject.Graphics.Show = false;
                    }
                }
                catch (Exception e)
                {
                }
            }
            else if (className == "CoverageDefinition")
            {
                IAgCoverageDefinition myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgCoverageDefinition;
                if (objectData.HideShow)
                {
                    myObject.Graphics.IsObjectGraphicsVisible = true;
                }
                else
                {
                    myObject.Graphics.IsObjectGraphicsVisible = false;
                }
            }
            else if (className == "FigureOfMerit")
            {
                IAgFigureOfMerit myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgFigureOfMerit;
                if (objectData.HideShow)
                {
                    myObject.Graphics.IsObjectGraphicsVisible = true;
                }
                else
                {
                    myObject.Graphics.IsObjectGraphicsVisible = false;
                }
            }
            else if (className == "CommSystem")
            {
                IAgCommSystem myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgCommSystem;
                if (objectData.HideShow)
                {
                    myObject.Graphics.Show = true;
                }
                else
                {
                    myObject.Graphics.Show = false;
                }
            }
            else if (className == "Chain")
            {
                IAgChain myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgChain;
                if (objectData.HideShow)
                {
                    myObject.Graphics.IsObjectGraphicsVisible = true;
                }
                else
                {
                    myObject.Graphics.IsObjectGraphicsVisible = false;
                }
            }
            else if (className == "Place")
            {
                IAgPlace myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgPlace;
                if (objectData.HideShow)
                {
                    myObject.Graphics.IsObjectGraphicsVisible = true;
                }
                else
                {
                    myObject.Graphics.IsObjectGraphicsVisible = false;
                }
            }
            else if (className == "AreaTarget")
            {
                IAgAreaTarget myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgAreaTarget;
                if (objectData.HideShow)
                {
                    myObject.Graphics.IsObjectGraphicsVisible = true;
                }
                else
                {
                    myObject.Graphics.IsObjectGraphicsVisible = false;
                }
            }
        }
示例#18
0
        /// <summary>
        /// 新建一个SARSYS在当前sc文件中
        /// 需要建立最基础的系统
        /// 参数大多数有默认值
        /// </summary>
        public void newsarsys()
        {
            #region 写入信息
            AGI.STKX.IAgExecCmdResult resultmsg = rootapp.ExecuteCommand("SetDescription * long SARSYS");
            #endregion

            #region 设定单位、仿真时间
            // Reset the units to the STK defaults
            dimensions = root.UnitPreferences;
            dimensions.ResetUnits();

            // Set the date unit, acquire an interface to the scenario and use
            // it to set the time period and epoch
            dimensions.SetCurrentUnit("DateFormat", "UTCG");

            scene = (IAgScenario)root.CurrentScenario;
            scene.StartTime = simstarttime;
            scene.StopTime = simstoptime;
            scene.Epoch = simstarttime;

            // Set new preference for Temperature
            dimensions.SetCurrentUnit("Temperature", "degC");
            #endregion

            #region 放置发射站
            //SATELLITE #1: TDRS
            //Assign a two-body propagator to propagate it
            tdrs = (IAgSatellite)root.CurrentScenario.Children.New(AgESTKObjectType.
                eSatellite, "TDRS");
            tdrs.SetPropagatorType(AgEVePropagatorType.ePropagatorTwoBody);
            twobody = (IAgVePropagatorTwoBody)tdrs.Propagator;

            //Define the TDRS satellite's orbit using
            //classical (Keplerian) orbital elements
            classical = (IAgOrbitStateClassical)twobody.InitialState.Representation.ConvertTo(AgEOrbitStateType.eOrbitStateClassical);

            //Set J2000 as the coordinate system
            //and set the time period and time step
            classical.CoordinateSystemType = AgECoordinateSystem.eCoordinateSystemJ2000;
            twobody.EphemerisInterval.SetStartAndStopTimes(simstarttime, simstoptime);
            twobody.Step = 60;

            //定义半主轴长度,离心率
            //Use period and eccentricity to define the size
            //and shape of the orbit
            classical.SizeShapeType = AgEClassicalSizeShape.eSizeShapeSemimajorAxis;
            IAgClassicalSizeShapeSemimajorAxis semi = (IAgClassicalSizeShapeSemimajorAxis)classical.SizeShape;
            semi.SemiMajorAxis = 35860;
            semi.Eccentricity = 0.0;

            //定义轨道倾角,升交点赤经,近地点幅角
            //Use argument of perigee, inclination
            //and longitude of ascending node to
            //define the orientation of the orbit
            classical.Orientation.ArgOfPerigee = 15.0;
            classical.Orientation.Inclination = 40.0;
            classical.Orientation.AscNodeType = AgEOrientationAscNode.eAscNodeLAN;
            IAgOrientationAscNodeLAN lan = (IAgOrientationAscNodeLAN)classical.Orientation.AscNode;
            lan.Value = 259.999982;

            //定义真近点角(?)来定义初始位置
            //Use true anomaly to specify the position of
            //the satellite in orbit
            classical.LocationType = AgEClassicalLocation.eLocationTrueAnomaly;
            IAgClassicalLocationTrueAnomaly trueAnomaly = (IAgClassicalLocationTrueAnomaly)classical.Location;
            trueAnomaly.Value = 178.845262;

            //Assign the orbital elements to the TDRS
            //satellite's propagator and propagate the orbit
            twobody.InitialState.Representation.Assign(classical);
            twobody.Propagate();

            root.Rewind();

            #endregion

            #region 放置接收站
            cruise = (IAgAircraft)root.CurrentScenario.Children.New(AgESTKObjectType.eAircraft, "Cruise");
            cruise.SetRouteType(AgEVePropagatorType.ePropagatorGreatArc);
            greatArc = (IAgVePropagatorGreatArc)cruise.Route;
            greatArc.EphemerisInterval.SetStartAndStopTimes(simstarttime, simstoptime);
            greatArc.Method = AgEVeWayPtCompMethod.eDetermineTimeAccFromVel;

            ((IAgVOModelFile)cruise.VO.Model.ModelData).Filename = @"\STKData\VO\Models\Air\e-3a_sentry_awacs.mdl";
            cruise.VO.Offsets.Rotational.Enable = true;
            cruise.VO.Offsets.Rotational.X = 180;

            //Use the convenience method defined above
            //to add waypoints specifying the ship's route
            AddWaypoint(greatArc.Waypoints, -42.1, -121.5, 3.0, .15, 0.0);
            AddWaypoint(greatArc.Waypoints, 62.0, -56.6, 3.0, .15, 0.0);

            cruise.SetAttitudeType(AgEVeAttitude.eAttitudeStandard);
            IAgVeRouteAttitudeStandard attitude = (IAgVeRouteAttitudeStandard)cruise.Attitude;
            attitude.Basic.SetProfileType(AgEVeProfile.
                eProfileECFVelocityAlignmentWithRadialConstraint);
            cruise.Graphics.WaypointMarker.IsWaypointMarkersVisible = true;
            cruise.Graphics.WaypointMarker.IsTurnMarkersVisible = true;
            greatArc.Propagate();
            root.Rewind();

            #endregion

            #region 放置发射站雷达
            horizon = (IAgSensor)root.CurrentScenario.Children["TDRS"].Children.
                    New(AgESTKObjectType.eSensor, "Horizon");
            horizon.SetPatternType(AgESnPattern.eSnSimpleConic);
            IAgSnSimpleConicPattern simpleConic = (IAgSnSimpleConicPattern)horizon.Pattern;
            simpleConic.ConeAngle = 0.1;

            //Select a Fixed pointing type and the Az-El
            //orientation type, and set the elevation angle to
            //90 deg, so that the sensor points straight down
            //with reference to the satellite
            horizon.SetPointingType(AgESnPointing.eSnPtFixed);
            IAgSnPtFixed fixedPt = (IAgSnPtFixed)horizon.Pointing;
            IAgOrientationAzEl azEl = (IAgOrientationAzEl)fixedPt.Orientation.ConvertTo(AgEOrientationType.eAzEl);
            azEl.Elevation = 89.2;
            azEl.AboutBoresight = AgEAzElAboutBoresight.eAzElAboutBoresightRotate;
            fixedPt.Orientation.Assign(azEl);

            root.Rewind();

            #endregion
        }
示例#19
0
        /// <summary>
        /// 新建一个SARSYS在当前sc文件中
        /// 需要建立最基础的系统
        /// 参数大多数有默认值
        /// </summary>
        public void newsarsys()
        {
            #region 写入信息
            AGI.STKX.IAgExecCmdResult resultmsg = rootapp.ExecuteCommand("SetDescription * long SARSYS");
            #endregion


            #region 设定单位、仿真时间
            // Reset the units to the STK defaults
            dimensions = root.UnitPreferences;
            dimensions.ResetUnits();

            // Set the date unit, acquire an interface to the scenario and use
            // it to set the time period and epoch
            dimensions.SetCurrentUnit("DateFormat", "UTCG");

            scene = (IAgScenario)root.CurrentScenario;
            scene.StartTime = simstarttime;
            scene.StopTime = simstoptime;
            scene.Epoch = simstarttime;

            //rootapp.ExecuteCommand("MapTracking * UTM");

            // Set new preference for Temperature
            dimensions.SetCurrentUnit("Temperature", "degC");
            #endregion

            #region 放置发射站
            //SATELLITE #1: TDRS
            //Assign a two-body propagator to propagate it
            tdrs = (IAgSatellite)root.CurrentScenario.Children.New(AgESTKObjectType.
                eSatellite, "TDRS");
            tdrs.SetPropagatorType(AgEVePropagatorType.ePropagatorTwoBody);
            twobody = (IAgVePropagatorTwoBody)tdrs.Propagator;

            //Define the TDRS satellite's orbit using
            //classical (Keplerian) orbital elements
            classical = (IAgOrbitStateClassical)twobody.InitialState.Representation.ConvertTo(AgEOrbitStateType.eOrbitStateClassical);

            //Set J2000 as the coordinate system
            //and set the time period and time step
            classical.CoordinateSystemType = AgECoordinateSystem.eCoordinateSystemJ2000;
            twobody.EphemerisInterval.SetStartAndStopTimes(simstarttime, simstoptime);
            twobody.Step = 60;

            //定义半主轴长度,离心率
            //Use period and eccentricity to define the size
            //and shape of the orbit
            classical.SizeShapeType = AgEClassicalSizeShape.eSizeShapeSemimajorAxis;
            IAgClassicalSizeShapeSemimajorAxis semi = (IAgClassicalSizeShapeSemimajorAxis)classical.SizeShape;
            semi.SemiMajorAxis = sasem;
            semi.Eccentricity = saecc;


            //定义轨道倾角,升交点赤经,近地点幅角
            //Use argument of perigee, inclination
            //and longitude of ascending node to
            //define the orientation of the orbit
            classical.Orientation.ArgOfPerigee = saaop;
            classical.Orientation.Inclination = sainc;
            classical.Orientation.AscNodeType = AgEOrientationAscNode.eAscNodeLAN;
            IAgOrientationAscNodeLAN lan = (IAgOrientationAscNodeLAN)classical.Orientation.AscNode;
            lan.Value = salan;

            //定义真近点角(?)来定义初始位置
            //Use true anomaly to specify the position of
            //the satellite in orbit
            classical.LocationType = AgEClassicalLocation.eLocationTrueAnomaly;
            IAgClassicalLocationTrueAnomaly trueAnomaly = (IAgClassicalLocationTrueAnomaly)classical.Location;
            trueAnomaly.Value = satra;


            //Assign the orbital elements to the TDRS
            //satellite's propagator and propagate the orbit	
            twobody.InitialState.Representation.Assign(classical);
            twobody.Propagate();

            root.Rewind();

            #endregion

            
            #region 放置接收站
            cruise = (IAgAircraft)root.CurrentScenario.Children.New(AgESTKObjectType.eAircraft, "Cruise");
            cruise.SetRouteType(AgEVePropagatorType.ePropagatorGreatArc);
            greatArc = (IAgVePropagatorGreatArc)cruise.Route;
            greatArc.EphemerisInterval.SetStartAndStopTimes(simstarttime, simstoptime);
            greatArc.Method = AgEVeWayPtCompMethod.eDetermineTimeAccFromVel;

            ((IAgVOModelFile)cruise.VO.Model.ModelData).Filename = @"\STKData\VO\Models\Air\rq-4a_globalhawk.mdl";
            cruise.VO.Offsets.Rotational.Enable = true;
            cruise.VO.Offsets.Rotational.X = 180;

            //Use the convenience method defined above
            //to add waypoints specifying the ship's route
            for (int ii = 0; ii < plwaypoints.Length; ii += 5)
            {
                AddWaypoint(greatArc.Waypoints, plwaypoints[ii], plwaypoints[ii + 1], plwaypoints[ii + 2], plwaypoints[ii + 3], plwaypoints[ii + 4]);
            }
              
            
            cruise.SetAttitudeType(AgEVeAttitude.eAttitudeStandard);
            IAgVeRouteAttitudeStandard attitude = (IAgVeRouteAttitudeStandard)cruise.Attitude;
            attitude.Basic.SetProfileType(AgEVeProfile.
                eProfileECFVelocityAlignmentWithRadialConstraint);
            cruise.Graphics.WaypointMarker.IsWaypointMarkersVisible = true;
            cruise.Graphics.WaypointMarker.IsTurnMarkersVisible = true;
            greatArc.Propagate();
            root.Rewind();


            #endregion

            #region 放置发射站雷达
            radar_t = (IAgSensor)root.CurrentScenario.Children["TDRS"].Children.New(AgESTKObjectType.eSensor, "radar_t");
            radar_t.SetPatternType(AgESnPattern.eSnSimpleConic);
            ((IAgSnSimpleConicPattern)radar_t.Pattern).ConeAngle = racoang;



            //Select a Fixed pointing type and the Az-El
            //orientation type, and set the elevation angle to
            //90 deg, so that the sensor points straight down
            //with reference to the satellite
            radar_t.SetPointingType(AgESnPointing.eSnPtFixed);
            IAgSnPtFixed fixedPt = (IAgSnPtFixed)radar_t.Pointing;
            IAgOrientationAzEl azEl = (IAgOrientationAzEl)fixedPt.Orientation.ConvertTo(AgEOrientationType.eAzEl);
            azEl.Elevation = raeleva;
            azEl.AboutBoresight = AgEAzElAboutBoresight.eAzElAboutBoresightRotate;
            fixedPt.Orientation.Assign(azEl);

            radar_t.Graphics.FillVisible = true;
            radar_t.VO.FillVisible = true;
            

            root.Rewind();


            #endregion


            #region 放置接收站雷达


            target = (IAgSensor)root.CurrentScenario.Children["TDRS"].Children.New(AgESTKObjectType.eSensor, "target");

            target.SetLocationType(AgESnLocation.eSnLocationCrdnPoint);
            IAgLocationCrdnPoint vgtPoint = target.LocationData as IAgLocationCrdnPoint;
            //vgtPoint.PointPath = "TDRS/radar_t BoresightIntersection(Terrain)";
            vgtPoint.PointPath = "Satellite/TDRS/Sensor/radar_t BoresightIntersection(Terrain)";
            target.SetPatternType(AgESnPattern.eSnSimpleConic);
            ((IAgSnSimpleConicPattern)target.Pattern).ConeAngle = 0.00001;
           
            

            IAgSnPtTargeted targetedSensor1 = target.CommonTasks.SetPointingTargetedTracking(
   AgETrackModeType.eTrackModeTranspond, AgEBoresightType.eBoresightRotate, "*/Aircraft/Cruise");


            target.SetPointingType(AgESnPointing.eSnPtTargeted);
            IAgSnPtTargeted rpt1 = (IAgSnPtTargeted)target.Pointing;
            rpt1.Boresight = AgESnPtTrgtBsightType.eSnPtTrgtBsightTracking;
            root.Rewind();
            rootapp.ExecuteCommand("Graphics */Satellite/TDRS/Sensor/target Show Off");


            /////////////////////////
            radar_r = (IAgSensor)root.CurrentScenario.Children["Cruise"].Children.New(AgESTKObjectType.eSensor, "radar_r");
            radar_r.SetPatternType(AgESnPattern.eSnSimpleConic);
            ((IAgSnSimpleConicPattern)radar_r.Pattern).ConeAngle = 3;
        

            IAgSnPtTargeted targetedSensor = radar_r.CommonTasks.SetPointingTargetedTracking(
    AgETrackModeType.eTrackModeTranspond, AgEBoresightType.eBoresightRotate, "*/Satellite/TDRS/Sensor/target");   

            
            radar_r.SetPointingType(AgESnPointing.eSnPtTargeted);
            IAgSnPtTargeted rpt = (IAgSnPtTargeted)radar_r.Pointing;
            rpt.Boresight = AgESnPtTrgtBsightType.eSnPtTrgtBsightTracking;
            

            root.Rewind();
            #endregion
        }
示例#20
0
        private IAgAircraft CreateRoute()
        {
            double speed      = double.Parse(textBox_Speed.Text) * 0.000514444444;              //knots to m/s
            double acturnGs   = double.Parse(textBox_TurnGs.Text);
            double altitude   = double.Parse(textBox_Altitude.Text) * 0.0003048;                // ft to meters
            double turnRadius = (((speed * 1000) * (speed * 1000)) / (acturnGs * 9.81)) / 1000; //  m/s to km

            RadioChanged();
            List <RasterSearch.Waypoint> waypoints = new List <RasterSearch.Waypoint>();

            foreach (DataGridViewRow row in dataGridView1.Rows)
            {
                IAgStkObject thisObj = root.GetObjectFromPath("*/" + row.Cells[0].Value.ToString());

                switch (thisObj.ClassType)
                {
                case AgESTKObjectType.eAreaTarget:
                    List <RasterSearch.Waypoint> searchWaypoints = new List <RasterSearch.Waypoint>();
                    if (row.Cells[1].Value.ToString() == "True")
                    {
                        searchWaypoints = routeBuilder.RasterSearchWaypointGenerator(
                            thisObj.Path, "NorthSouth", speed, altitude, turnRadius, swathType, swathParameter);
                        foreach (RasterSearch.Waypoint thisWaypoint in searchWaypoints)
                        {
                            waypoints.Add(thisWaypoint);
                        }
                    }
                    if (row.Cells[2].Value.ToString() == "True")
                    {
                        searchWaypoints = routeBuilder.RasterSearchWaypointGenerator(
                            thisObj.Path, "EastWest", speed, altitude, turnRadius, swathType, swathParameter);
                        foreach (RasterSearch.Waypoint thisWaypoint in searchWaypoints)
                        {
                            waypoints.Add(thisWaypoint);
                        }
                    }
                    if (row.Cells[3].Value.ToString() == "True")
                    {
                        searchWaypoints = routeBuilder.ExpandingSquareWaypointGenerator(
                            thisObj.Path, speed, altitude, turnRadius, swathType, swathParameter);
                        foreach (RasterSearch.Waypoint thisWaypoint in searchWaypoints)
                        {
                            waypoints.Add(thisWaypoint);
                        }
                    }

                    break;

                case AgESTKObjectType.eFacility:
                case AgESTKObjectType.ePlace:
                case AgESTKObjectType.eTarget:
                    waypoints.Add(routeBuilder.LocationWaypointGenerator(thisObj.Path, altitude, speed, turnRadius));
                    break;

                default:
                    break;
                }
            }
            bool   createSensor    = radioButton_SensorFOV.Checked;
            double sensorParameter = double.Parse(textBox_SensorFOV.Text);

            IAgAircraft aircraft = routeBuilder.CreateAircraft("AutoRoute", createSensor, sensorParameter, double.Parse(textBox_Speed.Text));

            routeBuilder.WaypointsToGreatArc(aircraft, waypoints, checkBox_useTakeoffLanding.Checked);
            return(aircraft);
        }