Ejemplo n.º 1
0
    public void ToggleMapViewingMode(List <GameObject> maps = null)
    {
        mapviewingMode = mapviewingMode == MapViewingMode.FLAT ? MapViewingMode.STACKED : MapViewingMode.FLAT;
        FlatMapCamera.SetActive(mapviewingMode == MapViewingMode.FLAT);
        //UICanvas.SetActive(mapviewingMode == MapViewingMode.FLAT);

        if (mapviewingMode == MapViewingMode.FLAT)
        {
            SilkMap.instance.removeSnapShots();
        }

        if (mapviewingMode == MapViewingMode.STACKED)
        {
            //PABLO CERRAR PANEL DE FILTROS
            HideFiltersPanel();
            StackedMapVirtualCamera.GetComponent <CameraFollowMap>().PopulateListOfMaps(maps.Select(m => m.transform).ToList());
        }
        StackedMapCamera.SetActive(mapviewingMode == MapViewingMode.STACKED);
        StackedMapCanvas.SetActive(mapviewingMode == MapViewingMode.STACKED);
        //Deactivate user interaction when mapmode is Stacked
        OnlineMapsCameraOrbit.instance.enabled             = mapviewingMode == MapViewingMode.FLAT;
        OnlineMapsTileSetControl.instance.allowUserControl = mapviewingMode == MapViewingMode.FLAT;
        OnlineMapsTileSetControl.instance.allowZoom        = mapviewingMode == MapViewingMode.FLAT;
        //Hide TimeVisualizationPanel
        if (mapviewingMode == MapViewingMode.STACKED && timeVisualizationPanelGameObject.activeSelf)
        {
            timeVisualizationPanelGameObject.SetActive(false);
        }

        //If MapviewingModed.STACKED -> disable all buttons except filters.

        ExitTimeVisualizationButton.SetActive(mapviewingMode == MapViewingMode.STACKED);
        RelationsToggle.SetActive(mapviewingMode != MapViewingMode.STACKED);

        foreach (var btn in FooterButtonBar.GetComponentsInChildren <Button>())
        {
            if (/*btn.gameObject.name != "Filter" && */ mapviewingMode == MapViewingMode.STACKED)
            {
                btn.interactable = false;
            }
            else
            {
                btn.interactable = true;
            }
        }
    }
Ejemplo n.º 2
0
        /// <summary>
        /// utility function to open and activate a map given the map url.
        /// </summary>
        /// <param name="url">unique map identifier</param>
        internal static async void OpenAndActivateMap(string url)
        {
            // find the map; returns null if map has never been opened in the Pro session
            Map map = MappingModule.FindMap(url);

            // default viewing mode
            MapViewingMode mode         = MapViewingMode.Item2D;
            bool           bAlreadyOpen = false;

            // if returns null - it has never been opened
            if (map == null)
            {
                // find the map mode (2d / 3d from the project items)
                MapProjectItem mapPI = ProjectModule.CurrentProject.GetMaps().FirstOrDefault(m => m.Path == url);
                if (mapPI != null)
                {
                    mode = mapPI.ViewingMode;
                }
            }
            else
            {
                mode = map.ViewingMode;

                // see if its already open
                IList <IMapPane> mapPanes = MappingModule.GetMapPanes(map);
                if ((mapPanes != null) && (mapPanes.Count > 0))
                {
                    bAlreadyOpen = true;

                    // activate the first one
                    Pane pane = mapPanes[0] as Pane;
                    if (pane != FrameworkApplication.Panes.ActivePane)
                    {
                        pane.Activate();
                    }
                }
            }

            // open it with the correct mode
            if (!bAlreadyOpen)
            {
                var mapPane = MappingModule.OpenMapView(url, mode);
                await Utils.BlockUntil(() => mapPane.MapView != null && mapPane.MapView.ViewerID >= 0);
            }
        }