public override List<LayerUITreeNode> GetTreeNodes()
        {
            var nodes = new List<LayerUITreeNode>();
            var nameColumn = layer.GetNameColumn();
            for (var i = 0; i < layer.shapefile.Shapes.Count; i++)
            {
                var type = layer.shapefile.Shapes[i].GetType();

                var node = new LayerUITreeNode();
                if (nameColumn == -1)
                {
                    node.Name = type.Name;
                }
                else
                {
                    node.Name = layer.shapefile.Shapes[i].Attributes[nameColumn].ToString();
                }

                node.Tag = layer.shapefile.Shapes[i];
                node.Checked = true;
                node.NodeSelected += node_NodeSelected;
                nodes.Add(node);
            }
            return nodes;
        }
        void node_NodeSelected(LayerUITreeNode node)
        {
            if (callbacks != null)
            {
                Shape shape = (Shape)node.Tag;

                if (shape.Attributes != null && shape.Attributes.ItemArray.GetLength(0) > 0)
                {

                    Dictionary<String, String> rowData = new Dictionary<string, string>();
                    for (int r = 0; r < shape.Attributes.ItemArray.GetLength(0); r++)
                    {

                        rowData.Add(shape.Attributes.Table.Columns[r].ColumnName, shape.Attributes.ItemArray[r].ToString());

                    }
                    callbacks.ShowRowData(rowData);
                }
            }
        }
Example #3
0
 public virtual List<LayerUIMenuItem> GetNodeContextMenu(LayerUITreeNode node)
 {
     return null;
 }
 void filterNode_NodeSelected(LayerUITreeNode node)
 {
 }
Example #5
0
 public LayerUITreeNode Add(string name)
 {
     LayerUITreeNode node = new LayerUITreeNode();
     node.Name = name;
     node.Parent = this;
     node.Level = this.Level + 1;
     Nodes.Add(node);
     return node;
 }
 public override List<LayerUIMenuItem> GetNodeContextMenu(LayerUITreeNode node)
 {
     return base.GetNodeContextMenu(node);
 }
        void node_NodeChecked(LayerUITreeNode node, bool newState)
        {
            var frame = (ReferenceFrame)node.Tag;

            if (frame != null)
            {
                frame.ShowOrbitPath = newState;
            }
        }
        private void AddFeatureToTree(KmlFeature feature, LayerUITreeNode parent)
        {
            feature.Dirty = false;
            string text = feature.Name;

            //if (!string.IsNullOrEmpty(feature.description))
            //{
            //    text += Environment.NewLine + feature.description;
            //}
            bool bold = false;
            if (text.Contains("<b>"))
            {
                bold = true;
                text = text.Replace("<b>", "").Replace("</b>", "");
            }

            LayerUITreeNode node = null;

            if (!(feature is KmlNetworkLink))
            {
                node = parent.Add(text);
                node.Tag = feature;
                node.Checked = feature.visibility;
                node.Opened = feature.open;
                node.NodeChecked += new LayerUITreeNodeCheckedDelegate(node_NodeChecked);
                node.NodeUpdated += new LayerUITreeNodeUpdatedDelegate(node_NodeUpdated);
                node.NodeActivated += new LayerUITreeNodeActivatedDelegate(node_NodeActivated);
                node.NodeSelected += new LayerUITreeNodeSelectedDelegate(node_NodeSelected);
                if (bold)
                {
                    node.Bold = true;
                }
            }

            if (feature is KmlContainer)
            {
                KmlContainer container = (KmlContainer)feature;
                if (container.children != null)
                {
                    //  if (feature.Style.GetStyle(false).ListStyle.ListItemType != KmlListItemTypes.CheckHideChildren)
                    {

                        foreach (KmlFeature child in container.children)
                        {
                            AddFeatureToTree(child, node);
                        }
                    }
                }
            }
            else
            {
                if (feature is KmlNetworkLink)
                {
                    KmlNetworkLink netLink = (KmlNetworkLink)feature;
                    if (netLink.LinkRoot != null)
                    {
                        AddRootToTree(netLink.LinkRoot, parent);
                    }
                }
            }
        }
 void LoadTree(List<LayerUITreeNode> nodes, List<ObjectNode> children)
 {
     foreach (ObjectNode child in children)
     {
         LayerUITreeNode node = new LayerUITreeNode();
         node.Name = child.Name;
         node.Tag = child;
         node.Checked = child.Enabled;
         node.NodeSelected += new LayerUITreeNodeSelectedDelegate(node_NodeSelected);
         node.NodeChecked += new LayerUITreeNodeCheckedDelegate(node_NodeChecked);
         nodes.Add(node);
         LoadTree(node.Nodes, child.Children);
     }
 }
 void node_NodeChecked(LayerUITreeNode node, bool newState)
 {
 }
 void node_NodeSelected(LayerUITreeNode node)
 {
 }
        public override List<LayerUITreeNode> GetTreeNodes()
        {
            var nodes = new List<LayerUITreeNode>();

                if (Layer.Filters.Count > 0)
                {
                    foreach (var fgt in Layer.Filters)
                    {
                        var node = new LayerUITreeNode();
                        node.Name = fgt.Title;
                        node.Tag = fgt;
                        node.Checked = fgt == Earth3d.MainWindow.UiController;
                        node.NodeSelected += node_NodeSelected;
                        node.NodeChecked += node_NodeChecked;
                        node.NodeActivated += node_NodeActivated;
                        nodes.Add(node);
                    }
                }

            return nodes;
        }
 void node_NodeActivated(LayerUITreeNode node)
 {
     Earth3d.MainWindow.UiController = node.Tag as FilterGraphTool;
 }
        public override List<LayerUIMenuItem> GetNodeContextMenu(LayerUITreeNode node)
        {
            var items = new List<LayerUIMenuItem>();

            //LayerUIMenuItem ColorMenu = new LayerUIMenuItem();
            //ColorMenu.Name = "Color";
            //ColorMenu.MenuItemSelected += new MenuItemSelectedDelegate(ColorMenu_MenuItemSelected);
            //ColorMenu.Tag = node.Tag;
            //items.Add(ColorMenu);

            return items;
        }
        void node_NodeSelected(LayerUITreeNode node)
        {
            if (callbacks != null)
            {
                ObjectNode child = (ObjectNode)node.Tag;

                Dictionary<String, String> rowData = new Dictionary<string, string>();

                rowData.Add("Name", child.Name);
                rowData.Add("Pivot.X", child.PivotPoint.X.ToString());
                rowData.Add("Pivot.Y", child.PivotPoint.Y.ToString());
                rowData.Add("Pivot.Z", child.PivotPoint.Z.ToString());
                callbacks.ShowRowData(rowData);

                //Object3dLayer.sketch.Clear();
                //Object3dLayer.sketch.AddLine(new Vector3d(0, 0, 0), new Vector3d(child.PivotPoint.X,-child.PivotPoint.Z,child.PivotPoint.Y));
            }
        }
        void node_NodeChecked(LayerUITreeNode node, bool newState)
        {
            ObjectNode child = (ObjectNode)node.Tag;

            if (child != null)
            {
                child.Enabled = newState;
            }
        }
        public override List<LayerUITreeNode> GetTreeNodes()
        {
            LayerUITreeNode parent = new LayerUITreeNode();

            AddRootToTree(layer.root, parent);

            return parent.Nodes;
        }
 void node_NodeActivated(LayerUITreeNode node)
 {
     if (node != null && node.Tag is KmlFeature)
     {
         KmlFeature feature = (KmlFeature)node.Tag;
         if (feature.LookAt != null)
         {
             if (feature.sky)
             {
                 Earth3d.MainWindow.GotoTarget(new TourPlace(feature.Name, feature.LookAt.latitude, (feature.LookAt.longitude + 180) / 15, Classification.Unidentified, "", ImageSetType.Sky, .8), false, false, true);
             }
             else
             {
                 GotoLookAt(feature);
             }
         }
         else if (node.Tag is KmlPlacemark)
         {
             KmlPlacemark placemark = (KmlPlacemark)node.Tag;
             if (placemark.geometry != null)
             {
                 KmlCoordinate point = placemark.geometry.GetCenterPoint();
                 if (placemark.sky)
                 {
                     Earth3d.MainWindow.GotoTarget(new TourPlace(placemark.Name, point.Lat, (point.Lng + 180) / 15, Classification.Unidentified, "", ImageSetType.Sky, .8), false, false, true);
                 }
                 else
                 {
                     Earth3d.MainWindow.GotoTarget(new TourPlace(placemark.Name, point.Lat, point.Lng, Classification.Unidentified, "", ImageSetType.Earth, .8), false, false, true);
                 }
             }
             //if (placemark.geometry is KmlPoint)
             //{
             //    KmlPoint point = (KmlPoint)placemark.geometry;
             //    if (placemark.sky)
             //    {
             //        Earth3d.MainWindow.GotoTarget(new TourPlace(placemark.Name, point.latitude, (point.longitude + 180) / 15, Classification.Unidentified, "", ImageSetType.Sky, .8), false, false, true);
             //    }
             //    else
             //    {
             //        Earth3d.MainWindow.GotoTarget(new TourPlace(placemark.Name, point.latitude, point.longitude, Classification.Unidentified, "", ImageSetType.Earth, .8), false, false, true);
             //    }
             //}
         }
     }
 }
 private static void CheckAllChildren(LayerUITreeNode node)
 {
     // deep check children
     foreach (LayerUITreeNode child in node.Nodes)
     {
         child.Checked = true;
         KmlFeature childFeature = child.Tag as KmlFeature;
         if (childFeature != null)
         {
             childFeature.visibility = true;
         }
         CheckAllChildren(child);
     }
 }
        void node_NodeSelected(LayerUITreeNode node)
        {
            if (node != null)
            {
                KmlPlacemark feature = node.Tag as KmlPlacemark;

                if (feature != null)
                {
                    feature.Selected = true;
                    layer.DeselectAll();
                    layer.RetainedVisualsDirty = true;
                }
            }
        }
 private void AddRootToTree(KmlRoot root, LayerUITreeNode node)
 {
     if (root.children != null)
     {
         foreach (KmlFeature child in root.children)
         {
             AddFeatureToTree(child, node);
         }
     }
 }
        void node_NodeChecked(LayerUITreeNode node, bool newState)
        {
            var child = node.Tag as SkyOverlay;

            if (child != null)
            {
                child.Enabled = newState;
            }
        }
        void node_NodeChecked(LayerUITreeNode node, bool newState)
        {
            layer.RetainedVisualsDirty = true;
            KmlFeature item = node.Tag as KmlFeature;
            if (item != null)
            {
                KmlFeature feature = node.Tag as KmlFeature;
                if (node.Tag is KmlFeature)
                {
                    // todo wire up true selection
                    bool selected = false;

                    KmlFeature parent = node.Parent.Tag as KmlFeature;
                    bool radioFolder = false;

                    radioFolder = parent == null ? false : parent.Style.GetStyle(selected).ListStyle.ListItemType == KmlListItemTypes.RadioFolder;
                    if (radioFolder)
                    {
                        // Radio folders can't uncheck themselves
                        if (feature.visibility && !node.Checked )
                        {
                            node.Checked = true;
                        }
                        else
                        {
                            feature.visibility = node.Checked;
                        }

                    }
                    else
                    {
                        // Radio folders can't uncheck themselves
                        feature.visibility = node.Checked;

                    }

                    if (feature.visibility)
                    {
                        if (feature.Style.GetStyle(selected).ListStyle.ListItemType != KmlListItemTypes.CheckOffOnly)
                        {
                            if (feature.Style.GetStyle(selected).ListStyle.ListItemType != KmlListItemTypes.RadioFolder)
                            {
                                CheckAllChildren(node);
                            }
                        }

                        // Uncheck siblings if we are a radio button
                        if (node.Parent.Tag is KmlFeature)
                        {
                            if (radioFolder)
                            {
                                foreach (LayerUITreeNode sibling in node.Parent.Nodes)
                                {
                                    if (sibling != node)
                                    {
                                        sibling.Checked = false;
                                        KmlFeature siblingFeature = sibling.Tag as KmlFeature;
                                        if (siblingFeature != null)
                                        {
                                            siblingFeature.visibility = false;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        void layerNode_NodeUpdated(LayerUITreeNode layerNode)
        {
            if (layerNode.UiUpdating)
            {
                // ignore events we started.
                return;
            }
            TreeNode node = layerNode.ReferenceTag as TreeNode;
            if (node != null)
            {
                if (node.Checked != layerNode.Checked)
                {
                    node.Checked = layerNode.Checked;
                }

                if (node.Text != layerNode.Name)
                {
                    node.Text = layerNode.Name;
                }

                if (node.IsExpanded != layerNode.Opened)
                {
                    if (layerNode.Opened)
                    {
                        node.Expand();
                    }
                    else
                    {
                        node.Collapse();
                    }
                }
            }
        }
 void node_NodeUpdated(LayerUITreeNode node)
 {
     layer.RetainedVisualsDirty = true;
 }
        private void LoadLayerChild(LayerUITreeNode layerNode, TreeNode parent)
        {
            TreeNode node = parent.Nodes.Add(layerNode.Name);
            node.Tag = layerNode;
            node.Checked = layerNode.Checked;
            node.Name = node.Text;
            layerNode.ReferenceTag = node;
            layerNode.NodeUpdated += new LayerUITreeNodeUpdatedDelegate(layerNode_NodeUpdated);

            foreach (LayerUITreeNode child in layerNode.Nodes)
            {
                LoadLayerChild(child, node);
            }

            if (node.IsExpanded != layerNode.Opened)
            {
                node.Expand();
            }
        }
        public override List<LayerUITreeNode> GetTreeNodes()
        {
            var nodes = new List<LayerUITreeNode>();
            foreach (var frame in layer.Frames)
            {

                var node = new LayerUITreeNode();
                node.Name = frame.Name;

                node.Tag = frame;
                node.Checked = frame.ShowOrbitPath;
                node.NodeSelected += node_NodeSelected;
                node.NodeChecked += node_NodeChecked;
                nodes.Add(node);
            }
            return nodes;
        }
        public void UpdateNode(Layer layer, LayerUITreeNode node)
        {
            if (node == null)
            {
                if (layer != null)
                {
                    TreeNode[] results = layerTree.Nodes.Find(layer.Name, true);

                    foreach(TreeNode child in results)
                    {
                        if (child.Tag == layer)
                        {
                            child.Nodes.Clear();
                            this.LoadLayerChildren(layer, child);
                        }
                    }
                }
            }
        }
        void node_NodeSelected(LayerUITreeNode node)
        {
            if (callbacks != null)
            {
                var frame = (ReferenceFrame)node.Tag;

                var rowData = new Dictionary<string, string>();

                rowData.Add("Name", frame.Name);
                rowData.Add("SemiMajor Axis", frame.SemiMajorAxis.ToString());
                rowData.Add("SMA Units", frame.SemiMajorAxisUnits.ToString());
                rowData.Add("Inclination", frame.Inclination.ToString());
                rowData.Add("Eccentricity", frame.Eccentricity.ToString());
                rowData.Add("Long of Asc. Node", frame.LongitudeOfAscendingNode.ToString());
                rowData.Add("Argument Of Periapsis", frame.ArgumentOfPeriapsis.ToString());
                rowData.Add("Epoch", frame.Epoch.ToString());
                rowData.Add("Mean Daily Motion", frame.MeanDailyMotion.ToString());
                rowData.Add("Mean Anomoly at Epoch", frame.MeanAnomolyAtEpoch.ToString());
                callbacks.ShowRowData(rowData);
            }
        }
 void filterNode_NodeChecked(LayerUITreeNode node, bool newState)
 {
     var filter = node.Tag as ConstellationFilter;
     if (filter != null)
     {
         filter.SetAll(newState);
     }
 }