现在的位置: 首页 > 综合 > 正文

mapxtreme画折线、画多边形

2013年10月20日 ⁄ 综合 ⁄ 共 1110字 ⁄ 字号 评论关闭

//折线

Catalog Cat = MapInfo.Engine.Session.Current.Catalog;
   
    Table tblTemp = Cat.GetTable("Line");

MapInfo.Geometry.DPoint[] point=new DPoint[3];

tblTemp.BeginAccess(TableAccessMode.Write); 
     Feature ftr = new Feature(tblTemp.TableInfo.Columns);
     CoordSys coordSys = this.mapControl1.Map.GetDisplayCoordSys();

point[0]=new DPoint(Convert.ToDouble(textBox17.Text.ToString()),Convert.ToDouble(textBox18.Text.ToString()));
     point[1]=new DPoint(Convert.ToDouble(textBox19.Text.ToString()),Convert.ToDouble(textBox20.Text.ToString()));
     point[2]=new DPoint(107.22751833,33.127);

MapInfo.Geometry.CurveSegment seg=new MapInfo.Geometry.LineString(coordSys,point);

FeatureGeometry geometry=new MapInfo.Geometry.MultiCurv(coordSys,seg.CurveSegmentType,point);

ftr.Geometry = geometry;
       
     //ftr["LineId"] = flag;
     
     tblTemp.InsertFeature(ftr);
tblTemp.EndAccess();  

//矩形

MapInfo.Geometry.CurveSegment seg=new MapInfo.Geometry.LineString(coordSys,point);

MapInfo.Geometry.MultiPolygon mulp=new MultiPolygon(coordSys,seg.CurveSegmentType,point);

ftr.Geometry =mulp;

【上篇】
【下篇】

抱歉!评论已关闭.