根据给定的弧段 ID 数组查找与这些弧段相连通的环路,返回构成环路的弧段 ID 数组。

命名空间:  SuperMap.Analyst.NetworkAnalyst
程序集:  SuperMap.Analyst.NetworkAnalyst (in SuperMap.Analyst.NetworkAnalyst)
版本: dll

语法

C#
public int[] FindLoopsFromEdges(
	int[] edgeIDs
)

参数

edgeIDs
Type: array< System..::.Int32 >[]()[]
指定的弧段 ID 数组。

返回值

与给定弧段相连通的环路的弧段 ID 数组。

备注

设施网络中,两条或两条以上流向值为 2(即不确定流向)的弧段构成的闭合路径,称为环路。详细内容请参阅 CheckLoops 方法的介绍。

示例

以下代码示范了如何查找与给定的弧段或结点相连通的环路。

假设下面函数操作的网络数据集为安装目录\SampleData\changchun\下的 changchun.udb 数据源中的名为 RoadNet 的网络数据集,并且已经为该网络数据集建立了流向以及等级。有关建立网络数据集的流向及等级,请参见 NetworkBuilder.BuildFacilityNetworkDirections 方法。

CopyC#
public void FindLoopsFrom(DatasetVector networkDataset)
{
    //设置用于设施网络分析的环境
    FacilityAnalystSetting facilityAnalystSetting = new FacilityAnalystSetting();
    facilityAnalystSetting.NetworkDataset = networkDataset;
    facilityAnalystSetting.DirectionField = "Direction";
    facilityAnalystSetting.EdgeIDField = "SmID";
    facilityAnalystSetting.NodeIDField = "SmNodeID";
    facilityAnalystSetting.FNodeIDField = "SmFNode";
    facilityAnalystSetting.TNodeIDField = "SmTNode";
    facilityAnalystSetting.Tolerance = 0.0015;
    WeightFieldInfo weightFieldInfo = new WeightFieldInfo();
    weightFieldInfo.Name = "Length";
    weightFieldInfo.FTWeightField = "SmLength";
    weightFieldInfo.TFWeightField = "SmLength";
    WeightFieldInfos weightFieldInfos = new WeightFieldInfos();
    weightFieldInfos.Add(weightFieldInfo);
    facilityAnalystSetting.WeightFieldInfos = weightFieldInfos;
    FacilityAnalyst facilityAnalyst = new FacilityAnalyst();
    facilityAnalyst.AnalystSetting = facilityAnalystSetting;
    facilityAnalyst.Load();

    //获取参与分析的弧段或结点
    Int32[] edgeIDs = new Int32[] { 3855, 9073 };
    Int32[] nodeIDs = new Int32[] { 2996, 2682 };

    //查找与给定弧段相连通的环路
    Int32[] loopsFromEdges = facilityAnalyst.FindLoopsFromEdges(edgeIDs);

    //查找与给定结点相连通的环路
    Int32[] loopsFromNodes = facilityAnalyst.FindLoopsFromNodes(nodeIDs);
}

版本信息

SuperMap iObjects .NET


请参见