2#include "Engine/Primitives/Primitive.h"
6#include <unordered_map>
20 using iterator_category = std::forward_iterator_tag;
21 using difference_type = std::ptrdiff_t;
25 std::vector<geo::PrimPtr>& primitives,
26 TransformClass transformClass,
35 return a.primIdx_ == b.primIdx_ && a.offset_ == b.offset_;
37 friend bool operator!=(
const Iterator& a,
const Iterator& b) {
return !(a == b); }
40 std::vector<geo::PrimPtr>& primitives_;
41 TransformClass transformClass_;
44 std::shared_ptr<attr::Attribute> curAttrib_;
46 std::vector<Transform> orientations_;
51 Transforms(std::vector<geo::PrimPtr>& primitives, TransformClass transformClass)
52 : primitives_(primitives), transformClass_(transformClass)
56 Iterator begin() {
return Iterator(primitives_, transformClass_, 0); }
57 Iterator end() {
return Iterator(primitives_, transformClass_, primitives_.size()); }
60 std::vector<geo::PrimPtr>& primitives_;
61 TransformClass transformClass_;
67 void addPrimitive(std::shared_ptr<enzo::geo::Primitive> primitive);
71 std::shared_ptr<enzo::geo::Primitive> getPrimitive(
unsigned int index);
72 std::shared_ptr<const enzo::geo::Primitive> getPrimitive(
unsigned int index)
const;
73 geo::PrimPtr getPrimAtPath(
const std::string& path);
74 std::shared_ptr<const geo::Primitive> getPrimAtPath(
const std::string& path)
const;
76 const std::vector<std::shared_ptr<enzo::geo::Primitive>>& getPrimitives()
const
80 std::vector<geo::PrimPtr> getPrimitives(enzo::geo::PrimType type)
const;
82 void movePrim(
const geo::PrimPtr& primitive,
const std::string& toPath);
84 void movePrim(
const std::string& fromPath,
const std::string& toPath);
85 void removePrim(std::string path);
87 Transforms getTransforms(TransformClass transformClass)
89 return Transforms(primitives_, transformClass);
93 NodePacket deepCopy()
const;
97 std::string claimPath(
const std::string& path);
99 std::vector<geo::PrimPtr> primitives_;
101 std::unordered_map<std::string, std::size_t> nextNumberByPath_;
size_t Offset
enzo::Offset is the internal discontinuous index of an element in a given AttributeOwner.
Definition Types.h:182
Definition NodePacket.h:12
void movePrim(const geo::PrimPtr &primitive, const std::string &toPath)
Moves the primitive to the path, numbering it when another primitive holds it.
Definition NodePacket.cpp:266
void addPrimitive(std::shared_ptr< enzo::geo::Primitive > primitive)
Adds the primitive, numbering its path when another primitive holds it.
Definition NodePacket.cpp:204
void attemptMerge(geo::PrimPtr prim)
Merges the primitive into the one at its path, or adds it when either cannot merge.
Definition NodePacket.cpp:210