3#include <NDEVR/DesignObjectLookup.h>
4#include <NDEVR/Deployment.h>
5#include <NDEVR/StationModel.h>
6#include <NDEVR/ModelIterator.h>
26 template<
class t_type>
29 std::sort(models.begin(), models.end(), [](t_type& a, t_type& b)
31 return String::AlphaNumericCompare(a.displayNamePath().translation(), b.displayNamePath().translation());
46 for (
UUID id : models_to_check)
53 if (types.size() == 0)
71 if (models[i].exportIgnored())
72 models.removeIndex(i);
89 for (
UUID id : models_to_check)
96 if (types.size() == 0)
114 if (models[i].exportIgnored())
115 models.removeIndex(i);
126 template<
class t_type>
131 for (
UUID id : models_to_check)
139 models.
add(t_type(model));
160 for (
UUID id : models_to_check)
166 models.
add(Deployment(model));
173 if (deployment.recordCount() == 0)
175 return !allow_planned && deployment.isPlanned();
179 SortModelsByName(models);
184#if NDEVR_STATION_MODEL && NDEVR_DEPLOYMENT
194 static Buffer<StationModel> FilterStationDeploymentModels(Buffer<UUID> models_to_check,
const DesignObjectLookup* lookup,
bool sort,
bool allow_planned =
false)
196 Buffer<Deployment> deployments = FilterDeploymentModels(models_to_check, lookup,
false, allow_planned);
197 Dictionary<UUID, StationModel> stations;
198 for (
const Deployment& deployment : deployments)
200 StationModel station = deployment.getStation();
201 if (station.isValid() && !stations.hasKey(station.get<NDPO::guid>()))
202 stations.add(station.get<NDPO::guid>(), station);
205 Buffer<StationModel> models = stations.values();
207 SortModelsByName(models);
234 for (
uint04 i = 0; i < models_to_check.size(); i++)
236 Model model = lookup->
model(models_to_check[i]);
238 iter.parseAll(model);
245 for (
const Model& child : children)
247 if (child.isApplicationOwned() || child.exportIgnored())
278 for (
uint04 i = 0; i < models_to_check.size(); i++)
280 Model model = lookup->
model(models_to_check[i]);
282 iter.parseAll(model);
289 for (
const Model& child : children)
291 if (child.isApplicationOwned() || child.exportIgnored())
A convenience subclass of ModelIterator that delegates processing to user-supplied std::function call...
The equivelent of std::vector but with a bit more control.
void removeAllUnordered(const t_type &object)
Removes all unordered described by object.
void add(t_type &&object)
Adds object to the end of the buffer.
A core class where all Design Objects including models, materials, and geometries are stored.
RLock readLock() const
Acquires a shared read lock on the design object store.
Model model(const UUID &id, bool allow_deleted=false) const
Retrieves a model by its UUID.
bool isValid() const
Checks whether this design object has a valid index into the database.
bool is(t_property_type property, const StringView &value) const
Checks whether a string property matches the given StringView value.
Provides easy filtering tools for factories that are only able to export certain types of models or g...
static Buffer< Model > FilterTypeModels(Buffer< UUID > models_to_check, const DesignObjectLookup *lookup, const Buffer< String > &types)
Filters models by one or more type name strings, returning only models (or their descendants) that ma...
static void SortModelsByName(Buffer< t_type > &models)
Sorts a buffer of models alphabetically by their display name path using alphanumeric comparison.
static Buffer< Model > FilterGeometryModels(Buffer< UUID > models_to_check, const DesignObjectLookup *lookup, const Buffer< GeometryType > &types)
Filters models to find those containing geometry matching any of the specified types.
static Buffer< Model > FilterGeometryModels(Buffer< UUID > models_to_check, const DesignObjectLookup *lookup, GeometryType type)
Filters models to find those containing geometry of a specific type.
static Buffer< t_type > FilterTypeModels(Buffer< UUID > models_to_check, const DesignObjectLookup *lookup)
Filters models by a compile-time type, returning only models (or their descendants) whose type name m...
static Buffer< Model > FilterTypeModels(Buffer< UUID > models_to_check, const DesignObjectLookup *lookup, const Buffer< StringView > &types)
Filters models by one or more type name string views, returning only models (or their descendants) th...
A core class within the model hierarchy containing vertex-based data (Usually 3D data) within a set c...
GeometryType getGeometryType() const
Retrieves the geometry type identifier.
std::function< bool(const Model &)> model_filter
Optional filter predicate for model processing. Returns true to include.
ParseResult
The result returned by process functions to control iteration flow.
@ e_continue_parsing
Continue normal traversal to sibling and child nodes.
A core class that represents a node on model hierarchy.
bool isApplicationOwned() const
Checks whether this model is owned by the application (not user-created).
static ModelBuffer ReduceToRoots(const ModelBuffer &children, const std::function< bool(const Model &, const Set< Model > &)> &filter)
Reduces a collection of models to only root-level models (removing any that are descendants of others...
Buffer< t_type > getTypeDescendants(const StringView &type) const
Recursively searches descendants for models of a specific type, cast to a derived type.
ModelBuffer getDescendantsByType(const StringView &type, uint04 max_count=Constant< uint04 >::Max) const
Recursively searches all descendants for models matching the given type.
ModelBuffer getChildren() const
Returns a buffer containing all direct children of this model.
bool exportIgnored() const
Checks whether this model is excluded from export operations.
Used to lock a particular variable for reading.
Container that stores unique elements in no particular order, and which allow for fast retrieval or i...
bool hasValue(const t_value &key) const
Checks whether the Set contains the given value.
The core String View class for the NDEVR API.
The core String class for the NDEVR API.
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
The primary namespace for the NDEVR SDK.
@ type
The type identifier string for this model node.
static constexpr bool IsValid(const Angle< t_type > &value)
Checks whether the given Angle holds a valid value.
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
GeometryType
Describes the high-level geometric topology of a Geometry object.