コード例 #1
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;
                }
            }
        }
コード例 #2
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;
                }
            }
        }