如何将区域插入到表中

 文章来源:http://www.gisdn.com/ShowPost.asp?id=2191

 //vb.Net编程


Dim conn As New MapInfo.Data.MIConnection
conn.Open()
Dim dPoints(5) As MapInfo.Geometry.DPoint
dPoints(0) = New MapInfo.Geometry.DPoint(-103, 32)
dPoints(1) = New MapInfo.Geometry.DPoint(-97, 26)
dPoints(2) = New MapInfo.Geometry.DPoint(-88, 29)
dPoints(3) = New MapInfo.Geometry.DPoint(-94, 36)
dPoints(4) = New MapInfo.Geometry.DPoint(-103, 32)
Dim g As MapInfo.Geometry.FeatureGeometry = New MapInfo.Geometry.MultiPolygon(MapControl1.Map.GetDisplayCoordSys(), MapInfo.Geometry.CurveSegmentType.Linear, dPoints)
Dim p As MapInfo.Geometry.MultiPolygon = CType(g, MapInfo.Geometry.MultiPolygon)
MsgBox(p.Area(MapInfo.Geometry.AreaUnit.SquareMile).ToString())
Dim sis As MapInfo.Styles.SimpleInterior = New MapInfo.Styles.SimpleInterior(9, System.Drawing.Color.Purple)
Dim lw As MapInfo.Styles.LineWidth = New MapInfo.Styles.LineWidth(3, MapInfo.Styles.LineWidthUnit.Point)
Dim sl As MapInfo.Styles.SimpleLineStyle = New MapInfo.Styles.SimpleLineStyle(lw, 3)
Dim ar As MapInfo.Styles.AreaStyle = New MapInfo.Styles.AreaStyle(sl, sis)


Dim cs As MapInfo.Styles.CompositeStyle = New MapInfo.Styles.CompositeStyle(ar, Nothing, Nothing, Nothing)
Dim t As MapInfo.Data.Table = conn.Catalog.GetTable("USA")
Dim f As MapInfo.Data.Feature = New Feature(g, cs)
Dim k As MapInfo.Data.Key = t.InsertFeature(f)