コード例 #1
0
        /// <summary>
        /// This function is used to Cleanup WWT layers from layer drop down when WWT is not running.
        /// This function performs the following operations:
        ///     1. Remove all WWT only layers.
        ///     2. Mark all Local IN WWT layer as not in sync with WWT.
        ///     3. Set the Selected layer map to null if the Selected WWT layer was deleted in WWT.
        /// </summary>
        /// <param name="workbookMap">
        /// Parent container.
        /// </param>
        internal static void CleanUpWWTLayers(this WorkbookMap workbookMap)
        {
            if (workbookMap != null)
            {
                // 1. Create en empty collection, since this method is called only when WWT is not running. Empty collection is needed
                //    to be passed for UpdateGroupStatus method.
                ICollection <Group> groups           = new List <Group>();
                LayerMap            selectedLayerMap = workbookMap.SelectedLayerMap;

                // 2. Remove all WWT only layers.
                workbookMap.RemoveWWTLayers();

                // 3. On Cleanup, no WWT layers are connected with WWT.
                workbookMap.LocalLayerMaps.ForEach(
                    layer =>
                {
                    // 3.a. Set IsNotInSync.
                    layer.IsNotInSync = true;

                    // 3.b. If the group (reference frame/ Layer Group) is deleted in WWT, then set the IsDeleted flag in Group to true.
                    UpdateGroupStatus(layer.LayerDetails.Group, groups);
                });

                // 4. Set the Selected layer map to null if the Selected WWT layer was deleted in WWT.
                //  If the selected layer is WWT layer/is localInWWT which is not deleted, this will be selected while
                if (selectedLayerMap != null && selectedLayerMap.MapType == LayerMapType.WWT && !workbookMap.Exists(selectedLayerMap.LayerDetails.ID))
                {
                    workbookMap.SelectedLayerMap = null;
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// This function is used to Load all WWT layers on the load of a workbook.
        /// This function performs the following operations:
        ///     1. Remove all WWT only layers.
        ///     2. On load of a workbook, no layers are connected with WWT.
        ///     3. Insert and update deleted WWT Layers.
        /// </summary>
        /// <param name="workbookMap">
        /// Parent container.
        /// </param>
        internal static void LoadWWTLayers(this WorkbookMap workbookMap)
        {
            if (workbookMap != null)
            {
                LayerMap selectedLayerMap = workbookMap.SelectedLayerMap;

                // 1. Remove all WWT only layers.
                workbookMap.RemoveWWTLayers();

                ICollection <Group> groups = WWTManager.GetAllWWTGroups(true);

                // 2. On load of a workbook, no layers are connected with WWT.
                workbookMap.LocalInWWTLayerMaps.ForEach(
                    layer =>
                {
                    // 2.a. Set IsNotInSync.
                    layer.IsNotInSync = true;

                    // 2.b. Update all group references.
                    Group group = SearchGroup(layer.LayerDetails.Group.Name, layer.LayerDetails.Group.Path, groups);
                    if (group != null)
                    {
                        layer.LayerDetails.Group = group;
                    }
                    else
                    {
                        layer.LayerDetails.Group.IsDeleted = true;
                    }
                });

                // 3. Synchronize WWT Layers
                workbookMap.SyncWWTLayers(groups);

                // 4. Set the Selected layer map to null if the Selected WWT layer was deleted in WWT.
                //  If the selected layer is WWT layer/is localInWWT which is not deleted, this will be selected while
                if (selectedLayerMap != null && selectedLayerMap.MapType == LayerMapType.WWT && !workbookMap.Exists(selectedLayerMap.LayerDetails.ID))
                {
                    workbookMap.SelectedLayerMap = null;
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// This function is used to refresh the layer drop down with the latest layers from WWT.
        /// This function performs the following operations:
        ///     1. Remove all WWT only layers.
        ///     2. Insert and update deleted WWT Layers.
        ///     3. Set the Selected layer map to null if the Selected WWT layer was deleted in WWT.
        /// </summary>
        /// <param name="workbookMap">
        /// Parent container.
        /// </param>
        internal static void RefreshLayers(this WorkbookMap workbookMap)
        {
            if (workbookMap != null)
            {
                LayerMap            selectedLayerMap = workbookMap.SelectedLayerMap;
                ICollection <Group> groups           = WWTManager.GetAllWWTGroups(true);

                // 1. Remove all WWT only layers.
                workbookMap.RemoveWWTLayers();

                // 2. Insert and update deleted WWT Layers
                workbookMap.SyncWWTLayers(groups);

                // 3. Set the Selected layer map to null if the Selected WWT layer was deleted in WWT.
                //  If the selected layer is WWT layer/is localInWWT which is not deleted, this will be selected while
                if (selectedLayerMap != null && selectedLayerMap.MapType == LayerMapType.WWT && !workbookMap.Exists(selectedLayerMap.LayerDetails.ID))
                {
                    workbookMap.SelectedLayerMap = null;
                }
            }
        }