Beispiel #1
0
        public void PreProcess(IPositionSet positionSet)
        {
            #region code for algorithm demo
            if (GetPositionSetToGetConvexHull != null)
            {
                GetPositionSetToGetConvexHull(positionSet);
            }
            #endregion

            //请在这里改变不同的m2mStructure实现。
            M2MSCreater_ForGeneralM2MStruture m2m_Creater_ForGeneralM2MStruture = new M2MSCreater_ForGeneralM2MStruture();

            m2m_Creater_ForGeneralM2MStruture.SetPointInPartFactor(set_pointInPartFactor);

            m2mStructure = m2m_Creater_ForGeneralM2MStruture.CreateAutomatically(positionSet);

            m2mStructure.Preprocessing(positionSet);

            #region code for algorithm demo
            if (GetM2MStructure != null)
            {
                GetM2MStructure(m2mStructure);
            }
            #endregion
        }
Beispiel #2
0
        //初始化地图,在地图被更改之后调用
        public void InitEngineForMap(IPositionSet_Connected mapPositionSet_Connected)
        {
            this.mapPositionSet_Connected = mapPositionSet_Connected;

            M2MSCreater_ForGeneralM2MStruture m2m_Creater_ForGeneralM2MStruture = new M2MSCreater_ForGeneralM2MStruture();

            m2m_Creater_ForGeneralM2MStruture.PartType = typeof(Part_Multi);
            m2m_Creater_ForGeneralM2MStruture.SetPointInPartFactor(50);
            m2m_Creater_ForGeneralM2MStruture.SetUnitNumInGridLength(3);
            m2mStructure = m2m_Creater_ForGeneralM2MStruture.CreateAutomatically(mapPositionSet_Connected);
            m2mStructure.Preprocessing(mapPositionSet_Connected);
            BuildPartSetConnectionForM2MStructure buildPartSetConnectionForM2MStructure = new BuildPartSetConnectionForM2MStructure();

            buildPartSetConnectionForM2MStructure.TraversalEveryLevelAndBuild(m2mStructure);

            #region code for algorithm demo
            if (GetM2MStructureInPreprocess != null)
            {
                GetM2MStructureInPreprocess(m2mStructure);
            }
            #endregion

            int num = (int)(Math.Sqrt((double)mapPositionSet_Connected.GetNum()));

            path = new List <IPosition_Connected>(num * 2);

            if (num > 0)
            {
                open = new PriorityQueue <IPosition_Connected>(num * 4, com);
            }
            else
            {
                open = new PriorityQueue <IPosition_Connected>(com);
            }
        }