Ejemplo n.º 1
0
 public void InitLineData(ClassLine line)
 {
     line.startX = m_PointList[0].X;
     line.startY = m_PointList[0].Y;
     line.endX   = m_PointList[10].X;
     line.endY   = m_PointList[10].Y;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 根据坐标在地图上划线
        /// </summary>
        /// <param name="Xstart"></param>
        /// <param name="Ystart"></param>
        /// <param name="Xend"></param>
        /// <param name="Yend"></param>
        public int WriteLine(ClassLine line, LineSet lineSet)
        {
            Shape shp = new Shape();

            shp.Create(ShpfileType.SHP_POLYLINE);

            Point pnt = new Point();

            pnt.x = line.startX;
            pnt.y = line.startY;
            int index = shp.numPoints;

            shp.InsertPoint(pnt, ref index);

            pnt   = new Point();
            pnt.x = line.endX;
            pnt.y = line.endY;
            index = shp.numPoints;
            shp.InsertPoint(pnt, ref index);

            index = sf.NumShapes;
            sf.EditInsertShape(shp, ref index);


            //var utils = new Utils();
            //LinePattern pattern = new LinePattern();
            //pattern.AddLine(utils.ColorByName(lineSet.color), lineSet.Width, lineSet.style);
            //ShapefileCategory ct = sf.Categories.Add("Railroad");
            //ct.DrawingOptions.LinePattern = pattern;
            //ct.DrawingOptions.UseLinePattern = true;
            //sf.set_ShapeCategory(0, 0);

            var         utils   = new Utils();
            LinePattern pattern = new LinePattern();

            pattern.AddLine(utils.ColorByName(lineSet.color), lineSet.Width, lineSet.style);
            sf.DefaultDrawingOptions.LinePattern    = pattern;
            sf.DefaultDrawingOptions.UseLinePattern = true;
            layerHandle = map.AddLayer(sf, true);



            return(layerHandle);
        }