Example #1
0
        private void DrawCompleteHandler(object sender, DrawEventArgs args)
        {
            _currentPoint = args.Geometry as MapPoint;
            TextSymbolPropsWindow win = new TextSymbolPropsWindow();

            win.EditMode = false;
            win.Closed  += new EventHandler(win_Closed);
            win.Show();
        }
Example #2
0
        private void ChangeTextHandler(object sender, RoutedEventArgs e)
        {
            //Graphic g = sender as Graphic;
            _currentPoint = Ambient.SelectedSymbol.Geometry as MapPoint;
            TextSymbol            ts  = Ambient.SelectedSymbol.Symbol as TextSymbol;
            TextSymbolPropsWindow win = new TextSymbolPropsWindow();

            win.TextFont     = ts.FontFamily.Source;
            win.TextFontSize = ts.FontSize;
            win.Annotation   = ts.Text;
            win.EditMode     = true;
            win.Closed      += new EventHandler(win_Closed);
            win.Show();
        }
Example #3
0
        void win_Closed(object sender, EventArgs e)
        {
            TextSymbolPropsWindow win = sender as TextSymbolPropsWindow;

            if ((bool)win.DialogResult)
            {
                GraphicsLayer graphicsLayer = BoundMap.Layers["AnnoLayer"] as GraphicsLayer;
                string        input         = win.Annotation;

                if (!String.IsNullOrEmpty(input))
                {
                    MapPoint   pt  = _currentPoint;
                    TextSymbol sym = new TextSymbol();
                    sym.FontFamily = new FontFamily(win.TextFont);
                    sym.FontSize   = win.TextFontSize;
                    sym.Text       = win.Annotation;
                    sym.Foreground = new SolidColorBrush {
                        Color = Colors.Black
                    };
                    Zekiah.Samples.Font f = new Font();
                    f.Family = sym.FontFamily;
                    f.Size   = sym.FontSize;
                    f.Style  = FontStyles.Normal;
                    f.Weight = FontWeights.Normal;
                    String s = new String(input.ToCharArray());

                    Size size = s.Measure(f);
                    sym.OffsetX = size.Width / 2;
                    sym.OffsetY = size.Height / 2;
                    ESRI.ArcGIS.Client.Graphic graphic = new ESRI.ArcGIS.Client.Graphic()
                    {
                        Geometry = pt,
                        Symbol   = sym,
                    };
                    graphic.MouseEnter           += new MouseEventHandler(graphic_MouseEnter);
                    graphic.MouseLeave           += new MouseEventHandler(graphic_MouseLeave);
                    graphic.MouseRightButtonDown += new System.Windows.Input.MouseButtonEventHandler(graphic_MouseRightButtonDown);
                    if (win.EditMode)
                    {
                        graphicsLayer.Graphics.Remove(Ambient.SelectedSymbol);
                    }
                    graphicsLayer.Graphics.Add(graphic);
                }
            }
        }