protected override void OnActiveTool(bool isActive)
    {
        if (isActive)
        {
            if (inspectorOutput != null)
            {
                outputPanel.SetPanel(inspectorOutput.transform);
            }

            if (inspectorType == InspectorType.Line && lineInspector.CurrLineInspection >= 0)
            {
                var currLine = lineInfos[lineInspector.CurrLineInspection];
                lineInspectorPanel.UpdateTransectChartAndOutput(currLine, true);
            }

            if (inspectorType == InspectorType.Area && areaInspector.CurrAreaInspection >= 0)
            {
                var currArea = areaInfos[areaInspector.CurrAreaInspection];
                areaInspectorPanel.UpdateGridsAndOutput(currArea, true);

                var contoursTool = ComponentManager.Instance.Get <ContoursTool>();
                if (contoursTool != null)
                {
                    inspectorOutput.AreaOutput.ShowAreaTypeHeaderAndDropdown(contoursTool.IsToggled);
                }
            }
        }
        else
        {
            outputPanel.SetPanel(null);
        }
    }
Example #2
0
    protected override void OnActiveTool(bool isActive)
    {
        if (isActive)
        {
            if (inspectorOutput != null)
            {
                outputPanel.SetPanel(inspectorOutput.transform);
            }

            if (inspectorType == InspectorType.Line && lineInspector.CurrLineInspection >= 0)
            {
                var currLine = lineInfos[lineInspector.CurrLineInspection];
                lineInspectorPanel.UpdateTransectChartAndOutput(currLine, true);
            }
        }
        else
        {
            outputPanel.SetPanel(null);
        }
    }
    //
    // Event Methods
    //

    protected override void OnToggleTool(bool isOn)
    {
        if (isOn)
        {
            // Create budget layer
            budgetLayer    = toolLayers.CreateGridMapLayer(budgetLayerPrefab, "WeightedLayer");
            highlightLayer = toolLayers.CreateGridMapLayer(highlightLayerPrefab, "HighlightLayer");
            highlightLayer.Show(false);

            // Store number of childs on start
            initChildsCount = transform.childCount + 1;

            // Add slider
            foreach (var panel in dataLayers.activeLayerPanels)
            {
                UpdateSlider(panel.DataLayer, true);
            }

            // Create output panel for tool
            municipalBudgetOutput      = Instantiate(outputPrefab);
            municipalBudgetOutput.name = "MunicipalBudget_OutputPanel";
            outputPanel.SetPanel(municipalBudgetOutput.transform);
            municipalBudgetOutput.OnItemHovering += OnItemHover;

            // Add event listeners
            siteBrowser.OnBeforeActiveSiteChange += OnBeforeActiveSiteChange;
            siteBrowser.OnAfterActiveSiteChange  += OnAfterActiveSiteChange;

            // Listen to any data layers being added/removed
            dataLayers.OnLayerAvailabilityChange += OnLayerAvailabilityChange;

            // Listen to any grids being added/removed
            var gridController = map.GetLayerController <GridLayerController>();
            gridController.OnShowGrid += OnShowGrid;

            // Initialize grids list with already visible grid layers
            foreach (var layer in gridController.mapLayers)
            {
                grids.Add(layer.Grid);
            }

            ShowBudgetLayer(false);

            // Add filter toggle event
            filterToggle.onValueChanged.AddListener(OnFilterToggleChange);
            noDataToggle.onValueChanged.AddListener(OnNoDataToggleChange);
            budgetLayer.useFilters = filterToggle.isOn;

            loadDataCR = StartCoroutine(LoadData());
        }
        else
        {
            if (loadDataCR != null)
            {
                StopCoroutine(loadDataCR);
            }

            // Remove listeners
            siteBrowser.OnBeforeActiveSiteChange -= OnBeforeActiveSiteChange;
            siteBrowser.OnAfterActiveSiteChange  -= OnAfterActiveSiteChange;
            dataLayers.OnLayerAvailabilityChange -= OnLayerAvailabilityChange;
            if (map != null)
            {
                var gridController = map.GetLayerController <GridLayerController>();
                if (gridController)
                {
                    gridController.OnShowGrid -= OnShowGrid;
                }
            }

            // Remove Output panel
            outputPanel.DestroyPanel(municipalBudgetOutput.gameObject);
            municipalBudgetOutput = null;

            // Remove map layer
            DeleteAllLayers();

            // Remove sliders
            foreach (var pair in sliders)
            {
                Destroy(pair.Value.gameObject);
            }
            sliders.Clear();

            grids.Clear();

            dataLayers.ResetToolOpacity();
        }
    }
Example #4
0
 public void SetOutput(bool showOutputPanel = true)
 {
     outputPanel.SetPanel((showOutputPanel) ? planningOutputPanel.transform : null);
 }