c# 進行AE開發時,如何在地圖上定位出一個點


 一、文本形式的氣泡提示框

由於本人是初學,所以具體的含義尚未弄清楚,直接給出代碼吧!

        /// <summary>
        /// ARCGIS Label標記
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tsmi_MapOperate_LocationMark_Click(object sender, EventArgs e)
        {
            ITextElement te = createTextElement(120.85811111, 30.21402778, "潮位站--上虞");
            this.axMapControl1.ActiveView.GraphicsContainer.AddElement(te as IElement, 1);
            this.axMapControl1.Refresh(esriViewDrawPhase.esriViewGraphics, null, null);
        }


        public ITextElement createTextElement(double x_longitude, double y_latitude, string text_content)
        {

            IBalloonCallout bc = CreateBalloonCallout(x_longitude, y_latitude);
            IRgbColor color_rgb = new RgbColorClass();
            ITextSymbol text_symbol = new TextSymbolClass();
            IFormattedTextSymbol ftext_symbol;
            IPoint point = new PointClass();
            ITextElement text_elt = new TextElementClass();
            double width, height;
            IElement e;

            color_rgb.Green = 255;
            text_symbol.Color = color_rgb;

            ftext_symbol = text_symbol as IFormattedTextSymbol;
            ftext_symbol.Background = bc as ITextBackground;

            //fts.Size = 8;
            text_symbol.Size = 8;

            width = this.axMapControl1.Extent.Width / 13;
            height = this.axMapControl1.Extent.Height / 20;
            point.PutCoords(x_longitude + width, y_latitude + height);
            
            //IMarkerElement me = new MarkerElementClass();
            text_elt.Symbol = text_symbol;
            text_elt.Text = text_content;

            e = text_elt as IElement;
            e.Geometry = point;


            return text_elt;

        }

        public IBalloonCallout CreateBalloonCallout(double x, double y)
        {
            IRgbColor color_rgb = new RgbColorClass();
            ISimpleFillSymbol simpleFillSbl = new SimpleFillSymbolClass();
            IPoint point = new PointClass(); ;
            IBalloonCallout balloonCallout = new BalloonCalloutClass(); // 氣球類型的插圖編號

            color_rgb.Red = 255;
            color_rgb.Green = 255;
            color_rgb.Blue = 200;

            simpleFillSbl.Color = color_rgb;
            simpleFillSbl.Style = esriSimpleFillStyle.esriSFSSolid;
            point.PutCoords(x, y);

            balloonCallout.Style = esriBalloonCalloutStyle.esriBCSRoundedRectangle;
            balloonCallout.Symbol = simpleFillSbl;
            balloonCallout.LeaderTolerance = 10;
            balloonCallout.AnchorPoint = point;

            return balloonCallout;
        }
View Code

 

 

 

 

 

 

 

 

 

 

參考文章

1. GIS二次開發(C#+AE)

2. ArcEnbine開發之添加標

3. GIS(一)——在js版搜索地圖上添加Marker標記

GIS ArcEngine字段標注顯示代碼 & 可以同時顯示多個標注

離線GoogleMapAPIV3加載本地谷歌地圖並添加標注

ArcGIS_Engine+C#實例開發教程+添加標注  

GIS的學習(二十一)在osmdroid 地圖中添加marker 並添加事件

arcEngine經典代碼-添加氣泡提示框(標注,文本)

Openlayers進階學習——多標注顯示/點擊彈出框/圖層控制/搜索定位/新增標注等

ArcGIS_Engine+C#實例開發教程+添加標注

GIS空間數據庫的建立

ArcMap技巧總結

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM