Exemplo n.º 1
0
        /// <summary>
        /// Method for applying the selected character to the point feature layer
        /// </summary>
        /// <returns></returns>
        private async Task ApplyFontAsMarker()
        {
            var charIndex = 0;

            charIndex = SelectedCharacter.Character;
            var fontName  = SelectedFontFamily.ToString();
            var styleName = SelectedTypeFace.ToString();

            if (MapView.Active != null)
            {
                GetSelectedPointFeatureLayer(); //the selected point feature layer in the TOC
            }
            var cimMarker = SymbolFactory.Instance.ConstructMarker(charIndex, fontName,
                                                                   styleName, Size); //creating the marker from the Font selected

            var pointSymbolFromMarker = SymbolFactory.Instance.ConstructPointSymbol(cimMarker);

            //create a symbol from the marker

            await SetFeatureLayerSymbolAsync(PointFeatureLayer, pointSymbolFromMarker);

            if (IsFavorites)
            {
                await CreateStyleItem();

                if (FontMarkerStyleProjectItem != null && pointSymbolFromMarker != null && !FontMarkerStyleProjectItem.IsReadOnly)
                {
                    await AddStyleItemToStyle(FontMarkerStyleProjectItem, pointSymbolFromMarker); //selected marker is added to the FontMarker style
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Method for applying the selected character to the point feature layer
        /// </summary>
        /// <returns></returns>
        private async Task ApplyFontAsMarker()
        {
            var charIndex = 0;

            charIndex = SelectedCharacter.Character;
            var fontName  = SelectedFontFamily.ToString();
            var styleName = SelectedTypeFace.ToString();

            if (MapView.Active != null)
            {
                GetSelectedPointFeatureLayer(); //the selected point feature layer in the TOC
            }
            var cimMarker = SymbolFactory.ConstructMarker(charIndex, fontName,
                                                          styleName, Size); //creating the marker from the Font selected

            var pointSymbolFromMarker = SymbolFactory.ConstructPointSymbol(cimMarker);

            //create a symbol from the marker

            await SetFeatureLayerSymbolAsync(PointFeatureLayer, pointSymbolFromMarker);
        }
Exemplo n.º 3
0
        private void OnSelectedFontFamilyChanged()
        {
            if (_fontFamilyListBox == null)
            {
                return;
            }

            _isInternalUpdate = true;

            // Select matching entry in list box.
            IEnumerable <FontFamilyDescription> fontFamilyItems = (IEnumerable <FontFamilyDescription>)_fontFamilyListBox.ItemsSource;
            var selectedItem = fontFamilyItems.FirstOrDefault(item => item.FontFamily.Equals(SelectedFontFamily));

            _fontFamilyListBox.SelectedItem = selectedItem;

            // Get display name.
            var displayName = (selectedItem != null) ? selectedItem.DisplayName : string.Empty;

            // Scroll list box entry into view.
            if (selectedItem != null)
            {
                _fontFamilyListBox.ScrollIntoView(selectedItem);
            }

            // If text box does not already contain a matching text, update the text box.
            // Do nothing if the cursor is currently in the text box (the user is typing).
            if (!_fontFamilyTextBox.IsKeyboardFocused && string.Compare(_fontFamilyTextBox.Text, displayName, true, CultureInfo.CurrentCulture) != 0)
            {
                _fontFamilyTextBox.Text = displayName;
            }

            // ----- Initialize typefaces list.
            // Fill the font family list box.
            if (SelectedFontFamily == null)
            {
                _typefaceListBox.ItemsSource = null;
            }
            else
            {
                var typefaces = SelectedFontFamily.GetTypefaces();

                // Create a text block for each font family
                var items = new List <TypefaceDescription>(typefaces.Count);
                foreach (var typeface in typefaces)
                {
                    var item = new TypefaceDescription
                    {
                        DisplayName  = FontHelper.GetDisplayName(typeface.FaceNames),
                        FontFamily   = SelectedFontFamily,
                        IsSymbolFont = FontHelper.IsSymbolFont(SelectedFontFamily),
                        Typeface     = typeface,
                    };

                    items.Add(item);
                }

                // Sort items by display name and assign the to the list box.
                items.Sort((a, b) => FontHelper.Compare(a.Typeface, b.Typeface));
                _typefaceListBox.ItemsSource = items;

                // Update the typeface controls.
                OnSelectedTypefaceChanged();
            }

            _isInternalUpdate = false;
        }