Ejemplo n.º 1
0
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="_mapControl"></param>
        /// <param name="pointKml"></param>
        public PointIco_ArcMap(AxMapControl _mapControl, MapFrame.Core.Model.KmlPoint pointKml, FactoryArcMap _mapFactory)
        {
            this.mapControl = _mapControl;
            this.mapFactory = _mapFactory;

            Dosomething((Action)(delegate
            {
                pictureMarkerSymbol = new PictureMarkerSymbolClass();
                SetPictureType(pointKml.IcoUrl);
                if (pointKml.Size == null)
                {
                    pictureMarkerSymbol.Size = 5;
                    bSize = 5;
                }
                else
                {
                    pictureMarkerSymbol.Size = pointKml.Size.Width;
                    bSize = pointKml.Size.Width;
                }
                IPoint point = new PointClass();
                point.PutCoords(pointKml.Position.Lng, pointKml.Position.Lat);
                base.Geometry = point;

                base.Symbol = pictureMarkerSymbol;
            }), true);

            this.Description    = pointKml.Description;
            flashTimer          = new System.Timers.Timer();
            flashTimer.Elapsed += new System.Timers.ElapsedEventHandler(flashTimer_Elapsed);
            isFlash             = false;
        }
Ejemplo n.º 2
0
        public Point_ArcMap(AxMapControl _mapControl, KmlPoint point, FactoryArcMap _mapFactory)
        {
            this.mapControl = _mapControl;
            this.mapFactory = _mapFactory;

            Dosomething((Action)(delegate
            {
                IPoint pt = new PointClass();
                pt.PutCoords(point.Position.Lng, point.Position.Lat);
                base.Geometry = pt;

                pMarkerSymbol = new SimpleMarkerSymbolClass();
                IRgbColor color = new RgbColorClass()
                {
                    Transparency = point.Color.A,
                    Red = point.Color.R,
                    Green = point.Color.G,
                    Blue = point.Color.B
                };
                bColor = point.Color;
                pMarkerSymbol.Color = color;
                pMarkerSymbol.Size = 5;
                pMarkerSymbol.Angle = 90;
                pMarkerSymbol.Style = esriSimpleMarkerStyle.esriSMSCircle;
                base.Symbol = pMarkerSymbol;
                this.Description = point.Description;
            }), true);

            position = new MapLngLat();
            position = point.Position;//目标位置

            flashTimer          = new Timer();
            flashTimer.Elapsed += new ElapsedEventHandler(flashTimer_Elapsed);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 面的构造函数
        /// </summary>
        /// <param name="_layer">图层</param>
        /// <param name="kmlPolygon">图元(kml)</param>
        /// <param name="mapfac">地图工厂</param>
        public Polygon_ArcMap(AxMapControl _mapcontrol, KmlPolygon kmlPolygon, FactoryArcMap _mapFac)
        {
            this.mapControl = _mapcontrol;
            mapFactory      = _mapFac;

            Dosomething((Action)(delegate
            {
                lineSymbol = new SimpleLineSymbolClass();
                //轮廓颜色
                IColor outlineColor = new RgbColorClass()
                {
                    Red = kmlPolygon.OutLineColor.R,
                    Green = kmlPolygon.OutLineColor.G,
                    Blue = kmlPolygon.OutLineColor.B
                };
                lineSymbol.Color = outlineColor;
                lineSymbol.Width = kmlPolygon.OutLineSize;
                //存储颜色和宽度
                outLineColor = kmlPolygon.OutLineColor;
                outLineWidth = kmlPolygon.OutLineSize;

                fillSymbol = new SimpleFillSymbol();
                fillSymbol.Outline = lineSymbol;
                //填充色
                IColor c = new RgbColorClass()
                {
                    Red = kmlPolygon.FillColor.R,
                    Green = kmlPolygon.FillColor.G,
                    Blue = kmlPolygon.FillColor.B
                };
                fillSymbol.Color = c;
                this.fillColor = kmlPolygon.FillColor;

                base.Symbol = fillSymbol;
                polygon = new PolygonClass();
                pointCollection = polygon as IPointCollection;
                foreach (var lngLat in kmlPolygon.PositionList)
                {
                    pointCollection.AddPoint(new PointClass()
                    {
                        X = lngLat.Lng, Y = lngLat.Lat
                    });
                }
                base.Geometry = (IGeometry)pointCollection;

                pointList = new List <MapLngLat>();//坐标点集合
                pointList = kmlPolygon.PositionList;

                this.Description = kmlPolygon.Description;
            }), true);

            flashTimer          = new Timer();
            flashTimer.Elapsed += new ElapsedEventHandler(flashTimer_Elapsed);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// 释放资源
 /// </summary>
 public void Dispose()
 {
     if (flashTimer != null)
     {
         flashTimer.Stop();
         flashTimer.Dispose();
     }
     pHightlight = false;
     pIsFlash    = false;
     isVisible   = true;
     position    = null;
     mapControl  = null;
     mapFactory  = null;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// 释放资源
 /// </summary>
 public void Dispose()
 {
     if (flashTimer != null)
     {
         flashTimer.Stop();
         flashTimer.Dispose();
     }
     pMarkerSymbol     = null;
     isFlash           = false;
     this.isHightLight = false;
     this.isVisible    = true;
     mapFactory        = null;
     mapControl        = null;
 }
Ejemplo n.º 6
0
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="_mapControl">地图控件</param>
        /// <param name="kmlLine">线</param>
        /// <param name="_mapFactory">地图工厂</param>
        public Line_ArcMap(AxMapControl _mapControl, KmlLineString kmlLine, FactoryArcMap _mapFactory)
        {
            this.mapControl = _mapControl;
            this.mapFactory = _mapFactory;

            Dosomething(new Action(delegate
            {
                lineSymbol   = new SimpleLineSymbolClass();
                IColor color = new RgbColorClass()
                {
                    Transparency = kmlLine.Color.A,
                    Red          = kmlLine.Color.R,
                    Green        = kmlLine.Color.G,
                    Blue         = kmlLine.Color.B
                };
                lineSymbol.Color   = color;
                lineSymbol.Width   = kmlLine.Width;
                lineSymbol.Style   = esriSimpleLineStyle.esriSLSDash;
                IPolyline polyLine = new PolylineClass();
                pointCollection    = polyLine as IPointCollection;
                IPoint p           = new PointClass();
                foreach (var item in kmlLine.PositionList)
                {
                    p.PutCoords(item.Lng, item.Lat);
                    p.Z = item.Alt;
                    pointCollection.AddPoint(p);
                }
                base.Symbol   = lineSymbol;
                base.Geometry = (IGeometry)pointCollection;
            }), true);

            //记录颜色、宽度、坐标集合
            outLineColor = kmlLine.Color;
            outLineWidth = kmlLine.Width;
            pointList    = new List <MapLngLat>();
            pointList    = kmlLine.PositionList;

            flashTimer          = new Timer();
            flashTimer.Elapsed += new ElapsedEventHandler(flashTimer_Elapsed);
        }
Ejemplo n.º 7
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;
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="_mapControl"></param>
        /// <param name="circle"></param>
        public Circle_ArcMap(AxMapControl _mapControl, KmlCircle circle, FactoryArcMap facArc)
        {
            this.mapControl    = _mapControl;
            this.factoryArcMap = facArc;

            Dosomething(new Action(delegate
            {
                lineSymbol       = new SimpleLineSymbolClass();
                lineSymbol.Color = new RgbColorClass()
                {
                    Red   = circle.StrokeColor.R,
                    Green = circle.StrokeColor.B,
                    Blue  = circle.StrokeColor.B
                };
                lineSymbol.Width = circle.StrokeWidth;

                fillSymbol         = new SimpleFillSymbol();
                fillSymbol.Outline = lineSymbol;
                //填充色
                IColor fillColor = new RgbColorClass()
                {
                    Transparency = circle.FillColor.A,
                    Red          = circle.FillColor.R,
                    Green        = circle.FillColor.G,
                    Blue         = circle.FillColor.B
                };
                fillSymbol.Color = fillColor;

                base.Symbol = fillSymbol;//颜色和风格

                iSeg        = new RingClass();
                centerPoint = new PointClass();//圆心坐标
                centerPoint.PutCoords(circle.Position.Lng, circle.Position.Lat);
                MapLngLat around          = MapFrame.Core.Common.Utils.GetPointByDistanceAndAngle((float)circle.Radius, circle.Position, 180);
                INewLineFeedback backline = new NewLineFeedbackClass();
                IPoint aroundPoint        = new PointClass()
                {
                    X = around.Lng, Y = around.Lat
                };
                backline.Start(centerPoint);
                backline.AddPoint(aroundPoint);
                var geo = backline.Stop();

                iSeg.SetCircle(centerPoint, geo.Length);
                object o = System.Type.Missing;
                pRing    = iSeg as IRing;
                pRing.Close();

                pGeometryColl = new PolygonClass();
                pGeometryColl.AddGeometry(pRing, ref o, ref o);
                pGeometry = pGeometryColl as IGeometry;

                base.Geometry = pGeometry;
            }), true);

            pRadius       = circle.Radius;
            bOutLineColor = circle.StrokeColor;
            bFillColor    = circle.FillColor;
            bWidth        = circle.StrokeWidth;

            flashTimer          = new Timer();
            flashTimer.Elapsed += new ElapsedEventHandler(flashTimer_Elapsed);

            #region MyRegion

            //if (mapControl.InvokeRequired)
            //{
            //    mapControl.Invoke((Action)delegate()
            //    {
            //        lineSymbol = new SimpleLineSymbolClass();
            //        lineSymbol.Color = new RgbColorClass()
            //        {
            //            Red = circle.StrokeColor.R,
            //            Green = circle.StrokeColor.B,
            //            Blue = circle.StrokeColor.B
            //        };
            //        lineSymbol.Width = circle.StrokeWidth;

            //        fillSymbol = new SimpleFillSymbol();
            //        fillSymbol.Outline = lineSymbol;
            //        //填充色
            //        IColor fillColor = new RgbColorClass()
            //        {
            //            Transparency = circle.FillColor.A,
            //            Red = circle.FillColor.R,
            //            Green = circle.FillColor.G,
            //            Blue = circle.FillColor.B
            //        };
            //        fillSymbol.Color = fillColor;

            //        base.Symbol = fillSymbol;//颜色和风格

            //        iSeg = new RingClass();
            //        centerPoint = new PointClass();//圆心坐标
            //        centerPoint.PutCoords(circle.Position.Lng, circle.Position.Lat);
            //        //MapFrame.Core.Model.MapLngLat around = GetPointByDistanceAndAngle(circle.Radius, circle.Position);
            //        MapLngLat around = MapFrame.Core.Common.Utils.GetPointByDistanceAndAngle((float)circle.Radius, circle.Position, 180);
            //        INewLineFeedback backline = new NewLineFeedbackClass();
            //        IPoint aroundPoint = new PointClass() { X = around.Lng, Y = around.Lat };
            //        backline.Start(centerPoint);
            //        backline.AddPoint(aroundPoint);
            //        var geo = backline.Stop();

            //        iSeg.SetCircle(centerPoint, geo.Length);
            //        object o = System.Type.Missing;
            //        pRing = iSeg as IRing;
            //        pRing.Close();

            //        pGeometryColl = new PolygonClass();
            //        pGeometryColl.AddGeometry(pRing, ref o, ref o);
            //        pGeometry = pGeometryColl as IGeometry;

            //        base.Geometry = pGeometry;
            //    });
            //}
            //else
            //{
            //    lineSymbol = new SimpleLineSymbolClass();
            //    lineSymbol.Color = new RgbColorClass()
            //    {
            //        Red = circle.StrokeColor.R,
            //        Green = circle.StrokeColor.B,
            //        Blue = circle.StrokeColor.B
            //    };
            //    lineSymbol.Width = circle.StrokeWidth;


            //    fillSymbol = new SimpleFillSymbol();
            //    fillSymbol.Outline = lineSymbol;
            //    //填充色
            //    IColor fillColor = new RgbColorClass()
            //    {
            //        Transparency = circle.FillColor.A,
            //        Red = circle.FillColor.R,
            //        Green = circle.FillColor.G,
            //        Blue = circle.FillColor.B
            //    };
            //    fillSymbol.Color = fillColor;

            //    base.Symbol = fillSymbol;//颜色和风格

            //    iSeg = new RingClass();
            //    centerPoint = new PointClass();//圆心坐标
            //    centerPoint.PutCoords(circle.Position.Lng, circle.Position.Lat);
            //    //MapFrame.Core.Model.MapLngLat around = GetPointByDistanceAndAngle(circle.Radius, circle.Position);
            //    MapLngLat around = MapFrame.Core.Common.Utils.GetPointByDistanceAndAngle((float)circle.Radius, circle.Position, 180);
            //    INewLineFeedback backline = new NewLineFeedbackClass();
            //    IPoint aroundPoint = new PointClass() { X = around.Lng, Y = around.Lat };
            //    backline.Start(centerPoint);
            //    backline.AddPoint(aroundPoint);
            //    var geo = backline.Stop();

            //    iSeg.SetCircle(centerPoint, geo.Length);
            //    object o = System.Type.Missing;
            //    pRing = iSeg as IRing;
            //    pRing.Close();

            //    pGeometryColl = new PolygonClass();
            //    pGeometryColl.AddGeometry(pRing, ref o, ref o);
            //    pGeometry = pGeometryColl as IGeometry;

            //    base.Geometry = pGeometry;
            //}
            #endregion
        }