Beispiel #1
0
        public override bool Equals(object obj)
        {
            KeyArea k   = this;
            KeyArea key = (KeyArea)obj;

            if (k == null || key == null || k.Nearestes == null)
            {
                return(false);
            }
            foreach (var item in key.Getaways)
            {
                if (this.Getaways.Contains(item) == false)
                {
                    return(false);
                }
            }

            foreach (var item in key.Nearestes)
            {
                if (this.Nearestes.Contains(item) == false)
                {
                    return(false);
                }
            }
            if (Getaways.Count() != key.Getaways.Count || Nearestes.Count() != key.Nearestes.Count)
            {
                return(false);
            }
            return(true);
        }
Beispiel #2
0
        //TODO: להחליף קוד
        #region function level2 מקבץ את הסטנדים לפי איזור
        public static Dictionary <KeyArea, Area> Level2GroupStandsByArea(Dictionary <Stand, List <Product> > ExtraStand, List <GetawayProcI_Result> getaways, Shop shop)
        {
            //level 2: מקבץ את הסטנדים שבאותו אזור -כלומר יש להם אותם השערים
            //key: המפתח הוא השערים של האזור וגם השערים הכי קרובים של האזור
            //value: הערך הוא איזור המכיל רשימת סטנדים, נקודת התחלת אזור, נקודת סוף אזור
            Dictionary <KeyArea, Area> productArea = new Dictionary <KeyArea, Area>();
            List <Connection>          connections;
            Stand stand;

            foreach (var productStand in ExtraStand)
            {
                KeyArea key = new KeyArea();
                stand         = productStand.Key;
                connections   = stand.GetConnections(shop);
                key.Nearestes = connections.Where(x => x.Nearest == true).Select(x => x.Getaway).ToList();
                key.Getaways  = Converts.ToGetawayProcResult(connections.Select(x => x.Getaway).ToList(), dtoShop.GetawayProcI_Results(CodeShop));
                KeyArea anotherKey = productArea.Keys.FirstOrDefault(x => x.Equals(key));
                if (anotherKey == null)
                {
                    Area ee = new Area();
                    ee.ExtraStand[productStand.Key] = productStand.Value;
                    productArea.Add(key, ee);
                }
                else
                {
                    productArea[anotherKey].ExtraStand.Add(productStand.Key, productStand.Value);
                }
            }
            return(productArea);
        }
Beispiel #3
0
        private static Dictionary <KeyArea, Area> Level2NotGroupStandsByArea(Dictionary <Stand, List <Product> > ExtraStand, List <GetawayProcI_Result> getawayProcI_Results, Shop shop)
        {
            //key: המפתח הוא השערים של האזור וגם השערים הכי קרובים של האזור
            //value: הערך הוא איזור המכיל רשימת סטנדים, נקודת התחלת אזור, נקודת סוף אזור
            Dictionary <KeyArea, Area> productArea = new Dictionary <KeyArea, Area>();

            foreach (var productStand in ExtraStand)
            {
                KeyArea key = new KeyArea();
                Stand   s   = productStand.Key;
                key.Nearestes = null;
                List <Connection> connections = s.GetConnections(shop);
                key.Getaways = Converts.ToGetawayProcResult(connections.Select(x => x.Getaway).ToList(), dtoShop.GetawayProcI_Results(CodeShop));
                KeyArea anotherKey = productArea.Keys.FirstOrDefault(x => x.Equals(key));
                Area    ee         = new Area();
                ee.ExtraStand[productStand.Key] = productStand.Value;
                productArea.Add(key, ee);
            }
            return(productArea);
        }
Beispiel #4
0
        public static List <KeyValuePair <KeyArea, Area> > Level3ConvertDictToList(Point pStart, Dictionary <KeyArea, Area> productArea, int [][] matShop, List <GetawayProcI_Result> getaways, List <Connection> connections, List <Wall> cashes, int CodeStartGetaway, List <Stand> stands, Shop shop)
        {
            //level 3: אחרי שקבצנו עלינו:
            //להוסיף אזור התחלה, להוסיף אינדקס של רשימה
            //ולחשב נקודת התחלה וסוף לכל אזור
            List <KeyValuePair <KeyArea, Area> > productAreaList = new List <KeyValuePair <KeyArea, Area> >();
            //ראשית כל אזור א' הוא אזור ההתחלה
            KeyArea SPkeyArea = new KeyArea()
            {
                Getaways = UtilitiesFunctions.StartPointManagment(pStart, matShop, getaways, CodeStartGetaway, stands, shop)
            };

            //אזור ההתחלה הוא ללא סטנדים /מוצרים כלל
            productAreaList.Add(new KeyValuePair <KeyArea, Area>(SPkeyArea, new Area()
            {
                P1 = pStart, P2 = pStart
            }));
            foreach (var pair in productArea)
            {
                //חישוב נקודות התחלה וסוף של אזור
                pair.Value.calculatePoints();
                //מעבירים לרשימה
                productAreaList.Add(pair);
            }
            //נקודות סיום
            foreach (var c in cashes)
            {
                KeyArea EPkeyArea2 = new KeyArea()
                {
                    Getaways = Converts.ToGetawayProcResult(connections.Where(x => x.TypeDest == Convert.ToInt32(eTypeConnection.wall) && x.CodeDest == c.Code).ToList().Select(x => x.Getaway).ToList(), getaways), Nearestes = null
                };
                dtoWall w = Converts.ToDtoWall(c);
                //אזור הסוף הוא ללא סטנדים /מוצרים כלל
                productAreaList.Add(new KeyValuePair <KeyArea, Area>(EPkeyArea2, new Area()
                {
                    P1 = w.P1, P2 = w.P2
                }));
            }
            return(productAreaList);
        }