Exemple #1
0
        public void Measure_performance_query_items_from_GDB()
        {
            Polygon polygon = PolygonConstruction
                              .StartPolygon(0, 0)
                              .LineTo(0, 20)
                              .LineTo(20, 20)
                              .LineTo(20, 0)
                              .ClosePolygon();

            Polygon areaOfInterest = PolygonConstruction
                                     .StartPolygon(0, 0)
                                     .LineTo(0, 100)
                                     .LineTo(100, 100)
                                     .LineTo(100, 0)
                                     .ClosePolygon();

            var rowCount = 10000;

            TestUtils.InsertRows(_emptyIssuesGdb, _featureClassName, polygon, rowCount);

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

                var geodatabase = new Geodatabase(new FileGeodatabaseConnectionPath(uri));

                var table = geodatabase.OpenDataset <Table>(_featureClassName);
                Dictionary <Geodatabase, List <Table> > tablesByGeodatabase = new Dictionary <Geodatabase, List <Table> >
                {
                    { geodatabase, new List <Table> {
                          table
                      } }
                };

                IRepository         stateRepository = new XmlWorkItemStateRepository(@"C:\temp\states.xml", null, null);
                IWorkItemRepository repository      = new IssueItemRepository(tablesByGeodatabase, stateRepository);

                IWorkList workList = new GdbQueryWorkList(repository, "work list");
                workList.AreaOfInterest = areaOfInterest;

                var filter = GdbQueryUtils.CreateSpatialFilter(areaOfInterest);

                var watch = new Stopwatch();
                watch.Start();

                IEnumerable <IWorkItem> items = workList.GetItems(filter);

                watch.Stop();
                Console.WriteLine($"{watch.ElapsedMilliseconds} ms");

                Assert.AreEqual(rowCount, items.Count());
            }
            finally
            {
                TestUtils.DeleteAllRows(_emptyIssuesGdb, _featureClassName);
            }
        }
Exemple #2
0
        public void WorkItemService_LearningTest()
        {
            Polygon polygon = PolygonConstruction
                              .StartPolygon(0, 0)
                              .LineTo(0, 20)
                              .LineTo(20, 20)
                              .LineTo(20, 0)
                              .ClosePolygon();

            var rowCount = 4;

            TestUtils.InsertRows(_emptyIssuesGdb, _featureClassName, polygon, rowCount);

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

                var geodatabase = new Geodatabase(new FileGeodatabaseConnectionPath(uri));
                var table       = geodatabase.OpenDataset <Table>(_featureClassName);
                Dictionary <Geodatabase, List <Table> > tablesByGeodatabase = new Dictionary <Geodatabase, List <Table> >
                {
                    { geodatabase, new List <Table> {
                          table
                      } }
                };

                IRepository         stateRepository = new XmlWorkItemStateRepository(@"C:\temp\states.xml", null, null);
                IWorkItemRepository repository      = new IssueItemRepository(tablesByGeodatabase, stateRepository);

                IWorkList workList = new GdbQueryWorkList(repository, "work list");

                var items = workList.GetItems().Cast <IssueItem>().ToList();

                Assert.AreEqual("Bart", items[0].IssueCodeDescription);
                Assert.AreEqual("Bart", items[1].IssueCodeDescription);
                Assert.AreEqual("Bart", items[2].IssueCodeDescription);
                Assert.AreEqual("Bart", items[3].IssueCodeDescription);
            }
            finally
            {
                TestUtils.DeleteAllRows(_emptyIssuesGdb, _featureClassName);
            }
        }