public static IAgAccessCnstrAngle GetSunExCnst(IAgAccessConstraintCollection constraints) { IAgAccessCnstrAngle sunConstraint; if (constraints.IsConstraintActive(AgEAccessConstraints.eCstrLOSSunExclusion)) { sunConstraint = constraints.GetActiveConstraint(AgEAccessConstraints.eCstrLOSSunExclusion) as IAgAccessCnstrAngle; } else { sunConstraint = constraints.AddConstraint(AgEAccessConstraints.eCstrLOSSunExclusion) as IAgAccessCnstrAngle; } return(sunConstraint); }
public static IAgAccessCnstrMinMax GetSunElCnst(IAgAccessConstraintCollection constraints) { IAgAccessCnstrMinMax elConstraint; if (constraints.IsConstraintActive(AgEAccessConstraints.eCstrSunElevationAngle)) { elConstraint = constraints.GetActiveConstraint(AgEAccessConstraints.eCstrSunElevationAngle) as IAgAccessCnstrMinMax; } else { elConstraint = constraints.AddConstraint(AgEAccessConstraints.eCstrSunElevationAngle) as IAgAccessCnstrMinMax; } return(elConstraint); }
public static IAgAccessCnstrMinMax GetAltCnst(IAgAccessConstraintCollection constraints) { IAgAccessCnstrMinMax altConstraint; if (constraints.IsConstraintActive(AgEAccessConstraints.eCstrAltitude)) { altConstraint = constraints.GetActiveConstraint(AgEAccessConstraints.eCstrAltitude) as IAgAccessCnstrMinMax; } else { altConstraint = constraints.AddConstraint(AgEAccessConstraints.eCstrAltitude) as IAgAccessCnstrMinMax; } return(altConstraint); }
public static IAgAccessCnstrMinMax GetRangeCnst(IAgAccessConstraintCollection constraints) { IAgAccessCnstrMinMax rangeConstraint; if (constraints.IsConstraintActive(AgEAccessConstraints.eCstrRange)) { rangeConstraint = constraints.GetActiveConstraint(AgEAccessConstraints.eCstrRange) as IAgAccessCnstrMinMax; } else { rangeConstraint = constraints.AddConstraint(AgEAccessConstraints.eCstrRange) as IAgAccessCnstrMinMax; } return(rangeConstraint); }
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)); } }