Exemple #1
0
        private void ColourClicked(object sender, EventArgs e)
        {
            var visgroup = VisgroupPanel.SelectedVisgroup;

            if (visgroup == null)
            {
                return;
            }

            var vg = (Vg)visgroup.Tag;

            using (var cp = new ColorDialog {
                Color = vg.Colour
            })
            {
                if (cp.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                ColourPanel.BackColor = visgroup.Colour = vg.Colour = cp.Color;
                ColourPanel.ForeColor = vg.Colour.GetIdealForegroundColour();
                VisgroupPanel.UpdateVisgroupState(visgroup);
            }
        }
Exemple #2
0
 private void Update(MapDocument document)
 {
     Task.Factory.StartNew(() =>
     {
         if (document == null)
         {
             this.InvokeLater(() => VisgroupPanel.Clear());
         }
         else
         {
             var tree = GetItemHierarchies(document);
             this.InvokeLater(() => VisgroupPanel.Update(tree));
         }
     });
 }
Exemple #3
0
        private IEnumerable <IMapObject> GetVisgroupObjects(VisgroupItem item)
        {
            if (item?.Tag is Primitives.MapData.Visgroup v)
            {
                return(v.Objects);
            }
            if (item?.Tag is AutomaticVisgroup av)
            {
                return(av.Objects);
            }

            var children = VisgroupPanel.GetAllItems().Where(x => x.Parent == item).SelectMany(GetVisgroupObjects);

            return(new HashSet <IMapObject>(children));
        }
Exemple #4
0
        private void GroupNameChanged(object sender, EventArgs e)
        {
            var visgroup = VisgroupPanel.SelectedVisgroup;

            if (visgroup == null)
            {
                return;
            }

            var vg = (Vg)visgroup.Tag;

            if (vg.Name == GroupName.Text)
            {
                return;
            }
            visgroup.Text = vg.Name = GroupName.Text;
            VisgroupPanel.UpdateVisgroupState(visgroup);
        }
Exemple #5
0
 private void UpdateVisgroups()
 {
     VisgroupPanel.Update(GetVisgroupItemList());
 }