STK Components 二次开发-地面站传感器

上一篇我们说了创建地面站,那么这次我们在地面站添加一些特效。

1. 创建地面站

var locationPoint1 = new PointCartographic(m_earth, new Cartographic(Trig.DegreesToRadians(117.17066), Trig.DegreesToRadians(31.84056), 240.359));
m_facility = new Platform
{
	Name = "DMZ",
	LocationPoint = locationPoint1,
	// Orient the facility using East-North-Up (ENU) axes.
	OrientationAxes = new AxesEastNorthUp(m_earth, locationPoint1),
};

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

// 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,
	Font = new ConstantCesiumProperty<string>("20px"),
	// 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,
}));

2.创建传感器

// Define the location of the facility using cartographic coordinates.
var locationPoint = new PointCartographic(m_earth, new Cartographic(Trig.DegreesToRadians(117.17066), Trig.DegreesToRadians(31.84056), 272.359));

m_sensorDome = new Platform
{
	Name = "Sensor Dome",
	LocationPoint = locationPoint,
	OrientationAxes = new AxesEastNorthUp(m_earth, locationPoint),
};

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

// Define the sensor geometry.
var dome = new ComplexConic();
dome.SetHalfAngles(0.0, Math.PI);
dome.SetClockAngles(0.0, Math.PI * 2);
dome.Radius = 10000.0;
m_sensorDome.Extensions.Add(new FieldOfViewExtension(dome));

// Configure graphical display of the sensor dome.
m_sensorDome.Extensions.Add(new FieldOfViewGraphicsExtension(new SensorFieldOfViewGraphics
{
	//遮罩线颜色
	DomeSurfaceMaterial = new GridMaterialGraphics
	{
		Color = Color.Transparent,
		CellAlpha = 0.0,
	},

	EllipsoidHorizonSurfaceMaterial = new SolidColorMaterialGraphics
	{
		Color = Color.YellowGreen,
	},
	//贴地透明色
	EllipsoidSurfaceMaterial = new SolidColorMaterialGraphics
	{
		Color = Color.Transparent,
	},
	EnvironmentIntersectionColor = new ConstantCesiumProperty<Color>(Color.Red),

	EnvironmentOcclusionMaterial = new SolidColorMaterialGraphics
	{
		Color = Color.Green,
	},
	IntersectionColor = new ConstantCesiumProperty<Color>(Color.Transparent),//贴地轮廓
	LateralSurfaceMaterial = new SolidColorMaterialGraphics
	{
		Color =  Color.Red,
	},

   

	EnvironmentConstraint =true,
	ViewshedOccludedColor = new ConstantCesiumProperty<Color>(Color.Red),
	ViewshedVisibleColor = new ConstantCesiumProperty<Color>(Color.Red)
}));

// Define a rotating axes.
var rotatingAxes = new AxesLinearRate
{
	ReferenceAxes = new AxesEastNorthUp(m_earth, locationPoint),
	ReferenceEpoch = m_epoch,
	InitialRotation = UnitQuaternion.Identity,
	SpinAxis = UnitCartesian.UnitZ,
	InitialRotationalVelocity = Trig.DegreesToRadians(5.0), // 5 degrees per second
	RotationalAcceleration = 0.0,
};

// Define a rotation around X.
UnitQuaternion quaternion = new UnitQuaternion(new AngleAxisRotation(Math.PI / 3.0, UnitCartesian.UnitX));
// Define an angular offset for the rotating axes.
var rotatedOffsetAxes = new AxesFixedOffset(rotatingAxes, quaternion);

m_rotatingSensor = new Platform
{
	Name = "Rotating Sensor",
	LocationPoint = locationPoint,
	OrientationAxes = rotatedOffsetAxes
};

// Set the identifier for the sensor in the CZML document. 
m_rotatingSensor.Extensions.Add(new IdentifierExtension("RotatingSensor"));

// Define the sensor geometry.
m_rotatingSensor.Extensions.Add(new FieldOfViewExtension(new RectangularPyramid
{
	XHalfAngle = Trig.DegreesToRadians(30),
	YHalfAngle = Trig.DegreesToRadians(30),
	Radius = 10000.0,
}));

// Configure graphical display of the sensor.
m_rotatingSensor.Extensions.Add(new FieldOfViewGraphicsExtension(new SensorFieldOfViewGraphics
{
	DomeSurfaceMaterial = new GridMaterialGraphics
	{
		Color = Color.Green,
		CellAlpha = 0.5,
	},
	LateralSurfaceMaterial = new GridMaterialGraphics
	{
		Color = Color.Pink,
		CellAlpha = 0.5,
	},
	IntersectionColor = Color.White,
	ShowIntersection = true,
	ShowEllipsoidHorizonSurfaces = true,
}));

实现效果

  • 8
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值