• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# FeatureDataTable类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: FeatureRow

 internal FeatureRow(DataRowBuilder rb) :
     base(rb)
 {
     tableFeature = ((FeatureDataTable) (Table));
 }
开发者ID:randomyed,项目名称:SobekCM-Web-Application,代码行数:5,代码来源:Map_Info_Tables.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: GeometryFactory

        /// <summary>
        /// Protected constructor for the abstract class.
        /// </summary>
        /// <param name="httpClientUtil">A configured <see cref="HttpClientUtil"/> instance for performing web requests</param>
        /// <param name="featureTypeInfo">A <see cref="WfsFeatureTypeInfo"/> instance providing metadata of the featuretype to query</param>
        /// <param name="labelInfo">A FeatureDataTable for labels</param>
        protected GeometryFactory(HttpClientUtil httpClientUtil, WfsFeatureTypeInfo featureTypeInfo,
                                  FeatureDataTable labelInfo)
        {
            _FeatureTypeInfo = featureTypeInfo;
            _HttpClientUtil = httpClientUtil;
            createReader(httpClientUtil);

            try
            {
                if (labelInfo != null)
                {
                    _LabelInfo = labelInfo;
                    _LabelNode = new PathNode(_FeatureTypeInfo.FeatureTypeNamespace, _LabelInfo.Columns[0].ColumnName,
                                              (NameTable) _XmlReader.NameTable);
                }
            }
            catch (Exception ex)
            {
                Trace.TraceError("An exception occured while initializing the label path node!");
                throw ex;
            }

            initializePathNodes();
            initializeSeparators();
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:31,代码来源:GeometryFactories.cs


示例5: PostFilterExistingFeatureDataTable

        /// <summary>
        /// This method takes a pre-populated FeatureDataTable and removes rows that do not truly intersect testGeometry
        /// </summary>
        /// <param name="featureDataTable">The FeatureDataTable instance to filter</param>
        /// <param name="testGeometry">the geometry to compare against</param>
        public void PostFilterExistingFeatureDataTable(FeatureDataTable featureDataTable, Geometry testGeometry)
        {
            //first we create a new GeometryFactory.
            GeometryFactory geometryFactory = new GeometryFactory();


            //then we convert the testGeometry into the equivalent NTS geometry
            GeoAPI.Geometries.IGeometry testGeometryAsNtsGeom = GeometryConverter.ToNTSGeometry(testGeometry, geometryFactory);


            //now we loop backwards through the FeatureDataTable 
            for (int i = featureDataTable.Rows.Count - 1; i > -1; i--)
            {
                //we get each row
                FeatureDataRow featureDataRow = featureDataTable.Rows[i] as FeatureDataRow;
                //and get the rows' geometry
                Geometry compareGeometry = featureDataRow.Geometry;
                //convert the rows' geometry into the equivalent NTS geometry
                GeoAPI.Geometries.IGeometry compareGeometryAsNts = GeometryConverter.ToNTSGeometry(compareGeometry, geometryFactory);
                //now test for intesection (note other operations such as Contains, Within, Disjoint etc can all be done the same way)
                bool intersects = testGeometryAsNtsGeom.Intersects(compareGeometryAsNts);

                //if it doesn't intersect remove the row.
                if (!intersects)
                    featureDataTable.Rows.RemoveAt(i);
            }
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:32,代码来源:TrueIntersectionTestingWithNTS.cs


示例6: GeometryFactory

        /// <summary>
        /// Protected constructor for the abstract class.
        /// </summary>
        /// <param name="httpClientUtil">A configured <see cref="HttpClientUtil"/> instance for performing web requests</param>
        /// <param name="featureTypeInfo">A <see cref="WfsFeatureTypeInfo"/> instance providing metadata of the featuretype to query</param>
        /// <param name="labelInfo">A FeatureDataTable for labels</param>
        protected GeometryFactory(HttpClientUtil httpClientUtil, WfsFeatureTypeInfo featureTypeInfo,
                                  FeatureDataTable labelInfo)
        {
            _FeatureTypeInfo = featureTypeInfo;
            Factory = featureTypeInfo.Factory;
            _httpClientUtil = httpClientUtil;
            createReader(httpClientUtil);

            try
            {
                if (labelInfo != null)
                {
                    _LabelInfo = labelInfo;
                    var pathNodes = new IPathNode[labelInfo.Columns.Count];
                    for (var i = 0; i < pathNodes.Length; i++)
                    {
                        pathNodes[i] = new PathNode(_FeatureTypeInfo.FeatureTypeNamespace, _LabelInfo.Columns[i].ColumnName, (NameTable)_XmlReader.NameTable);
                    }
                    _LabelNode = new AlternativePathNodesCollection(pathNodes);
                }
            }
            catch (Exception ex)
            {
                Trace.TraceError("An exception occured while initializing the label path node!");
                throw ex;
            }

            initializePathNodes();
            initializeSeparators();
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:36,代码来源:GeometryFactories.cs


示例7: 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


示例8: GetFeatureTableForFields

        internal static FeatureDataTable<uint> GetFeatureTableForFields(IEnumerable<DbaseField> _dbaseColumns)
        {
            FeatureDataTable<uint> table = new FeatureDataTable<uint>(OidColumnName);

            foreach (DbaseField dbf in _dbaseColumns)
            {
                DataColumn col = table.Columns.Add(dbf.ColumnName, dbf.DataType);

				if (dbf.DataType == typeof(string))
				{
					col.MaxLength = dbf.Length;
				}
				else
				{
                    col.ExtendedProperties[ProviderSchemaHelper.LengthExtendedProperty] = dbf.Length;
				}

				if (dbf.Decimals > 0)
				{
                    col.ExtendedProperties[ProviderSchemaHelper.NumericPrecisionExtendedProperty] = dbf.Decimals;
				}
            }

            return table;
        }
开发者ID:sridhar19091986,项目名称:sharpmapcf,代码行数:25,代码来源:DbaseSchema.cs


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


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


示例11: 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


示例12: 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


示例13: CreateTable

 protected static FeatureDataTable CreateTable()
 {
     var res = new FeatureDataTable();
     res.Columns.Add(new DataColumn("Oid", typeof(ushort)));
     res.Columns.Add(new DataColumn("Value", typeof(double)));
     res.Constraints.Add("PK_OID", res.Columns[0], true);
     return res;
 }
开发者ID:geobabbler,项目名称:SharpMap,代码行数:8,代码来源:MatrixProviderBase.cs


示例14: 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


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


示例16: 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


示例17: 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


示例18: CreateFeatureDataTable

 private static FeatureDataTable CreateFeatureDataTable(string name)
 {
     var t1 = new FeatureDataTable { TableName = name };
     t1.Columns.Add(new DataColumn("oid", typeof(uint)));
     t1.Columns.Add(new DataColumn("P1", typeof(string)));
     t1.Columns.Add(new DataColumn("P2", typeof(double)));
     t1.Columns.Add(new DataColumn("P3", typeof(DateTime)));
     t1.PrimaryKey = new[] { t1.Columns[0] };
     return t1;
 }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:10,代码来源:FeatureDataSetTests.cs


示例19: 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


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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# FeatureLayer类代码示例发布时间:2022-05-24
下一篇:
C# FeatureDataSet类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap