/// <summary>
 /// Creates a new point symbolizer that has a character symbol based on the specified characteristics.
 /// </summary>
 /// <param name="character">The character to draw</param>
 /// <param name="fontFamily">The font family to use for rendering the font</param>
 /// <param name="color">The font color</param>
 /// <param name="size">The size of the symbol</param>
 public PointSymbolizer(char character, string fontFamily, Color color, double size)
 {
     _symbols = new CopyList<ISymbol>();
     CharacterSymbol cs = new CharacterSymbol(character, fontFamily, color, size);
     _symbols.Add(cs);
 }
 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();
 }
        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;
            }
        }
示例#4
0
        private void SetInnerSymbol(SymbolTypes type)
        {
            ISymbol newSymbol = null;
            // If this class is acting as a wrapper class, then it should update the internal IStroke.
            switch (type)
            {
                case SymbolTypes.Character:
                    newSymbol = new CharacterSymbol();
                    break;
                case SymbolTypes.Picture:
                    newSymbol = new PictureSymbol();
                    break;
                case SymbolTypes.Simple:
                    newSymbol = new SimpleSymbol();
                    break;
            }
            if (newSymbol != null)
            {
                if (_innerSymbol != null) newSymbol.CopyPlacement(_innerSymbol);
            }
            _innerSymbol = newSymbol;

        }