public static bool AddLGUBoundary(out string feedBack)
 {
     if (Directory.Exists($@"{LayersFolder}\LGUBoundary"))
     {
         var files = Directory.GetFiles($@"{LayersFolder}\LGUBoundary", "*.shp");
         if (files.Length >= 0)
         {
             var result = MapLayersHandler.FileOpenHandler(files[0], "LGU boundary", layerkey: "lgu_boundary");
             feedBack = result.errMsg;
             return(result.success);
         }
     }
     feedBack = "Folder for LGU boundary not found";
     return(false);
 }
        public static bool SetBoundaryShapefile()
        {
            var boundaryFolder = $@"{LayersFolder}\BSCBoundaryLine";

            if (Directory.Exists(boundaryFolder))
            {
                var boundarySF = Directory.GetFiles(boundaryFolder, "*.shp");
                if (boundarySF.Length == 1)
                {
                    MapLayersHandler.FileOpenHandler(boundarySF[0], "BSC boundary", layerkey: "bsc_boundary");
                    BSCBoundaryShapefile = (Shapefile)MapLayersHandler.CurrentMapLayer.LayerObject;
                    return(true);
                }
            }
            return(false);
        }
        public static bool AddBSCBoundaryLineShapefile(string inSF, out string feedBack)
        {
            var boundaryFolder = $@"{LayersFolder}\BSCBoundaryLine";

            if (File.Exists(inSF))
            {
                FileInfo fi = new FileInfo(inSF);
                if (fi.Extension == ".shp")
                {
                    if (!Directory.Exists(boundaryFolder))
                    {
                        Directory.CreateDirectory(boundaryFolder);
                    }


                    var sourceDirInfo = new DirectoryInfo(Path.GetDirectoryName(inSF));
                    var listFiles     = Directory.GetFiles(sourceDirInfo.FullName, $"{Path.GetFileNameWithoutExtension(fi.Name)}.*");

                    var files = Directory.GetFiles(boundaryFolder, "*.shp");
                    if (files.Length == 0)
                    {
                        foreach (var item in listFiles)
                        {
                            File.Copy(item, $@"{boundaryFolder}\{Path.GetFileName(item)}");
                        }
                        files = Directory.GetFiles(boundaryFolder, "*.shp");
                        var result = MapLayersHandler.FileOpenHandler(files[0], "BSC boundary", layerkey: "bsc_boundary");
                        BSCBoundaryShapefile = (Shapefile)MapLayersHandler.CurrentMapLayer.LayerObject;
                        feedBack             = result.errMsg;
                        return(result.success);
                    }
                }
            }



            feedBack = "Folder for LGU boundary not found";
            return(false);
        }
        public static bool AddShapefileLayer(string sf, out string feedBack)
        {
            if (File.Exists(sf))
            {
                FileInfo fi = new FileInfo(sf);
                if (fi.Extension == ".shp")
                {
                    DirectoryInfo dirInfo;
                    dirInfo = new DirectoryInfo(Path.GetDirectoryName(sf));
                    var listFiles    = Directory.GetFiles(dirInfo.FullName, $"{Path.GetFileNameWithoutExtension(fi.Name)}.*");
                    var proposedPath = $@"{LayersFolder}\{Path.GetFileNameWithoutExtension(fi.Name)}";
                    if (!Directory.Exists(proposedPath))
                    {
                        dirInfo = Directory.CreateDirectory(proposedPath);
                    }
                    else
                    {
                        dirInfo = new DirectoryInfo(proposedPath);
                    }
                    var files = Directory.GetFiles(dirInfo.FullName, "*.shp");
                    if (files.Length == 0)
                    {
                        foreach (var item in listFiles)
                        {
                            File.Copy(item, $@"{dirInfo.FullName}\{Path.GetFileName(item)}");
                        }
                    }
                    files = Directory.GetFiles(dirInfo.FullName, "*.shp");
                    var result = MapLayersHandler.FileOpenHandler(files[0], $"{fi.Name}", layerkey: $"{fi.Name}");
                    feedBack = result.errMsg;
                    return(result.success);
                }
            }

            feedBack = "Folder for LGU boundary not found";
            return(false);
        }