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


C# FeatureDataTable.EndLoadData方法代码示例

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


在下文中一共展示了FeatureDataTable.EndLoadData方法的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;
    }
开发者ID:geobabbler,项目名称:SharpMap,代码行数:17,代码来源:GeometryFeature.aspx.cs

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

示例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();
        }
开发者ID:geobabbler,项目名称:SharpMap,代码行数:13,代码来源:HeatLayerExample.cs

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


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