예제 #1
0
        /// <summary>
        ///Minor grids that are inside land will be copied to another shapefile of inland minor grids
        /// </summary>
        private static void ProcessInlandGrids()
        {
            bool proceed = true;

            if (_inlandMinorGrids.NumShapes == 0)
            {
                try
                {
                    _inlandMinorGrids = MinorGridsShapefile.ExportSelection();
                }
                catch
                {
                    proceed = false;
                }
            }
            else
            {
                _inlandMinorGrids = _inlandMinorGrids.Merge(false, MinorGridsShapefile, true);
            }
            if (proceed)
            {
                _inlandMinorGrids.DefaultDrawingOptions.FillVisible = false;
                _inlandMinorGrids.DefaultDrawingOptions.LineWidth   = 1.1f;
                _inlandMinorGrids.DefaultDrawingOptions.LineColor   = new Utils().ColorByName(tkMapColor.Red);
            }
        }
예제 #2
0
        public void MergeSf()
        {
            const string sf3Location = @"Issues\MWGIS-69\SHP3_POINT.shp";
            const string sf4Location = @"Issues\MWGIS-69\SHP4_POINT.shp";

            var sf3 = new Shapefile {
                GlobalCallback = this
            };

            if (!sf3.Open(sf3Location))
            {
                Assert.Fail("Can't open " + sf3Location + " Error: " + sf3.ErrorMsg[sf3.LastErrorCode]);
            }

            var sf4 = new Shapefile {
                GlobalCallback = this
            };

            if (!sf4.Open(sf4Location))
            {
                Assert.Fail("Can't open " + sf4Location + " Error: " + sf4.ErrorMsg[sf4.LastErrorCode]);
            }

            var sfMerged = sf3.Merge(false, sf4, false);

            Assert.IsNotNull(sfMerged, "Merge failed. Error: " + sf3.ErrorMsg[sf3.LastErrorCode]);
            Assert.AreEqual(2, sfMerged.NumShapes, "Incorrect number of shapes");
            Helper.SaveAsShapefile(sfMerged, Path.Combine(Path.GetTempPath(), "MergeSf.shp"));
        }
예제 #3
0
        public void MergeM()
        {
            const string sf1Location = @"Issues\MWGIS-69\SHP1_POINT_M.shp";
            const string sf2Location = @"Issues\MWGIS-69\SHP2_POINT_M.shp";

            var sf1 = new Shapefile {
                GlobalCallback = this
            };

            if (!sf1.Open(sf1Location))
            {
                Assert.Fail("Can't open " + sf1Location + " Error: " + sf1.ErrorMsg[sf1.LastErrorCode]);
            }
            Console.WriteLine("num shapes in sf1: " + sf1.NumShapes);

            var sf2 = new Shapefile {
                GlobalCallback = this
            };

            if (!sf2.Open(sf2Location))
            {
                Assert.Fail("Can't open " + sf2Location + " Error: " + sf2.ErrorMsg[sf2.LastErrorCode]);
            }
            Console.WriteLine("num shapes in sf2: " + sf2.NumShapes);

            Console.WriteLine("Before merge");
            var sfMerged = sf1.Merge(false, sf2, false);

            Assert.IsNotNull(sfMerged, "Merge failed. Error: " + sf1.ErrorMsg[sf1.LastErrorCode]);
            Assert.AreEqual(2, sfMerged.NumShapes, "Incorrect number of shapes");
            Helper.SaveAsShapefile(sfMerged, Path.Combine(Path.GetTempPath(), "MergeM.shp"));
        }
예제 #4
0
        public IFeatureSet Merge(bool selectedOnlyThis, IFeatureSet featureSet, bool selectedOnly)
        {
            var sf     = featureSet.GetInternal();
            var result = _shapefile.Merge(selectedOnlyThis, sf, selectedOnly);

            return(WrapShapefile(result));
        }