Exemplo n.º 1
0
        public void CanGetExistingRowsFastEnough()
        {
            IFeatureWorkspace ws = OpenTestWorkspace();
            ITable            fc = ws.OpenTable("TOPGIS_TLM.TLM_WANDERWEG");

            const int max = 100;
            IDictionary <int, IRow> rows = GetFirstNRows(fc, max);

            var watch = new Stopwatch();

            watch.Start();

            foreach (int oid in rows.Keys)
            {
                Assert.NotNull(GdbQueryUtils.GetRow(fc, oid));
                _msg.Info($"Oid {oid} time: {watch.ElapsedMilliseconds}");
            }

            watch.Stop();

            double msPerIteration = watch.ElapsedMilliseconds / (double)rows.Count;

            _msg.InfoFormat(@"GetRow() per iteration: {0} ms", msPerIteration);

            Assert.True(msPerIteration < 50,
                        "GetFeature with existing feature takes too long ({0} ms, {1} rows)",
                        msPerIteration, rows.Count);
        }
Exemplo n.º 2
0
        public void CanGetNullForNonExistingRow()
        {
            IFeatureWorkspace ws    = OpenTestWorkspace();
            ITable            table = ws.OpenTable("TOPGIS_TLM.TLM_WANDERWEG");

            Assert.Null(GdbQueryUtils.GetRow(table, 999999999));
        }
Exemplo n.º 3
0
        public void CanGetNullForNonExistingFeatureByGetRow()
        {
            IFeatureWorkspace ws = OpenTestWorkspace();
            IFeatureClass     fc = ws.OpenFeatureClass("TOPGIS_TLM.TLM_STRASSE");

            Assert.Null(GdbQueryUtils.GetRow((ITable)fc, 999999999));
        }
Exemplo n.º 4
0
 public static void UpdateDescription(string path, string featureClassName, int oid)
 {
     using (var geodatabase = new Geodatabase(new FileGeodatabaseConnectionPath(new Uri(path, UriKind.Absolute))))
     {
         using (var table = geodatabase.OpenDataset <Table>(featureClassName))
         {
             var row = GdbQueryUtils.GetRow(table, oid);
             row["Description"] = "Moe";
             row.Store();
         }
     }
 }
Exemplo n.º 5
0
        public static Row GetRow(string path, string tableName, long oid)
        {
            var uri = new Uri(path, UriKind.Absolute);

            using (var geodatabase = new Geodatabase(new FileGeodatabaseConnectionPath(uri)))
            {
                using (var table = geodatabase.OpenDataset <Table>(tableName))
                {
                    return(GdbQueryUtils.GetRow(table, oid));
                }
            }
        }
Exemplo n.º 6
0
 public static void UpdateFeatureGeometry(string path, string featureClassName, Geometry newGeometry, int oid)
 {
     using (var geodatabase = new Geodatabase(new FileGeodatabaseConnectionPath(new Uri(path, UriKind.Absolute))))
     {
         using (var featureClass = geodatabase.OpenDataset <FeatureClass>(featureClassName))
         {
             var feature = (Feature)GdbQueryUtils.GetRow(featureClass, oid);
             feature.SetShape(newGeometry);
             feature.Store();
         }
     }
 }
Exemplo n.º 7
0
        private object GetStatusFromDatabase(string featureClass, string statusField)
        {
            object status;

            var uri = new Uri(_emptyIssuesGdb, UriKind.Absolute);

            using (var geodatabase = new Geodatabase(new FileGeodatabaseConnectionPath(uri)))
            {
                using (var fc = geodatabase.OpenDataset <FeatureClass>(featureClass))
                {
                    Row row = GdbQueryUtils.GetRow(fc, 1);
                    status = row[statusField];
                }
            }

            return(status);
        }