예제 #1
0
    //
    // Unity Methods
    //

    private void Awake()
    {
        // Components
        var componentManager = ComponentManager.Instance;

        inspectorTool       = componentManager.Get <InspectorTool>();
        contoursTool        = componentManager.Get <ContoursTool>();
        dataLayers          = componentManager.Get <DataLayers>();
        gridLayerController = inspectorTool.Map.GetLayerController <GridLayerController>();
        translator          = LocalizationManager.Instance;

        areaPSUIRef.Init(translator);
        contourPSUIRef.Init(translator);

        // Initialize dropdowns
        inspectorOutputDropdowns = new InspectorOutputDropdown[]
        {
            new InspectorOutputDropdown(areaTypeDropdown, AreaTypeOptions),
            new InspectorOutputDropdown(areaPSUIRef.summaryDropdown, PSO.AreaSummaryOptions),
            new InspectorOutputDropdown(areaPSUIRef.metricsDropdown, PSO.MetricsOptions),
        };
        InitDropdowns();

        // Initialize properties and summaries
        int maxInspectionCount = inspectorTool.maxInspectionCount;

        areaPS = new AreaPS[maxInspectionCount];
        for (int i = 0; i < maxInspectionCount; ++i)
        {
            areaPS[i] = new AreaPS();
        }
        contourPS = new ContourPS();

        // Initialize listeners
        gridLayerController.OnShowGrid += OnShowGrid;
        LocalizationManager.Instance.OnLanguageChanged += OnLanguageChanged;
        areaTypeDropdown.onValueChanged.AddListener(UpdatePropertiesAndSummariesPanel);
        areaPSUIRef.summaryDropdown.onValueChanged.AddListener(UpdateAreaPanel);
        areaPSUIRef.computeCorrelationButton.onClick.AddListener(OnComputeCorrelationClicked);

        // Update panels
        UpdatePropertiesAndSummariesPanel(Area);
        UpdateAreaPanel(AreaPS.SelectedArea);
        UpdateContourPanel();

        ResetAndClearOutput();

        // If contours tool is already open and there is a selected contour
        if (contoursTool != null && inspectorTool.InspectOutput != null)
        {
            inspectorTool.InspectOutput.AreaOutput.UpdateContourInspectorOutput(dataLayers);
        }
    }
예제 #2
0
    private void PlotAreaData()
    {
        currAreaInspectionIndex = inspectorTool.areaInspectorPanel.areaInspector.CurrAreaInspection;

        if (currAreaInspectionIndex == -1)
        {
            return;
        }

        AreaPS currPS = areaPS[currAreaInspectionIndex];

        foreach (var inspectorOutputItem in areaDO.itemslist)
        {
            InspectorOutputItemLabel inspectorOutputItemLabel = null;
            string itemName = inspectorOutputItem.name;

            if (areaDO.inspectorOutputItemLabels.ContainsKey(itemName))
            {
                inspectorOutputItemLabel = areaDO.inspectorOutputItemLabels[itemName];
            }
            else
            {
                inspectorOutputItemLabel = Instantiate(itemPrefab, areaPSUIRef.container, false);

                inspectorOutputItemLabel.name = itemName;
                inspectorOutputItemLabel.SetName(itemName);
                inspectorOutputItemLabel.SetUnitsValue(inspectorOutputItem.units);
                inspectorOutputItemLabel.SetDotColor(inspectorOutputItem.dotColor);

                areaDO.inspectorOutputItemLabels.Add(itemName, inspectorOutputItemLabel);
            }

            float max    = inspectorOutputItem.maxVal,
                  min    = inspectorOutputItem.minVal,
                  median = inspectorOutputItem.medianVal,
                  mean   = inspectorOutputItem.meanVal,
                  sum    = inspectorOutputItem.sumVal;

            inspectorOutputItemLabel.SetMaxValue(max.ToString("#,##0.##"));
            inspectorOutputItemLabel.SetMedianValue(median.ToString("#,##0.##"));
            inspectorOutputItemLabel.SetMinValue(min.ToString("#,##0.##"));
            inspectorOutputItemLabel.SetMeanValue(mean.ToString("#,##0.##"));
            inspectorOutputItemLabel.SetSumValue(sum.ToString("#,##0.##"));

            PS.AddOrUpdateMetric(currPS.maxVal, itemName, max);
            PS.AddOrUpdateMetric(currPS.minVal, itemName, min);
            PS.AddOrUpdateMetric(currPS.medianVal, itemName, median);
            PS.AddOrUpdateMetric(currPS.meanVal, itemName, mean);
            PS.AddOrUpdateMetric(currPS.sumVal, itemName, sum);
        }
    }
예제 #3
0
    public void SelectedTotalArea(AreaPropertiesAndSummaries areaPS)
    {
        var   suffix = "";
        float area   = (float)(areaPS.totalArea * 0.000001);

        if (area > 1e+12)
        {
            area  *= 1e-12f;
            suffix = " " + translator.Get("trillion");
        }
        else if (area > 1e+9)
        {
            area  *= 1e-9f;
            suffix = " " + translator.Get("billion");
        }
        else if (area > 1e+6)
        {
            area  *= 1e-6f;
            suffix = " " + translator.Get("million");
        }

        totalAreaVal.text = area.ToString("#,##0.##") + suffix + " km\xB2";
    }
예제 #4
0
 public void SelectedNoDataArea(AreaPropertiesAndSummaries areaPS)
 {
     noDataAreaVal.text = (areaPS.noDataArea * 100).ToString("0.##") + "%";
 }