|
1、创建Shp的C#代码:
if (PointLayer == null) {
PointLayer = sgworld.Creator.CreateNewFeatureLayer("shp", 0, "FileName=duplicate" +System.DateTime.Now.Second+ ".shp;TEPlugName=OGR;", "");
PointLayer.Streaming =true;
PointLayer.DataSourceInfo.Attributes.CreateAttribute("OBJECTID", AttributeTypeCode.AT_DOUBLE, 0, 4);
PointLayer.Visibility.MaxVisibilityDistance = 3000;
bool gSupportOnTerrain = false;
PointLayer.Position.Distance = 200;
PointLayer.FeatureGroups.SetProperty("Altitude Method", 0);
PointLayer.Refresh();
}
2、创建完之后添加每个feature的代码如下:
PointLayer.FeatureGroups.Point.CreateFeature(sgworld.Creator.GeometryCreator.CreatePointGeometry(new double[]{Convert.ToDouble(x),Convert.ToDouble(y), 0}),"");
|
|