创建一个区域目标(在当前场景的中心体上)
% IAgStkObjectRoot root: STK Object Model Root
% Create the AreaTarget on the current scenario central body (use
% NewOnCentralBody to specify explicitly the central body)
areaTarget = root.CurrentScenario.Children.New('eAreaTarget', 'MyAreaTarget');
从经度/纬度/高度列表中定义区域目标边界和位置
uiap = actxserver('STK11.application');
root = uiap.Personality2;
root.NewScenario('exam');
disp('NewScenario');
areaTarget = root.CurrentScenario.Children.New('eAreaTarget', 'MyAreaTarget');
root.BeginUpdate();
areaTarget.AreaType = 'ePattern';
patterns = areaTarget.AreaTypeData;
patterns.Add(48.897, 18.637);
patterns.Add(46.534, 13.919);
patterns.Add(44.173, 21.476);
root.EndUpdate();
areaTarget.AutoCentroid = true;
注意:BeginUpdate/EndUpdate防止中间重绘?
从经度/纬度/高度列表中定义区域目标的边界和位置(使用普通任务)
uiap = actxserver('STK11.application');
uiap.Visible = 1;
root = uiap.Personality2;
root.NewScenario('exam');
disp('NewScenario');
areaTarget = root.CurrentScenario.Children.New('eAreaTarget', 'MyAreaTarget');
root.BeginUpdate();
boundary = {29, -12;
29, 34;
6, 34;
6, -12};
areaTarget.CommonTasks.SetAreaTypePattern(boundary);
root.EndUpdate();
areaTarget.AutoCentroid = true;
列出一个区域目标中的所有点
uiap = actxserver('STK11.application');
uiap.Visible = 1;
root = uiap.Personality2;
root.NewScenario('exam');
disp('NewScenario');
areaTarget = root.CurrentScenario.Children.New('eAreaTarget', 'MyAreaTarget');
root.BeginUpdate();
areaTarget.AreaType = 'ePattern';
boundary = {29, -12;
29, 34;
6, 34;
6, -12};
% SetAreaTypePattern expects a two dimensional array of latitude and longitude values
areaTarget.CommonTasks.SetAreaTypePattern(boundary);
root.EndUpdate();
areaTarget.AutoCentroid = true;
if strcmp(areaTarget.AreaType, 'ePattern')
% Get IAgAreaTypePatternCollection interface from AreaTypeData
patternPoints = areaTarget.AreaTypeData;
% ToArray returns a two dimensional array of latitude and longitude points
areaTargetPoints = patternPoints.ToArray();
disp('All points in Area Target');
for i= 1:length(areaTargetPoints)
disp(['Latitude ' num2str(areaTargetPoints{i, 1}) ' Longitude: ' num2str(areaTargetPoints{i, 2})]);
end
end
注意:可以用第二个例子,也可以用第三个例子,结果如图:
?
设置一个椭圆的区域目标
uiap = actxserver('STK11.application');
uiap.Visible = 1;
root = uiap.Personality2;
root.NewScenario('exam');
disp('NewScenario');
areaTarget = root.CurrentScenario.Children.New('eAreaTarget', 'MyAreaTarget');
root.BeginUpdate();
areaTarget.AreaType = 'eEllipse';
ellipse = areaTarget.AreaTypeData;
ellipse.SemiMajorAxis = 85.25; % 以公里为单位(距离维度)
ellipse.SemiMinorAxis = 80.75; % 以公里为单位(距离维度)
ellipse.Bearing = 44; % 单位是deg (角度尺寸)
root.EndUpdate();
设置一个椭圆的区域目标(使用普通任务)
uiap = actxserver('STK11.application');
uiap.Visible = 1;
root = uiap.Personality2;
root.NewScenario('exam');
disp('NewScenario');
areaTarget = root.CurrentScenario.Children.New('eAreaTarget', 'MyAreaTarget');
areaTarget.CommonTasks.SetAreaTypeEllipse(85.25, 80.75, 44);
disp('Ellipse be created');
通过这一章节的学习,我可以设置一个区域目标作为后面我要进行覆盖计算和计算重访时间的目标,暂定北京市(市界的地理坐标为:北纬39”26’至41”03’,东经115”25’至 117”30’),代码如下:
uiap = actxserver('STK11.application');
uiap.Visible = 1;
root = uiap.Personality2;
root.NewScenario('exam');
disp('NewScenario');
areaTarget = root.CurrentScenario.Children.New('eAreaTarget', 'MyAreaTarget');
root.BeginUpdate();
boundary = {39.26, 115.25;
39.26, 117.30;
41.03, 117.30;
41.03, 115.25};
areaTarget.CommonTasks.SetAreaTypePattern(boundary);
root.EndUpdate();
areaTarget.AutoCentroid = true;
结果如图:
查看Google地图检验北京市的标定
?可见目标区域设定成功
?
|