Exemplo n.º 1
0
        private void CcSymbolsAddClicked(object sender, EventArgs e)
        {
            ISymbol    s          = null;
            SymbolType symbolType = Global.ParseEnum <SymbolType>(cmbSymbolType.SelectedIndex);

            switch (symbolType)
            {
            case SymbolType.Simple:
                s = new SimpleSymbol();
                break;

            case SymbolType.Character:
                CharacterSymbol cs         = new CharacterSymbol();
                string          fontFamily = Properties.Settings.Default.DetailedPointSymbolControlFontFamilyName;
                if (!string.IsNullOrWhiteSpace(fontFamily))
                {
                    cs.FontFamilyName = fontFamily;
                }
                s = cs;
                break;

            case SymbolType.Picture:
                s = new PictureSymbol();
                break;

            case SymbolType.Custom:
                MessageBox.Show("暂未实现");
                return;
            }
            if (s != null)
            {
                double width  = Properties.Settings.Default.DetailedPointSymbolControlSymbolWidth;
                double height = Properties.Settings.Default.DetailedPointSymbolControlSymbolHeight;
                if (width <= 0)
                {
                    width = 10;
                }
                if (height <= 0)
                {
                    height = 10;
                }
                s.Size = new Size2D(width, height);
                s.SetColor(ccSymbols.SelectedSymbol.GetColor());
                ccSymbols.Symbols.Add(s);
                UpdatePreview();
            }
        }
Exemplo n.º 2
0
        private void CmbSymbolTypeSelectedIndexChanged(object sender, EventArgs e)
        {
            if (cmbSymbolType.SelectedItem.ToString() == "Simple")
            {
                if (tabSymbolProperties.TabPages.Contains(tabPicture))
                {
                    tabSymbolProperties.TabPages.Remove(tabPicture);
                }

                if (tabSymbolProperties.TabPages.Contains(tabCharacter))
                {
                    tabSymbolProperties.TabPages.Remove(tabCharacter);
                }

                if (tabSymbolProperties.TabPages.Contains(tabSimple) == false)
                {
                    tabSymbolProperties.TabPages.Insert(0, tabSimple);
                    tabSymbolProperties.SelectedTab = tabSimple;
                }
            }

            if (cmbSymbolType.SelectedItem.ToString() == "Character")
            {
                if (tabSymbolProperties.TabPages.Contains(tabPicture))
                {
                    tabSymbolProperties.TabPages.Remove(tabPicture);
                }

                if (tabSymbolProperties.TabPages.Contains(tabSimple))
                {
                    tabSymbolProperties.TabPages.Remove(tabSimple);
                }

                if (tabSymbolProperties.TabPages.Contains(tabCharacter) == false)
                {
                    tabSymbolProperties.TabPages.Insert(0, tabCharacter);
                    tabSymbolProperties.SelectedTab = tabCharacter;
                }
            }

            if (cmbSymbolType.SelectedItem.ToString() == "Picture")
            {
                if (tabSymbolProperties.TabPages.Contains(tabSimple))
                {
                    tabSymbolProperties.TabPages.Remove(tabSimple);
                }

                if (tabSymbolProperties.TabPages.Contains(tabCharacter))
                {
                    tabSymbolProperties.TabPages.Remove(tabCharacter);
                }

                if (tabSymbolProperties.TabPages.Contains(tabPicture) == false)
                {
                    tabSymbolProperties.TabPages.Insert(0, tabPicture);
                    tabSymbolProperties.SelectedTab = tabPicture;
                }
            }

            if (_ignoreChanges)
            {
                return;
            }

            int index = ccSymbols.Symbols.IndexOf(ccSymbols.SelectedSymbol);

            if (index == -1)
            {
                return;
            }
            ISymbol oldSymbol = ccSymbols.SelectedSymbol;

            if (cmbSymbolType.SelectedItem.ToString() == "Simple")
            {
                SimpleSymbol ss = new SimpleSymbol();
                if (oldSymbol != null)
                {
                    ss.CopyPlacement(oldSymbol);
                }
                ccSymbols.Symbols[index] = ss;
                ccSymbols.RefreshList();
                ccSymbols.SelectedSymbol = ss;
            }

            if (cmbSymbolType.SelectedItem.ToString() == "Character")
            {
                CharacterSymbol cs = new CharacterSymbol();
                if (oldSymbol != null)
                {
                    cs.CopyPlacement(oldSymbol);
                }
                ccSymbols.Symbols[index] = cs;
                ccSymbols.RefreshList();
                ccSymbols.SelectedSymbol = cs;
            }

            if (cmbSymbolType.SelectedItem.ToString() == "Picture")
            {
                PictureSymbol ps = new PictureSymbol();
                if (oldSymbol != null)
                {
                    ps.CopyPlacement(oldSymbol);
                }
                ccSymbols.Symbols[index] = ps;
                ccSymbols.RefreshList();
                ccSymbols.SelectedSymbol = ps;
            }
        }
        private void cmbSymbolType_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cmbSymbolType.SelectedItem.ToString() == "Simple")
            {
                if (tabSymbolProperties.TabPages.Contains(tabPicture))
                {
                    tabSymbolProperties.TabPages.Remove(tabPicture);
                }
                if (tabSymbolProperties.TabPages.Contains(tabCharacter))
                {
                    tabSymbolProperties.TabPages.Remove(tabCharacter);
                }
                if (tabSymbolProperties.TabPages.Contains(tabSimple) == false)
                {
                    tabSymbolProperties.TabPages.Insert(0, tabSimple);
                    tabSymbolProperties.SelectedTab = tabSimple;
                }
            }
            if (cmbSymbolType.SelectedItem.ToString() == "Character")
            {
                if (tabSymbolProperties.TabPages.Contains(tabPicture))
                {
                    tabSymbolProperties.TabPages.Remove(tabPicture);
                }
                if (tabSymbolProperties.TabPages.Contains(tabSimple))
                {
                    tabSymbolProperties.TabPages.Remove(tabSimple);
                }
                if (tabSymbolProperties.TabPages.Contains(tabCharacter) == false)
                {
                    tabSymbolProperties.TabPages.Insert(0, tabCharacter);
                    tabSymbolProperties.SelectedTab = tabCharacter;
                }
            }
            if (cmbSymbolType.SelectedItem.ToString() == "Picture")
            {
                if (tabSymbolProperties.TabPages.Contains(tabSimple))
                {
                    tabSymbolProperties.TabPages.Remove(tabSimple);
                }
                if (tabSymbolProperties.TabPages.Contains(tabCharacter))
                {
                    tabSymbolProperties.TabPages.Remove(tabCharacter);
                }
                if (tabSymbolProperties.TabPages.Contains(tabPicture) == false)
                {
                    tabSymbolProperties.TabPages.Insert(0, tabPicture);
                    tabSymbolProperties.SelectedTab = tabPicture;
                }
            }

            if (_ignoreChanges) return;

            int index = ccSymbols.Symbols.IndexOf(ccSymbols.SelectedSymbol);
            if (index == -1) return;
            ISymbol oldSymbol = ccSymbols.SelectedSymbol;

            if (cmbSymbolType.SelectedItem.ToString() == "Simple")
            {
                SimpleSymbol ss = new SimpleSymbol();
                if (oldSymbol != null) ss.CopyPlacement(oldSymbol);
                ccSymbols.Symbols[index] = ss;
                ccSymbols.RefreshList();
                ccSymbols.SelectedSymbol = ss;
            }
            if (cmbSymbolType.SelectedItem.ToString() == "Character")
            {
                CharacterSymbol cs = new CharacterSymbol();
                if (oldSymbol != null) cs.CopyPlacement(oldSymbol);
                ccSymbols.Symbols[index] = cs;
                ccSymbols.RefreshList();
                ccSymbols.SelectedSymbol = cs;
            }
            if (cmbSymbolType.SelectedItem.ToString() == "Picture")
            {
                PictureSymbol ps = new PictureSymbol();
                if (oldSymbol != null) ps.CopyPlacement(oldSymbol);
                ccSymbols.Symbols[index] = ps;
                ccSymbols.RefreshList();
                ccSymbols.SelectedSymbol = ps;
            }
        }
 private void ccSymbols_AddClicked(object sender, EventArgs e)
 {
     ISymbol s = null;
     string type = cmbSymbolType.SelectedItem.ToString();
     switch (type)
     {
         case "Simple": s = new SimpleSymbol(); break;
         case "Character": s = new CharacterSymbol(); break;
         case "Picture": s = new PictureSymbol(); break;
     }
     if (s != null) ccSymbols.Symbols.Add(s);
     ccSymbols.RefreshList();
     UpdatePreview();
 }
Exemplo n.º 5
0
        private void CmbSymbolTypeSelectedIndexChanged(object sender, EventArgs e)
        {
            SymbolType newSymbolType = Global.ParseEnum <SymbolType>(cmbSymbolType.SelectedIndex);
            ISymbol    oldSymbol     = ccSymbols.SelectedSymbol;

            switch (newSymbolType)
            {
            case SymbolType.Simple:
                if (tabSymbolProperties.TabPages.Contains(tabPicture))
                {
                    tabSymbolProperties.TabPages.Remove(tabPicture);
                }

                if (tabSymbolProperties.TabPages.Contains(tabCharacter))
                {
                    tabSymbolProperties.TabPages.Remove(tabCharacter);
                }

                if (tabSymbolProperties.TabPages.Contains(tabSimple) == false)
                {
                    tabSymbolProperties.TabPages.Insert(0, tabSimple);
                    tabSymbolProperties.SelectedTab = tabSimple;
                }
                break;

            case SymbolType.Character:
                if (tabSymbolProperties.TabPages.Contains(tabPicture))
                {
                    tabSymbolProperties.TabPages.Remove(tabPicture);
                }

                if (tabSymbolProperties.TabPages.Contains(tabSimple))
                {
                    tabSymbolProperties.TabPages.Remove(tabSimple);
                }

                if (tabSymbolProperties.TabPages.Contains(tabCharacter) == false)
                {
                    tabSymbolProperties.TabPages.Insert(0, tabCharacter);
                    tabSymbolProperties.SelectedTab = tabCharacter;
                }
                break;

            case SymbolType.Picture:
                if (tabSymbolProperties.TabPages.Contains(tabSimple))
                {
                    tabSymbolProperties.TabPages.Remove(tabSimple);
                }

                if (tabSymbolProperties.TabPages.Contains(tabCharacter))
                {
                    tabSymbolProperties.TabPages.Remove(tabCharacter);
                }

                if (tabSymbolProperties.TabPages.Contains(tabPicture) == false)
                {
                    tabSymbolProperties.TabPages.Insert(0, tabPicture);
                    tabSymbolProperties.SelectedTab = tabPicture;
                }
                break;

            case SymbolType.Custom:
                MessageBox.Show("暂未实现");
                if (oldSymbol != null)
                {
                    SymbolType oldSymbolType = oldSymbol.SymbolType;
                    cmbSymbolType.SelectedIndex = Global.GetEnumIndex(oldSymbolType);
                }
                return;
            }

            if (_ignoreChanges)
            {
                return;
            }

            int index = ccSymbols.Symbols.IndexOf(ccSymbols.SelectedSymbol);

            if (index == -1)
            {
                return;
            }
            ISymbol newSymbol = null;

            switch (newSymbolType)
            {
            case SymbolType.Simple:
                SimpleSymbol ss = new SimpleSymbol();
                if (oldSymbol != null)
                {
                    ss.CopyPlacement(oldSymbol);
                }
                ccSymbols.Symbols[index] = ss;
                ccSymbols.RefreshList();
                ccSymbols.SelectedSymbol = ss;
                newSymbol = ss;
                break;

            case SymbolType.Character:
                CharacterSymbol cs = new CharacterSymbol();
                if (!string.IsNullOrWhiteSpace(Properties.Settings.Default.DetailedPointSymbolControlFontFamilyName))
                {
                    cs.FontFamilyName = Properties.Settings.Default.DetailedPointSymbolControlFontFamilyName;
                }
                if (oldSymbol != null)
                {
                    cs.CopyPlacement(oldSymbol);
                }
                ccSymbols.Symbols[index] = cs;
                ccSymbols.RefreshList();
                ccSymbols.SelectedSymbol = cs;
                newSymbol = cs;
                break;

            case SymbolType.Picture:
                PictureSymbol ps = new PictureSymbol();
                if (oldSymbol != null)
                {
                    ps.CopyPlacement(oldSymbol);
                }
                ccSymbols.Symbols[index] = ps;
                ccSymbols.RefreshList();
                ccSymbols.SelectedSymbol = ps;
                newSymbol = ps;
                break;

            case SymbolType.Custom:
                break;
            }
            //if (newSymbol != null)
            //{
            //    newSymbol.SetColor(oldSymbol.GetColor());
            //}
        }