/// <summary> /// Create NASolver and NAContext /// </summary> /// <param name="networkDataset">Input network dataset</param> private void CreateSolverContext(INetworkDataset networkDataset) { if (networkDataset == null) { return; } //Get the Data Element IDENetworkDataset deNDS = GetDENetworkDataset(networkDataset); INASolver naSolver = new NAServiceAreaSolverClass(); m_NAContext = naSolver.CreateContext(deNDS, naSolver.Name); ((INAContextEdit)m_NAContext).Bind(networkDataset, new GPMessagesClass()); }
private void CreateContextAndSolver(INetworkDataset networkDataset) { if (networkDataset == null) { return; } IDatasetComponent datasetComponent = networkDataset as IDatasetComponent; IDENetworkDataset deNetworkDataset = datasetComponent.DataElement as IDENetworkDataset; INASolver naSolver = new NAServiceAreaSolverClass(); m_naContext = naSolver.CreateContext(deNetworkDataset, "ServiceArea"); INAContextEdit naContextEdit = m_naContext as INAContextEdit; naContextEdit.Bind(networkDataset, new GPMessagesClass()); }
/// <summary> /// Create NASolver and NAContext /// </summary> /// <param name="networkDataset">Input network dataset</param> private void CreateSolverContext(INetworkDataset networkDataset) { if (networkDataset == null) return; //Get the Data Element IDENetworkDataset deNDS = GetDENetworkDataset(networkDataset); INASolver naSolver = new NAServiceAreaSolverClass(); m_NAContext = naSolver.CreateContext(deNDS, naSolver.Name); ((INAContextEdit)m_NAContext).Bind(networkDataset, new GPMessagesClass()); }
//创建解决器上下文 public static INAContext CreateSolverContext(INetworkDataset networkDataset,string ServiceType) { //Get the Data Element IDENetworkDataset deNDS = GetDENetworkDataset(networkDataset); INASolver naSolver=null; switch (ServiceType) { case "路线": naSolver = new NARouteSolverClass(); break; case "服务": naSolver = new NAServiceAreaSolverClass(); break; case "设施": naSolver = new NAClosestFacilitySolverClass(); break; case "费用": naSolver = new NAODCostMatrixSolverClass(); break; } INAContextEdit contextEdit = naSolver.CreateContext(deNDS, naSolver.Name) as INAContextEdit; contextEdit.Bind(networkDataset, new GPMessagesClass()); return contextEdit as INAContext; }