public static IAgStkObject AttachFacilityRadar(IAgStkObject parent, string radarName, RadarParams rParams)
        {
            IAgStkObject sensorObj = CreatorFunctions.GetCreateSensor(parent, radarName);
            IAgSensor    sensor    = sensorObj as IAgSensor;

            sensor.Graphics.IsObjectGraphicsVisible = false;
            IAgSnSimpleConicPattern pattern = sensor.Pattern as IAgSnSimpleConicPattern;

            pattern.ConeAngle = Double.Parse(rParams.HalfAngle);
            IAgSnPtFixed pointing = sensor.Pointing as IAgSnPtFixed;

            pointing.Orientation.AssignAzEl(Double.Parse(rParams.Az), Double.Parse(rParams.El), AGI.STKUtil.AgEAzElAboutBoresight.eAzElAboutBoresightRotate);

            IAgAccessConstraintCollection constraints = sensor.AccessConstraints;
            IAgAccessCnstrMinMax          elConstraint;
            IAgAccessCnstrMinMax          azConstraint;
            IAgAccessCnstrMinMax          rangeConstraint;
            IAgAccessCnstrAngle           solarExConstraint;

            elConstraint = CreatorFunctions.GetElCnst(constraints);
            CreatorFunctions.SetCnstMinMax(elConstraint, Double.Parse(rParams.MinEl), Double.Parse(rParams.MaxEl));
            azConstraint = CreatorFunctions.GetAzCnst(constraints);
            CreatorFunctions.SetCnstMinMax(azConstraint, Double.Parse(rParams.MinAz), Double.Parse(rParams.MaxAz));
            rangeConstraint = CreatorFunctions.GetRangeCnst(constraints);
            CreatorFunctions.SetCnstMinMax(rangeConstraint, Double.Parse(rParams.MinRange), Double.Parse(rParams.MaxRange));
            solarExConstraint       = CreatorFunctions.GetSunExCnst(constraints);
            solarExConstraint.Angle = rParams.SolarExAngle;

            SetRadarGraphics(sensor);

            return(sensorObj);
        }
        public static IAgStkObject AttachFacilityOptical(IAgStkObject parent, string radarName, OpticalParams rParams)
        {
            IAgStkObject sensorObj = CreatorFunctions.GetCreateSensor(parent, radarName);
            IAgSensor    sensor    = sensorObj as IAgSensor;

            sensor.Graphics.IsObjectGraphicsVisible = false;
            IAgSnSimpleConicPattern pattern = sensor.Pattern as IAgSnSimpleConicPattern;

            pattern.ConeAngle = Double.Parse(rParams.HalfAngle);

            IAgAccessConstraintCollection constraints = sensor.AccessConstraints;
            IAgAccessCnstrMinMax          elConstraint;
            IAgAccessCnstrMinMax          azConstraint;
            IAgAccessCnstrMinMax          rangeConstraint;
            IAgAccessCnstrMinMax          sunElConstraint;
            IAgAccessCnstrAngle           lunExConstraint;

            elConstraint = CreatorFunctions.GetElCnst(constraints);
            CreatorFunctions.SetCnstMinMax(elConstraint, Double.Parse(rParams.MinEl), Double.Parse(rParams.MaxEl));
            azConstraint = CreatorFunctions.GetAzCnst(constraints);
            CreatorFunctions.SetCnstMinMax(azConstraint, Double.Parse(rParams.MinAz), Double.Parse(rParams.MaxAz));

            sunElConstraint = CreatorFunctions.GetSunElCnst(constraints);
            CreatorFunctions.SetCnstMinMax(sunElConstraint, -90, Double.Parse(rParams.SunElAngle));

            rangeConstraint = CreatorFunctions.GetRangeCnst(constraints);
            CreatorFunctions.SetCnstMinMax(rangeConstraint, Double.Parse(rParams.MinRange), Double.Parse(rParams.MaxRange));

            lunExConstraint       = CreatorFunctions.GetLunExCnst(constraints);
            lunExConstraint.Angle = rParams.LunarExAngle;

            SetOpticalGraphics(sensor);

            return(sensorObj);
        }
Ejemplo n.º 3
0
        private void Generate_Click(object sender, EventArgs e)
        {
            if (ExistingVolumes.SelectedIndex != -1 && ExistingVolumes.Items.Count > 0 && LocationList.SelectedIndex != -1)
            {
                IAgFacility  place;
                IAgStkObject placeObj;
                placeObj = CreatorFunctions.GetCreateFacility(CommonData.LocationList[CommonData.LocationIndex].Name);
                place    = placeObj as IAgFacility;

                place.Position.AssignGeodetic(Double.Parse(CommonData.LocationList[CommonData.LocationIndex].Latitude), Double.Parse(CommonData.LocationList[CommonData.LocationIndex].Longitude), 0);
                place.AltRef = AgEAltRefType.eWGS84;
                //Create complex conic sensor
                IAgStkObject sensorObj = CreatorFunctions.GetCreateSensor(placeObj, CommonData.VolumeList[CommonData.TvSelectedIndex].Name + "_" + CommonData.LocationList[CommonData.LocationIndex].Name);
                IAgSensor    sensor    = sensorObj as IAgSensor;
                sensor.SetPatternType(AgESnPattern.eSnComplexConic);
                IAgSnComplexConicPattern pattern = sensor.Pattern as IAgSnComplexConicPattern;
                pattern.OuterConeHalfAngle    = 180.0;
                sensor.VO.PercentTranslucency = 70.0;

                IAgAccessConstraintCollection constraints = sensor.AccessConstraints;
                IAgAccessCnstrMinMax          elConstraint;
                IAgAccessCnstrMinMax          rangeConstraint;
                IAgAccessCnstrMinMax          altConstraint;
                //Add elevation angle constraint
                if (constraints.IsConstraintActive(AgEAccessConstraints.eCstrElevationAngle))
                {
                    elConstraint = constraints.GetActiveConstraint(AgEAccessConstraints.eCstrElevationAngle) as IAgAccessCnstrMinMax;
                }
                else
                {
                    elConstraint = constraints.AddConstraint(AgEAccessConstraints.eCstrElevationAngle) as IAgAccessCnstrMinMax;
                }
                elConstraint.EnableMin = true;
                elConstraint.Min       = Double.Parse(CommonData.VolumeList[CommonData.TvSelectedIndex].MinEl);
                elConstraint.EnableMax = true;
                elConstraint.Max       = Double.Parse(CommonData.VolumeList[CommonData.TvSelectedIndex].MaxEl);
                //Add range constraint
                if (constraints.IsConstraintActive(AgEAccessConstraints.eCstrRange))
                {
                    rangeConstraint = constraints.GetActiveConstraint(AgEAccessConstraints.eCstrRange) as IAgAccessCnstrMinMax;
                }
                else
                {
                    rangeConstraint = constraints.AddConstraint(AgEAccessConstraints.eCstrRange) as IAgAccessCnstrMinMax;
                }
                rangeConstraint.EnableMin = true;
                rangeConstraint.Min       = Double.Parse(CommonData.VolumeList[CommonData.TvSelectedIndex].MinRange);
                rangeConstraint.EnableMax = true;
                rangeConstraint.Max       = Double.Parse(CommonData.VolumeList[CommonData.TvSelectedIndex].MaxRange);
                //Add altitude constraint
                if (constraints.IsConstraintActive(AgEAccessConstraints.eCstrAltitude))
                {
                    altConstraint = constraints.GetActiveConstraint(AgEAccessConstraints.eCstrAltitude) as IAgAccessCnstrMinMax;
                }
                else
                {
                    altConstraint = constraints.AddConstraint(AgEAccessConstraints.eCstrAltitude) as IAgAccessCnstrMinMax;
                }
                altConstraint.EnableMin = true;
                altConstraint.Min       = Double.Parse(CommonData.VolumeList[CommonData.TvSelectedIndex].MinAlt);
                altConstraint.EnableMax = true;
                altConstraint.Max       = Double.Parse(CommonData.VolumeList[CommonData.TvSelectedIndex].MaxAlt);

                //Add Azimuth Constraint
                IAgAccessCnstrMinMax azConstraint = CreatorFunctions.GetAzCnst(constraints);
                CreatorFunctions.SetCnstMinMax(azConstraint, Double.Parse(CommonData.VolumeList[CommonData.TvSelectedIndex].MinAz), Double.Parse(CommonData.VolumeList[CommonData.TvSelectedIndex].MaxAz));

                try
                {
                    sensor.Graphics.Projection.UseConstraints = true;
                    sensor.Graphics.Projection.EnableConstraint("ElevationAngle");
                    sensor.Graphics.Projection.EnableConstraint("AzimuthAngle");
                    CommonData.StkRoot.ExecuteCommand("Animate * Refresh");
                }
                catch (Exception)
                {
                }
                CreatorFunctions.ChangeObjectColor(sensorObj.Path, (CustomUserInterface.ColorOptions)Enum.Parse(typeof(CustomUserInterface.ColorOptions), ColorSelection.Text));
            }
        }