public static DialogResult ShowPropertiesSheet(ReferenceFrame frame)
        {
            WizardPropsBinding props = GetPropsObject();
            props.Data = frame;

            PropsShell shell = new PropsShell(props);
            props.UpdateTabVisibility += new UpdateTabDelegate(props_UpdateTabVisibility);

            return shell.ShowDialog();
        }
        public static DialogResult ShowPropertiesSheet(ReferenceFrame frame)
        {
            var props = GetPropsObject();
            props.Data = frame;

            var shell = new PropsShell(props);
            props.UpdateTabVisibility += props_UpdateTabVisibility;

            return shell.ShowDialog();
        }
 public override void SetData(object data)
 {
     frame = data as ReferenceFrame;
 }
        void newMenu_Click(object sender, EventArgs e)
        {
            LayerMap target = (LayerMap)layerTree.SelectedNode.Tag;
            ReferenceFrame frame = new ReferenceFrame();
            frame.SystemGenerated = false;
            if (FrameWizard.ShowWizard(frame) == DialogResult.OK)
            {
                LayerMap newMap = new LayerMap(frame.Name, ReferenceFrames.Custom);
                if (!AllMaps.ContainsKey(frame.Name))
                {
                    newMap.Frame = frame;

                    target.AddChild(newMap);
                    newMap.Frame.Parent = target.Name;
                    AllMaps.Add(frame.Name, newMap);
                    version++;
                    LoadTreeLocal();
                }
            }
        }
        public static string GetFramePropByName(string name, string propName, out ReferenceFrame frame)
        {
            if (AllMaps.ContainsKey(name))
            {
                frame = AllMaps[name].Frame;

                return frame.GetProp(propName);
            }
            else
            {
                frame = null;
                return "";
            }
        }
Beispiel #6
0
        void IScriptable.SetProperty(string name, string value)
        {
            try
            {
                if (LayerManager.CurrentSelection is LayerMap)
                {
                    LayerMap map = LayerManager.CurrentSelection as LayerMap;
                    if (map.Frame.reference == ReferenceFrames.Custom)
                    {
                        ReferenceFrame frame = map.Frame;
                        double         val;
                        if (name.ToLower() == "scale")
                        {
                            val = double.Parse(value);

                            frame.Scale = val;
                            return;
                        }

                        if (name.ToLower().StartsWith("translate."))
                        {
                            val = double.Parse(value);
                            Vector3d translate = frame.translation;
                            switch (name.ToLower())
                            {
                            case "translate.x":
                                translate.X = val;

                                break;

                            case "translate.y":
                                translate.Y = val;
                                break;

                            case "translate.z":
                                translate.Z = val;
                                break;
                            }
                            frame.translation = translate;
                            return;
                        }

                        frame.SetProp(name, value);
                    }
                }
                if (LayerManager.CurrentSelection is Layer)
                {
                    //MethodInvoker doIt = delegate
                    //{
                    //    Earth3d.MainWindow.Text = value;
                    //};

                    //Earth3d.MainWindow.Invoke(doIt);

                    Layer layer = LayerManager.CurrentSelection as Layer;
                    if (layer is Object3dLayer)
                    {
                        Object3dLayer object3d = layer as Object3dLayer;
                        double        val;
                        if (name.ToLower() == "scale")
                        {
                            val = double.Parse(value);

                            object3d.Scale = new Vector3d(val, val, val);
                            return;
                        }

                        if (name.ToLower().StartsWith("translate."))
                        {
                            val = double.Parse(value);
                            Vector3d translate = object3d.Translate;
                            switch (name.ToLower())
                            {
                            case "translate.x":
                                translate.X = val;

                                break;

                            case "translate.y":
                                translate.Y = val;
                                break;

                            case "translate.z":
                                translate.Z = val;
                                break;
                            }
                            object3d.Translate = translate;
                        }

                        layer.SetProp(name, value);
                    }
                }
            }
            catch
            {
            }
        }
        private void MakeLayerGroup(string name)
        {
            LayerMap target = (LayerMap)layerTree.SelectedNode.Tag;
            ReferenceFrame frame = new ReferenceFrame();
            frame.Name = name;
            frame.Reference = ReferenceFrames.Identity;
            LayerMap newMap = new LayerMap(frame.Name, ReferenceFrames.Identity);
            newMap.Frame = frame;
            newMap.Frame.SystemGenerated = false;
            target.AddChild(newMap);

            newMap.Frame.Parent = target.Name;
            AllMaps.Add(frame.Name, newMap);
            version++;
        }
 internal static bool CreateLayerGroup(string name, string referenceFrame)
 {
     LayerMap parent = AllMaps[referenceFrame];
     if (parent == null)
     {
         return false;
     }
     try
     {
         ReferenceFrame frame = new ReferenceFrame();
         frame.Name = name;
         frame.Reference = ReferenceFrames.Identity;
         LayerMap newMap = new LayerMap(frame.Name, ReferenceFrames.Identity);
         newMap.Frame = frame;
         newMap.Frame.SystemGenerated = false;
         parent.AddChild(newMap);
         newMap.Frame.Parent = parent.Name;
         AllMaps.Add(frame.Name, newMap);
         LoadTree();
         version++;
         return true;
     }
     catch
     {
         return false;
     }
 }
        void FramePropertiesMenu_Click(object sender, EventArgs e)
        {
            LayerMap target = (LayerMap)layerTree.SelectedNode.Tag;

            ReferenceFrame frame = new ReferenceFrame();
            if (FrameWizard.ShowPropertiesSheet(target.Frame) == DialogResult.OK)
            {

            }
        }
Beispiel #10
0
        public static TourDocument FromXml(string filename)
        {
            var newTour = new TourDocument();
            newTour.filename = filename;
            var doc = new XmlDocument();
            doc.Load(filename);

            XmlNode root = doc["Tour"];

            newTour.id = root.Attributes["ID"].Value;
            newTour.Title = root.Attributes["Title"].Value;
            newTour.Author = root.Attributes["Author"].Value;

            if (root.Attributes["Descirption"] != null)
            {
                newTour.Description = root.Attributes["Descirption"].Value;
            }

            if (root.Attributes["Description"] != null)
            {
                newTour.Description = root.Attributes["Description"].Value;
            }

            if (root.Attributes["AuthorEmail"] != null)
            {
                newTour.authorEmail = root.Attributes["AuthorEmail"].Value;
            }

            if (root.Attributes["Keywords"] != null)
            {
                newTour.Keywords = root.Attributes["Keywords"].Value;
            }

            if (root.Attributes["OrganizationName"] != null)
            {
                newTour.OrgName = root.Attributes["OrganizationName"].Value;
            }

            if (root.Attributes["DomeMode"] != null)
            {
                newTour.DomeMode = bool.Parse(root.Attributes["DomeMode"].Value);
            }

            newTour.organizationUrl = root.Attributes["OrganizationUrl"].Value;
            newTour.level = (UserLevel)Enum.Parse(typeof(UserLevel), root.Attributes["UserLevel"].Value);
            newTour.type = (Classification)Enum.Parse(typeof(Classification), root.Attributes["Classification"].Value);
            newTour.taxonomy = root.Attributes["Taxonomy"].Value;

            var timeLineTour = false;
            if (root.Attributes["TimeLineTour"] != null)
            {
                timeLineTour = bool.Parse(root.Attributes["TimeLineTour"].Value);
            }

            XmlNode TourStops = null;

            if (timeLineTour)
            {
                TourStops = root["TimeLineTourStops"];
            }
            else
            {
                TourStops = root["TourStops"];
            }

            foreach (XmlNode tourStop in TourStops)
            {
                newTour.AddTourStop(TourStop.FromXml(newTour, tourStop));
            }

            XmlNode Frames = root["ReferenceFrames"];

            if (Frames != null)
            {
                foreach (XmlNode frame in Frames)
                {
                    var newFrame = new ReferenceFrame();
                    newFrame.InitializeFromXml(frame);
                    if (!LayerManager.AllMaps.ContainsKey(newFrame.Name))
                    {
                        var map = new LayerMap(newFrame.Name, ReferenceFrames.Custom);
                        map.Frame = newFrame;
                        map.LoadedFromTour = true;
                        LayerManager.AllMaps.Add(newFrame.Name, map);
                    }
                }
                LayerManager.ConnectAllChildren();
                LayerManager.LoadTree();
            }

            XmlNode Layers = root["Layers"];

            if (Layers != null)
            {
                foreach (XmlNode layer in Layers)
                {
                    var newLayer = Layer.FromXml(layer, true);
                    var fileName = newTour.WorkingDirectory + string.Format("{0}.txt", newLayer.ID);

                    // Overwite ISS layer if in a tour using the authored ISS details
                    if (LayerManager.LayerList.ContainsKey(newLayer.ID) && newLayer.ID == ISSLayer.ISSGuid)
                    {
                        LayerManager.DeleteLayerByID(newLayer.ID, true, false);
                    }

                    // Ask about merging other layers.
                    if (LayerManager.LayerList.ContainsKey(newLayer.ID) && newLayer.ID != ISSLayer.ISSGuid)
                    {
                        if (!newTour.CollisionChecked)
                        {
                            if (UiTools.ShowMessageBox(Language.GetLocalizedText(958, "There are layers with the same name. Overwrite existing layers?"), Language.GetLocalizedText(3, "Microsoft WorldWide Telescope"), MessageBoxButtons.YesNo) == DialogResult.Yes)
                            {
                                newTour.OverWrite = true;
                            }
                            else
                            {
                                newTour.OverWrite = false;

                            }
                            newTour.CollisionChecked = true;
                        }

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

                    try
                    {
                        newLayer.LoadedFromTour = true;
                        newLayer.LoadData(fileName);
                        LayerManager.Add(newLayer, false);
                    }
                    catch
                    {
                    }
                }
                LayerManager.LoadTree();
            }

            if (File.Exists(newTour.WorkingDirectory + "Author.png"))
            {
                newTour.authorImage = UiTools.LoadBitmap(newTour.WorkingDirectory + "Author.png");
            }

            newTour.tourDirty = 0;
            return newTour;
        }
        public static LayerContainer FromXml(string filename, string parentFrame, bool referenceFrameRightClick)
        {
            var newDoc = new LayerContainer();
            newDoc.filename = filename;
            var doc = new XmlDocument();
            doc.Load(filename);

            XmlNode root = doc["LayerContainer"];
            newDoc.id = root.Attributes["ID"].Value;

            XmlNode Layers = root["Layers"];

            var loadAtNewParent = false;
            if (!referenceFrameRightClick || Layers.ChildNodes.Count != 1)
            {
                XmlNode Frames = root["ReferenceFrames"];

                if (Frames != null)
                {
                    foreach (XmlNode frame in Frames)
                    {
                        var newFrame = new ReferenceFrame();
                        newFrame.InitializeFromXml(frame);

                        if (!LayerManager.AllMaps.ContainsKey(newFrame.Name))
                        {
                            var map = new LayerMap(newFrame.Name, ReferenceFrames.Custom);
                            map.Frame = newFrame;
                            LayerManager.AllMaps.Add(newFrame.Name, map);
                        }
                    }
                    LayerManager.ConnectAllChildren();
                    LayerManager.LoadTree();
                }
            }
            else
            {
                loadAtNewParent = true;
            }

            if (Layers != null)
            {
                foreach (XmlNode layer in Layers)
                {
                    var newLayer = Layer.FromXml(layer, true);
                    var fileName = newDoc.WorkingDirectory + string.Format("{0}.txt", newLayer.ID);

                    if (LayerManager.LayerList.ContainsKey(newLayer.ID) && newLayer.ID != ISSLayer.ISSGuid)
                    {
                        if (!newDoc.CollisionChecked)
                        {
                            if (UiTools.ShowMessageBox(Language.GetLocalizedText(958, "There are layers with the same name. Overwrite existing layers?"), Language.GetLocalizedText(3, "Microsoft WorldWide Telescope"), MessageBoxButtons.YesNo) == DialogResult.Yes)
                            {
                                newDoc.OverWrite = true;
                            }
                            else
                            {
                                newDoc.OverWrite = false;

                            }
                            newDoc.CollisionChecked = true;
                        }

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

                    newLayer.LoadData(fileName);

                    if (loadAtNewParent)
                    {
                        newLayer.ReferenceFrame = parentFrame;
                    }

                    LayerManager.Add(newLayer, false);
                    newDoc.LastLoadedLayer = newLayer;

                }
                LayerManager.LoadTree();
            }

            newDoc.tourDirty = 0;
            return newDoc;
        }
Beispiel #12
0
        public void MergeTourStopsFromXml(string filename)
        {
            var doc = new XmlDocument();
            doc.Load(filename);

            XmlNode root = doc["Tour"];

            var timeLineTour = false;
            if (root.Attributes["TimeLineTour"] != null)
            {
                timeLineTour = bool.Parse(root.Attributes["TimeLineTour"].Value);
            }

            XmlNode TourStops = null;

            if (timeLineTour)
            {
                TourStops = root["TimeLineTourStops"];
            }
            else
            {
                TourStops = root["TourStops"];
            }

            foreach (XmlNode tourStop in TourStops)
            {
                currentTourstopIndex++;
                InsertTourStop(TourStop.FromXml(this, tourStop));
            }

            XmlNode Frames = root["ReferenceFrames"];

            if (Frames != null)
            {
                foreach (XmlNode frame in Frames)
                {
                    var newFrame = new ReferenceFrame();
                    newFrame.InitializeFromXml(frame);
                    if (!LayerManager.AllMaps.ContainsKey(newFrame.Name))
                    {
                        var map = new LayerMap(newFrame.Name, ReferenceFrames.Custom);
                        map.Frame = newFrame;
                        LayerManager.AllMaps.Add(newFrame.Name, map);
                    }
                }
                LayerManager.ConnectAllChildren();
                LayerManager.LoadTree();
            }

            XmlNode Layers = root["Layers"];

            if (Layers != null)
            {
                foreach (XmlNode layer in Layers)
                {
                    var newLayer = Layer.FromXml(layer, true);
                    var fileName = WorkingDirectory + string.Format("{0}.txt", newLayer.ID);

                    newLayer.LoadData(fileName);
                    LayerManager.Add(newLayer, false);

                }
                LayerManager.LoadTree();
            }
        }
Beispiel #13
0
        public void MergeTourStopsFromXml(string filename)
        {
            XmlDocument doc = new XmlDocument();

            doc.Load(filename);


            XmlNode root = doc["Tour"];


            bool timeLineTour = false;

            if (root.Attributes["TimeLineTour"] != null)
            {
                timeLineTour = bool.Parse(root.Attributes["TimeLineTour"].Value);
            }


            XmlNode TourStops = null;

            if (timeLineTour)
            {
                TourStops = root["TimeLineTourStops"];
            }
            else
            {
                TourStops = root["TourStops"];
            }

            foreach (XmlNode tourStop in TourStops)
            {
                currentTourstopIndex++;
                InsertTourStop(TourStop.FromXml(this, tourStop));
            }

            XmlNode Frames = root["ReferenceFrames"];

            if (Frames != null)
            {
                foreach (XmlNode frame in Frames)
                {
                    ReferenceFrame newFrame = new ReferenceFrame();
                    newFrame.InitializeFromXml(frame);
                    if (!LayerManager.AllMaps.ContainsKey(newFrame.Name))
                    {
                        LayerMap map = new LayerMap(newFrame.Name, ReferenceFrames.Custom);
                        map.Frame = newFrame;
                        LayerManager.AllMaps.Add(newFrame.Name, map);
                    }
                }
                LayerManager.ConnectAllChildren();
                LayerManager.LoadTree();
            }



            XmlNode Layers = root["Layers"];

            if (Layers != null)
            {
                foreach (XmlNode layer in Layers)
                {
                    Layer  newLayer = Layer.FromXml(layer, true);
                    string fileName = WorkingDirectory + string.Format("{0}.txt", newLayer.ID.ToString());

                    newLayer.LoadData(fileName);
                    LayerManager.Add(newLayer, false);
                }
                LayerManager.LoadTree();
            }
        }
Beispiel #14
0
        public static TourDocument FromXml(string filename)
        {
            TourDocument newTour = new TourDocument();

            newTour.filename = filename;
            XmlDocument doc = new XmlDocument();

            doc.Load(filename);


            XmlNode root = doc["Tour"];


            newTour.id     = root.Attributes["ID"].Value.ToString();
            newTour.Title  = root.Attributes["Title"].Value.ToString();
            newTour.Author = root.Attributes["Author"].Value.ToString();

            if (root.Attributes["Descirption"] != null)
            {
                newTour.Description = root.Attributes["Descirption"].Value;
            }

            if (root.Attributes["Description"] != null)
            {
                newTour.Description = root.Attributes["Description"].Value;
            }

            if (root.Attributes["AuthorEmail"] != null)
            {
                newTour.authorEmail = root.Attributes["AuthorEmail"].Value;
            }

            if (root.Attributes["Keywords"] != null)
            {
                newTour.Keywords = root.Attributes["Keywords"].Value;
            }

            if (root.Attributes["OrganizationName"] != null)
            {
                newTour.OrgName = root.Attributes["OrganizationName"].Value;
            }

            if (root.Attributes["DomeMode"] != null)
            {
                newTour.DomeMode = bool.Parse(root.Attributes["DomeMode"].Value);
            }

            newTour.organizationUrl = root.Attributes["OrganizationUrl"].Value.ToString();
            newTour.level           = (UserLevel)Enum.Parse(typeof(UserLevel), root.Attributes["UserLevel"].Value.ToString());
            newTour.type            = (Classification)Enum.Parse(typeof(Classification), root.Attributes["Classification"].Value.ToString());
            newTour.taxonomy        = root.Attributes["Taxonomy"].Value.ToString();

            bool timeLineTour = false;

            if (root.Attributes["TimeLineTour"] != null)
            {
                timeLineTour = bool.Parse(root.Attributes["TimeLineTour"].Value);
            }


            XmlNode TourStops = null;

            if (timeLineTour)
            {
                TourStops = root["TimeLineTourStops"];
            }
            else
            {
                TourStops = root["TourStops"];
            }


            foreach (XmlNode tourStop in TourStops)
            {
                newTour.AddTourStop(TourStop.FromXml(newTour, tourStop));
            }

            XmlNode Frames = root["ReferenceFrames"];

            if (Frames != null)
            {
                foreach (XmlNode frame in Frames)
                {
                    ReferenceFrame newFrame = new ReferenceFrame();
                    newFrame.InitializeFromXml(frame);
                    if (!LayerManager.AllMaps.ContainsKey(newFrame.Name))
                    {
                        LayerMap map = new LayerMap(newFrame.Name, ReferenceFrames.Custom);
                        map.Frame          = newFrame;
                        map.LoadedFromTour = true;
                        LayerManager.AllMaps.Add(newFrame.Name, map);
                    }
                }
                LayerManager.ConnectAllChildren();
                LayerManager.LoadTree();
            }

            XmlNode Layers = root["Layers"];

            if (Layers != null)
            {
                foreach (XmlNode layer in Layers)
                {
                    Layer  newLayer = Layer.FromXml(layer, true);
                    string fileName = newTour.WorkingDirectory + string.Format("{0}.txt", newLayer.ID.ToString());

                    // Overwite ISS layer if in a tour using the authored ISS details
                    if (LayerManager.LayerList.ContainsKey(newLayer.ID) && newLayer.ID == ISSLayer.ISSGuid)
                    {
                        LayerManager.DeleteLayerByID(newLayer.ID, true, false);
                    }

                    // Ask about merging other layers.
                    if (LayerManager.LayerList.ContainsKey(newLayer.ID) && newLayer.ID != ISSLayer.ISSGuid)
                    {
                        if (!newTour.CollisionChecked)
                        {
                            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)
                            {
                                newTour.OverWrite = true;
                            }
                            else
                            {
                                newTour.OverWrite = false;
                            }
                            newTour.CollisionChecked = true;
                        }

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

                    try
                    {
                        newLayer.LoadedFromTour = true;
                        newLayer.LoadData(fileName);
                        LayerManager.Add(newLayer, false);
                    }
                    catch
                    {
                    }
                }
                LayerManager.LoadTree();
            }

            if (File.Exists(newTour.WorkingDirectory + "Author.png"))
            {
                newTour.authorImage = UiTools.LoadBitmap(newTour.WorkingDirectory + "Author.png");
            }

            newTour.tourDirty = 0;
            return(newTour);
        }
Beispiel #15
0
 public override void SetData(object data)
 {
     frame = data as ReferenceFrame;
 }
        public static bool CreateReferenceFrame(string name, string parent, string xml)
        {
            if (!AllMaps.ContainsKey(name) && AllMaps.ContainsKey(parent))
            {
                LayerMap target = AllMaps[parent];
                ReferenceFrame frame = new ReferenceFrame();
                frame.Name = name;

                if (!string.IsNullOrEmpty(xml))
                {
                    if (!frame.SetProps(xml))
                    {
                        return false;
                    }
                }

                LayerMap newMap = new LayerMap(frame.Name, ReferenceFrames.Custom);
                newMap.Frame = frame;
                target.AddChild(newMap);
                newMap.Frame.Parent = target.Name;
                AllMaps.Add(frame.Name, newMap);

                version++;
                LoadTree();
                return true;
            }
            return false;
        }
        public override void LoadData(string path)
        {
            filename = path;
            if (File.Exists(filename))
            {
                var data = File.ReadAllLines(path);
                frames.Clear();
                for (var i = 0; i < data.Length; i += 2)
                {
                    var line1 = i;
                    var line2 = i + 1;
                    var frame = new ReferenceFrame();
                    if (data[i].Substring(0, 1) != "1")
                    {
                        line1++;
                        line2++;
                        frame.Name = data[i].Trim();
                        i++;
                    }
                    else if (data[i].Substring(0, 1) == "1")
                    {
                        frame.Name = data[i].Substring(2, 5);
                    }
                    else
                    {
                        i -= 2;
                        continue;
                    }

                    frame.Reference = ReferenceFrames.Custom;
                    frame.Oblateness = 0;
                    frame.ShowOrbitPath = true;
                    frame.ShowAsPoint = true;
                    frame.ReferenceFrameType = ReferenceFrameTypes.Orbital;
                    frame.Scale = 1;
                    frame.SemiMajorAxisUnits = AltUnits.Meters;
                    frame.MeanRadius = 10;
                    frame.Oblateness = 0;
                    frame.FromTLE(data[line1], data[line2], 398600441800000);
                    frames.Add(frame);
                }
            }
        }
Beispiel #18
0
        public static LayerContainer FromXml(string filename, string parentFrame, bool referenceFrameRightClick)
        {
            LayerContainer newDoc = new LayerContainer();

            newDoc.filename = filename;
            XmlDocument doc = new XmlDocument();

            doc.Load(filename);

            XmlNode root = doc["LayerContainer"];

            newDoc.id = root.Attributes["ID"].Value.ToString();

            XmlNode Layers = root["Layers"];

            bool loadAtNewParent = false;

            if (!referenceFrameRightClick || Layers.ChildNodes.Count != 1)
            {
                XmlNode Frames = root["ReferenceFrames"];

                if (Frames != null)
                {
                    foreach (XmlNode frame in Frames)
                    {
                        ReferenceFrame newFrame = new ReferenceFrame();
                        newFrame.InitializeFromXml(frame);

                        if (!LayerManager.AllMaps.ContainsKey(newFrame.Name))
                        {
                            LayerMap map = new LayerMap(newFrame.Name, ReferenceFrames.Custom);
                            map.Frame = newFrame;
                            LayerManager.AllMaps.Add(newFrame.Name, map);
                        }
                    }
                    LayerManager.ConnectAllChildren();
                    LayerManager.LoadTree();
                }
            }
            else
            {
                loadAtNewParent = true;
            }


            if (Layers != null)
            {
                foreach (XmlNode layer in Layers)
                {
                    Layer  newLayer = Layer.FromXml(layer, true);
                    string fileName = newDoc.WorkingDirectory + string.Format("{0}.txt", newLayer.ID.ToString());


                    if (LayerManager.LayerList.ContainsKey(newLayer.ID) && newLayer.ID != ISSLayer.ISSGuid)
                    {
                        if (!newDoc.CollisionChecked)
                        {
                            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)
                            {
                                newDoc.OverWrite = true;
                            }
                            else
                            {
                                newDoc.OverWrite = false;
                            }
                            newDoc.CollisionChecked = true;
                        }

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

                    newLayer.LoadData(fileName);

                    if (loadAtNewParent)
                    {
                        newLayer.ReferenceFrame = parentFrame;
                    }

                    LayerManager.Add(newLayer, false);
                    newDoc.LastLoadedLayer = newLayer;
                }
                LayerManager.LoadTree();
            }

            newDoc.tourDirty = 0;
            return(newDoc);
        }