| |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| #ifndef MATERIAL_MODELLIBRARY_H |
| #define MATERIAL_MODELLIBRARY_H |
|
|
| #include <memory> |
|
|
| #include <QDir> |
| #include <QString> |
|
|
| #include <Base/BaseClass.h> |
| #include <Base/Quantity.h> |
|
|
| #include <Mod/Material/MaterialGlobal.h> |
|
|
| #include "Library.h" |
| #include "MaterialValue.h" |
| #include "Model.h" |
|
|
| namespace Materials |
| { |
|
|
| class MaterialsExport ModelLibrary: public Library, |
| public std::enable_shared_from_this<ModelLibrary> |
| { |
| TYPESYSTEM_HEADER_WITH_OVERRIDE(); |
|
|
| public: |
| ModelLibrary(); |
| ModelLibrary(const Library& library); |
| ModelLibrary(const QString& libraryName, |
| const QString& dir, |
| const QString& iconPath, |
| bool readOnly = true); |
| ModelLibrary(const ModelLibrary& other) = delete; |
| ~ModelLibrary() override = default; |
|
|
| std::shared_ptr<std::map<QString, std::shared_ptr<ModelTreeNode>>> |
| getModelTree(ModelFilter filter) const; |
|
|
| |
| std::shared_ptr<ModelLibrary> getptr() |
| { |
| return shared_from_this(); |
| } |
| }; |
|
|
| class MaterialsExport ModelLibraryLocal: public ModelLibrary |
| { |
| TYPESYSTEM_HEADER_WITH_OVERRIDE(); |
|
|
| public: |
| ModelLibraryLocal(); |
| ModelLibraryLocal(const Library& other); |
| ModelLibraryLocal(const QString& libraryName, |
| const QString& dir, |
| const QString& iconPath, |
| bool readOnly = true); |
| ModelLibraryLocal(const ModelLibraryLocal& other) = delete; |
| ~ModelLibraryLocal() override = default; |
|
|
| bool operator==(const ModelLibrary& library) const |
| { |
| return Library::operator==(library); |
| } |
| bool operator!=(const ModelLibrary& library) const |
| { |
| return !operator==(library); |
| } |
| std::shared_ptr<Model> getModelByPath(const QString& path) const; |
|
|
| std::shared_ptr<Model> addModel(const Model& model, const QString& path); |
|
|
| private: |
|
|
| std::unique_ptr<std::map<QString, std::shared_ptr<Model>>> _modelPathMap; |
| }; |
|
|
| } |
|
|
| Q_DECLARE_METATYPE(std::shared_ptr<Materials::ModelLibrary>) |
| Q_DECLARE_METATYPE(std::shared_ptr<Materials::ModelLibraryLocal>) |
|
|
| #endif |
|
|