Пример #1
0
        public void ExportSelectionTest()
        {
            string filename = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TestFiles", "soils.shp");
            string fileOut = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TestFiles", "soilsExport.shp");

            ShapefileLayerProvider provider = new ShapefileLayerProvider();
            var target = (FeatureLayer)provider.OpenLayer(filename, false, null, null);
            target.SelectByAttribute("[BPEJ_K_S42]>7710");

            Assert.IsTrue(target.Selection.Count > 0);

            target.ExportSelection(fileOut);

            File.Delete(fileOut);
        }
Пример #2
0
        public void ExportSelectionTestWithCulture()
        {
            Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("cs-CZ");
            Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("cs-CZ");

            string filename = Path.Combine("TestFiles", "soils.shp");
            string fileOut = Path.Combine("TestFiles", "soilsExport.shp");

            ShapefileLayerProvider provider = new ShapefileLayerProvider();
            var target = (FeatureLayer)provider.OpenLayer(filename, false, null, null);
            target.SelectByAttribute("[BPEJ_K_S42]>7710");

            Assert.IsTrue(target.Selection.Count > 0);

            target.ExportSelection(fileOut);

            File.Delete(fileOut);
        }
Пример #3
0
        public void ExportSelectionTest()
        {
            string filename = FileTools.PathToTestFile(@"Shapefiles\Soils\soils.shp");
            string fileOut = FileTools.GetTempFileName(".shp");
            try
            {
                var provider = new ShapefileLayerProvider();
                var target = (FeatureLayer)provider.OpenLayer(filename, false, null, null);
                target.SelectByAttribute("[BPEJ_K_S42]>7710");

                Assert.IsTrue(target.Selection.Count < target.DataSet.Count);
                Assert.IsTrue(target.Selection.Count > 0);
                target.ExportSelection(fileOut);

            }
            finally
            {
                FileTools.DeleteShapeFile(fileOut);
            }
        }
Пример #4
0
 public void ExportSelectionTestWithCulture()
 {
     var currentCultute = Thread.CurrentThread.CurrentCulture;
     var currentUICultute = Thread.CurrentThread.CurrentUICulture;
     string filename = FileTools.PathToTestFile(@"Shapefiles\Soils\soils.shp");
     string fileOut = FileTools.GetTempFileName(".shp");
     try
     {
         Thread.CurrentThread.CurrentCulture = Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("cs-CZ");
         var provider = new ShapefileLayerProvider();
         var target = (FeatureLayer)provider.OpenLayer(filename, false, null, null);
         target.SelectByAttribute("[BPEJ_K_S42]>7710");
         Assert.IsTrue(target.Selection.Count > 0);
         target.ExportSelection(fileOut);
     }
     finally
     {
         Thread.CurrentThread.CurrentCulture = currentCultute;
         Thread.CurrentThread.CurrentUICulture = currentUICultute;
         FileTools.DeleteShapeFile(fileOut);   
     }
     
 }