public void ChangeGroup(PlanningGroup group) { this.group = group; UpdateLineCount(group.cells.Count); coords = group.center; }
// // Public Methods // public void Init(PlanningGroup group, SummaryPanel summaryPanel) { base.Init(group.center, summaryPanel); this.group = group; UpdateLineCount(group.cells.Count); }
private void AddOrUpdateGroupSmryLayerInfos(PlanningGroup group) { List <PlanningCell> cells = group.cells; foreach (PlanningCell cell in cells) { Typology typology = cell.typology; // Area occupied by each Typology in the group of cells if (typologyAreas.ContainsKey(typology)) { typologyAreas[typology] += cell.areaSqM; } else { typologyAreas.Add(typology, cell.areaSqM); } group.groupPaintedArea += cell.areaSqM; // SummaryLayerInfo for each Typology in the group of cells if (summaryLayerInfos.ContainsKey(typology)) { UpdateSummaryLayerInfo(typology, typologyAreas[typology]); } else { SummaryLayerInfo smryLayerInfo = NewSummaryLayerInfo(typology.color, typology.name, typologyAreas[typology]); summaryLayerInfos.Add(typology, smryLayerInfo); } } }
public void UpdateGroupSummaryPanel(PlanningGroup group) { ClearTypologyCounts(); ClearSummaryLayerInfos(); ClearDistributionBars(); AddOrUpdateGroupTypologyCounts(group); AddOrUpdateGroupSmryLayerInfos(group); AddOrUpdateGroupDistribBars(group); }
private void AddOrUpdateGroupTypologyCounts(PlanningGroup group) { List <PlanningCell> cells = group.cells; foreach (PlanningCell cell in cells) { if (typologyCounts.ContainsKey(cell.typology)) { ++typologyCounts[cell.typology]; } else { typologyCounts.Add(cell.typology, 1); } ++totalTypologyCount; } }
private void AddOrUpdateGroupDistribBars(PlanningGroup group) { List <PlanningCell> cells = group.cells; foreach (PlanningCell cell in cells) { Typology typology = cell.typology; if (distributionBars.ContainsKey(typology)) { UpdateDistributionBar(typology); } else { DistributionBar dBar = NewDistribBar(typology.color, typologyCounts[typology] / (float)totalTypologyCount); distributionBars.Add(typology, dBar); } distributionContainer.gameObject.SetActive((distributionBars.Count > 1) ? true : false); } }
protected override void ActivateView(string viewName, System.Collections.Generic.IDictionary <string, object> viewParameters) { try { IsNew = (bool)viewParameters["New"]; } catch (KeyNotFoundException) { } var planningGroup = (PlanningGroup)viewParameters["PlanningGroup"]; if (planningGroup != null) { PlanningGroup = planningGroup; } ReportControl = new ReportControlViewModel(); if (planningGroup != null) { ReportControl.CurrentPlanningGroupId = planningGroup.PlanningGroupId; } ReportControl.LoadReportsForView((int)ReportViews.PlanningGroup, ReportService); RaisePropertyChanged(() => ReportControl); try { var profitCenterOrganization = (Organization)viewParameters["Organization"]; if (profitCenterOrganization != null) { CurrentProfitCenter = new ProfitCenter() { Name = profitCenterOrganization.Name, ProfitCenterNumber = profitCenterOrganization.ExternalId }; } } catch (KeyNotFoundException) { } }
private GroupPin AddGroupPin(PlanningGroup group) { // Create summary panel SummaryPanel groupSummary = Instantiate(summaryPanelPrefab, flagContainer, false); groupSummary.SetPlanningOutput(planningOutput); groupSummaries.Add(groupSummary); groupSummary.Init(summaryPanelPrefab.name, grid, 2); groupSummary.gameObject.SetActive(showFlags); // Create pin var groupPin = Instantiate(groupPinPrefab, pinContainer, true); groupPin.name = "Group_" + group.id; groupPin.Init(group, groupSummary); groupPin.globalCount = planningGroups.Count; groupPin.UpdatePosition(map); groupPins.Add(groupPin); return(groupPin); }
private PlanningGroup CreateGroup(PlanningCell cell, int groupId) { PlanningGroup group = new PlanningGroup(groupId, this); group.center = new Coordinate(); Queue <PlanningCell> queue = new Queue <PlanningCell>(); HashSet <PlanningCell> set = new HashSet <PlanningCell>(); queue.Enqueue(cell); set.Add(cell); int count = 0; while (queue.Count > 0) { cell = queue.Dequeue(); int index = cell.x + cell.y * grid.countX; count++; group.cells.Add(cell); group.center.Longitude += cell.coords.Longitude; group.center.Latitude += cell.coords.Latitude; cell.group = groupId; if (cell.x > 0) { // Left AddNeighbor(index - 1, queue, set); // Top-Left if (cell.y > 0) { AddNeighbor(index - 1 - grid.countX, queue, set); } // Bottom-Left if (cell.y < grid.countY - 1) { AddNeighbor(index - 1 + grid.countX, queue, set); } } if (cell.x < grid.countX - 1) { // Right AddNeighbor(index + 1, queue, set); // Top-Right if (cell.y > 0) { AddNeighbor(index + 1 - grid.countX, queue, set); } // Bottom-Right if (cell.y < grid.countY - 1) { AddNeighbor(index + 1 + grid.countX, queue, set); } } // Top if (cell.y > 0) { AddNeighbor(index - grid.countX, queue, set); } // Bottom if (cell.y < grid.countY - 1) { AddNeighbor(index + grid.countX, queue, set); } } double invCount = 1.0 / count; group.center.Longitude *= invCount; group.center.Latitude *= invCount; return(group); }
private void UpdateGroupSummary(SummaryPanel groupSummary, PlanningGroup group) { groupSummary.gameObject.SetActive(showFlags); groupSummary.UpdateGroupSummaryPanel(group); groupSummary.gridNoData = group.gridNoData; }