STK Components 二次开发-创建地面站

1.地面站只需要知道地面站的经纬高。

 // Define the location of the facility using cartographic coordinates.
 var location = new Cartographic(Trig.DegreesToRadians(-75.596766667), Trig.DegreesToRadians(40.0388333333), 0.0);

2.创建地面站

创建方式和卫星一样生成对象,添加模型,设置各种属性
最后生成czml 
private void CreateFacility()
{
	// Define the location of the facility using cartographic coordinates.
	var location = new Cartographic(Trig.DegreesToRadians(-75.596766667), Trig.DegreesToRadians(40.0388333333), 0.0);
	var locationPoint = new PointCartographic(m_earth, location);
	m_facility = new Platform
	{
		Name = "AGI HQ",
		LocationPoint = locationPoint,
		// Orient the facility using East-North-Up (ENU) axes.
		OrientationAxes = new AxesEastNorthUp(m_earth, locationPoint),
	};

	// Set the identifier for the facility in the CZML document. 
	m_facility.Extensions.Add(new IdentifierExtension("AGI"));

	// Configure a glTF model for the facility.
	m_facility.Extensions.Add(new ModelGraphicsExtension(new ModelGraphics
	{
		// Link to a binary glTF file.
		Model = new CesiumResource(GetModelUri("facility.glb"), CesiumResourceBehavior.LinkTo),
		RunAnimations = false,
		HeightReference = CesiumHeightReference.ClampToGround,
	}));

	// Configure label for AGI HQ.
	m_facility.Extensions.Add(new LabelGraphicsExtension(new LabelGraphics
	{
		Text = m_facility.Name,
		FillColor = Color.White,
		// Only show label when camera is far enough from the satellite,
		// to avoid visually clashing with the model.
		DistanceDisplayCondition = new Bounds(1000.0, double.MaxValue),
		HeightReference = CesiumHeightReference.ClampToGround,
	}));
}

实现效果

3.卫星和地面可见性

可见性主要通过 CentralBodyObstructionConstraint这个算法判断。

是一种不考虑地形和海平面的一种理想条件。

private void CreateSatelliteAccessLink()
{
	m_satelliteFacilityLink = new LinkInstantaneous(m_facility, m_satellite);

	// Set the identifier for the link in the CZML document. 
	m_satelliteFacilityLink.Extensions.Add(new IdentifierExtension("SatelliteFacilityAccess"));

	// Specify how access should be constrained.  In this case, 
	// access will only exist when no part of the earth is between AGI HQ and the satellite.
	m_accessQuery = new CentralBodyObstructionConstraint(m_satelliteFacilityLink, m_earth);

	// Configure graphical display of the access link.
	m_satelliteFacilityLink.Extensions.Add(new LinkGraphicsExtension(new LinkGraphics
	{
		// Show the access link only when access is satisfied.
		Show = new AccessQueryCesiumProperty(m_accessQuery, true, false, false),
		Material = new SolidColorMaterialGraphics(Color.Yellow),
	}));
}

效果

以上就是本次的学习内容。

你可能感兴趣的:(c#,STK,Components,c#)