20 ".shp",
".shx",
".prj",
".dbf",
".cpg"
24 ".shp",
".shx",
".dbf",
".prj"
28 return std::ranges::any_of(
FILE_EXTENSIONS,[&path](
const auto & ext){
return ext == path.extension().
string();});
31 static bool isValid(
const std::filesystem::path & path) {
32 return std::ranges::all_of(
REQUIRED_FILES,[&path](
const auto & ext){
return std::filesystem::exists(path.parent_path() / std::filesystem::path(path.stem().string()+ext));});
37 throw std::invalid_argument(
"Not a shapefile!");
40 [[nodiscard]]
bool exists() const noexcept{
44 operator bool() const noexcept {
48 bool remove() const noexcept override;
56 Shapefile &
move(
const std::filesystem::path & rootPath, std::string filename);
60 Shapefile copy(
const std::filesystem::path & rootPath, std::string filename)
const;
62 std::string
toString() const noexcept;
bool exists() const noexcept
Tests if the GISFile exists on the filesystem.
Definition GISFile.hpp:79
std::filesystem::path pathToFile
Definition GISFile.hpp:49
Definition GISFile.hpp:131
Shapefile handle implementation.
Definition Shapefile.hpp:14
std::string toString() const noexcept
Definition Shapefile.cpp:62
static constexpr std::array< std::string, 5 > FILE_EXTENSIONS
Definition Shapefile.hpp:19
std::vector< std::filesystem::path > getAssociatedFiles() const
Definition Shapefile.cpp:7
Shapefile(const std::filesystem::path &path)
Definition Shapefile.hpp:35
GISFileType type() const noexcept override
Returns the type of GISFile.
Definition Shapefile.hpp:50
Shapefile & move(const std::filesystem::path &path)
static bool isValid(const std::filesystem::path &path)
Definition Shapefile.hpp:31
static bool supportsExtension(const std::filesystem::path &path)
Definition Shapefile.hpp:27
static constexpr std::array< std::string, 4 > REQUIRED_FILES
Definition Shapefile.hpp:23
Shapefile copy(const std::filesystem::path &rootPath, std::string filename) const
bool remove() const noexcept override
Removes the file from the filesystem.
Definition Shapefile.cpp:19
Shapefile copy(const std::filesystem::path &path) const
Shapefile & move(const std::filesystem::path &rootPath, std::string filename)
bool exists() const noexcept
Definition Shapefile.hpp:40
Interface for GISFile types. Implementation have to inherit from AbstractGISFile and have to printabl...
Definition GISFile.hpp:175
Interface for all Raster GISFile types.
Definition GISFile.hpp:197
Interface for all Vector GISFile types.
Definition GISFile.hpp:187
Definition BFSClustering.hpp:5
GISFileType
Definition GISFile.hpp:11