Example #1
0
        /// <summary>
        /// 在地图上添加图片
        /// </summary>
        /// <param name="data"></param>
        /// <param name="path"></param>
        /// <returns></returns>
        public int AddPicture(ClassPoint data, string path)
        {
            pointData    = new ClassPoint[1];
            PointData[0] = new ClassPoint();
            pointData[0] = data;

            Shape shp = new Shape();             //创建shp图层

            shp.Create(ShpfileType.SHP_POINT);
            var pnt = new Point();

            pnt.x = data.x;
            pnt.y = data.y;
            int index = 0;

            shp.InsertPoint(pnt, ref index);
            sf.EditInsertShape(shp, ref shapindex);

            ShapefileCategory ct = sf.Categories.Add("0");
            var utils            = new Utils();

            ct.DrawingOptions           = sf.DefaultDrawingOptions;
            ct.DrawingOptions.PointType = tkPointSymbolType.ptSymbolPicture;
            Image img = new Image();

            img.Open(path);
            ct.DrawingOptions.Picture       = img;
            ct.DrawingOptions.PointRotation = 45.0;
            sf.CollisionMode = tkCollisionMode.AllowCollisions;
            sf.set_ShapeCategory2(shapindex, "0");

            layerHandle = Map.AddLayer(sf, true);
            return(layerHandle);
        }
Example #2
0
        /// <summary>
        /// 讲ais类型数据转成point类型数据
        /// </summary>
        private void IntoPointData()
        {
            int num = aisData.Length;

            point = new ClassPoint[num];
            for (int i = 0; i < num; i++)
            {
                point[i]     = new ClassPoint();
                point[i].x   = aisData[i].longitude;
                point[i].y   = aisData[i].latitude;
                point[i].str = aisData[i].str;
            }
        }