Example #1
0
        private static List <ClashResultGroup> GroupByLevel(List <ClashResult> results)
        {
            //TODO Check if the grid system exist
            GridSystem gridSystem = Application.MainDocument.Grids.ActiveSystem;
            Dictionary <GridLevel, ClashResultGroup> groups = new Dictionary <GridLevel, ClashResultGroup>();
            ClashResultGroup currentGroup;

            foreach (ClashResult result in results)
            {
                //Cannot add original result to new clash test, so I create a copy
                ClashResult copiedResult = (ClashResult)result.CreateCopy();
                GridLevel   closestLevel = gridSystem.ClosestIntersection(copiedResult.Center).Level;

                if (!groups.TryGetValue(closestLevel, out currentGroup))
                {
                    currentGroup             = new ClashResultGroup();
                    currentGroup.DisplayName = closestLevel.DisplayName;
                    groups.Add(closestLevel, currentGroup);
                }
                currentGroup.Children.Add(copiedResult);
            }

            IOrderedEnumerable <KeyValuePair <GridLevel, ClashResultGroup> > list = groups.OrderBy(key => key.Key.Elevation);

            groups = list.ToDictionary((keyItem) => keyItem.Key, (valueItem) => valueItem.Value);
            return(groups.Values.ToList());
        }
Example #2
0
    // Start is called before the first frame update
    void Start()
    {
        mazeWidth  = GridLevel.width;
        mazeHeight = GridLevel.height;
        level      = new GridLevel();
        Location start = new Location(0, 0);

        maze(level, start);
        BuildMaze();
    }
Example #3
0
 private void InitializeItemBinding()
 {
     if (this._grid.Levels.Count != 0)
     {
         GridLevel level = this._grid.Levels[0];
         if (level.Columns["scGridID"] != null)
         {
             this._grid.ItemDataBound += new Grid.ItemDataBoundEventHandler(this.Grid_ItemDataBound);
         }
     }
 }
        private static List <ClashResultGroup> GroupByLevel(List <ClashResult> results, string initialName)
        {
            //I already checked if it exists
            GridSystem gridSystem = Application.MainDocument.Grids.ActiveSystem;
            Dictionary <GridLevel, ClashResultGroup> groups = new Dictionary <GridLevel, ClashResultGroup>();
            ClashResultGroup currentGroup;

            //Create a group for the null GridIntersection
            ClashResultGroup nullGridGroup = new ClashResultGroup();

            nullGridGroup.DisplayName = initialName + "No Level";

            foreach (ClashResult result in results)
            {
                //Cannot add original result to new clash test, so I create a copy
                ClashResult copiedResult = (ClashResult)result.CreateCopy();

                if (gridSystem.ClosestIntersection(copiedResult.Center) != null)
                {
                    GridLevel closestLevel = gridSystem.ClosestIntersection(copiedResult.Center).Level;

                    if (!groups.TryGetValue(closestLevel, out currentGroup))
                    {
                        currentGroup = new ClashResultGroup();
                        string displayName = closestLevel.DisplayName;
                        if (string.IsNullOrEmpty(displayName))
                        {
                            displayName = "Unnamed Level";
                        }
                        currentGroup.DisplayName = initialName + displayName;
                        groups.Add(closestLevel, currentGroup);
                    }
                    currentGroup.Children.Add(copiedResult);
                }
                else
                {
                    nullGridGroup.Children.Add(copiedResult);
                }
            }

            IOrderedEnumerable <KeyValuePair <GridLevel, ClashResultGroup> > list = groups.OrderBy(key => key.Key.Elevation);

            groups = list.ToDictionary((keyItem) => keyItem.Key, (valueItem) => valueItem.Value);

            List <ClashResultGroup> groupsByLevel = groups.Values.ToList();

            if (nullGridGroup.Children.Count != 0)
            {
                groupsByLevel.Add(nullGridGroup);
            }

            return(groupsByLevel);
        }
Example #5
0
    // Start is called before the first frame update
    void Awake()
    {
        mazeWidth  = GridLevel.width;
        mazeHeight = GridLevel.height;
        level      = new GridLevel();
        //mazeWidth = GridLevelWithRooms.width;
        //mazeHeight = GridLevelWithRooms.height;
        //level = new GridLevelWithRooms();
        //level.unplacedRooms.Push(new Room());
        Location start = new Location(0, 0);

        maze(level, start);
        BuildMaze();
    }
Example #6
0
        private static void RemaneGroupBySortingMode(ref List <ClashResultGroup> clashResultGroups, GroupingMode mode)
        {
            GridSystem gridSystem = Application.MainDocument.Grids.ActiveSystem;

            foreach (ClashResultGroup clashResultGroup in clashResultGroups)
            {
                switch (mode)
                {
                case GroupingMode.None:
                    return;

                case GroupingMode.ByLevel:
                    GridLevel closestLevel = gridSystem.ClosestIntersection(clashResultGroup.Center).Level;
                    clashResultGroup.DisplayName = closestLevel.DisplayName + "_" + clashResultGroup.DisplayName;
                    break;

                case GroupingMode.ByGridIntersection:
                    GridIntersection closestIntersection = gridSystem.ClosestIntersection(clashResultGroup.Center);
                    clashResultGroup.DisplayName = closestIntersection.DisplayName + "_" + clashResultGroup.DisplayName;
                    break;

                case GroupingMode.BySelectionA:
                case GroupingMode.BySelectionB:
                    break;

                case GroupingMode.ByApprovedBy:
                    string approvedByValue = "N/A";
                    if (!String.IsNullOrEmpty(clashResultGroup.ApprovedBy))
                    {
                        approvedByValue = clashResultGroup.ApprovedBy;
                    }
                    clashResultGroup.DisplayName = approvedByValue + "_" + clashResultGroup.DisplayName;
                    break;

                case GroupingMode.ByAssignedTo:
                    string assignedToValue = "N/A";
                    if (!String.IsNullOrEmpty(clashResultGroup.AssignedTo))
                    {
                        assignedToValue = clashResultGroup.ApprovedBy;
                    }
                    clashResultGroup.DisplayName = assignedToValue + "_" + clashResultGroup.DisplayName;
                    break;

                case GroupingMode.ByStatus:
                    clashResultGroup.DisplayName = clashResultGroup.Status.ToString() + "_" + clashResultGroup.DisplayName;
                    break;
                }
            }
        }
Example #7
0
        public bool Equals(DestinyNodeActivationRequirement input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     GridLevel == input.GridLevel ||
                     (GridLevel.Equals(input.GridLevel))
                     ) &&
                 (
                     MaterialRequirementHashes == input.MaterialRequirementHashes ||
                     (MaterialRequirementHashes != null && MaterialRequirementHashes.SequenceEqual(input.MaterialRequirementHashes))
                 ));
        }
Example #8
0
        public int GetBestLevel(double mapResolution, double percent)
        {
            if (_levels.Count == 0)
            {
                return(-1);
            }

            for (int i = 0; i < _levels.Count - 1; i++)
            {
                GridLevel level = _levels[i];
                if (mapResolution >= (level.Resolution - (level.Resolution - _levels[i + 1].Resolution) * percent / 100D))
                {
                    return(level.Level);
                }
            }

            return(this.MinResolutionLevel);
        }
Example #9
0
    // Debug line from professor Slease's code example
    public void debugLineMaze(GridLevel maze)
    {
        for (int x = 0; x < width; x++)
        {
            for (int y = 0; y < height; y++)
            {
                Connections currentCell = maze.cells[x, y];
                if (maze.cells[x, y].inMaze)
                {
                    Vector3 cellPos    = new Vector3(x, 0, y);
                    float   lineLength = 1f;
                    if (currentCell.directions[0])
                    {
                        // positive x
                        Vector3 neighborPos = new Vector3(x + lineLength, 0, y);

                        Debug.DrawLine(cellPos, neighborPos, Color.cyan);
                    }
                    if (currentCell.directions[1])
                    {
                        // positive y
                        Vector3 neighborPos = new Vector3(x, 0, y + lineLength);
                        Debug.DrawLine(cellPos, neighborPos, Color.cyan);
                    }
                    if (currentCell.directions[2])
                    {
                        // negative y
                        Vector3 neighborPos = new Vector3(x, 0, y - lineLength);
                        Debug.DrawLine(cellPos, neighborPos, Color.cyan);
                    }
                    if (currentCell.directions[3])
                    {
                        // negative x
                        Vector3 neighborPos = new Vector3(x - lineLength, 0, y);
                        Debug.DrawLine(cellPos, neighborPos, Color.cyan);
                    }
                }
            }
        }
    }
Example #10
0
 // Start is called before the first frame update
 void Start()
 {
     maze = new GridLevel(mazeWidth, mazeHeight);
     //maze.startAt(new Location(0,0));
     generateMaze(maze, startCell);
 }
Example #11
0
 private void Awake()
 {
     _gridLevel = GetComponent <GridLevel>();
 }
Example #12
0
		protected override void BuildGrid()
		{
			if (! IsDefault)
			{
				GridColumn gc;
				GridLevel level;
				GridServerTemplate LinkTemplate = new GridServerTemplate();
				GridServerTemplate ImageTemplate = new GridServerTemplate();

				if (dgBrowseGrid.Levels.Count > 0)
				{
					level = dgBrowseGrid.Levels[0];
				}
				else
				{
					level = new GridLevel();
				}
				int counter = 0;
				foreach (DataColumn dc in dsBrowseGrid.Tables["Data"].Columns)
				{
					gc = new GridColumn();
					if (dc.ColumnName == "OrderCurrent")
					{
						ImageTemplate.Template = new ImageTemplate(dc.ColumnName);
						ImageTemplate.ID = "ImageTemplate";
						gc.DataCellServerTemplateId = ImageTemplate.ID;
						gc.Align = ComponentArt.Web.UI.TextAlign.Center;
					}
					else if (dc.ColumnName == LinkColumn)
					{
						LinkTemplate.Template = new LinkButtonTemplate(dc.ColumnName,GeneratedReportID);
						LinkTemplate.ID = "LinkTemplate";
						gc.DataCellServerTemplateId = LinkTemplate.ID;
					}
					gc.DataField = dc.ColumnName;
					gc.HeadingText = dc.ColumnName.ToString().Replace('_',' ');
					if (dc.ColumnName.ToLower().StartsWith("internal") == true)
					{
						gc.Visible = false;
					}
					level.Columns.Add(gc);
					counter++;
				}
				dgBrowseGrid.ServerTemplates.Add(LinkTemplate);
				dgBrowseGrid.ServerTemplates.Add(ImageTemplate);
				if (dgBrowseGrid.Levels.Count == 0)
				{
					dgBrowseGrid.Levels.Add(level);
				}
			}
		}
Example #13
0
 public void createMaze()
 {
     maze = new GridLevel(width, height);
     GenerateMaze(maze, mazeStart);
 }
Example #14
0
 public void clearMaze()
 {
     maze = null;
 }
Example #15
0
 public void SetGridLevel(GridLevel gridLevel)
 {
     _gridLevel = gridLevel;
 }
Example #16
0
    static void Init()
    {
        GridLevel windows = EditorWindow.GetWindow(typeof(GridLevel)) as GridLevel;

        windows.CameraDummyObj = new GameObject();
    }
Example #17
0
 private void Awake()
 {
     instance = this;
 }