API Documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
LibraryManager.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: NDEVR
28File: LibraryManager
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include <NDEVR/QTModelManager.h>
34#include <NDEVR/TranslatedString.h>
35namespace NDEVR
36{
37 /**--------------------------------------------------------------------------------------------------
38 \brief Manages loading Models from a group that is stored either on a remote server or locally on
39 the disk in a compressed or uncompressed folder.
40 **/
41 class NDEVR_API LibraryManager : public QObject
42 {
43 Q_OBJECT
44 public:
45 LibraryManager(QTModelManager* manager, const File& library_folder);
46 String getIcon(const UUID& id) const;
47 TranslatedString getName(const UUID& id) const
48 {
49 return m_names.get(id);
50 }
51 String getType(const UUID& id) const
52 {
53 return m_types.get(id);
54 }
56 {
57 return m_search_terms.get(id);
58 }
59 Model loadObject(const UUID& id, bool center_model);
60 void centerModel(Model& model);
61 bool hasID(const UUID& id) const;
62 Buffer<UUID> getIDs() const { return m_ids; }
67 void addToLibrary(const UUID& object, UUID library_object);
68 void removeFromLibrary(const UUID& object);
72 void addLayer(Model& model);
73 QTModelManager* manager() { return m_manager; }
76 protected:
77 void updateFromArchive(const UUID& file);
78 void updateFromArchive(const File& file);
79 bool writeToLibrary(const UUID& object_to_write, UUID library_id);
80 signals:
81 void modelAdded(UUID id);
83 protected:
92 };
93}
#define NDEVR_API
Definition DLLInfo.h:50
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:56
decltype(auto) get(t_index_type index)
Definition Buffer.hpp:541
A core class where all Design Objects including models, materials, and geometries are stored....
Definition DesignObjectLookup.h:65
A hash-based key-value store, useful for quick associative lookups. Key features include:
Definition Dictionary.h:61
Logic for reading or writing to a file as well as navigating filesystems.
Definition File.h:48
Manages loading Models from a group that is stored either on a remote server or locally on the disk i...
Definition LibraryManager.h:42
void modelAdded(UUID id)
QTModelManager * manager()
Definition LibraryManager.h:73
String getType(const UUID &id) const
Definition LibraryManager.h:51
void recomputeObject(UUID)
void updateFromArchive(const File &file)
Dictionary< UUID, String > m_types
Definition LibraryManager.h:87
bool hasID(const UUID &id) const
void saveAllImagesToFolder(File folder)
Buffer< UUID > getIDsByCategory(const TranslatedString &category)
Dictionary< UUID, TranslatedString > m_categories
Definition LibraryManager.h:88
void saveToArchiveFile(File file)
void updateFromArchive(const UUID &file)
Buffer< UUID > m_ids
Definition LibraryManager.h:85
void pullFromArchiveFile(File file)
void centerModel(Model &model)
bool writeToLibrary(const UUID &object_to_write, UUID library_id)
Dictionary< UUID, TranslatedString > m_search_terms
Definition LibraryManager.h:89
void modelRemoved(UUID id)
void addToLibrary(const UUID &object, UUID library_object)
LibraryManager(QTModelManager *manager, const File &library_folder)
QTModelManager * m_manager
Definition LibraryManager.h:90
Buffer< UUID > getIDs() const
Definition LibraryManager.h:62
Dictionary< UUID, TranslatedString > m_names
Definition LibraryManager.h:86
Buffer< String > getTypes() const
void removeFromLibrary(const UUID &object)
Buffer< TranslatedString > getCategories() const
File m_archive_path
Definition LibraryManager.h:91
Model loadObject(const UUID &id, bool center_model)
TranslatedString getName(const UUID &id) const
Definition LibraryManager.h:47
String getIcon(const UUID &id) const
DesignObjectLookup m_library_lookup
Definition LibraryManager.h:84
TranslatedString getSearchTerms(const UUID &id) const
Definition LibraryManager.h:55
void addLayer(Model &model)
A core class that represents a node on model heirarchy. This node may contain a Geometry or one or mo...
Definition Model.h:58
A wrapper around DesignObjectLookup that provides signal and slot functionality and adds rendering ca...
Definition QTModelManager.h:105
The core String class for the NDEVR API.
Definition String.h:69
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
Definition TranslatedString.h:13
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
Definition UUID.h:60
Definition ACIColor.h:37