STK二次开发之MATLAB 区域目标

创建一个区域目标(在当前场景的中心体上)

% 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地图检验北京市的标定

 可见目标区域设定成功

 

  • 4
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值