85 TYPE_SPACE_CHANGER = 2,
107 EVENT_DELETE = 1 << 0,
108 EVENT_RESIZE = 1 << 1,
109 EVENT_DELEGATED = 1 << 2,
110 EVENT_CHILDREN_INSERT = 1 << 3,
111 EVENT_CHILDREN_REMOVE = 1 << 4,
112 EVENT_CHILDREN_GENERIC = 1 << 5,
115 EVENT_STEPS = 1 << 7,
116 EVENT_USER_DEFINED = 1 << 8
127 return flagsWithout(EVENT_DELETE | EVENT_CHILDREN_INSERT | EVENT_CHILDREN_REMOVE | EVENT_CHILDREN_GENERIC) |
128 EVENT_DELEGATED | (hasFlag(EVENT_DELETE) ? EVENT_RESIZE : 0u);
141 if (hasAnyFlag(EVENT_CHILDREN_INSERT | EVENT_CHILDREN_REMOVE | EVENT_CHILDREN_GENERIC))
142 result |= EVENT_CHILDREN_GENERIC;
157 bool isDelete()
const {
return hasFlag(EVENT_DELETE); }
163 bool isResize()
const {
return hasFlag(EVENT_RESIZE); }
176 return hasAnyFlag(EVENT_CHILDREN_INSERT | EVENT_CHILDREN_REMOVE | EVENT_CHILDREN_GENERIC);
219 const std::size_t beginIndex,
220 const std::size_t endIndex)
221 :
Event(source, flags), beginIndex(beginIndex), endIndex(endIndex) {}
244 Subtree(shared_ptr<const GeometryObject>
object = shared_ptr<const GeometryObject>()) : object(object) {}
251 Subtree(shared_ptr<const GeometryObject>
object,
const std::vector<Subtree>& children)
252 : object(object), children(children) {}
259 Subtree(shared_ptr<const GeometryObject>
object, std::vector<Subtree>&& children)
260 : object(object), children(
std::forward<
std::vector<
Subtree>>(children)) {}
273 return children.
empty() ?
Subtree() :
Subtree(root, std::vector<Subtree>{std::forward<Subtree>(children)});
287 return children.
empty()
289 :
Subtree(root->shared_from_this(), std::vector<Subtree>{std::forward<Subtree>(children)});
297 bool hasBranches()
const;
305 Path toLinearPath()
const;
311 Path getLastPath()
const;
317 bool empty()
const {
return !object; }
379 bool apply(shared_ptr<GeometryObject>& to_change,
Vec<3, double>* translation = 0)
const override;
386 shared_ptr<const GeometryObject>
from;
387 shared_ptr<GeometryObject>
to;
400 : from(from), to(to), translation(translation) {}
407 template <
typename F>
409 : from(from), translation(0.0, 0.0, 0.0) {
410 this->to = calc_replace(this->from);
413 bool apply(shared_ptr<GeometryObject>& to_change,
Vec<3, double>* translation = 0)
const override;
425 shared_ptr<const GeometryObject>
toDel;
429 bool apply(shared_ptr<GeometryObject>& to_change,
Vec<3, double>* translation = 0)
const override;
442 PredicateIsA(
const shared_ptr<GeometryObject>& objectToBeEqual) : objectToBeEqual(*objectToBeEqual) {}
443 PredicateIsA(
const shared_ptr<const GeometryObject>& objectToBeEqual) : objectToBeEqual(*objectToBeEqual) {}
451 boost::algorithm::trim(this->role_name);
454 boost::algorithm::trim(this->role_name);
485 std::map<const GeometryObject*, std::string> names_of_saved;
487 std::map<const GeometryObject*, unsigned> counts;
489 unsigned nextAutoName;
518 virtual std::vector<std::string> getPathNames(
const GeometryObject& parent,
520 std::size_t index_of_child_in_parent)
const;
537 std::size_t index_of_child_in_parent)
const;
561 min_step_size = value;
579 template <
typename ClassT,
typename methodT>
582 boost::signals2::connect_position at = boost::signals2::at_back) {
583 return changed.connect(boost::bind(method, obj,
_1), at);
588 changed.disconnect(boost::bind(method, obj,
_1));
604 template <
typename EventT = Event,
typename...
Args>
617 min_step_size(
to_copy.min_step_size) {}
626 min_step_size =
to_copy.min_step_size;
632 GeometryObject(
unsigned max_steps,
double min_step_size) : max_steps(max_steps), min_step_size(min_step_size) {}
712 bool isLeaf()
const {
return getType() == TYPE_LEAF; }
713 bool isTransform()
const {
return getType() == TYPE_TRANSFORM || getType() == TYPE_SPACE_CHANGER; }
716 bool isGeometry()
const {
return getType() == TYPE_GEOMETRY; }
748 std::set<double> points;
749 addPointsAlongToSet(points, direction, max_steps, min_step_size);
759 boost::algorithm::trim(role_name);
760 return roles.find(role_name) != roles.end();
768 boost::algorithm::trim(role_name);
769 roles.insert(role_name);
777 boost::algorithm::trim(role_name);
778 roles.erase(role_name);
809 return !getObjects(
PredicateIsA(el), pathHints).empty();
813 return hasInSubtree(*el, pathHints);
845 getObjectsToVec(predicate,
dest, &path);
856 std::vector<shared_ptr<const GeometryObject>>
result;
857 getObjectsToVec(predicate,
result, path);
868 return getObjects(predicate, &path);
886 getLeafsToVec(
dest, &path);
895 std::vector<shared_ptr<const GeometryObject>>
result;
896 getLeafsToVec(
result, path);
944 virtual std::size_t getRealChildrenCount()
const;
964 virtual void removeAtUnsafe(std::size_t index);
973 ensureIsValidChildNr(index,
"removeAt",
"index");
974 removeAtUnsafe(index);
975 fireChildrenRemoved(index, index + 1);
989 ensureIsValidChildNr(
index_end - 1,
"removeRange",
"index_end-1");
1005 struct ChildGetter {
1006 shared_ptr<const GeometryObject> el;
1007 ChildGetter(
const shared_ptr<const GeometryObject>& el) : el(el) {}
1008 shared_ptr<GeometryObject> operator()(std::size_t index)
const {
return el->getChildNo(index); }
1052 std::map<const GeometryObject*, shared_ptr<GeometryObject>>
copied;
1103 const char*
arg_name =
"child_no")
const {
1118 const char*
arg_name =
"pos")
const {