本文整理汇总了C#中FeatureDataTable.NewRow方法的典型用法代码示例。如果您正苦于以下问题:C# FeatureDataTable.NewRow方法的具体用法?C# FeatureDataTable.NewRow怎么用?C# FeatureDataTable.NewRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FeatureDataTable
的用法示例。
在下文中一共展示了FeatureDataTable.NewRow方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShowMapWithPointLayerBasedOnFeatureDataTable
public void ShowMapWithPointLayerBasedOnFeatureDataTable()
{
var table = new FeatureDataTable();
table.Columns.Add("X", typeof(double));
table.Columns.Add("Y", typeof(double));
table.Columns.Add("Category", typeof(string));
DataRow row = table.NewRow();
table.Rows.Add(row);
row.ItemArray = new object[] { 100000, 400000, "testCategory" };
row = table.NewRow();
table.Rows.Add(row);
row.ItemArray = new object[] { 200000, 400000, "TestCategory" };
var dataTablePoint = new DataTablePoint(table, "Category", "X", "Y");
var vectorLayer = new VectorLayer("test", dataTablePoint);
vectorLayer.Theme =ThemeFactory.CreateSingleFeatureTheme(vectorLayer.Style.GeometryType, Color.Blue, 10);
var map = new Map { Name = "testmap" };
map.Layers.Add(vectorLayer);
map.Center = new Coordinate(150000, 400000);
map.Zoom = 200000;
//map.ZoomToExtents();
//map.ZoomToBox(map.Envelope);
MapTestHelper.Show(map);
}
示例2: SetupMap
/// <summary>
/// little util wich just adds one vector layer to the map and assigns it a random theme.
/// </summary>
/// <param name="context"></param>
/// <param name="m"></param>
public static void SetupMap(HttpContext context, Map m)
{
var l = new VectorLayer(
"Countries",
new ShapeFile(context.Server.MapPath(ConfigurationManager.AppSettings["shpfilePath"])));
l.Style = RandomStyle.RandomVectorStyleNoSymbols();
l.Theme = new CustomTheme<IVectorStyle>(
delegate { return RandomStyle.RandomVectorStyleNoSymbols(); });
m.Layers.Add(l);
FeatureDataTable labelData = new FeatureDataTable();
labelData.Columns.Add("Name", typeof (string));
FeatureDataRow r = labelData.NewRow();
r["Name"] = "My Lair";
r.Geometry = new Point(5, 5);
labelData.AddRow(r);
LabelLayer labelLayer = new LabelLayer("labelLayer")
{
DataSource = new GeometryFeatureProvider(labelData),
Enabled = true,
LabelColumn = "Name",
Style = new LabelStyle
{
BackColor = new SolidBrush(Color.Black),
ForeColor = Color.White,
Halo = new Pen(Color.Yellow, 0.1F),
CollisionDetection = false,
Font = new Font("Arial", 10, GraphicsUnit.Point)
}
};
m.Layers.Add(labelLayer);
}
示例3: GetSetAttributesViaIFeature
public void GetSetAttributesViaIFeature()
{
var featureTable = new FeatureDataTable();
featureTable.Columns.Add("name", typeof (string));
featureTable.Columns.Add("attribute1", typeof(int));
var feature1 = featureTable.NewRow();
feature1.Geometry = new Point(0, 0);
feature1["name"] = "feature1";
feature1["attribute1"] = 1;
featureTable.Rows.Add(feature1);
// now access it using IFeature iterfaces
IFeature f1 = feature1;
f1.Attributes.Count
.Should().Be.EqualTo(2);
f1.Attributes.Keys
.Should().Have.SameSequenceAs(new[] {"name", "attribute1"});
f1.Attributes["name"]
.Should().Be.EqualTo("feature1");
f1.Attributes["attribute1"]
.Should().Be.EqualTo(1);
f1.Attributes[0]
.Should().Be.EqualTo("feature1");
f1.Attributes[1]
.Should().Be.EqualTo(1);
}
示例4: AddedRowChangesRowState
public void AddedRowChangesRowState()
{
FeatureDataTable table = new FeatureDataTable();
FeatureDataRow row = table.NewRow();
table.AddRow(row);
Assert.AreEqual(DataRowState.Added, row.RowState);
}
示例5: Reload
/// <summary>
/// reloads the data
/// </summary>
public void Reload()
{
using (System.Data.OleDb.OleDbConnection conn = new OleDbConnection(_ConnectionString))
{
string strSQL = "Select * FROM " + this.Table;
using (System.Data.OleDb.OleDbDataAdapter adapter = new OleDbDataAdapter(strSQL, conn))
{
conn.Open();
System.Data.DataSet ds2 = new System.Data.DataSet();
adapter.Fill(ds2);
conn.Close();
if (ds2.Tables.Count > 0)
{
m_fdt = new FeatureDataTable(ds2.Tables[0]);
foreach (System.Data.DataColumn col in ds2.Tables[0].Columns)
m_fdt.Columns.Add(col.ColumnName, col.DataType, col.Expression);
foreach (System.Data.DataRow dr in ds2.Tables[0].Rows)
{
SharpMap.Data.FeatureDataRow fdr = m_fdt.NewRow();
foreach (System.Data.DataColumn col in ds2.Tables[0].Columns)
fdr[col.ColumnName] = dr[col];
SharpMap.Geometries.Geometry geom = SharpMap.Converters.WellKnownBinary.GeometryFromWKB.Parse((byte[])dr[this.GeometryColumn]);
fdr.Geometry = geom;
m_fdt.AddRow(fdr);
}
}
}
}
}
示例6: AcceptChangesAppearAsUnchanged
public void AcceptChangesAppearAsUnchanged()
{
FeatureDataTable table = new FeatureDataTable();
FeatureDataRow row = table.NewRow();
table.AddRow(row);
table.AcceptChanges();
Assert.AreEqual(DataRowState.Unchanged, row.RowState);
}
示例7: AddedRowAppearsAsChange
public void AddedRowAppearsAsChange()
{
FeatureDataTable table = new FeatureDataTable();
FeatureDataRow row = table.NewRow();
table.AddRow(row);
FeatureDataTable changes = table.GetChanges();
Assert.AreEqual(1, changes.FeatureCount);
}
示例8: AddedRowIncreasesRowCount
public void AddedRowIncreasesRowCount()
{
FeatureDataTable table = new FeatureDataTable();
FeatureDataRow row = table.NewRow();
table.AddRow(row);
Assert.AreEqual(1, table.Rows.Count);
Assert.AreEqual(1, table.FeatureCount);
}
示例9: AcceptChangesReturnsNullChangesTable
public void AcceptChangesReturnsNullChangesTable()
{
FeatureDataTable table = new FeatureDataTable();
FeatureDataRow row = table.NewRow();
table.AddRow(row);
table.AcceptChanges();
FeatureDataTable changes = table.GetChanges();
Assert.IsNull(changes);
}
示例10: NewRowReturnsDetachedFeatureDataRow
public void NewRowReturnsDetachedFeatureDataRow()
{
FeatureDataTable table = new FeatureDataTable();
FeatureDataRow row = table.NewRow();
Assert.IsNotNull(row);
Assert.AreEqual(0, table.Rows.Count);
Assert.AreEqual(DataRowState.Detached, row.RowState);
Assert.AreSame(table, row.Table);
}
示例11: GeometryFeatureProvider
/// <summary>
/// Initializes a new instance of the <see cref="GeometryProvider"/>
/// </summary>
/// <param name="geometries">Set of geometries that this datasource should contain</param>
public GeometryFeatureProvider(Collection<Geometry> geometries)
{
_features = new FeatureDataTable();
foreach (Geometry geom in geometries)
{
FeatureDataRow fdr = _features.NewRow();
fdr.Geometry = geom;
_features.AddRow(fdr);
}
}
示例12: GeometryFeatureProvider
/// <summary>
/// Initializes a new instance of the <see cref="GeometryProvider"/>
/// </summary>
/// <param name="geometries">Set of geometries that this datasource should contain</param>
public GeometryFeatureProvider(IEnumerable<IGeometry> geometries)
{
_features = new FeatureDataTable();
foreach (var geom in geometries)
{
var fdr = _features.NewRow();
fdr.Geometry = geom;
_features.AddRow(fdr);
}
_features.TableCleared += HandleFeaturesCleared;
}
示例13: KeepColumnNamesInSync
public void KeepColumnNamesInSync()
{
var table = new FeatureDataTable();
var row = table.NewRow();
table.Rows.Add(row);
var accessor = new FeatureDataRowAttributeAccessor(row);
// now add column and check if it is available via accessor
table.Columns.Add("Name", typeof (string));
accessor.Count
.Should().Be.EqualTo(1);
}
示例14: CreateGeometryLayer
public VectorLayer CreateGeometryLayer()
{
FeatureDataTable fdt = new FeatureDataTable();
fdt.Columns.Add(new DataColumn("Name", typeof (String)));
FeatureDataRow fdr;
fdr = fdt.NewRow();
fdr["Name"] = "Mayence";
fdr.Geometry = (Geometry) new Point(8.1, 50.0);
fdt.AddRow(fdr);
VectorLayer vLayer = new VectorLayer("GeometryProvider");
vLayer.DataSource = new GeometryFeatureProvider(fdt);
vLayer.SRID = 4326;
return vLayer;
}
示例15: FixtureSetUp
public void FixtureSetUp()
{
var fdt = new FeatureDataTable();
fdt.Columns.Add(new DataColumn("ID", typeof (int)));
fdt.Columns.Add(new DataColumn("LABEL", typeof (string)));
fdt.Columns.Add(new DataColumn("HALIGN", typeof (int)));
fdt.Columns.Add(new DataColumn("VALIGN", typeof (int)));
var factory = GeoAPI.GeometryServiceProvider.Instance.CreateGeometryFactory(4236);
for (var i = 0; i < 3; i++)
{
for (var j = 0; j < 3; j++)
{
var fdr = fdt.NewRow();
fdr[0] = i*3 + j;
fdr[1] = string.Format("Point({0}, {1})\nID {2}", i, j, i*3 + j);
fdr[2] = j;
fdr[3] = i;
fdr.Geometry = factory.CreatePoint(new Coordinate(j*100, i*100));
fdt.AddRow(fdr);
}
}
_featureDataTable = fdt;
}