Ejemplo n.º 1
0
        private static void ClearLayers()
        {
            foreach (Guid key in LayerList.Keys)
            {
                Layer layer = LayerList[key];
                layer.CleanUp();
            }

            LayerList.Clear();
            LayerMaps.Clear();
        }
Ejemplo n.º 2
0
 public static bool DeleteLayerByID(Guid ID, bool removeFromParent, bool updateTree)
 {
     if (LayerList.ContainsKey(ID))
     {
         Layer layer = LayerList[ID];
         layer.CleanUp();
         if (removeFromParent)
         {
             AllMaps[layer.ReferenceFrame].Layers.Remove(layer);
         }
         LayerList.Remove(ID);
         version++;
         if (updateTree)
         {
             LoadTree();
         }
         return(true);
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 3
0
        // Merged layers from Tour Player Alternate universe into the real layer manager layers list
        public static void MergeToursLayers()
        {
            tourLayers = false;
            bool OverWrite        = false;
            bool CollisionChecked = false;

            foreach (String key in allMapsTours.Keys)
            {
                LayerMap map = allMapsTours[key];
                if (!allMaps.ContainsKey(map.Name))
                {
                    LayerMap newMap = new LayerMap(map.Name, ReferenceFrames.Custom);
                    newMap.Frame                      = map.Frame;
                    newMap.LoadedFromTour             = true;
                    LayerManager.AllMaps[newMap.Name] = newMap;
                }
            }
            ConnectAllChildren();
            foreach (Guid key in layerListTours.Keys)
            {
                Layer layer = layerListTours[key];

                if (LayerList.ContainsKey(layer.ID))
                {
                    if (!CollisionChecked)
                    {
                        //todo add UI in the future
                        if (true)
                        // if (UiTools.ShowMessageBox(Language.GetLocalizedText(958, "There are layers with the same name. Overwrite existing layers?"), Language.GetLocalizedText(3, "Microsoft WorldWide Telescope"), System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                        {
                            OverWrite = true;
                        }
                        else
                        {
                            OverWrite = false;
                        }
                        CollisionChecked = true;
                    }

                    if (OverWrite)
                    {
                        LayerManager.DeleteLayerByID(layer.ID, true, false);
                    }
                }

                if (!LayerList.ContainsKey(layer.ID))
                {
                    if (AllMaps.ContainsKey(layer.ReferenceFrame))
                    {
                        LayerList[layer.ID] = layer;

                        AllMaps[layer.ReferenceFrame].Layers.Add(layer);
                    }
                }
                else
                {
                    layer.CleanUp();
                }
            }

            layerListTours.Clear();
            allMapsTours.Clear();
            layerMapsTours.Clear();
            LoadTree();
        }