Ejemplo n.º 1
0
 /// <summary>
 /// 主线程做事
 /// </summary>
 /// <param name="action">要做的内容</param>
 /// <param name="synchronization">是否同步执行</param>
 private void Dosomething(Action action, bool synchronization)
 {
     if (mapControl == null)
     {
         return;
     }
     if (synchronization)
     {
         if (mapControl.InvokeRequired)
         {
             mapControl.Invoke(action);
         }
         else
         {
             action();
         }
     }
     else
     {
         if (mapControl.InvokeRequired)
         {
             mapControl.BeginInvoke(action);
         }
         else
         {
             action();
         }
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 设置线宽
 /// </summary>
 /// <param name="width"></param>
 /// <returns></returns>
 public bool SetWidth(float width)
 {
     outLineWidth = width;
     if (mapControl.InvokeRequired)
     {
         mapControl.Invoke((Action) delegate()
         {
             lineSymbol.Width = width;
             Update();
         });
     }
     else
     {
         lineSymbol.Width = width;
         Update();
     }
     return(true);
 }
Ejemplo n.º 3
0
        ///// <summary>
        ///// 构造函数
        ///// </summary>
        ///// <param name="kmlText"></param>
        ///// <param name="layer"></param>
        //public Text_ArcMap(KmlText kmlText, CompositeGraphicsLayerClass compositeGraphicsLayer)
        //{
        //    System.Drawing.Color c = System.Drawing.Color.FromArgb(kmlText.Color);
        //    bTextColor = c;
        //    base.Color = new RgbColorClass() { Red = c.R, Green = c.G, Blue = c.B };
        //    base.Size = kmlText.Size;
        //    bOutLineSize = kmlText.Size;
        //    base.FontName = kmlText.Font;
        //    base.Text = kmlText.Content;
        //    base.Geometry = new PointClass() { X = kmlText.Position.Lng, Y = kmlText.Position.Lat };

        //    this.Description = kmlText.Description;

        //    position = new MapLngLat();
        //    position = kmlText.Position;//坐标点
        //    pIsFlash = false;
        //    flashTimer = new System.Timers.Timer();
        //    flashTimer.Elapsed += new System.Timers.ElapsedEventHandler(flashTimer_Elapsed);
        //}

        public Text_ArcMap(AxMapControl _mapControl, KmlText kmlText, FactoryArcMap _mapFactory)
        {
            this.mapControl = _mapControl;
            this.mapFactory = _mapFactory;

            //System.Drawing.Color c = System.Drawing.Color.Red;

            if (mapControl.InvokeRequired)
            {
                mapControl.Invoke((Action) delegate()
                {
                    System.Drawing.Color c = kmlText.Color;

                    textSymbol = new TextSymbolClass();
                    font       = new stdole.StdFontClass();

                    font.Name = kmlText.Font;
                    font.Size = (decimal)kmlText.Size;
                    switch (kmlText.FontStyle)
                    {
                    case FontStyle.Bold:
                        font.Bold          = true;
                        font.Italic        = false;
                        font.Strikethrough = false;
                        font.Underline     = false;
                        break;

                    case FontStyle.Italic:
                        font.Bold          = false;
                        font.Italic        = true;
                        font.Strikethrough = false;
                        font.Underline     = false;
                        break;

                    case FontStyle.Strikeout:
                        font.Bold          = false;
                        font.Italic        = false;
                        font.Strikethrough = true;
                        font.Underline     = false;
                        break;

                    case FontStyle.Underline:
                        font.Bold          = false;
                        font.Italic        = false;
                        font.Strikethrough = false;
                        font.Underline     = true;
                        break;
                    }
                    textSymbol.Font  = font as stdole.IFontDisp;
                    textSymbol.Color = new RgbColorClass()
                    {
                        Red = c.R, Green = c.G, Blue = c.B
                    };
                    //textSymbol.Color.RGB = c.B * 65536 + c.G * 256 + c.G;
                    base.Symbol    = textSymbol;
                    base.Text      = kmlText.Content;
                    base.ScaleText = true;
                    base.Geometry  = new PointClass()
                    {
                        X = kmlText.Position.Lng, Y = kmlText.Position.Lat
                    };
                });
            }
            else
            {
                System.Drawing.Color c = kmlText.Color;

                textSymbol = new TextSymbolClass();
                font       = new stdole.StdFontClass();
                font.Name  = kmlText.Font;
                font.Size  = (decimal)kmlText.Size;
                switch (kmlText.FontStyle)
                {
                case FontStyle.Bold:
                    font.Bold          = true;
                    font.Italic        = false;
                    font.Strikethrough = false;
                    font.Underline     = false;
                    break;

                case FontStyle.Italic:
                    font.Bold          = false;
                    font.Italic        = true;
                    font.Strikethrough = false;
                    font.Underline     = false;
                    break;

                case FontStyle.Strikeout:
                    font.Bold          = false;
                    font.Italic        = false;
                    font.Strikethrough = true;
                    font.Underline     = false;
                    break;

                case FontStyle.Underline:
                    font.Bold          = false;
                    font.Italic        = false;
                    font.Strikethrough = false;
                    font.Underline     = true;
                    break;
                }
                textSymbol.Font  = font as stdole.IFontDisp;
                textSymbol.Color = new RgbColorClass()
                {
                    Red = c.R, Green = c.G, Blue = c.B
                };
                //textSymbol.Color.RGB = c.B * 65536 + c.G * 256 + c.G;
                base.Symbol = textSymbol;

                base.Text      = kmlText.Content;
                base.ScaleText = true;
                base.Geometry  = new PointClass()
                {
                    X = kmlText.Position.Lng, Y = kmlText.Position.Lat
                };
            }

            this.Description = kmlText.Description;
            //记录
            bTextColor   = kmlText.Color;;
            bOutLineSize = kmlText.Size;

            position = new MapLngLat();
            position = kmlText.Position;//坐标点

            flashTimer          = new System.Timers.Timer();
            flashTimer.Elapsed += new System.Timers.ElapsedEventHandler(flashTimer_Elapsed);
            flashTimer.Interval = 1000;
        }