API Documentation
Loading...
Searching...
No Matches
ModelIterator.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: Design
28File: ModelIterator
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include <NDEVR/Model.h>
34#include <NDEVR/Geometry.h>
35#include <functional>
36namespace NDEVR
37{
39 {
40 public:
42 {
43 e_continue_parsing
44 , e_do_not_parse_children
45 , e_finish_parsing
46 };
48 explicit ModelIterator(const Model& model);
49 explicit ModelIterator(Buffer<Model> models);
50 void parseAll(const Model& model);
51 void parseAll(const Buffer<Model>& models);
52 void parseAll();
53 /**--------------------------------------------------------------------------------------------------
54 Fn: Buffer::decltype(auto) operator[](const uint04 index)
55
56 Constructor.
57
58 Author: Tyler Parke
59
60 Date: 2017-11-19
61
62 Parameters:
63 parameter1 - The first parameter.
64 *-----------------------------------------------------------------------------------------------**/
65 ParseResult parseNext();
66 Model currentModel() const;
67 std::function<bool(const Model&, const Geometry&)> geo_filter;
68 std::function<bool(const Model&, const Material&)> material_filter;
69 std::function<bool(const Model&)> model_filter;
70
71 bool process_material = false;
72 bool process_geometry = true;
73 bool process_model = true;
74 bool post_process_model = false;
75 bool depth_first = true;
76 bool is_recursive = true;
77 bool use_unit = false;
78 PrimitiveProperty material_property = PrimitiveProperty::Solid;
79 protected:
80 virtual ParseResult process(Model& model);
81 virtual ParseResult process(Model& model, Material& mat);
82 virtual ParseResult process(Model& model, Geometry& geo);
83 virtual ParseResult postProcess(Model& model);
84 void removeFromPostProcessStack();
85 virtual void _parseAll();
86 Model popNextModel();
90 };
91
93 {
94 public:
96 explicit BasicModelIterator(const Model& model);
97 explicit BasicModelIterator(const Buffer<Model>& models);
98 explicit BasicModelIterator(const std::function<ParseResult(Model&, Geometry&)>& geo_callback);
99 explicit BasicModelIterator(const std::function<ParseResult(Model&, Material&)>& material_callback);
100 explicit BasicModelIterator(const std::function<ParseResult(Model&)>& model_callback);
101
102 void setCallback(const std::function<ParseResult(Model&, Geometry&)>& geo_callback);
103 void setCallback(const std::function<ParseResult(Model&, Material&)>& material_callback);
104 void setCallback(const std::function<ParseResult(Model&)>& model_callback);
105 protected:
106 ParseResult process(Model& model) final override;
107 ParseResult process(Model& model, Material& mat) final override;
108 ParseResult process(Model& model, Geometry& geo) final override;
109 protected:
113 };
114}
115
116
117
118
#define NDEVR_DESIGN_API
Definition DLLInfo.h:77
Definition ModelIterator.h:93
std::function< ParseResult(Model &)> m_model_callback
Definition ModelIterator.h:112
std::function< ParseResult(Model &, Geometry &)> m_geo_callback
Definition ModelIterator.h:110
std::function< ParseResult(Model &, Material &)> m_material_callback
Definition ModelIterator.h:111
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:64
Definition Geometry.h:64
Definition Material.h:45
Definition Model.h:54
Definition ModelIterator.h:39
Buffer< Model > m_model_parent_stack
Definition ModelIterator.h:89
std::function< bool(const Model &, const Geometry &)> geo_filter
Definition ModelIterator.h:67
std::function< bool(const Model &, const Material &)> material_filter
Definition ModelIterator.h:68
Buffer< uint04 > m_model_parent_child_count
Definition ModelIterator.h:88
Buffer< Model > m_model_stack
Definition ModelIterator.h:87
ParseResult
Definition ModelIterator.h:42
std::function< bool(const Model &)> model_filter
Definition ModelIterator.h:69
Definition ACIColor.h:37
PrimitiveProperty
Definition DesignObjectBase.h:44