/// <summary> /// last call GenerateTaxiPathNode(...) /// </summary> /// <param name="taxiPathId"></param> /// <param name="fromTaxiNodeId"></param> /// <param name="toTaxiNodeId"></param> public void RegisterTaxiPath(BaseTaxiPath baseTaxiPath) { if (baseTaxiPath == null) { Debug.WriteLine("BaseTaxiPathNodeManager.RegisterTaxiPath(...) - baseTaxiPath == null error!"); return; } m_TaxiPaths.Add(baseTaxiPath.TaxiPathId, baseTaxiPath); m_TaxiPathNodes = null; }
/// <summary> /// last call GenerateTaxiPathNode(...) /// </summary> /// <param name="taxiPathId"></param> /// <param name="fromTaxiNodeId"></param> /// <param name="toTaxiNodeId"></param> public void RegisterTaxiPath( BaseTaxiPath baseTaxiPath ) { if ( baseTaxiPath == null ) { Debug.WriteLine( "BaseTaxiPathNodeManager.RegisterTaxiPath(...) - baseTaxiPath == null error!" ); return; } m_TaxiPaths.Add( baseTaxiPath.TaxiPathId, baseTaxiPath ); m_TaxiPathNodes = null; }
/// <summary> /// 产生路径点 /// </summary> /// <param name="iTaxiNodeId"></param> /// <param name="baseTaxiPathArray"></param> /// <param name="baseTaxiPathList"></param> /// <param name="taxiPathNode"></param> private void GetTaxiPathNodeInfo( long iTaxiNodeId, BaseTaxiPath[] baseTaxiPathArray, ref List<BaseTaxiPath> baseTaxiPathList, ref Dictionary<long, List<BaseTaxiPath[]>> taxiPathNode ) { for ( int iIndex = 0; iIndex < baseTaxiPathArray.Length; iIndex++ ) { if ( iTaxiNodeId == baseTaxiPathArray[iIndex].FromTaxiNodeId ) { // 检测是否已经有相同的路径点存在 bool bIsInvalidTaxiPath = false; foreach ( BaseTaxiPath baseTaxiPath in baseTaxiPathList ) { if ( baseTaxiPathArray[iIndex].ToTaxiNodeId == baseTaxiPath.FromTaxiNodeId ) { bIsInvalidTaxiPath = true; break; } } if ( bIsInvalidTaxiPath == true ) continue; // 完成路径计算,添加路径 List<BaseTaxiPath[]> baseTaxiPathArrayList = null; if ( taxiPathNode.TryGetValue( baseTaxiPathArray[iIndex].ToTaxiNodeId, out baseTaxiPathArrayList ) == false ) baseTaxiPathArrayList = new List<BaseTaxiPath[]>(); if ( baseTaxiPathArrayList == null ) baseTaxiPathArrayList = new List<BaseTaxiPath[]>(); List<BaseTaxiPath> taxiPathListDuplicate = new List<BaseTaxiPath>(); taxiPathListDuplicate.AddRange( baseTaxiPathList ); taxiPathListDuplicate.Add( baseTaxiPathArray[iIndex] ); baseTaxiPathArrayList.Add( taxiPathListDuplicate.ToArray() ); taxiPathNode[baseTaxiPathArray[iIndex].ToTaxiNodeId] = baseTaxiPathArrayList; // 继续下一个路径计算 taxiPathListDuplicate.Clear(); taxiPathListDuplicate.AddRange( baseTaxiPathList ); GetTaxiPathNodeInfo( baseTaxiPathArray[iIndex].ToTaxiNodeId, baseTaxiPathArray, ref taxiPathListDuplicate, ref taxiPathNode ); } } }