3#include <NDEVR/DesignObjectLookup.h>
4#include <NDEVR/Deployment.h>
5#include <NDEVR/StationModel.h>
6#include <NDEVR/ModelIterator.h>
13 template<
class t_type>
16 std::sort(models.
begin(), models.
end(), [](t_type& a, t_type& b)
18 return String::AlphaNumericCompare(a.displayNamePath().translation(), b.displayNamePath().translation());
25 for (
UUID id : models_to_check)
32 if (types.
size() == 0)
38 for (
const String& type : types)
50 if (models[i].exportIgnored())
55 template<
class t_type>
60 for (
UUID id : models_to_check)
67 if (model.
isOfType(t_type::TypeName()))
68 models.
add(t_type(model));
80 for (
UUID id : models_to_check)
85 if (model.
isOfType(Deployment::TypeName()))
86 models.
add(Deployment(model));
93 if (deployment.recordCount() == 0)
95 return !allow_planned && deployment.isPlanned();
99 SortModelsByName(models);
104#if NDEVR_STATION_MODEL && NDEVR_DEPLOYMENT
105 static Buffer<StationModel> FilterStationDeploymentModels(Buffer<UUID> models_to_check,
const DesignObjectLookup* lookup,
bool sort,
bool allow_planned =
false)
107 Buffer<Deployment> deployments = FilterDeploymentModels(models_to_check, lookup,
false, allow_planned);
108 Dictionary<UUID, StationModel> stations;
109 for (
const Deployment& deployment : deployments)
111 StationModel station = deployment.getStation();
112 if (station.isValid() && !stations.hasKey(station.uuid()))
113 stations.add(station.uuid(), station);
116 Buffer<StationModel> models = stations.values();
118 SortModelsByName(models);
130 return BasicModelIterator::ParseResult::e_continue_parsing;
136 for (
uint04 i = 0; i < models_to_check.
size(); i++)
138 Model model = lookup->
model(models_to_check[i]);
140 iter.parseAll(model);
142 return Model::ReduceToRoots(all_models, [](
const Model& model,
const Set<Model>& all_set)->
bool
147 for (
const Model& child : children)
149 if (child.isApplicationOwned() || child.exportIgnored())
165 return BasicModelIterator::ParseResult::e_continue_parsing;
171 for (
uint04 i = 0; i < models_to_check.
size(); i++)
173 Model model = lookup->
model(models_to_check[i]);
175 iter.parseAll(model);
177 return Model::ReduceToRoots(all_models, [](
const Model& model,
const Set<Model>& all_set)->
bool
182 for (
const Model& child : children)
184 if (child.isApplicationOwned() || child.exportIgnored())
Definition ModelIterator.h:93
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:64
void add(t_type &&object)
Definition Buffer.hpp:199
bool contains(const t_type &element) const
Definition Buffer.hpp:674
void removeAllUnordered(const t_type &object)
Definition Buffer.hpp:1119
constexpr t_index_type size() const
Definition Buffer.hpp:1461
void addAll(const Buffer< t_type, t_other_index_type, t_other_memory_allocator, t_other_memory_manager > &buffer)
Definition Buffer.hpp:248
decltype(auto) end()
Definition Buffer.hpp:746
void removeIndex(t_index_type location)
Definition Buffer.hpp:1037
decltype(auto) begin()
Definition Buffer.hpp:504
bool isValid() const
Definition DesignObject.h:362
Definition DesignObjectLookup.h:61
RLock readLock() const
Definition DesignObjectLookup.cpp:909
Model model(const UUID &id, bool allow_deleted=false) const
Definition DesignObjectLookup.cpp:1683
Definition FactoryModelFilters.h:11
static Buffer< Model > FilterGeometryModels(Buffer< UUID > models_to_check, const DesignObjectLookup *lookup, GeometryType type)
Definition FactoryModelFilters.h:122
static void SortModelsByName(Buffer< t_type > &models)
Definition FactoryModelFilters.h:14
static Buffer< Model > FilterTypeModels(Buffer< UUID > models_to_check, const DesignObjectLookup *lookup, const Buffer< String > &types)
Definition FactoryModelFilters.h:21
static Buffer< t_type > FilterTypeModels(Buffer< UUID > models_to_check, const DesignObjectLookup *lookup)
Definition FactoryModelFilters.h:56
static Buffer< Model > FilterGeometryModels(Buffer< UUID > models_to_check, const DesignObjectLookup *lookup, const Buffer< GeometryType > &types)
Definition FactoryModelFilters.h:157
GeometryType getGeometryType() const
Definition Geometry.cpp:1054
Buffer< t_type > getTypeDescendents(const String &type) const
Definition Model.h:298
Buffer< Model, uint04, ObjectAllocator< DESIGN_PRIM > > getChildren() const
Definition Model.cpp:2733
bool isApplicationOwned() const
Definition Model.cpp:3181
bool exportIgnored() const
Definition Model.cpp:1249
Buffer< Model, uint04, ObjectAllocator< DESIGN_PRIM > > getDescendentsByType(const String &type, uint04 max_count=Constant< uint04 >::Max) const
Definition Model.cpp:2805
bool isOfType(const String &type) const
Definition Model.cpp:3075
ParseResult
Definition ModelIterator.h:42
std::function< bool(const Model &)> model_filter
Definition ModelIterator.h:69
bool hasValue(const t_value &key) const
Definition Set.h:61
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:120
constexpr bool isNaN(const t_type &value)
Query if 'value' is valid or invalid.
Definition BaseFunctions.hpp:200