Beispiel #1
0
 private void OnLayerAvailabilityChange(DataLayer layer, bool visible)
 {
     if (dataLayers.IsLayerActive(layer))
     {
         UpdateLayersOpacity();
     }
 }
Beispiel #2
0
 private void OnLayerAvailabilityChange(DataLayer layer, bool visible)
 {
     if (dataLayers.IsLayerActive(layer))
     {
         dataLayers.AutoReduceToolOpacity();
     }
 }
Beispiel #3
0
    private void OnLayerVisibilityChange(DataLayer layer, bool visible)
    {
        if (layer.Name == networkLayerName && !visible)
        {
            SetNetworkPatch(null);
        }

        if (!dataLayers.IsLayerActive(networkLayer))
        {
            if (movedAwayError)
            {
                ResetErrorMessage();
            }
            ShowError(NetworkLayerOffError);
            deactivatedLayerError = true;
        }
        else if (!dataLayers.IsLayerActive(reachabilityLayer) && reachabilityPatch != null)
        {
            ShowError(ReachabilityLayerOffError);
            deactivatedLayerError = true;
        }
        else if (deactivatedLayerError)
        {
            deactivatedLayerError = false;
            HideErrorMessage();
        }
    }
Beispiel #4
0
    public void ReloadPatches(DataLayer layer, string siteName, int level, int year)
    {
        var site = GetSite(siteName);

        layer.RemovePatches(site, level, year);
        ClearPatchCache();

        if (dataLayers.IsLayerActive(layer))
        {
            layer.UpdatePatches(ActiveSite, map.CurrentLevel, map.MapCoordBounds);
        }
    }
Beispiel #5
0
    private void ResetLayersYear()
    {
        var site = dataManager.ActiveSite;

        foreach (var group in dataManager.groups)
        {
            foreach (var layer in group.layers)
            {
                layer.visibleYear = -1;
                if (dataLayers.IsLayerActive(layer))
                {
                    layer.HideLoadedPatches();
                    layer.UpdatePatches(site, map.CurrentLevel, map.MapCoordBounds);
                }
            }
        }
    }
Beispiel #6
0
    protected override void OnToggleTool(bool isOn)
    {
        if (isOn)
        {
            // Cache references
            dataManager = ComponentManager.Instance.Get <DataManager>();
            dataLayers  = ComponentManager.Instance.Get <DataLayers>();

            // Enable listeners
            dataLayers.OnLayerVisibilityChange += OnDataLayerVisibilityChange;
            slider.onValueChanged.AddListener(OnSliderChange);
            map.OnBoundsChange += OnMapBoundsUpdate;

            foreach (var group in dataManager.groups)
            {
                foreach (var layer in group.layers)
                {
                    if (dataLayers.IsLayerActive(layer))
                    {
                        activeLayers.Add(layer);
                        layer.OnPatchVisibilityChange += OnPatchVisibilityChange;
                    }
                }
            }

            CheckVisibleData();
        }
        else
        {
            // Disable listeners
            dataLayers.OnLayerVisibilityChange -= OnDataLayerVisibilityChange;
            slider.onValueChanged.RemoveAllListeners();
            map.OnBoundsChange -= OnMapBoundsUpdate;

            foreach (var layer in activeLayers)
            {
                layer.OnPatchVisibilityChange -= OnPatchVisibilityChange;
            }

            activeLayers.Clear();

            ResetLayersYear();

            selectedYear = -1;
        }
    }