API Documentation
Loading...
Searching...
No Matches
NDVFactory.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: IOFactory
28File: NDVFactory
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include <NDEVR/SoftwareService.h>
34#include <NDEVR/IOFactory.h>
35#include <NDEVR/Material.h>
36#include <NDEVR/Model.h>
37#include <NDEVR/File.h>
38namespace NDEVR
39{
40 class FactoryOptions;
41 class Model;
42 class Log;
43 class ImageFactory;
44 class FactoryFeatures;
45 /**--------------------------------------------------------------------------------------------------
46 \brief Used to modify objects when they are imported using the NDVFactory.
47 **/
49 {
50 public:
51 NDVSetupCallback(std::function<void(Model&)> callback)
53 {}
54 std::function<void(Model&)> callback;
55 };
56 /**--------------------------------------------------------------------------------------------------
57 \brief reads and writes to NDV Files. NDV Files are optionally compressed data dumps of the internal
58 structure of model heirarchies.
59
60 NDVSetupCallbacks can be used to modify objects when they are imported.
61 **/
63 {
64 protected:
66 public:
68 static String ReadIcon(const File& file, ImageFactory& factory);
69 String getIcon(const File& file) override;
70 String getData(const File& file);
71 FactoryFeatures factoryFeatures(const FactoryParameters& file, bool is_import) const override;
74 static void AddSetupCallback(NDVSetupCallback* callback);
76 virtual void getSupportedFormats(Buffer<FileFormat>& formats, bool is_read) override;
77 virtual bool readFile(FactoryParameters& params) override;
78 virtual bool writeFile(FactoryParameters& params) override;
79 uint08 version(const File& file);
81 virtual bool determineExtension(const File& file, String& extension) override;
82 virtual bool canRead(const FactoryParameters& file) override;
83 virtual bool canWrite(const FactoryParameters& file) override;
84 virtual bool canWrite(const FileFormat& file) override;
85 private:
86 void tidyUpScene(const FactoryParameters& file
87 , Scene& scene
88 , const Buffer<UUID>& objects_read
89 , uint08 version_number
90 , Buffer<Model>& read_models
91 , Buffer<Material>& read_materials
92 , bool ignore_project
93 , Time current_time);
94 static void EnsureSaneModel(Model& model, Time& current_time);
95 static Buffer<NDVSetupCallback*> s_setup_callbacks;
96 };
97
98}
#define NDEVR_FACTORY_API
Definition DLLInfo.h:57
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:56
Allows IOFactories to report what features they support to make the import/export dialogs easier to s...
Definition FactoryFeatures.h:44
User-defined options that define preferences for importing and exporting using IOFactory objects.
Definition FactoryOptions.h:49
Data that describes a particular file format and how to use the format with the program....
Definition FileFormat.h:43
Logic for reading or writing to a file as well as navigating filesystems.
Definition File.h:48
A service that provides Import/Export functionality for a model heirarchy. These can be registered wi...
Definition IOFactory.h:117
The core class for reading/writing and storing images in an optimized way.
Definition ImageFactory.h:75
A core class that represents a node on model heirarchy. This node may contain a Geometry or one or mo...
Definition Model.h:58
reads and writes to NDV Files. NDV Files are optionally compressed data dumps of the internal structu...
Definition NDVFactory.h:63
static uint08 CurrentVersion()
static NDVFactory & DefaultFactory()
virtual bool readFile(FactoryParameters &params) override
virtual bool determineExtension(const File &file, String &extension) override
virtual bool canRead(const FactoryParameters &file) override
static FileFormat NDVFormat()
FactoryOptions defaultReadOptions(const FactoryParameters &file) const override
FactoryFeatures factoryFeatures(const FactoryParameters &file, bool is_import) const override
String getIcon(const File &file) override
static void AddSetupCallback(NDVSetupCallback *callback)
String getData(const File &file)
virtual bool canWrite(const FileFormat &file) override
virtual void getSupportedFormats(Buffer< FileFormat > &formats, bool is_read) override
uint08 version(const File &file)
virtual bool writeFile(FactoryParameters &params) override
FactoryOptions defaultWriteOptions(const FactoryParameters &file) const override
virtual bool canWrite(const FactoryParameters &file) override
static String ReadIcon(const File &file, ImageFactory &factory)
Used to modify objects when they are imported using the NDVFactory.
Definition NDVFactory.h:49
NDVSetupCallback(std::function< void(Model &)> callback)
Definition NDVFactory.h:51
std::function< void(Model &)> callback
Definition NDVFactory.h:54
The root Model that is responsible for storing the underlying data for all Scene Models.
Definition Model.h:492
Software Services provide an interface for adding to or changing the software behavior via functional...
Definition SoftwareService.h:9
Software Service Managers take a Software service to modify the behavior of the software.
Definition SoftwareService.h:15
The core String class for the NDEVR API.
Definition String.h:69
Represents a timestamp with utilities for manipulation and conversion.
Definition Time.h:54
Definition ACIColor.h:37
uint64_t uint08
-Defines an alias representing an 8 byte, unsigned integer
Definition BaseValues.hpp:106
A container of input information that is to be filled with output information by an IOFactory.
Definition IOFactory.h:61