本文整理汇总了C#中FeatureDataTable.BeginLoadData方法的典型用法代码示例。如果您正苦于以下问题:C# FeatureDataTable.BeginLoadData方法的具体用法?C# FeatureDataTable.BeginLoadData怎么用?C# FeatureDataTable.BeginLoadData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FeatureDataTable
的用法示例。
在下文中一共展示了FeatureDataTable.BeginLoadData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateGeometryLayer
public VectorLayer CreateGeometryLayer()
{
var gf = new NetTopologySuite.Geometries.GeometryFactory();
var fdt = new FeatureDataTable();
fdt.Columns.Add(new DataColumn("Name", typeof (String)));
fdt.BeginLoadData();
var fdr = (FeatureDataRow)fdt.LoadDataRow(new[] {(object) "Mayence"}, true);
fdr.Geometry = gf.CreatePoint(new Point(8.1, 50.0));
fdt.EndLoadData();
var vLayer = new VectorLayer("GeometryProvider");
vLayer.DataSource = new FeatureProvider(fdt);
vLayer.SRID = 4326;
return vLayer;
}
示例2: ExecuteIntersectionQuery
/// <summary>
/// Returns all features with the view box
/// </summary>
/// <param name="bbox">view box</param>
/// <param name="ds">FeatureDataSet to fill data into</param>
public override void ExecuteIntersectionQuery(Envelope bbox, FeatureDataSet ds)
{
//List<Geometries.Geometry> features = new List<SharpMap.Geometries.Geometry>();
using (var conn = new OleDbConnection(ConnectionString))
{
conn.Open();
var strSQL = "SELECT * FROM " + Table + " WHERE ";
//If a definition query has been specified, add this as a filter on the query
strSQL += GetDefinitionQueryConstraint(true);
//Limit to the points within the boundingbox
strSQL += GetSpatialConstraint(bbox);
using (var cmd = new OleDbCommand(strSQL, conn))
{
using (var reader = cmd.ExecuteReader())
{
if (reader == null)
throw new InvalidOperationException();
//Set up result table
var fdt = new FeatureDataTable();
fdt.TableName = Table;
for (var c = 0; c < reader.FieldCount; c++)
{
var fieldType = reader.GetFieldType(c);
if (fieldType == null)
throw new Exception("Failed to retrieve field type for column: " + c);
fdt.Columns.Add(reader.GetName(c), fieldType);
}
var dataTransfer = new object[reader.FieldCount];
//Get factory and precision model
var factory = Factory;
var pm = factory.PrecisionModel;
fdt.BeginLoadData();
while (reader.Read())
{
var count = reader.GetValues(dataTransfer);
System.Diagnostics.Debug.Assert(count == dataTransfer.Length);
var fdr = (FeatureDataRow) fdt.LoadDataRow(dataTransfer, true);
var c = new Coordinate(Convert.ToDouble(fdr[XColumn]), Convert.ToDouble(fdr[YColumn]));
pm.MakePrecise(c);
fdr.Geometry = Factory.CreatePoint(c);
}
fdt.EndLoadData();
ds.Tables.Add(fdt);
}
}
}
}
示例3: FillRealDataTable
private static void FillRealDataTable(FeatureDataTable table)
{
table.BeginLoadData();
var factory = GeoAPI.GeometryServiceProvider.Instance.CreateGeometryFactory(4326);
uint id = 0;
foreach (var datas in PointData())
{
var row = (FeatureDataRow) table.LoadDataRow(new object[] {id++, datas[0]}, LoadOption.OverwriteChanges);
row.Geometry = factory.CreatePoint(new Coordinate(datas[2], datas[1]));
}
table.EndLoadData();
}
示例4: OnExecuteIntersectionQuery
/// <summary>
/// Returns the features that intersects with 'geom'
/// </summary>
/// <param name="geom"></param>
/// <param name="ds">FeatureDataSet to fill data into</param>
protected override void OnExecuteIntersectionQuery(IGeometry geom, IFeatureCollectionSet ds, CancellationToken? cancellationToken=null)
{
//List<Geometry> features = new List<Geometry>();
using (var conn = new SqlConnection(ConnectionString))
{
//TODO: Convert to SQL Server
string strGeom = _spatialObject + "::STGeomFromText('" + geom.AsText() + "', #SRID#)";
strGeom = strGeom.Replace("#SRID#", SRID > 0 ? SRID.ToString() : "0");
strGeom = GeometryColumn + ".STIntersects(" + strGeom + ") = 1";
string strSQL = "SELECT g.* , g." + GeometryColumn + ".STAsBinary() As sharpmap_tempgeometry FROM " + Table + " g " + BuildTableHints() + " WHERE ";
if (!String.IsNullOrEmpty(_definitionQuery))
strSQL += DefinitionQuery + " AND ";
strSQL += strGeom;
string extraOptions = GetExtraOptions();
if (!string.IsNullOrEmpty(extraOptions))
strSQL += " " + extraOptions;
var fds = new FeatureDataSet();
using (SqlDataAdapter adapter = new SqlDataAdapter(strSQL, conn))
{
conn.Open();
adapter.Fill(fds);
conn.Close();
if (fds.Tables.Count > 0)
{
var fdt = new FeatureDataTable(fds.Tables[0]);
foreach (System.Data.DataColumn col in fds.Tables[0].Columns)
if (col.ColumnName != GeometryColumn && col.ColumnName != "sharpmap_tempgeometry")
fdt.Columns.Add(col.ColumnName, col.DataType, col.Expression);
fdt.BeginLoadData();
foreach (System.Data.DataRow dr in fds.Tables[0].Rows)
{
FeatureDataRow fdr = fdt.NewRow();
foreach (System.Data.DataColumn col in fds.Tables[0].Columns)
if (col.ColumnName != GeometryColumn && col.ColumnName != "sharpmap_tempgeometry")
fdr[col.ColumnName] = dr[col];
fdr.Geometry = Converters.WellKnownBinary.GeometryFromWKB.Parse((byte[])dr["sharpmap_tempgeometry"], Factory);
fdt.AddRow(fdr);
}
fdt.EndLoadData();
ds.Add(fdt);
}
}
}
}