当前位置: 首页>>代码示例>>C#>>正文


C# FeatureDataTable.AddRow方法代码示例

本文整理汇总了C#中FeatureDataTable.AddRow方法的典型用法代码示例。如果您正苦于以下问题:C# FeatureDataTable.AddRow方法的具体用法?C# FeatureDataTable.AddRow怎么用?C# FeatureDataTable.AddRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FeatureDataTable的用法示例。


在下文中一共展示了FeatureDataTable.AddRow方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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);
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:40,代码来源:DemoMapSetupUtility.cs

示例2: AddedRowChangesRowState

 public void AddedRowChangesRowState()
 {
     FeatureDataTable table = new FeatureDataTable();
     FeatureDataRow row = table.NewRow();
     table.AddRow(row);
     Assert.AreEqual(DataRowState.Added, row.RowState);
 }
开发者ID:sridhar19091986,项目名称:sharpmapcf,代码行数:7,代码来源:FeatureDataTableTests.cs

示例3: 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);
                        }
                    }
                }
            }
        }
开发者ID:oliverheilig,项目名称:SharpMap.Ptv,代码行数:33,代码来源:MMProviderStatic.cs

示例4: 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);
 }
开发者ID:sridhar19091986,项目名称:sharpmapcf,代码行数:8,代码来源:FeatureDataTableTests.cs

示例5: AcceptChangesAppearAsUnchanged

 public void AcceptChangesAppearAsUnchanged()
 {
     FeatureDataTable table = new FeatureDataTable();
     FeatureDataRow row = table.NewRow();
     table.AddRow(row);
     table.AcceptChanges();
     Assert.AreEqual(DataRowState.Unchanged, row.RowState);
 }
开发者ID:sridhar19091986,项目名称:sharpmapcf,代码行数:8,代码来源:FeatureDataTableTests.cs

示例6: AddedRowAppearsAsChange

 public void AddedRowAppearsAsChange()
 {
     FeatureDataTable table = new FeatureDataTable();
     FeatureDataRow row = table.NewRow();
     table.AddRow(row);
     FeatureDataTable changes = table.GetChanges();
     Assert.AreEqual(1, changes.FeatureCount);
 }
开发者ID:sridhar19091986,项目名称:sharpmapcf,代码行数:8,代码来源:FeatureDataTableTests.cs

示例7: AcceptChangesReturnsNullChangesTable

 public void AcceptChangesReturnsNullChangesTable()
 {
     FeatureDataTable table = new FeatureDataTable();
     FeatureDataRow row = table.NewRow();
     table.AddRow(row);
     table.AcceptChanges();
     FeatureDataTable changes = table.GetChanges();
     Assert.IsNull(changes);
 }
开发者ID:sridhar19091986,项目名称:sharpmapcf,代码行数:9,代码来源:FeatureDataTableTests.cs

示例8: 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);
     }
 }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:14,代码来源:GeometryFeatureProvider.cs

示例9: 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;
 }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:15,代码来源:GeometryFeatureProvider.cs

示例10: 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;
    }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:21,代码来源:GeometryFeature.aspx.cs

示例11: 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;
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:24,代码来源:LabelLayerTest.cs

示例12: OnExecuteIntersectionQuery

        /// <summary>
        /// Returns the features that intersects with 'geom'
        /// </summary>
        /// <param name="geom"></param>
        /// <param name="fcs">FeatureCollectionSet to fill data into</param>
        protected override void OnExecuteIntersectionQuery(IGeometry geom, IFeatureCollectionSet fcs, CancellationToken? cancellationToken=null)
        {
            using (var conn = new OracleConnection(ConnectionString))
            {
                var strGeom = "MDSYS.SDO_GEOMETRY('" + geom.AsText() + "', #SRID#)";

                strGeom = strGeom.Replace("#SRID#", SRID > 0 ? SRID.ToString(Map.NumberFormatEnUs) : "NULL");

                strGeom = "SDO_RELATE(g." + GeometryColumn + ", " + strGeom +
                          ", 'mask=ANYINTERACT querytype=WINDOW') = 'TRUE'";

                var strSQL = "SELECT g.* , g." + GeometryColumn + ").Get_WKB() As sharpmap_tempgeometry FROM " +
                             Table + " g WHERE ";

                if (!String.IsNullOrEmpty(_definitionQuery))
                    strSQL += DefinitionQuery + " AND ";

                strSQL += strGeom;
                var ds = new FeatureDataSet();

                using (var adapter = new OracleDataAdapter(strSQL, conn))
                {
                    conn.Open();
                    adapter.Fill(ds);
                    conn.Close();
                    if (ds.Tables.Count <= 0)
                    {
                        return;
                    }
                    
                    var fdt = new FeatureDataTable(ds.Tables[0]);
                    foreach (DataColumn col in ds.Tables[0].Columns)
                    {
                        if (col.ColumnName != GeometryColumn && col.ColumnName != "sharpmap_tempgeometry")
                        {
                            fdt.Columns.Add(col.ColumnName, col.DataType, col.Expression);
                        }
                    }
                    
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        var fdr = fdt.NewRow();
                        foreach (DataColumn col in ds.Tables[0].Columns)
                            if (col.ColumnName != GeometryColumn && col.ColumnName != "sharpmap_tempgeometry")
                                fdr[col.ColumnName] = dr[col];
                        fdr.Geometry = GeometryFromWKB.Parse((byte[]) dr["sharpmap_tempgeometry"], Factory);
                        fdt.AddRow(fdr);
                    }
                    fcs.Add(fdt);
                }
            }
        }
开发者ID:geobabbler,项目名称:SharpMap,代码行数:57,代码来源:Oracle.cs

示例13: 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 void ExecuteIntersectionQuery(SharpMap.Geometries.BoundingBox bbox, SharpMap.Data.FeatureDataSet ds)
		{
			//List<Geometries.Geometry> features = new List<SharpMap.Geometries.Geometry>();
			using (SqlConnection conn = new SqlConnection(_ConnectionString))
			{
				string strSQL = "SELECT *, " + this.GeometryColumn + " AS sharpmap_tempgeometry ";
				strSQL += "FROM " + this.Table + " WHERE ";
				strSQL += GetBoxClause(bbox);

				if (!String.IsNullOrEmpty(_defintionQuery))
					strSQL += " AND " + this.DefinitionQuery;

				using (SqlDataAdapter adapter = new SqlDataAdapter(strSQL, conn))
				{
					conn.Open();
					System.Data.DataSet ds2 = new System.Data.DataSet();
					adapter.Fill(ds2);
					conn.Close();
					if (ds2.Tables.Count > 0)
					{
						FeatureDataTable fdt = new FeatureDataTable(ds2.Tables[0]);
						foreach (System.Data.DataColumn col in ds2.Tables[0].Columns)
							if (col.ColumnName != this.GeometryColumn && col.ColumnName != "sharpmap_tempgeometry" && !col.ColumnName.StartsWith("Envelope_"))
								fdt.Columns.Add(col.ColumnName, col.DataType, col.Expression);
						foreach (System.Data.DataRow dr in ds2.Tables[0].Rows)
						{
							SharpMap.Data.FeatureDataRow fdr = fdt.NewRow();
							foreach (System.Data.DataColumn col in ds2.Tables[0].Columns)
								if (col.ColumnName != this.GeometryColumn && col.ColumnName != "sharpmap_tempgeometry" && !col.ColumnName.StartsWith("Envelope_"))
									fdr[col.ColumnName] = dr[col];
							if (dr["sharpmap_tempgeometry"] != DBNull.Value)
								fdr.Geometry = SharpMap.Converters.WellKnownBinary.GeometryFromWKB.Parse((byte[])dr["sharpmap_tempgeometry"]);
							fdt.AddRow(fdr);
						}
						ds.Tables.Add(fdt);
					}
				}
			}
		}
开发者ID:lishxi,项目名称:_SharpMap,代码行数:44,代码来源:MsSql.cs

示例14: ExecuteIntersectionQuery

		/// <summary>
		/// Returns the features that intersects with 'geom'
		/// </summary>
		/// <param name="geom"></param>
		/// <param name="ds">FeatureDataSet to fill data into</param>
		public void ExecuteIntersectionQuery(SharpMap.Geometries.Geometry geom, FeatureDataSet ds)
		{
			List<Geometries.Geometry> features = new List<SharpMap.Geometries.Geometry>();
			using (SqlConnection conn = new SqlConnection(this.ConnectionString))
			{
				string strGeom;
				if (this.TargetSRID > 0 && this.SRID > 0 && this.SRID != this.TargetSRID)
					strGeom = "ST.Transform(ST.GeomFromText('" + geom.AsText() + "'," + this.TargetSRID.ToString() + ")," + this.SRID.ToString() + ")";
				else
					strGeom = "ST.GeomFromText('" + geom.AsText() + "', " + this.SRID.ToString() + ")";

				string strSQL = "SELECT " + this.FeatureColumns + ", ST.AsBinary(" + this.BuildGeometryExpression() + ") As sharpmap_tempgeometry ";
				strSQL += "FROM ST.RelateQuery" + this.BuildSpatialQuerySuffix() + "(" + strGeom + ", 'intersects')";

				if (!String.IsNullOrEmpty(this.DefinitionQuery))
					strSQL += " WHERE " + this.DefinitionQuery;

				if (!String.IsNullOrEmpty(this.OrderQuery))
					strSQL += " ORDER BY " + this.OrderQuery;

				using (SqlDataAdapter adapter = new SqlDataAdapter(strSQL, conn))
				{
					conn.Open();
					adapter.Fill(ds);
					conn.Close();
					if (ds.Tables.Count > 0)
					{
						FeatureDataTable fdt = new FeatureDataTable(ds.Tables[0]);
						foreach (System.Data.DataColumn col in ds.Tables[0].Columns)
							if (col.ColumnName != this.GeometryColumn && !col.ColumnName.StartsWith(this.GeometryColumn + "_Envelope_") && col.ColumnName != "sharpmap_tempgeometry")
								fdt.Columns.Add(col.ColumnName, col.DataType, col.Expression);
						foreach (System.Data.DataRow dr in ds.Tables[0].Rows)
						{
							SharpMap.Data.FeatureDataRow fdr = fdt.NewRow();
							foreach (System.Data.DataColumn col in ds.Tables[0].Columns)
								if (col.ColumnName != this.GeometryColumn && !col.ColumnName.StartsWith(this.GeometryColumn + "_Envelope_") && col.ColumnName != "sharpmap_tempgeometry")
									fdr[col.ColumnName] = dr[col];
							if (dr["sharpmap_tempgeometry"] != DBNull.Value)
								fdr.Geometry = SharpMap.Converters.WellKnownBinary.GeometryFromWKB.Parse((byte[])dr["sharpmap_tempgeometry"]);
							fdt.AddRow(fdr);
						}
						ds.Tables.Add(fdt);
					}
				}
			}
		}
开发者ID:lishxi,项目名称:_SharpMap,代码行数:51,代码来源:MsSqlSpatial.cs

示例15: QueryFeatures

        public FeatureDataTable QueryFeatures(Geometry geom, double distance)
        {
            //List<Geometries.Geometry> features = new List<SharpMap.Geometries.Geometry>();
            using (SqlConnection conn = new SqlConnection(ConnectionString))
            {
                string strGeom;
                if (TargetSRID > 0 && SRID > 0 && SRID != TargetSRID)
                    strGeom = "ST.Transform(ST.GeomFromText('" + geom.AsText() + "'," + TargetSRID.ToString() + ")," +
                              SRID.ToString() + ")";
                else
                    strGeom = "ST.GeomFromText('" + geom.AsText() + "', " + SRID.ToString() + ")";

                string strSQL = "SELECT " + FeatureColumns + ", ST.AsBinary(" + BuildGeometryExpression() +
                                ") As sharpmap_tempgeometry ";
                strSQL += "FROM ST.IsWithinDistanceQuery" + BuildSpatialQuerySuffix() + "(" + strGeom + ", " +
                          distance.ToString(Map.NumberFormatEnUs) + ")";

                if (!String.IsNullOrEmpty(DefinitionQuery))
                    strSQL += " WHERE " + DefinitionQuery;

                if (!String.IsNullOrEmpty(OrderQuery))
                    strSQL += " ORDER BY " + OrderQuery;

                using (SqlDataAdapter adapter = new SqlDataAdapter(strSQL, conn))
                {
                    DataSet ds = new DataSet();
                    conn.Open();
                    adapter.Fill(ds);
                    conn.Close();
                    if (ds.Tables.Count > 0)
                    {
                        FeatureDataTable fdt = new FeatureDataTable(ds.Tables[0]);
                        foreach (DataColumn col in ds.Tables[0].Columns)
                            if (col.ColumnName != GeometryColumn &&
                                !col.ColumnName.StartsWith(GeometryColumn + "_Envelope_") &&
                                col.ColumnName != "sharpmap_tempgeometry")
                                fdt.Columns.Add(col.ColumnName, col.DataType, col.Expression);
                        foreach (DataRow dr in ds.Tables[0].Rows)
                        {
                            FeatureDataRow fdr = fdt.NewRow();
                            foreach (DataColumn col in ds.Tables[0].Columns)
                                if (col.ColumnName != GeometryColumn &&
                                    !col.ColumnName.StartsWith(GeometryColumn + "_Envelope_") &&
                                    col.ColumnName != "sharpmap_tempgeometry")
                                    fdr[col.ColumnName] = dr[col];
                            if (dr["sharpmap_tempgeometry"] != DBNull.Value)
                                fdr.Geometry = GeometryFromWKB.Parse((byte[]) dr["sharpmap_tempgeometry"]);
                            fdt.AddRow(fdr);
                        }
                        return fdt;
                    }
                    else return null;
                }
            }
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:55,代码来源:MsSqlSpatial.cs


注:本文中的FeatureDataTable.AddRow方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。