根据网络弧段标识表示的网络关系,构建拓扑逻辑图。在调用此接口之前,必须先设置结果数据集所在的数据源和数据集名称。
命名空间:
SuperMap.Analyst.SpatialAnalyst程序集: SuperMap.Analyst.SpatialAnalyst (in SuperMap.Analyst.SpatialAnalyst)
版本: dll
语法
C# |
---|
public virtual DatasetVector Build( NetworkEdgeID[] networkEdgeIDs ) |
参数
- networkEdgeIDs
- Type: array<
SuperMap.Analyst.SpatialAnalyst..::.NetworkEdgeID
>[]()[]
表示网络关系的弧段标识对象集合。
返回值
构建成功返回存储拓扑逻辑图的二维网络数据集,否则,返回null。示例
以下代码示范了通过网络弧段标识对象构建等级逻辑拓扑图
CopyC#
public bool TestHierarchicalSchema(Datasource datasource) { if (datasource == null) { System.Console.WriteLine("数据源为空"); return false; } String datasetName = "SrcNet"; DatasetVector datasetNet = datasource.Datasets[datasetName] as DatasetVector; if (datasetNet == null) { System.Console.WriteLine("获取网络数据集失败"); return false; } datasetNet.Open(); Recordset recordset = datasetNet.GetRecordset(false, CursorType.Static); if (recordset == null) { System.Console.WriteLine("查询记录集失败"); return false; } // 获取网络弧段标识信息 String edgeIDField = datasetNet.GetFieldNameBySign(FieldSign.EdgeID); String fromNodeIDField = datasetNet.GetFieldNameBySign(FieldSign.FNode); String toNodeIDField = datasetNet.GetFieldNameBySign(FieldSign.TNode); NetworkEdgeID[] networkEdgeIDs = new NetworkEdgeID[recordset.RecordCount]; int i=0; while (!recordset.IsEOF) { NetworkEdgeID networkEdgeID = new NetworkEdgeID(); networkEdgeID.EdgeID = recordset.GetInt32(edgeIDField); networkEdgeID.FromNodeID = recordset.GetInt32(fromNodeIDField); networkEdgeID.ToNodeID = recordset.GetInt32(toNodeIDField); networkEdgeIDs[i++] = networkEdgeID; recordset.MoveNext(); } recordset.Dispose(); TopologicalHierarchicalSchema hierarchicalSchema = new TopologicalHierarchicalSchema(); hierarchicalSchema.OutputDatasetName = datasource.Datasets.GetAvailableDatasetName("ResultSchema"); hierarchicalSchema.OutputDatasource = datasource; DatasetVector resultDt = hierarchicalSchema.Build(networkEdgeIDs); // 等级拓扑图对象释放 hierarchicalSchema.Dispose(); return resultDt != null; }