NDEVR
API Documentation
FactoryOptions.h
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: FactoryOptions
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#include <NDEVR/DesignObjectBase.h>
35#include <NDEVR/AsciiOptions.h>
36
37#include <NDEVR/INIInterface.h>
38#include <NDEVR/UnitManager.h>
39#include <NDEVR/GenericOption.h>
40#include <NDEVR/Set.h>
41#include <NDEVR/PasswordString.h>
42#include <NDEVR/StringEnum.h>
43#include <NDEVR/ApplicationOptions.h>
44namespace NDEVR
45{
46 class Model;
47 class Material;
57 class NDEVR_FACTORY_API FactoryOptions : public INIInterface
58 {
59 public:
60 FactoryOptions();
61 ~FactoryOptions();
62
71
80 {
82 , e_include_default_precision = 1
83 , e_include_high_precision = 2
84 , e_generate_default_precision = 3
85 , e_generate_high_precision = 4
87 };
88
93 {
94 e_duplicate
95 , e_ignore_import
96 , e_replace
97 , e_remap_imported
98 , e_merge_and_replace_from_file
99 , e_merge_and_ignore_from_file
100 };
101
106 {
107 e_data_cant_be_geo_referenced
108 , e_data_geo_referenced
109 , e_user_place_with_cursor
110 , e_user_geo_reference_dialog
111 , e_prompt_user_all
112 , e_prompt_user_no_existing_reference
113 };
114
119 void prepareForINI(INIFactory& factory) override;
120
125 virtual void getINI(INIFactory& factory) override;
126
131 void finishReadingINI(INIFactory& factory) override;
132
137
143 bool useHighPrecision(VertexProperty property) const;
144
150 bool useValue(VertexProperty property) const
151 {
153 }
154
164
170 bool useHighPrecision(GeometryType property) const;
171
177 bool useValue(GeometryType property) const
178 {
180 return false;
182 }
183
189 bool generateValue(GeometryType property) const;
190
196 bool operator==(const FactoryOptions& options) const;
197
203 bool operator!=(const FactoryOptions& options) const
204 {
205 return !(*this == options);
206 }
207
215
223 void postProcess(Model& model, ProgressInfo& info, const void* lock) const;
224 protected:
230 public:
244 UUID default_coord_projection = Constant<UUID>::Invalid;
252 bool flatten_model = false;
253 bool center_model = false;
254 bool multithread = true;
255 bool tree_is_visible = true;
256 bool application_owned = false;
257 bool convert_degenerates = false;
258 bool application_locked = false;
261 bool optimize_meshes = false;
264 bool find_invalid_data = false;
266 bool fix_inward_normals = false;
267 bool generate_UV_mappings = false;
268 bool generate_trees = true;
269 bool flip_UV_coordinates = false;
270 bool ignore_invisible = false;
271 bool two_sided = false;
272 bool wireframe = false;
273 bool triangulate = false;
274 bool validate_geometry = false;
276 bool use_cameras = true;
277 bool is_auto_save = false;
278 bool is_user_action = false;
284 private:
285 String m_selected_ascii_options_all;
286 };
289
293 #define NDEVR_FILE_POINTMODE_ITEMS(X) \
294 X(e_point) \
295 X(e_station) \
296 X(e_90_cross_hair_square) \
297 X(e_45_cross_hair_square) \
298 X(e_90_cross_hair_circle) \
299 X(e_45_cross_hair_circle)
300 NDEVR_DEFINE_STRING_STREAM(NDEVRFilePointMode, NDEVR_FILE_POINTMODE_ITEMS)
302}
Provides cross-platform DLL export/import macros for the IOFactory module.
#define NDEVR_FACTORY_API
GCC/Clang symbol visibility — marks symbols as visible in the shared library.
Definition DLLInfo.h:92
#define NDEVR_FACTORY_T_API
Template export companion — empty for GCC/Clang builds.
Definition DLLInfo.h:94
Stores an angle in an optimized internal format with support for efficient trigonometric operations.
Definition Angle.h:83
The default object to store data of any type that should persist through sessions of the application.
Storage class for all IO options related to an Ascii file output used by an IOFactory services that w...
A hash-based key-value store, useful for quick associative lookups.
Definition Dictionary.h:64
bool useValue(GeometryType property) const
Checks whether the given geometry type should be included (not ignored).
PasswordString owner_password
Owner-level password for encrypted file formats.
bool useValue(VertexProperty property) const
Checks whether the given vertex property should be included (not ignored).
bool canPostProcessVertices() const
Checks whether any post-processing flags affecting vertices are enabled.
bool show_dialog_for_export
Whether to show an options dialog before exporting.
bool flip_UV_coordinates
Whether to flip UV coordinates vertically (invert V axis).
bool generateValue(VertexProperty property) const
Checks whether the given vertex property should be generated if it does not already exist.
String name
Optional dataset name.
bool triangulate
Whether to convert all polygons to triangles.
UnitManager units
Unit definitions for coordinate and measurement conversion.
Matrix< fltp08 > transform
A top-level transform applied to all imported/exported data.
bool show_dialog_for_import
Whether to show an options dialog before importing.
ImportMergeProperties
Controls how duplicate or conflicting data is resolved when importing into an existing scene.
@ e_duplicate
Always imports, creating duplicates if they exist.
bool generate_trees
Whether to generate spatial tree structures for the imported data.
bool ignore_invisible
Whether to skip invisible objects during import/export.
Vector< cast< uint01 >(VertexProperty::Vertex_Property_Size), IncludeProperties > vector_properties
Per-vertex-property inclusion/generation settings.
Vector< cast< uint01 >(GeometryType::e_geometry_type_size), IncludeProperties > geometry_properties
Per-geometry-type inclusion/generation settings.
bool application_locked
Whether the imported data should be locked from user editing.
bool combine_mesh_instances
Whether to merge identical mesh instances into a single mesh.
virtual void getINI(INIFactory &factory) override
Reads or writes all option fields to/from the INI factory.
ImportMergeProperties duplicate_uuid_behavior
How to handle objects with duplicate UUIDs on import.
GeoReferenceProperties geo_reference_behavior
How geo-referencing is resolved during import.
bool operator==(const FactoryOptions &options) const
Compares two FactoryOptions for equality.
fltp04 default_line_thickness
Default rendered line thickness.
fltp04 default_mesh_thickness
Default rendered mesh edge thickness.
bool flatten_model
Whether to flatten the model hierarchy into a single level.
bool generateValue(GeometryType property) const
Checks whether the given geometry type should be generated if it does not already exist.
bool optimize_meshes
Whether to optimize mesh data for rendering performance.
bool multithread
Whether to allow multithreaded import/export processing.
bool show_properties_after_complete
Whether to show a properties dialog after the operation completes.
bool convert_degenerates
Whether to convert degenerate primitives (e.g., zero-area triangles).
bool validate_geometry
Whether to validate geometry integrity after import.
bool fix_inward_normals
Whether to flip normals that point inward.
WindingMode wind_triangles
Triangle winding mode to enforce during post-processing.
GeoReferenceProperties
Controls how geo-referencing is handled for imported data.
@ e_data_geo_referenced
The data already contains valid geo-reference information.
bool useHighPrecision(GeometryType property) const
Checks whether the given geometry type should use high-precision storage.
bool preserve_high_precision_values
Whether to preserve high-precision (fltp08) vertex values.
void postProcess(Model &model, ProgressInfo &info, const void *lock) const
Applies post-processing steps to an imported model based on the current option flags (e....
Set< StringAllocatingView > exclusion_model_types
Model types to exclude from reading or writing.
bool find_invalid_data
Whether to detect and flag invalid geometry data.
static ApplicationOption< bool > DefaultExportOnlyVisible
Application-wide default for exporting only visible objects.
void prepareForINI(INIFactory &factory) override
Prepares internal state before INI serialization begins.
bool generate_UV_mappings
Whether to generate UV texture coordinates if they are missing.
bool join_identical_vertices
Whether to merge vertices with identical positions and attributes.
Angle< fltp08 > normal_smooth_angle
Maximum angle between faces for smooth normal blending. Invalid means use factory default.
bool is_auto_save
Whether this operation is an automatic save (not user-initiated).
bool operator!=(const FactoryOptions &options) const
Compares two FactoryOptions for inequality.
NormalGenerationModel
Controls how vertex normals are generated during import post-processing.
@ e_flat
Generates flat normals (one normal per face).
@ e_smooth
Generates smooth normals by averaging adjacent face normals.
CompressionMode compression_mode
Compression mode for export.
bool two_sided
Whether materials should default to two-sided rendering.
PasswordString user_password
User-level password for encrypted file formats.
UUID default_coord_projection
Default coordinate projection UUID. Invalid means none specified.
AsciiOptions ascii
Options for reading or writing ASCII files.
void finishReadingINI(INIFactory &factory) override
Performs any finalization after INI deserialization completes.
NormalGenerationModel normal_generation_mode
The model used when generating vertex normals.
bool optimize_model_hierarchy
Whether to simplify the model hierarchy by removing redundant nodes.
void setupDefaultMaterial(GeometryType type, Material &mat) const
Configures a Material with default visual properties based on the geometry type and current option va...
bool load_images_to_memory
Whether to load referenced images into memory rather than streaming from disk.
ImportMergeProperties duplicate_name_behavior
How to handle objects with duplicate names on import.
bool center_model
Whether to translate the model so its center is at the origin.
fltp04 default_point_size
Default rendered point size in pixels.
bool tree_is_visible
Whether the imported model tree is initially visible.
bool application_owned
Whether the imported data is owned by the application (not user-managed).
Dictionary< String, GenericOptionGroup > custom_options
Importer/exporter-specific custom option groups.
IncludeProperties
Describes how a particular data field (vertex property or geometry type) should be handled during imp...
@ e_generate_default_precision
Generates the field if possible, at default precision.
@ e_ignore
Ignores the field even if it exists.
bool useHighPrecision(VertexProperty property) const
Checks whether the given vertex property should use high-precision storage.
void setToDefaultUnits()
Resets the unit manager to system-default units.
String icon
Optional dataset icon identifier.
bool is_user_action
Whether this operation was triggered directly by a user action.
bool use_cameras
Whether to import camera objects from the file.
bool wireframe
Whether to render meshes in wireframe mode.
RGBColor default_color
Color applied when the source data has no color information.
Contains methods for easily reading and writing to an INI file including efficient casting,...
Definition INIReader.h:107
INIInterface()
Constructs an INIInterface with no default INI file.
Container responsible for storing and setting the appearance of a Model or Geometry within the NDEVR ...
Definition Material.h:153
Templated logic for doing matrix multiplication.
Definition Matrix.hpp:182
A core class that represents a node on model hierarchy.
Definition Model.h:292
When passwords are used inside the NDEVR engine, we don't want them logged or visible.
Used with InfoPipe to signal that the system will be using progress.
Represents a color in the RGB space with optional alpha transparency.
Definition RGBColor.h:57
Container that stores unique elements in no particular order, and which allow for fast retrieval or i...
Definition Set.h:59
Logic for reading or writing to a string or a user friendly, TranslatedString.
The core String class for the NDEVR API.
Definition String.h:95
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
Definition UUID.h:61
Manages a collection of units across multiple data categories with INI persistence.
A fixed-size array with N dimensions used as the basis for geometric and mathematical types.
Definition Vector.hpp:62
The primary namespace for the NDEVR SDK.
VertexProperty
Per-vertex data channels that can be stored in the vertex table to be used by Geometry.
@ Vertex_Property_Size
The number of vertex property types. Used for sizing arrays.
float fltp04
Defines an alias representing a 4 byte floating-point number Bit layout is as follows: -Sign: 1 bit a...
@ e_ignore
Ignore the failure and continue.
@ e_not_supported
The command is not supported by the hardware.
GeometryType
Describes the high-level geometric topology of a Geometry object.
@ e_geometry_type_size
The number of geometry types. Used for sizing arrays.
CompressionMode
Forward declaration of the Module struct for module metadata.
Definition Compressor.h:17
@ e_default_compression
Uses a sensible default compression strategy.
Definition Compressor.h:19
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
WindingMode
Describes the vertex winding order used to determine front-facing direction of polygons.
@ e_no_winding
No winding order is defined.
constexpr t_to cast(const Angle< t_from > &value)
Casts an Angle from one backing type to another.
Definition Angle.h:408
Defines for a given type (such as sint04, fltp08, UUID, etc) a maximum, minimum, and reserved 'invali...