Пример #1
0
        public void ContactLinesToRectDiagonal(SiteMapObject pappa)
        {
            List <SiteMapObject> childTempList = ObjectList.Where(x => x.ObjectBeforID == pappa.ObjectID).ToList();

            int pappaX = (pappa.XPoint) + (recWidht / 2);
            int pappaY;

            if (pappa.Show)
            {
                pappaY = (pappa.YPoint);
            }
            else
            {
                pappaY = (pappa.YPoint) + recHight;
            }

            foreach (var item in childTempList)
            {
                int childX = (item.XPoint) + (recWidht / 2);
                int childY = item.YPoint;
                if (item.Show)
                {
                    childX = (item.XPoint) + (recWidht / 2);
                    childY = item.YPoint - recHightText;
                }
                SiteMapLineObject newObject = new SiteMapLineObject();
                newObject.FromX = pappaX;
                newObject.FromY = pappaY;
                newObject.ToX   = childX;
                newObject.ToY   = childY;
                _SiteMapLineObjects.Add(newObject);
            }
        }
Пример #2
0
        private bool DosPappaHaveBrodersThatAreNotPlaced(SiteMapObject pappa)
        {
            Brothers = ObjectList.Where(x => x.ObjectBeforID == pappa.ObjectBeforID && x.Placed == false).ToList();

            if (Brothers.Count() > 0)
            {
                return(true);
            }

            return(false);
        }
Пример #3
0
        private int XPointWhenGroupOfChildrenHaveABrotherPlaced(SiteMapObject child)
        {
            List <SiteMapObject> tempChildrenList = GetChildrenByPappaId(child.ObjectBeforID);

            if (tempChildrenList[0].Show == true)
            {
                return(tempChildrenList.Max(x => x.XPoint) + recWidhtText);
            }
            else
            {
                return(tempChildrenList.Max(x => x.XPoint) + recWidht);
            }
        }
Пример #4
0
        public void ContactLinesToRect(SiteMapObject pappa)
        {
            List <SiteMapObject> childTempList = ObjectList.Where(x => x.ObjectBeforID == pappa.ObjectID).ToList();
            int y      = pappa.YPoint + 20;
            int xStart = childTempList.Min(x => x.XPoint) + (recWidht / 2);
            int xEnd   = childTempList.Max(x => x.XPoint) + (recWidht / 2);
            SiteMapLineObject middleObject = new SiteMapLineObject();

            middleObject.FromX = xStart;
            middleObject.FromY = y;
            middleObject.ToX   = xEnd;
            middleObject.ToY   = y;
            _SiteMapLineObjects.Add(middleObject);

            int pappaX = (pappa.XPoint) + (recWidht / 2);
            int pappaY;

            if (pappa.Show)
            {
                pappaY = (pappa.YPoint);
            }
            else
            {
                pappaY = (pappa.YPoint) + recHight;
            }

            SiteMapLineObject pappaObject = new SiteMapLineObject();

            pappaObject.FromX = pappaX;
            pappaObject.FromY = pappaY;
            pappaObject.ToX   = pappaX;
            pappaObject.ToY   = y;
            _SiteMapLineObjects.Add(pappaObject);

            foreach (var item in childTempList)
            {
                int childX = (item.XPoint) + (recWidht / 2);
                int childY = item.YPoint;
                if (item.Show)
                {
                    childX = (item.XPoint) + (recWidht / 2);
                    childY = item.YPoint - recHightText;
                }
                SiteMapLineObject newObject = new SiteMapLineObject();
                newObject.FromX = childX;
                newObject.FromY = y;
                newObject.ToX   = childX;
                newObject.ToY   = childY;
                _SiteMapLineObjects.Add(newObject);
            }
        }
Пример #5
0
        private bool DosTheGroupOfChildrenHaveABrotherPlacedAndShowTrue(SiteMapObject child)
        {
            bool result = false;
            List <SiteMapObject> tempChildrenList = GetChildrenByPappaId(child.ObjectBeforID);

            foreach (var item in tempChildrenList)
            {
                if (item.Placed == true && item.Show == true)
                {
                    result = true;
                }
            }
            return(result);
        }
Пример #6
0
        private SiteMapObject getObjectBefor(int place, string fullPath)
        {
            string[] stringArray = fullPath.Split('/');

            SiteMapObject obj = ListOfSiteMapObjects.Where(x => x.ObjectName == stringArray[0]).Single();

            if (place > 1)
            {
                for (int i = 1; i <= place - 1; i++)
                {
                    SiteMapObject objnext = ListOfSiteMapObjects.Where(x => x.ObjectName == stringArray[i] && x.ObjectBeforID == obj.ObjectID).Single();
                    obj = objnext;
                }
            }
            return(obj);
        }
Пример #7
0
        private void placePappa(SiteMapObject pappa)
        {
            List <SiteMapObject> childTempList = ObjectList.Where(x => x.ObjectBeforID == pappa.ObjectID).ToList();

            if (pappa.Show == true)
            {
                if (childTempList[0].Show)
                {
                    pappa.XPoint = ((((childTempList.Min(x => x.XPoint)) + recWidhtText + (childTempList.Max(x => x.XPoint))) / 2) - (recWidhtText / 2));
                }
                else
                {
                    pappa.XPoint = ((((childTempList.Min(x => x.XPoint)) + recWidht + (childTempList.Max(x => x.XPoint))) / 2) - (recWidht / 2));
                }

                WidthSizeCount(pappa.XPoint + recWidhtText + (columnsChildDiff / 2));
            }
            else
            {
                pappa.XPoint = ((((childTempList.Min(x => x.XPoint)) + recWidht + (childTempList.Max(x => x.XPoint))) / 2) - (recWidht / 2));
            }
            pappa.YPoint = GetYPoint(pappa.ObjectLevel);
            pappa.Placed = true;

            switch (LinesPatern)
            {
            case "1":
                ContactLinesToRect(pappa);

                break;

            case "2":
                ContactLinesToRectDiagonal(pappa);
                break;

            case "3":
                break;

            default:
                break;
            }
        }
Пример #8
0
        private bool IsObjectExistsInSamePath(string objName, string fullPath, int place)
        {
            bool result = false;
            List <SiteMapObject> objList = ListOfSiteMapObjects.Where(x => x.ObjectName == objName).ToList();

            for (int i = 0; i < objList.Count(); i++)
            {
                string        newFullPath = objList[i].ObjectName;
                SiteMapObject objToList   = ListOfSiteMapObjects.Where(x => x.ObjectID == objList[i].ObjectBeforID).Single();
                newFullPath = objToList.ObjectName + "/" + newFullPath;

                for (int z = objToList.ObjectLevel; z > 0; z--)
                {
                    objToList   = ListOfSiteMapObjects.Where(x => x.ObjectID == objToList.ObjectBeforID).Single();
                    newFullPath = objToList.ObjectName + "/" + newFullPath;
                }

                if (string.Compare(fullPath, newFullPath) == 0)
                {
                    result = true;
                }
            }
            return(result);
        }
Пример #9
0
        public List <SiteMapObject> Build()
        {
            bool workInProgress = true;

            getObjectListToLevels();
            TempChildrenLevel = getLowestLevelWithBigestGroupOfChildrenInTempChild();
            if (TempChildrenLevel.XKantStart == 0 && TempChildrenLevel.XKantEnd == 0)
            {
                TempChildrenLevel.XKantStart = columnsDiff;
                TempChildrenLevel.XKantEnd   = columnsDiff;
            }

            pappa = GetPappa(TempChildrenLevel.LevelChildTemp[0]);

            while (workInProgress)
            {
                if (TempChildrenLevel.LevelChildTemp.Count > 0)
                {
                    PlaceChildren(TempChildrenLevel);
                    foreach (var item in TempChildrenLevel.LevelChildTemp)
                    {
                        if (item.ObjectBeforID == Guid.Empty)
                        {
                            workInProgress = false;
                        }
                    }
                }
                placePappa(pappa);
                if (pappa.ObjectBeforID == Guid.Empty)
                {
                    workInProgress = false;
                }
                if (DosPappaHaveBrodersThatAreNotPlaced(pappa) && workInProgress)
                {
                    if (DosBrodersHaveChildrenThatAreNotPlaced())
                    {
                        bool theLowestChildrenInThisTree = true;
                        while (theLowestChildrenInThisTree)
                        {
                            TempBrothers = new List <SiteMapObject>();
                            foreach (var brother in Brothers)
                            {
                                if (ObjectList.Where(x => x.ObjectBeforID == brother.ObjectID && x.Placed == false).ToList().Count() > 0)
                                {
                                    var br = ObjectList.Where(x => x.ObjectBeforID == brother.ObjectID && x.Placed == false).ToList();
                                    foreach (var child in br)
                                    {
                                        TempBrothers.Add(child);
                                    }
                                }
                            }
                            if (TempBrothers.Count() > 0)
                            {
                                Brothers = TempBrothers;
                            }
                            else
                            {
                                TempChildrenLevel = getALevelByID(Brothers[0].ObjectLevel);
                                TempChildrenLevel.LevelChildTemp = GetmostTempChildrenFromSamePapp(Brothers);
                                theLowestChildrenInThisTree      = false;
                                pappa = GetPappa(TempChildrenLevel.LevelChildTemp[0]);
                            }
                        }
                    }
                    else
                    {
                        TempChildrenLevel = getALevelByID(Brothers[0].ObjectLevel);
                        TempChildrenLevel.LevelChildTemp = Brothers;
                        TempChildrenLevel.LevelChildTemp = Brothers;
                        pappa = GetPappa(TempChildrenLevel.LevelChildTemp[0]);
                    }
                }
                else
                {
                    if (pappa.ObjectBeforID != Guid.Empty)
                    {
                        pappa = GetPappasPappa(pappa);
                    }
                }
            }
            List <SiteMapObject> checkNoamDelete = ObjectList.Where(x => x.ObjectName == "greenlight").ToList();

            return(ObjectList);
        }
Пример #10
0
 private SiteMapObject GetPappa(SiteMapObject child)
 {
     return(ObjectList.Where(x => x.ObjectID == child.ObjectBeforID).First());
 }
Пример #11
0
 private SiteMapObject GetPappasPappa(SiteMapObject pappa)
 {
     return(ObjectList.Where(x => x.ObjectID == pappa.ObjectBeforID).First());
 }
Пример #12
0
        private void PlaceChildren(Level children)
        {
            if (children.XKantEnd == columnsDiff && WidthSize == 0)
            {
                //do nothing
            }
            else
            {
                if (DosTheGroupOfChildrenHaveABrotherPlaced(children.LevelChildTemp[0]))
                {
                    if (DosTheGroupOfChildrenHaveABrotherPlacedAndShowTrue(children.LevelChildTemp[0]))
                    {
                        children.XKantEnd = XPointWhenGroupOfChildrenHaveABrotherPlaced(children.LevelChildTemp[0]) + recWidhtText;
                    }
                    else
                    {
                        children.XKantEnd = XPointWhenGroupOfChildrenHaveABrotherPlaced(children.LevelChildTemp[0]) + columnsChildDiff;
                    }
                }
                else
                {
                    if (children.XKantEnd >= WidthSize)
                    {
                        children.XKantEnd += columnsDiff;
                    }
                    else
                    {
                        SiteMapObject tPappa = GetPappa(children.LevelChildTemp[0]);
                        if (tPappa.Show == true)
                        {
                            children.XKantEnd = WidthSize + (recWidhtText);
                        }
                        else
                        {
                            children.XKantEnd = WidthSize + columnsDiff;
                        }
                    }
                }
            }

            foreach (var Child in children.LevelChildTemp)
            {
                if (Child.Placed == false)
                {
                    if (Child.Show == true)
                    {
                        Child.XPoint = children.XKantEnd + (recWidhtText / 2);
                        TempChildrenLevel.XKantEnd += columnsChildDiff + recWidhtText;
                    }
                    else
                    {
                        Child.XPoint = children.XKantEnd;
                        TempChildrenLevel.XKantEnd += columnsChildDiff + recWidht;
                    }
                    Child.YPoint = GetYPoint(children.LevelId);
                    Child.Placed = true;
                }
            }
            TempChildrenLevel.XKantEnd -= columnsChildDiff;
            WidthSizeCount(children.XKantEnd - columnsChildDiff);
        }
Пример #13
0
        private void ObjectifyFullPath(string fullPath, int showLevel)
        {
            string[] stringArray = fullPath.Split('/');
            for (int i = 0; i < stringArray.Length; i++)
            {
                if (ObjectExists(stringArray[i]))
                {
                    if (i != 0)
                    {
                        string newFullPath = stringArray[i];

                        for (int a = i - 1; a >= 0; a--)
                        {
                            newFullPath = stringArray[a] + "/" + newFullPath;
                        }
                        bool ObjectExistsInSamePath = IsObjectExistsInSamePath(stringArray[i], newFullPath, i);

                        if (!ObjectExistsInSamePath)
                        {
                            SiteMapObject obj      = new SiteMapObject();
                            SiteMapObject objBefor = getObjectBefor(i, fullPath);
                            obj.ObjectLevel      = i;
                            obj.ObjectPath       = GetRelativePath(fullPath, i);
                            obj.ObjectName       = stringArray[i];
                            obj.ObjectBeforID    = objBefor.ObjectID;
                            obj.ObjectBeforLevel = objBefor.ObjectLevel;
                            if (i < (showLevel + 1))
                            {
                                obj.Show = true;
                            }

                            ListOfSiteMapObjects.Add(obj);
                        }
                    }
                }
                else
                {
                    SiteMapObject obj = new SiteMapObject();
                    if (i == 0)
                    {
                        obj.ObjectLevel      = i;
                        obj.ObjectName       = stringArray[i];
                        obj.ObjectBeforID    = Guid.Empty;
                        obj.ObjectBeforLevel = i;
                        obj.ObjectPath       = GetRelativePath(fullPath, i);
                        if (i < (showLevel + 1))
                        {
                            obj.Show = true;
                        }
                        ListOfSiteMapObjects.Add(obj);
                    }
                    else
                    {
                        SiteMapObject objBefor = getObjectBefor(i, fullPath);
                        obj.ObjectLevel      = i;
                        obj.ObjectName       = stringArray[i];
                        obj.ObjectBeforID    = objBefor.ObjectID;
                        obj.ObjectBeforLevel = objBefor.ObjectLevel;
                        obj.ObjectPath       = GetRelativePath(fullPath, i);
                        if (i < (showLevel + 1))
                        {
                            obj.Show = true;
                        }
                        ListOfSiteMapObjects.Add(obj);
                    }
                }
            }
        }
Пример #14
0
        private SiteMapObject GetObjectBYID(Guid ID)
        {
            SiteMapObject objBefor = ListOfSiteMapObjects.Where(x => x.ObjectBeforID == ID).Single();

            return(objBefor);
        }