8 #include "../casters.h"
17 using namespace pybind11::literals;
25 throw std::runtime_error(
"Bad argument");
27 throw std::runtime_error(
"Unknown file");
29 throw std::runtime_error(
"Wrong file type");
31 throw std::runtime_error(
"Error when writing");
33 throw std::runtime_error(
"Error when reading");
35 throw std::runtime_error(
"Nothing to save");
37 throw std::runtime_error(
"Nothing to load");
39 throw std::runtime_error(
"Bad entity type");
41 throw std::runtime_error(
"Canceled by user");
43 throw std::runtime_error(
"Not enough memory");
45 throw std::runtime_error(
"Malformed File");
47 throw std::runtime_error(
"The error has been logged in the console");
49 throw std::runtime_error(
"Broken dependency");
51 throw std::runtime_error(
"File was written by unknown plugin");
53 throw std::runtime_error(
"Third party lib failure");
55 throw std::runtime_error(
"Third party lib exception");
57 throw std::runtime_error(
"Internal error");
59 throw std::runtime_error(
"Not implemented");
65 py::class_<ecvGlobalShiftManager> PyccGlobalShiftManager(m,
"ccGlobalShiftManager");
67 py::native_enum<ecvGlobalShiftManager::Mode>(
68 PyccGlobalShiftManager,
"Mode",
"enum.Enum",
"ecvGlobalShiftManager::Mode.")
69 .value(
"NO_DIALOG", ecvGlobalShiftManager::Mode::NO_DIALOG)
70 .value(
"NO_DIALOG_AUTO_SHIFT", ecvGlobalShiftManager::Mode::NO_DIALOG_AUTO_SHIFT)
71 .value(
"DIALOG_IF_NECESSARY", ecvGlobalShiftManager::Mode::DIALOG_IF_NECESSARY)
72 .value(
"ALWAYS_DISPLAY_DIALOG", ecvGlobalShiftManager::Mode::ALWAYS_DISPLAY_DIALOG)
76 py::class_<FileIOFilter> PyFileIOFilter(m,
"FileIOFilter");
87 py::return_value_policy::take_ownership)
93 const QString filterName = QString())
95 const QString requestedFilterName =
96 filterName.isEmpty() ? QFileInfo(
filename).suffix() : filterName;
101 const QStringList filters = filter->getFileFilters(
false );
103 std::find_if(filters.begin(),
105 [&requestedFilterName](
const QString &filterString)
106 { return filterString.contains(requestedFilterName); });
107 if (it != filters.end())
115 throw std::runtime_error(std::string(
"Unable to find FileFilter for ") +
116 requestedFilterName.toStdString());
121 "fileFileter"_a = QString());
123 py::class_<FileIOFilter::LoadParameters>(PyFileIOFilter,
"LoadParameters")
126 .def_readwrite(
"alwaysDisplayLoadDialog",
128 .def_readwrite(
"coordinatesShiftEnabled",
130 .def_readwrite(
"coordinatesShift",
132 py::return_value_policy::reference)
135 .def_readwrite(
"parentWidget",
137 py::return_value_policy::reference)
140 py::class_<FileIOFilter::SaveParameters>(PyFileIOFilter,
"SaveParameters")
142 .def_readwrite(
"alwaysDisplaySaveDialog",
144 .def_readwrite(
"parentWidget",
146 py::return_value_policy::reference);
CC_FILE_ERROR
Typical I/O filter errors.
@ CC_FERR_CANCELED_BY_USER
@ CC_FERR_THIRD_PARTY_LIB_FAILURE
@ CC_FERR_THIRD_PARTY_LIB_EXCEPTION
@ CC_FERR_NOT_IMPLEMENTED
@ CC_FERR_BROKEN_DEPENDENCY_ERROR
@ CC_FERR_BAD_ENTITY_TYPE
@ CC_FERR_FILE_WAS_WRITTEN_BY_UNKNOWN_PLUGIN
@ CC_FERR_NOT_ENOUGH_MEMORY
@ CC_FERR_WRONG_FILE_TYPE
static CC_FILE_ERROR SaveToFile(ccHObject *entities, const QString &filename, const SaveParameters ¶meters, Shared filter)
static const FilterContainer & GetFilters()
Returns the set of all registered filters.
QSharedPointer< FileIOFilter > Shared
Shared type.
static ccHObject * LoadFromFile(const QString &filename, LoadParameters ¶meters, Shared filter, CC_FILE_ERROR &result)
Loads one or more entities from a file with a known filter.
std::vector< FileIOFilter::Shared > FilterContainer
Type of a I/O filters container.
Hierarchical CLOUDVIEWER Object.
static void error(char *msg)
void define_qcc_io(py::module &m)
static void ThrowForFileError(CC_FILE_ERROR error)
Generic loading parameters.
CCVector3d * coordinatesShift
If applicable, applied shift on load (optional)
ecvGlobalShiftManager::Mode shiftHandlingMode
How to handle big coordinates.
QWidget * parentWidget
Parent widget (if any)
bool alwaysDisplayLoadDialog
bool sessionStart
Session start (whether the load action is the first of a session)
bool preserveShiftOnSave
If applicable, whether shift should be preserved or not (optional)
bool * coordinatesShiftEnabled
Whether shift on load has been applied after loading (optional)
Generic saving parameters.
QWidget * parentWidget
Parent widget (if any)
bool alwaysDisplaySaveDialog