예제 #1
0
        private void PLBTree__Select(object sender, TreeViewEventArgs e)
        {
            PLBPanel.Controls.Clear();

            PLBNode node = null;

            try { node = (PLBNode)PLBTree.SelectedNode; }
            catch (Exception)
            {
                PLBPanel_Button_Save.Enabled  = false;
                PLBPanel_Button_Reset.Enabled = false;
                return;
            }

            PLBPanel_Button_Save.Enabled  = true;
            PLBPanel_Button_Reset.Enabled = true;

            PLBControlBase plbControl = null;

            if (node.item is Section)
            {
                plbControl = new PLBControlSection(node);
            }
            else if (node.item is Group)
            {
                plbControl = new PLBControlGroup(node);
            }
            else if (node.item is Layer)
            {
                plbControl = new PLBControlLayer(node);
            }
            else if (node.item is GroupRef)
            {
                plbControl = new PLBControlGroupref(node);
            }
            else if (node.item is ItemEntry)
            {
                plbControl = new PLBControlItem(node);
            }
            else if (node.item is MapEntry)
            {
                plbControl = new PLBControlMap(node);
            }
            else if (node.item is GroupSection)
            {
                plbControl = new PLBControlGroupSection(node);
            }

            if (plbControl != null)
            {
                plbControl.Dock = DockStyle.Fill;
                PLBPanel.Controls.Add(plbControl);
            }
        }
예제 #2
0
        private PLBNode CreateTreeGroupSect(GroupSection section, string prefix)
        {
            PLBNode sectNode = new PLBNode(section.Id);
            PLBNode tempNode = null;

            sectNode.Name             = prefix + '_' + sectNode.Name;
            sectNode.ContextMenuStrip = MenuContext_Containee;
            sectNode.item             = section;

            TreeNode groupNode = new TreeNode(sectNode.Name + "_Groups");

            groupNode.ContextMenuStrip = MenuContext_Container;
            groupNode.Text             = "Groups";
            if (section.Groups != null)
            {
                foreach (Group group in section.Groups)
                {
                    groupNode.Nodes.Add(CreateTreeGroup(group, sectNode.Name));
                }
            }

            TreeNode itemNode = new TreeNode(sectNode.Name + "_Items");

            itemNode.ContextMenuStrip = MenuContext_Container;
            itemNode.Text             = "Items";
            if (section.Items != null)
            {
                foreach (ItemEntry item in section.Items)
                {
                    tempNode = new PLBNode(item.Id);

                    tempNode.Name             = itemNode.Name + '_' + tempNode.Name;
                    tempNode.ContextMenuStrip = MenuContext_Containee;
                    tempNode.item             = item;

                    itemNode.Nodes.Add(tempNode);
                }
            }

            sectNode.Nodes.AddRange(new TreeNode[] { groupNode, itemNode });
            return(sectNode);
        }
예제 #3
0
        private void CreateTree()
        {
            TreeNode parent   = null;
            PLBNode  tempNode = null;

            parent = PLBTree.Nodes["Node_Sect"];
            parent.Nodes.Clear();
            if (data.Sections != null)
            {
                foreach (Section section in data.Sections)
                {
                    parent.Nodes.Add(CreateTreeSection(section));
                }
            }

            parent = PLBTree.Nodes["Node_Group"];
            parent.Nodes.Clear();
            if (data.Groups != null)
            {
                foreach (Group group in data.Groups)
                {
                    parent.Nodes.Add(CreateTreeGroup(group, "Node_Group"));
                }
            }

            parent = PLBTree.Nodes["Node_Lyr"];
            parent.Nodes.Clear();
            if (data.Layers != null)
            {
                foreach (Layer layer in data.Layers)
                {
                    tempNode                  = new PLBNode(layer.Name);
                    tempNode.Name             = "Node_Lyr_" + layer.Name;
                    tempNode.ContextMenuStrip = MenuContext_Containee;
                    tempNode.item             = layer;
                    parent.Nodes.Add(tempNode);
                }
            }
        }
예제 #4
0
        private PLBNode CreateTreeGroup(Group group, string prefix)
        {
            PLBNode groupNode = new PLBNode(group.Id);
            PLBNode tempNode  = null;

            TreeNode[] tempNodes = new TreeNode[3];

            groupNode.Name             = prefix + '_' + group.Id;
            groupNode.ContextMenuStrip = MenuContext_Containee;
            groupNode.item             = group;

            TreeNode sectNode = new TreeNode(groupNode.Name + "_Sections");

            sectNode.ContextMenuStrip = MenuContext_Container;
            sectNode.Text             = "Sections";
            if (group.Sections != null)
            {
                foreach (GroupSection section in group.Sections)
                {
                    sectNode.Nodes.Add(CreateTreeGroupSect(section, sectNode.Name));
                }
            }

            TreeNode itemNode = new TreeNode(groupNode.Name + "_Items");

            itemNode.ContextMenuStrip = MenuContext_Container;
            itemNode.Text             = "Items";
            if (group.Items != null)
            {
                foreach (ItemEntry item in group.Items)
                {
                    tempNode = new PLBNode(item.Id);

                    tempNode.Name             = itemNode.Name + '_' + tempNode.Name;
                    tempNode.ContextMenuStrip = MenuContext_Containee;
                    tempNode.item             = item;

                    itemNode.Nodes.Add(tempNode);
                }
            }


            //TODO: group ukns nodes?
            //TreeNode mapNode = new TreeNode(groupNode.Name + "_Maps");
            //mapNode.Text = "Maps";
            //if (section.Maps != null)
            //    foreach (MapEntry map in section.Maps)
            //    {
            //        tempNode = new PLBNode(map.Label);
            //
            //        groupNode.Name = mapNode.Name + '_' + tempNode.Name;
            //        tempNode.item = map;
            //
            //        mapNode.Nodes.Add(tempNode);
            //    }


            groupNode.Nodes.AddRange(new TreeNode[] { sectNode, itemNode });

            return(groupNode);
        }
예제 #5
0
        private PLBNode CreateTreeSection(Section section)
        {
            PLBNode sectNode = new PLBNode(section.Name);
            PLBNode tempNode = null;

            TreeNode[] tempNodes = new TreeNode[3];

            sectNode.Name             = "Node_Section_" + section.Name;
            sectNode.ContextMenuStrip = MenuContext_Containee;
            sectNode.item             = section;

            TreeNode groupNode = new TreeNode(sectNode.Name + "_GroupRefs");

            groupNode.Text             = "Group Refs";
            groupNode.ContextMenuStrip = MenuContext_Container;
            if (section.GroupRefs != null)
            {
                foreach (GroupRef gref in section.GroupRefs)
                {
                    tempNode = new PLBNode(gref.gref);

                    sectNode.Name             = groupNode.Name + '_' + tempNode.Name;
                    tempNode.ContextMenuStrip = MenuContext_Containee;
                    tempNode.item             = gref;

                    groupNode.Nodes.Add(tempNode);
                }
            }


            TreeNode itemNode = new TreeNode(sectNode.Name + "_Items");

            itemNode.Text             = "Items";
            itemNode.ContextMenuStrip = MenuContext_Container;
            if (section.Items != null)
            {
                foreach (ItemEntry item in section.Items)
                {
                    tempNode = new PLBNode(item.Id);

                    sectNode.Name             = itemNode.Name + '_' + tempNode.Name;
                    tempNode.ContextMenuStrip = MenuContext_Containee;
                    tempNode.item             = item;

                    itemNode.Nodes.Add(tempNode);
                }
            }


            TreeNode mapNode = new TreeNode(sectNode.Name + "_Maps");

            mapNode.Text             = "Maps";
            mapNode.ContextMenuStrip = MenuContext_Container;
            if (section.Maps != null)
            {
                foreach (MapEntry map in section.Maps)
                {
                    tempNode = new PLBNode(map.Id);

                    sectNode.Name             = mapNode.Name + '_' + tempNode.Name;
                    tempNode.ContextMenuStrip = MenuContext_Containee;
                    tempNode.item             = map;

                    mapNode.Nodes.Add(tempNode);
                }
            }


            sectNode.Nodes.AddRange(new TreeNode[] { groupNode, itemNode, mapNode });

            return(sectNode);
        }