3#include <NDEVR/DesignObjectLookup.h>
4#include <NDEVR/Deployment.h>
5#include <NDEVR/StationModel.h>
6#include <NDEVR/ModelIterator.h>
17 template<
class t_type>
20 std::sort(models.
begin(), models.
end(), [](t_type& a, t_type& b)
22 return String::AlphaNumericCompare(a.displayNamePath().translation(), b.displayNamePath().translation());
29 for (
UUID id : models_to_check)
36 if (types.
size() == 0)
42 for (
const String& type : types)
54 if (models[i].exportIgnored())
59 template<
class t_type>
64 for (
UUID id : models_to_check)
71 if (model.
isOfType(t_type::TypeName()))
72 models.
add(t_type(model));
84 for (
UUID id : models_to_check)
89 if (model.
isOfType(Deployment::TypeName()))
90 models.
add(Deployment(model));
97 if (deployment.recordCount() == 0)
99 return !allow_planned && deployment.isPlanned();
103 SortModelsByName(models);
108#if NDEVR_STATION_MODEL && NDEVR_DEPLOYMENT
109 static Buffer<StationModel> FilterStationDeploymentModels(Buffer<UUID> models_to_check,
const DesignObjectLookup* lookup,
bool sort,
bool allow_planned =
false)
111 Buffer<Deployment> deployments = FilterDeploymentModels(models_to_check, lookup,
false, allow_planned);
112 Dictionary<UUID, StationModel> stations;
113 for (
const Deployment& deployment : deployments)
115 StationModel station = deployment.getStation();
116 if (station.isValid() && !stations.hasKey(station.uuid()))
117 stations.add(station.uuid(), station);
120 Buffer<StationModel> models = stations.values();
122 SortModelsByName(models);
134 return BasicModelIterator::ParseResult::e_continue_parsing;
140 for (
uint04 i = 0; i < models_to_check.
size(); i++)
142 Model model = lookup->
model(models_to_check[i]);
144 iter.parseAll(model);
146 return Model::ReduceToRoots(all_models, [](
const Model& model,
const Set<Model>& all_set)->
bool
151 for (
const Model& child : children)
153 if (child.isApplicationOwned() || child.exportIgnored())
169 return BasicModelIterator::ParseResult::e_continue_parsing;
175 for (
uint04 i = 0; i < models_to_check.
size(); i++)
177 Model model = lookup->
model(models_to_check[i]);
179 iter.parseAll(model);
181 return Model::ReduceToRoots(all_models, [](
const Model& model,
const Set<Model>& all_set)->
bool
186 for (
const Model& child : children)
188 if (child.isApplicationOwned() || child.exportIgnored())
A class for easily transversing a model heirarchy, applying an optional function at each level.
Definition ModelIterator.h:87
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:56
void add(t_type &&object)
Adds object to the end of the buffer.
Definition Buffer.hpp:186
bool contains(const t_type &element) const
Definition Buffer.hpp:465
void removeAllUnordered(const t_type &object)
Removes all unordered described by object. This function does not preserve the order of the buffer.
Definition Buffer.hpp:641
constexpr t_index_type size() const
Definition Buffer.hpp:823
void addAll(const Buffer< t_type, t_other_index_type, t_other_memory_allocator, t_other_memory_manager > &buffer)
Definition Buffer.hpp:243
decltype(auto) end()
Definition Buffer.hpp:507
void removeIndex(t_index_type location)
Definition Buffer.hpp:606
decltype(auto) begin()
Definition Buffer.hpp:402
bool isValid() const
Definition DesignObject.h:355
A core class where all Design Objects including models, materials, and geometries are stored....
Definition DesignObjectLookup.h:65
Model model(const UUID &id, bool allow_deleted=false) const
Provides easy filtering tools for factories that are only able to export certain types of models or g...
Definition FactoryModelFilters.h:15
static Buffer< Model > FilterGeometryModels(Buffer< UUID > models_to_check, const DesignObjectLookup *lookup, GeometryType type)
Definition FactoryModelFilters.h:126
static void SortModelsByName(Buffer< t_type > &models)
Definition FactoryModelFilters.h:18
static Buffer< Model > FilterTypeModels(Buffer< UUID > models_to_check, const DesignObjectLookup *lookup, const Buffer< String > &types)
Definition FactoryModelFilters.h:25
static Buffer< t_type > FilterTypeModels(Buffer< UUID > models_to_check, const DesignObjectLookup *lookup)
Definition FactoryModelFilters.h:60
static Buffer< Model > FilterGeometryModels(Buffer< UUID > models_to_check, const DesignObjectLookup *lookup, const Buffer< GeometryType > &types)
Definition FactoryModelFilters.h:161
A core class within the model heirarchy containing vertex-based data (Usually 3D data) within a set c...
Definition Geometry.h:64
GeometryType getGeometryType() const
A core class that represents a node on model heirarchy. This node may contain a Geometry or one or mo...
Definition Model.h:58
Buffer< Model, uint04, ObjectAllocator< DESIGN_PRIM > > getDescendentsByType(const String &type, uint04 max_count=Constant< uint04 >::Max) const
Buffer< t_type > getTypeDescendents(const String &type) const
Definition Model.h:302
Buffer< Model, uint04, ObjectAllocator< DESIGN_PRIM > > getChildren() const
bool isApplicationOwned() const
bool exportIgnored() const
bool isOfType(const String &type) const
ParseResult
Definition ModelIterator.h:46
std::function< bool(const Model &)> model_filter
Definition ModelIterator.h:61
Used to lock a particular variable for reading. Any number of readers can be created when no write lo...
Definition RWLock.h:91
Container that stores unique elements in no particular order, and which allow for fast retrieval or i...
Definition Model.h:51
bool hasValue(const t_value &key) const
Definition Set.h:70
The core String class for the NDEVR API.
Definition String.h:69
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
Definition UUID.h:60
constexpr bool IsInvalid(const t_type &value)
Query if 'value' is valid or invalid. Invalid values should return invalid if used for calculations o...
Definition BaseFunctions.hpp:170
GeometryType
Definition DesignObjectBase.h:86
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:96