Exemplo n.º 1
0
        /// <summary>
        /// Gets the FeatureLayer that is used for the selection tests.
        /// </summary>
        /// <param name="cat">Reference to the second category.</param>
        /// <returns>The FeatureLayer.</returns>
        private static IFeatureLayer GetFeatureLayer(out PolygonCategory cat)
        {
            // load layer with us states
            ShapefileLayerProvider provider = new ShapefileLayerProvider();
            var fl = (IFeatureLayer)provider.OpenLayer(Path.Combine(@"TestFiles", "50mil_us_states.shp"), false, null, null);

            Assert.IsNotNull(fl);

            // add two categories for testing category.SelectionEnabled
            PolygonScheme scheme = new PolygonScheme();

            scheme.ClearCategories();
            scheme.AddCategory(new PolygonCategory(Color.LightBlue, Color.DarkBlue, 1)
            {
                FilterExpression = "[FIPS] >= 10",
                LegendText       = ">= 10"
            });
            cat = new PolygonCategory(Color.Pink, Color.DarkRed, 1)
            {
                FilterExpression = "[FIPS] < 10",
                LegendText       = "< 10"
            };
            scheme.AddCategory(cat);
            fl.Symbology = scheme;
            Assert.IsTrue(cat.SelectionEnabled, "Categories must be initialized with SelectionEnabled = true.");
            return(fl);
        }
Exemplo n.º 2
0
        public void ExportSelectionTest()
        {
            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);
        }
Exemplo n.º 3
0
        public void ExportSelectionTestWithCulture()
        {
            Thread.CurrentThread.CurrentCulture   = new CultureInfo("cs-CZ");
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("cs-CZ");

            string filename = Path.Combine(_folder, "soils.shp");
            string fileOut  = Path.Combine(_folder, "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);
        }