两点画一条线

xiaoxiao2021-02-28  110

ISegmentCollection pPath = new PathClass();      object o = Type.Missing;      IPoint startPoint = null;//起始点      foreach (DataRow dr2 in dt2.Rows)      {          if (startPoint == null)          {              startPoint = ConstructPoint(Convert.ToDouble(dr2["经度"]), Convert.ToDouble(dr2["纬度"]));          }          else          {              IPoint endPoint = ConstructPoint(Convert.ToDouble(dr2["经度"]), Convert.ToDouble(dr2["纬度"]));//终止点              ILine pLine = new LineClass();              pLine.FromPoint = startPoint;              pLine.ToPoint = endPoint;              //pLine.PutCoords(startPoint, endPoint);              pPath.AddSegment(pLine as ISegment, ref o, ref o);              startPoint = endPoint;          }      }        IGeometryCollection pPolyline = new PolylineClass();      pPolyline.AddGeometry(pPath as IGeometry, ref o, ref o);        ISimpleLineSymbol lineSymbol = new SimpleLineSymbolClass();      lineSymbol.Color = GetColor(colorValue);//颜色      lineSymbol.Style = esriSimpleLineStyle.esriSLSInsideFrame; //样式      lineSymbol.Width = 2;        ILineElement pLineElement = new LineElementClass();      pLineElement.Symbol = lineSymbol;        IElement pElement = pLineElement as IElement;      tempGeometry = pElement.Geometry = pPolyline as IGeometry;      pGraphicsContainer.AddElement(pElement, 0); 
转载请注明原文地址: https://www.6miu.com/read-43211.html

最新回复(0)