PLaSK library
Loading...
Searching...
No Matches
plask::StackContainer< dim > Struct Template Reference

Container which have children in stack/layers. More...

#include <plask/geometry/stack.hpp>

Inheritance diagram for plask::StackContainer< dim >:
[legend]
Collaboration diagram for plask::StackContainer< dim >:
[legend]

Public Types

typedef StackContainerChildAligner< dim > ChildAligner
 
typedef StackContainerBaseImpl< dim >::ChildType ChildType
 
typedef StackContainerBaseImpl< dim >::TranslationT TranslationT
 
typedef StackContainerBaseImpl< dim >::Box Box
 Rectangle type in space on this, rectangle in space with dim number of dimensions.
 
- Public Types inherited from plask::WithAligners< StackContainerBaseImpl< dim >, StackContainerChildAligner< dim > >
typedef StackContainerChildAligner< dim > ChildAligner
 
typedef ParentType::TranslationT TranslationT
 
- Public Types inherited from plask::StackContainerBaseImpl< dim, growingDirection >
typedef GeometryObjectContainer< dim > BaseClass
 
typedef BaseClass::DVec DVec
 Vector of doubles type in space on this, vector in space with dim number of dimensions.
 
typedef BaseClass::Box Box
 Rectangle type in space on this, rectangle in space with dim number of dimensions.
 
typedef BaseClass::ChildType ChildType
 Type of this child.
 
typedef BaseClass::TranslationT TranslationT
 Type of translation geometry element in space of this.
 
typedef BaseClass::TranslationVector TranslationVector
 Type of the vector holding container children.
 
- Public Types inherited from plask::GeometryObjectContainer< dim >
typedef GeometryObjectContainer< dim >::DVec DVec
 Vector of doubles type in space on this, vector in space with dim number of dimensions.
 
typedef GeometryObjectContainer< dim >::Box Box
 Rectangle type in space on this, rectangle in space with dim number of dimensions.
 
typedef GeometryObjectD< dim > ChildType
 Type of the container children.
 
typedef Translation< dim > TranslationT
 Type of translation geometry object in space of this.
 
typedef std::vector< shared_ptr< TranslationT > > TranslationVector
 Type of the vector holding container children.
 
- Public Types inherited from plask::GeometryObjectD< dim >
typedef Primitive< dim >::Box Box
 
typedef Primitive< dim >::DVec DVec
 
- Public Types inherited from plask::GeometryObject
enum  Type {
  TYPE_LEAF = 0 , TYPE_TRANSFORM = 1 , TYPE_SPACE_CHANGER = 2 , TYPE_CONTAINER = 3 ,
  TYPE_GEOMETRY = 4 , TYPE_SEPARATOR = 5
}
 Type of geometry object. More...
 
typedef std::function< bool(const GeometryObject &)> Predicate
 Predicate on GeometryObject.
 

Public Member Functions

std::string getTypeName () const override
 Get name of object type (like: "block2d", "shelf", "stack3d", etc.).
 
 StackContainer (const double baseHeight=0.0, const ChildAligner &aligner=DefaultAligner())
 
void onChildChanged (const GeometryObject::Event &evt) override
 Called by child.change signal, call this change.
 
PathHints::Hint insertUnsafe (const shared_ptr< ChildType > &el, const std::size_t pos, const ChildAligner &aligner)
 Insert children to stack at given position.
 
PathHints::Hint insertUnsafe (const shared_ptr< ChildType > &el, const std::size_t pos)
 
PathHints::Hint insert (const shared_ptr< ChildType > &el, const std::size_t pos, const ChildAligner &aligner)
 Insert children to stack at given position.
 
PathHints::Hint insert (const shared_ptr< ChildType > &el, const std::size_t pos)
 
PathHints::Hint addUnsafe (const shared_ptr< ChildType > &el, const ChildAligner &aligner)
 Add children to stack top.
 
PathHints::Hint addUnsafe (const shared_ptr< ChildType > &el)
 
PathHints::Hint add (const shared_ptr< ChildType > &el, const ChildAligner &aligner)
 Add children to stack top.
 
PathHints::Hint add (const shared_ptr< ChildType > &el)
 
PathHints::Hint push_back (const shared_ptr< ChildType > &el, const ChildAligner &aligner)
 Add child to stack top.
 
PathHints::Hint push_back (const shared_ptr< ChildType > &el)
 
PathHints::Hint push_front (const shared_ptr< ChildType > &el, const ChildAligner &aligner)
 Add child to stack bottom, move all other children up.
 
PathHints::Hint push_front (const shared_ptr< ChildType > &el)
 
const ChildAlignergetAlignerAt (std::size_t child_no) const
 
bool removeIfTUnsafe (const std::function< bool(const shared_ptr< TranslationT > &c)> &predicate) override
 Remove all children which fulfil predicate.
 
void removeAtUnsafe (std::size_t index) override
 Remove child at given index.
 
void writeXML (XMLWriter::Element &parent_xml_object, GeometryObject::WriteXMLCallback &write_cb, AxisNames parent_axes) const override
 Call writeXMLAttr for this container attribute and writeXMLChildAttr for each child tag.
 
shared_ptr< GeometryObjectshallowCopy () const override
 Get shallow copy of this.
 
shared_ptr< GeometryObjectdeepCopy (std::map< const GeometryObject *, shared_ptr< GeometryObject > > &copied) const override
 Get deep copy of this.
 
const StackContainer< 2 >::ChildAlignerDefaultAligner ()
 
const StackContainer< 3 >::ChildAlignerDefaultAligner ()
 
const StackContainer< 2 >::ChildAlignerDefaultAligner ()
 
const StackContainer< 3 >::ChildAlignerDefaultAligner ()
 
- Public Member Functions inherited from plask::WithAligners< StackContainerBaseImpl< dim >, StackContainerChildAligner< dim > >
 WithAligners (Args &&... args)
 Delegate all constructors to parent class.
 
void onChildChanged (const GeometryObject::Event &evt) override
 Called by child.change signal.
 
bool removeIfTUnsafe (const std::function< bool(const shared_ptr< TranslationT > &c)> &predicate) override
 
void removeAtUnsafe (std::size_t index) override
 
void writeXMLChildAttr (XMLWriter::Element &dest_xml_child_tag, std::size_t child_index, const AxisNames &axes) const override
 
void move (std::size_t index, ChildAligner aligner)
 Set new aligner for child at given index.
 
void move (shared_ptr< const TranslationT > child, ChildAligner aligner)
 Set new aligner for given child.
 
void move (const TranslationT &child, ChildAligner aligner)
 Set new aligner for given child.
 
const std::vector< ChildAligner > & getAligners () const
 Get const reference to aligners.
 
- Public Member Functions inherited from plask::StackContainerBaseImpl< dim, growingDirection >
 StackContainerBaseImpl (const double baseHeight=0.0)
 
double getBaseHeight () const
 Get component of position in growing direction where stack starts.
 
void setBaseHeight (double newBaseHeight)
 Set height where should start first object.
 
void setZeroBefore (std::size_t index)
 Set zero coordinate at the bottom of the specified object.
 
void setZeroBefore (const shared_ptr< ChildType > &object, const PathHints *path=0)
 Set zero coordinate at the bottom of the specified object.
 
void setZeroBefore (const shared_ptr< ChildType > &object, const PathHints &path)
 Set zero coordinate at the bottom of the specified object.
 
void alignZeroOn (std::size_t index, double pos=0.)
 Align zero coordinate with the specified position of the object of specified index.
 
void alignZeroOn (const shared_ptr< ChildType > &object, const PathHints *path=0, double pos=0.)
 Align zero coordinate with the zero of the specified object.
 
void alignZeroOn (const shared_ptr< ChildType > &object, const PathHints &path, double pos=0.)
 Align zero coordinate with the zero of the specified object.
 
std::size_t getInsertionIndexForHeight (double height) const
 
const shared_ptr< TranslationTgetChildForHeight (double height, shared_ptr< TranslationT > &sec_candidate) const
 
const shared_ptr< TranslationTgetChildForHeight (double height) const
 
bool contains (const DVec &p) const override
 
shared_ptr< MaterialgetMaterial (const DVec &p) const override
 
GeometryObject::Subtree getPathsAt (const DVec &point, bool all=false) const override
 
bool removeIfTUnsafe (const std::function< bool(const shared_ptr< TranslationT > &c)> &predicate) override
 Remove all children which fulfil predicate.
 
double getHeight () const
 Get height of stack.
 
- Public Member Functions inherited from plask::GeometryObjectContainer< dim >
 ~GeometryObjectContainer ()
 Disconnect onChildChanged from current child change signal.
 
void connectOnChildChanged (Translation< dim > &child)
 Connect onChildChanged to current child change signal.
 
void disconnectOnChildChanged (Translation< dim > &child)
 Disconnect onChildChanged from current child change signal.
 
const TranslationVectorgetChildrenVector () const
 Get physically stored children (with translations).
 
GeometryObject::Type getType () const override
 
bool contains (const DVec &p) const override
 
Box getBoundingBox () const override
 Calculate minimal rectangle which contains all points of geometry object.
 
shared_ptr< MaterialgetMaterial (const DVec &p) const override
 Iterate over children in reverse order and check if any returns material.
 
void getBoundingBoxesToVec (const GeometryObject::Predicate &predicate, std::vector< Box > &dest, const PathHints *path=0) const override
 
void getObjectsToVec (const GeometryObject::Predicate &predicate, std::vector< shared_ptr< const GeometryObject > > &dest, const PathHints *path=0) const override
 Append all objects from subtree with this in root, which fulfill predicate to vector dest.
 
virtual void getPositionsToVec (const GeometryObject::Predicate &predicate, std::vector< DVec > &dest, const PathHints *path=0) const override
 
bool hasInSubtree (const GeometryObject &el) const override
 Check if el is in subtree with this in root.
 
template<typename ChildIter >
GeometryObject::Subtree findPathsFromChildTo (ChildIter childBegin, ChildIter childEnd, const GeometryObject &el, const PathHints *path=0) const
 
GeometryObject::Subtree getPathsTo (const GeometryObject &el, const PathHints *path=0) const override
 Find paths to el.
 
GeometryObject::Subtree getPathsAt (const DVec &point, bool all=false) const override
 
std::size_t getChildrenCount () const override
 Get number of all children of this in geometry graph.
 
shared_ptr< GeometryObjectgetChildNo (std::size_t child_no) const override
 Get child with given index.
 
std::size_t getChildIndex (const shared_ptr< ChildType > &el, const PathHints *path=0) const
 Return index of the given item.
 
std::size_t getChildIndex (const shared_ptr< ChildType > &el, const PathHints &path) const
 Return index of the given item.
 
virtual shared_ptr< const GeometryObjectchangedVersion (const GeometryObject::Changer &changer, Vec< 3, double > *translation=0) const override
 Get this or copy of this with some changes in subtree.
 
bool removeIfT (const std::function< bool(const shared_ptr< TranslationT > &c)> &predicate)
 Remove all children which fulfil predicate.
 
bool removeIf (const std::function< bool(const shared_ptr< ChildType > &c)> &predicate)
 Remove all children which fulfil predicate.
 
bool removeT (shared_ptr< const TranslationT > el)
 Remove all children exactly equal to el.
 
bool remove (shared_ptr< const ChildType > el)
 Remove all children exactly equal to el.
 
bool remove (const PathHints &hints)
 Remove child pointed, for this container, in hints.
 
void clear ()
 Remove all children from the container.
 
template<typename UnaryFunction >
void forEachChild (UnaryFunction fun, const PathHints *path=nullptr) const
 Call fun(child) for each real child of this.
 
void addPointsAlongToSet (std::set< double > &points, Primitive< 3 >::Direction direction, unsigned max_steps, double min_step_size) const override
 
void addLineSegmentsToSet (std::set< typename GeometryObjectD< dim >::LineSegment > &segments, unsigned max_steps, double min_step_size) const override
 
- Public Member Functions inherited from plask::GeometryObjectD< dim >
int getDimensionsCount () const override
 Get number of dimensions.
 
virtual Subtree getPathsAt (const DVec &point, bool all=false) const =0
 Find all paths to objects which lies at given point.
 
virtual bool contains (const DVec &point) const =0
 Check if this geometry object contains point.
 
virtual DVec getBoundingBoxSize () const
 
virtual Box getRealBoundingBox () const
 Calculate minimal rectangle which contains all points of real geometry object.
 
virtual shared_ptr< MaterialgetMaterial (const DVec &p) const =0
 Return material in a given point inside the geometry object.
 
shared_ptr< MaterialgetMaterialOrAir (const DVec &p) const
 Return material in a given point inside the geometry object.
 
virtual void getBoundingBoxesToVec (const GeometryObject::Predicate &predicate, std::vector< Box > &dest, const PathHints *path=0) const =0
 Calculate and append to vector bounding boxes of all nodes which fulfill given predicate, optionally marked by path.
 
void getBoundingBoxesToVec (const GeometryObject::Predicate &predicate, std::vector< Box > &dest, const PathHints &path) const
 Calculate and append to vector bounding boxes of all nodes which fulfill given predicate, marked by path.
 
std::vector< BoxgetBoundingBoxes (const GeometryObject::Predicate &predicate, const PathHints *path=0) const
 Calculate the vector of bounding boxes of all nodes which fulfill given predicate, optionally marked by path.
 
std::vector< BoxgetBoundingBoxes (const GeometryObject::Predicate &predicate, const PathHints &path)
 Calculate the vector of bounding boxes of all nodes which fulfill given predicate, marked by path.
 
void getLeafsBoundingBoxesToVec (std::vector< Box > &dest, const PathHints *path=0) const
 Calculate and append to vector bounding boxes of all leafs, optionally marked by path.
 
void getLeafsBoundingBoxesToVec (std::vector< Box > &dest, const PathHints &path) const
 Calculate and append to vector bounding boxes of all leafs, marked by path.
 
std::vector< BoxgetLeafsBoundingBoxes (const PathHints *path=0) const
 Calculate bounding boxes of all leafs, optionally marked by path.
 
std::vector< BoxgetLeafsBoundingBoxes (const PathHints &path) const
 Calculate bounding boxes of all leafs, marked by path.
 
void getObjectBoundingBoxesToVec (std::vector< Box > &dest, const GeometryObject &object, const PathHints *path=0) const
 Calculate and append to vector bounding boxes of all instances of given object, optionally marked by path.
 
void getObjectBoundingBoxesToVec (std::vector< Box > &dest, const GeometryObject &object, const PathHints &path) const
 Calculate and append to vector bounding boxes of all instances of given object, marked by path.
 
std::vector< BoxgetObjectBoundingBoxes (const GeometryObject &object, const PathHints *path=0) const
 Calculate bounding boxes of all instances of given object, optionally marked by path.
 
std::vector< BoxgetObjectBoundingBoxes (const GeometryObject &object, const PathHints &path) const
 Calculate bounding boxes of all instances of given objects, marked by path.
 
virtual void getPositionsToVec (const Predicate &predicate, std::vector< DVec > &dest, const PathHints *path=0) const =0
 Calculate and append to vector positions of all nodes which fulfill given predicate, optionally marked by path.
 
void getPositionsToVec (const Predicate &predicate, std::vector< DVec > &dest, const PathHints &path) const
 Calculate and append to vector positions of all nodes which fulfill given predicate, marked by path.
 
std::vector< DVecgetPositions (const Predicate &predicate, const PathHints *path=0) const
 Calculate and append to vector positions of all nodes which fulfill given predicate, optionally marked by path.
 
std::vector< DVecgetPositions (const Predicate &predicate, const PathHints &path) const
 Calculate and append to vector positions of all nodes which fulfill given predicate, marked by path.
 
void getLeafsPositionsToVec (std::vector< DVec > &dest, const PathHints *path=0) const
 Calculate and append to vector positions of all leafs, optionally marked by path.
 
void getLeafsPositionsToVec (std::vector< DVec > &dest, const PathHints &path) const
 Calculate and append to vector positions of all leafs, marked by path.
 
std::vector< DVecgetLeafsPositions (const PathHints *path=0) const
 Calculate and return a vector of positions of all leafs, optionally marked by path.
 
std::vector< DVecgetLeafsPositions (const PathHints &path) const
 Calculate and return a vector of positions of all leafs, marked by path.
 
void getObjectPositionsToVec (std::vector< DVec > &dest, const GeometryObject &object, const PathHints *path=0) const
 Calculate and append to vector positions of all instances of given object, optionally marked by path.
 
void getObjectPositionsToVec (std::vector< DVec > &dest, const GeometryObject &object, const PathHints &path) const
 Calculate and append to vector positions of all instances of given object, marked by path.
 
std::vector< DVecgetObjectPositions (const GeometryObject &object, const PathHints *path=0) const
 Calculate and return a vector of positions of all instances of given object, optionally marked by path.
 
std::vector< DVecgetObjectPositions (const GeometryObject &object, const PathHints &path) const
 Calculate and return a vector of positions of all instances of given object, marked by path.
 
shared_ptr< const GeometryObjectgetMatchingAt (const DVec &point, const Predicate &predicate, const PathHints *path=0) const
 Get object closest to the root, which contains specific point and fulfills the predicate.
 
shared_ptr< const GeometryObjectgetMatchingAt (const DVec &point, const Predicate &predicate, const PathHints &path) const
 Get object closest to the root, which contains specific point and fulfills the predicate.
 
bool objectIncludes (const GeometryObject &object, const PathHints *path, const DVec &point) const
 Check if specified geometry object contains a point point.
 
bool objectIncludes (const GeometryObject &object, const PathHints &path, const DVec &point) const
 Check if specified geometry object contains a point point.
 
bool objectIncludes (const GeometryObject &object, const DVec &point) const
 Check if specified geometry object contains a point point.
 
std::set< std::string > getRolesAt (const DVec &point, const plask::PathHints *path=0) const
 Get a sum of roles sets of all objects which lies on path from this to leaf at given point.
 
std::set< std::string > getRolesAt (const DVec &point, const plask::PathHints &path) const
 Get a sum of roles sets of all objects which lies on path from this to leaf at given point.
 
shared_ptr< const GeometryObjecthasRoleAt (const std::string &role_name, const DVec &point, const plask::PathHints *path=0) const
 Check if any object at given point, not hidden by another object, plays role with given name role_name (if so, returns non-nullptr).
 
shared_ptr< const GeometryObjecthasRoleAt (const std::string &role_name, const DVec &point, const plask::PathHints &path) const
 Check if any object at given point, not hidden by another object, plays role with given name role_name (if so, returns non-nullptr).
 
virtual void addLineSegmentsToSet (std::set< LineSegment > &PLASK_UNUSED(segments), unsigned PLASK_UNUSED(max_steps), double PLASK_UNUSED(min_step_size)) const =0
 Add characteristic points to the set and edges connecting them.
 
std::set< LineSegmentgetLineSegments (unsigned max_steps=PLASK_GEOMETRY_MAX_STEPS, double min_step_size=PLASK_GEOMETRY_MIN_STEP_SIZE) const
 Add characteristic points to the set and edges connecting them.
 
virtual Subtree getPathsTo (const GeometryObject &el, const PathHints *pathHints=0) const=0
 Find paths to el.
 
- Public Member Functions inherited from plask::GeometryObject
void setMaxSteps (unsigned value)
 Set max_steps.
 
void setMinStepSize (double value)
 Set min_step_size.
 
template<typename ClassT , typename methodT >
boost::signals2::connection changedConnectMethod (ClassT *obj, methodT method, boost::signals2::connect_position at=boost::signals2::at_back)
 Connect a method to changed signal.
 
template<typename ClassT , typename methodT >
void changedDisconnectMethod (ClassT *obj, methodT method)
 Disconnect a method from changed signal.
 
template<typename EventT = Event, typename... Args>
void fireChanged (Args &&... event_constructor_params_without_source)
 Call changed with this as event source.
 
 GeometryObject (const GeometryObject &to_copy)
 Initialize this to be the same as to_copy but doesn't have any changes observer.
 
GeometryObjectoperator= (const GeometryObject &to_copy)
 Set this to be the same as to_copy but doesn't change changes observer.
 
 GeometryObject ()
 
 GeometryObject (unsigned max_steps, double min_step_size)
 
virtual ~GeometryObject ()
 Virtual destructor.
 
void writeXML (XMLWriter::Element &parent_xml_object, WriteXMLCallback &write_cb) const
 Write geometry tree branch rooted by this to XML.
 
void writeXML (XMLWriter::Element &parent_xml_object) const
 Write geometry tree branch rooted by this to XML.
 
template<int DIMS>
shared_ptr< GeometryObjectD< DIMS > > asD ()
 Cast this to GeometryObjectD<DIMS>.
 
template<int DIMS>
shared_ptr< const GeometryObjectD< DIMS > > asD () const
 Cast this to GeometryObjectD<DIMS> (const version).
 
shared_ptr< GeometryasGeometry ()
 Cast this to Geometry.
 
shared_ptr< const GeometryasGeometry () const
 Cast this to Geometry.
 
bool isLeaf () const
 
bool isTransform () const
 
bool isSpaceChanger () const
 
bool isContainer () const
 
bool isGeometry () const
 
virtual void addPointsAlongToSet (std::set< double > &points, Primitive< 3 >::Direction PLASK_UNUSED(direction), unsigned PLASK_UNUSED(max_steps), double PLASK_UNUSED(min_step_size)) const =0
 Add characteristic points information along specified axis to set.
 
std::set< doublegetPointsAlong (Primitive< 3 >::Direction direction, unsigned max_steps=PLASK_GEOMETRY_MAX_STEPS, double min_step_size=PLASK_GEOMETRY_MIN_STEP_SIZE) const
 Get characteristic points information along specified axis.
 
bool hasRole (std::string role_name) const
 Check if this object belongs to class (has tag) with name role_name.
 
void addRole (std::string role_name)
 Add this to given class.
 
void removeRole (std::string role_name)
 Remove this from given class, do nothing if this is not in given class.
 
void clearRoles ()
 Clear set of roles of this.
 
virtual void validate () const
 Check if object is ready for calculation.
 
bool hasInSubtree (const GeometryObject &el, const PathHints *pathHints) const
 
bool hasInSubtree (shared_ptr< const GeometryObject > el, const PathHints *pathHints) const
 
void getObjectsToVec (const Predicate &predicate, std::vector< shared_ptr< const GeometryObject > > &dest, const PathHints &path) const
 Append all objects from subtree with this in root, which fulfill predicate to vector dest.
 
std::vector< shared_ptr< const GeometryObject > > getObjects (const Predicate &predicate, const PathHints *path=0) const
 Get vector of all objects from subtree with this in root, which fulfill predicate.
 
std::vector< shared_ptr< const GeometryObject > > getObjects (const Predicate &predicate, const PathHints &path) const
 Get vector of all objects from subtree with this in root, which fulfill predicate.
 
void getLeafsToVec (std::vector< shared_ptr< const GeometryObject > > &dest, const PathHints *path=0) const
 Append all leafs in subtree with this in root to vector dest.
 
void getLeafsToVec (std::vector< shared_ptr< const GeometryObject > > &dest, const PathHints &path) const
 Append all leafs in subtree with this in root to vector dest.
 
std::vector< shared_ptr< const GeometryObject > > getLeafs (const PathHints *path=0) const
 Get all leafs in subtree with this object as root.
 
std::vector< shared_ptr< const GeometryObject > > getLeafs (const PathHints &path) const
 Get all leafs in subtree with this object as root.
 
void getObjectsWithRoleToVec (const std::string &role, std::vector< shared_ptr< const GeometryObject > > &dest) const
 Append all objects with a specified role in subtree with this in root to vector dest.
 
std::vector< shared_ptr< const GeometryObject > > getObjectsWithRole (const std::string &role) const
 Get all objects with a specified role in subtree with this object as root.
 
virtual std::size_t getRealChildrenCount () const
 Get number of real (physically stored) children in geometry graph.
 
virtual shared_ptr< GeometryObjectgetRealChildNo (std::size_t child_no) const
 Get real (physically stored) child with given index.
 
void removeAt (std::size_t index)
 Remove child at given index.
 
void removeRangeUnsafe (std::size_t index_begin, std::size_t index_end)
 
bool removeRange (std::size_t index_begin, std::size_t index_end)
 Remove all children in given range [index_begin, index_end).
 
virtual void forEachRealObjectInSubtree (std::function< bool(const GeometryObject &)> callback) const
 Call a callback for each object in subtree with this in root.
 
FunctorIndexedIterator< ChildGetter > begin () const
 
FunctorIndexedIterator< ChildGetter > end () const
 
shared_ptr< GeometryObjectdeepCopy ()
 Get deep copy of this.
 
bool canHasAsChild (const GeometryObject &potential_child) const
 
bool canHasAsParent (const GeometryObject &potential_parent) const
 
void ensureCanHasAsParent (const GeometryObject &potential_parent) const
 Throw CyclicReferenceException if potential_parent is in subtree with this in root.
 
void ensureCanHaveAsChild (const GeometryObject &potential_child) const
 Throw CyclicReferenceException if potential_child has this in subtree.
 

Static Public Member Functions

static const ChildAlignerDefaultAligner ()
 
- Static Public Member Functions inherited from plask::GeometryObject
static bool PredicateIsLeaf (const GeometryObject &el)
 Predicate which check if given object is leaf.
 

Public Attributes

ChildAligner default_aligner
 
- Public Attributes inherited from plask::StackContainerBaseImpl< dim, growingDirection >
TranslationVector children
 
- Public Attributes inherited from plask::GeometryObject
unsigned max_steps
 Maximum number of points to split a single leaf.
 
double min_step_size
 Minimum distance between divisions for a single leaf.
 
std::set< std::string > roles
 Roles/tags.
 
boost::signals2::signal< void(Event &)> changed
 Changed signal, fired when object was changed.
 

Static Public Attributes

static const charNAME = dim == 2 ? PLASK_STACK2D_NAME : PLASK_STACK3D_NAME
 
- Static Public Attributes inherited from plask::StackContainerBaseImpl< dim, growingDirection >
static constexpr Primitive< dim >::Direction GROWING_DIR = growingDirection
 
- Static Public Attributes inherited from plask::GeometryObjectD< dim >
static const int DIM = dim
 

Protected Member Functions

void writeXMLChildAttr (XMLWriter::Element &dest_xml_child_tag, std::size_t child_index, const AxisNames &axes) const override
 Add attributes to child tag.
 
shared_ptr< GeometryObjectchangedVersionForChildren (std::vector< std::pair< shared_ptr< ChildType >, Vec< 3, double > > > &children_after_change, Vec< 3, double > *recomended_translation) const override
 This is called by changedVersion method to create new version of this container which consists of new children.
 
- Protected Member Functions inherited from plask::WithAligners< StackContainerBaseImpl< dim >, StackContainerChildAligner< dim > >
PathHints::Hint _insertUnsafe (const std::size_t pos, shared_ptr< TranslationT > to_insert, ChildAligner aligner)
 Do everything, but align to_insert by aligner.
 
PathHints::Hint _insert (const std::size_t pos, shared_ptr< TranslationT > to_insert, ChildAligner aligner)
 
PathHints::Hint _addUnsafe (shared_ptr< TranslationT > to_add, ChildAligner aligner)
 
ChildAligner getAlignerFor (shared_ptr< const TranslationT > child)
 
ChildAligner getAlignerFor (TranslationT &child)
 
void align (shared_ptr< TranslationT > child)
 
void align (TranslationT *child)
 
void align (TranslationT &child)
 
- Protected Member Functions inherited from plask::StackContainerBaseImpl< dim, growingDirection >
void calcHeight (const Box &elBoudingBox, double prev_height, double &el_translation, double &next_height)
 Calculate object vertical translation and height of stack with object el.
 
void calcHeight (const shared_ptr< ChildType > &el, double prev_height, double &el_translation, double &next_height)
 Calculate object vertical translation and height of stack with object el.
 
void updateHeight (std::size_t child_index)
 Update stack height (fragment with pointed child on top) and pointed child up translation.
 
void updateAllHeights (std::size_t first_child_index)
 Update stack heights and translation in stack growing direction of all children, with indexes from first_child_index.
 
void updateAllHeights ()
 
void rebuildStackHeights (std::size_t first_child_index=0)
 Resize stackHeights (to be compatible with children vector) and refresh its value from given index.
 
void writeXMLAttr (XMLWriter::Element &dest_xml_object, const AxisNames &axes) const override
 Append XML attributes of this to dest_xml_object.
 
- Protected Member Functions inherited from plask::GeometryObject
virtual void writeXMLChildren (XMLWriter::Element &dest_xml_object, WriteXMLCallback &write_cb, const AxisNames &axes) const
 Append all children of this to XML dest_xml_object.
 
void ensureIsValidChildNr (std::size_t child_no, const char *method_name="getChildNo", const char *arg_name="child_no") const
 Check if given index is valid child index and throw exception of it is not.
 
void ensureIsValidInsertPosition (std::size_t child_no, const char *method_name="insert", const char *arg_name="pos") const
 Check if given index is valid insert index and throw exception of it is not.
 
void fireChildrenChanged ()
 Inform observers that children list was changed (also that this is resized)
 
void fireChildrenRemoved (std::size_t beginIndex, std::size_t endIndex)
 
void fireChildrenInserted (std::size_t beginIndex, std::size_t endIndex)
 

Additional Inherited Members

- Protected Attributes inherited from plask::WithAligners< StackContainerBaseImpl< dim >, StackContainerChildAligner< dim > >
std::vector< ChildAligneraligners
 
- Protected Attributes inherited from plask::StackContainerBaseImpl< dim, growingDirection >
std::vector< doublestackHeights
 stackHeights[x] is current stack heights with x first objects in it (sums of heights of first x objects), stackHeights.size() = children.size() + 1 and stackHeights[0] is a base height (typically 0.0)
 
- Protected Attributes inherited from plask::GeometryObjectContainer< dim >
TranslationVector children
 

Detailed Description

template<int dim>
struct plask::StackContainer< dim >

Container which have children in stack/layers.

Definition at line 357 of file stack.hpp.

Member Typedef Documentation

◆ Box

template<int dim>
typedef StackContainerBaseImpl<dim>::Box plask::StackContainer< dim >::Box

Rectangle type in space on this, rectangle in space with dim number of dimensions.

Definition at line 366 of file stack.hpp.

◆ ChildAligner

template<int dim>
typedef StackContainerChildAligner<dim> plask::StackContainer< dim >::ChildAligner

Definition at line 359 of file stack.hpp.

◆ ChildType

template<int dim>
typedef StackContainerBaseImpl<dim>::ChildType plask::StackContainer< dim >::ChildType

Definition at line 362 of file stack.hpp.

◆ TranslationT

template<int dim>
typedef StackContainerBaseImpl<dim>::TranslationT plask::StackContainer< dim >::TranslationT

Definition at line 363 of file stack.hpp.

Constructor & Destructor Documentation

◆ StackContainer()

template<int dim>
plask::StackContainer< dim >::StackContainer ( const double  baseHeight = 0.0,
const ChildAligner aligner = DefaultAligner() 
)
inlineexplicit
Parameters
baseHeightheight where the first object should start
alignerdefault stack aligner

Definition at line 407 of file stack.hpp.

Member Function Documentation

◆ add() [1/2]

template<int dim>
PathHints::Hint plask::StackContainer< dim >::add ( const shared_ptr< ChildType > &  el)
inline

Definition at line 468 of file stack.hpp.

◆ add() [2/2]

template<int dim>
PathHints::Hint plask::StackContainer< dim >::add ( const shared_ptr< ChildType > &  el,
const ChildAligner aligner 
)
inline

Add children to stack top.

Parameters
elobject to add
aligneraligner which will be used to calculate horizontal translation of inserted object
Returns
path hint, see Paths
Exceptions
CyclicReferenceExceptionif adding the new child cause inception of cycle in geometry graph

Definition at line 463 of file stack.hpp.

◆ addUnsafe() [1/2]

template<int dim>
PathHints::Hint plask::StackContainer< dim >::addUnsafe ( const shared_ptr< ChildType > &  el)
inline

Definition at line 452 of file stack.hpp.

◆ addUnsafe() [2/2]

template<int dim>
PathHints::Hint plask::StackContainer< dim >::addUnsafe ( const shared_ptr< ChildType > &  el,
const ChildAligner aligner 
)

Add children to stack top.

This method is fast but also unsafe because it doesn't ensure that there will be no cycle in geometry graph after adding the new child.

Parameters
elobject to add
aligneraligner which will be used to calculate horizontal translation of inserted object
Returns
path hint, see Paths

◆ changedVersionForChildren()

template<int dim>
shared_ptr< GeometryObject > plask::StackContainer< dim >::changedVersionForChildren ( std::vector< std::pair< shared_ptr< ChildType >, Vec< 3, double > > > &  children_after_change,
Vec< 3, double > *  recomended_translation 
) const
overrideprotectedvirtual

This is called by changedVersion method to create new version of this container which consists of new children.

Parameters
[in]children_after_changevector of new children
[out]recomended_translationoptional, place to store recommended translation (if is not nullptr, it has all coordinates equals to 0.0)
Returns
copy of this, with new children

Implements plask::GeometryObjectContainer< dim >.

Definition at line 376 of file stack.cpp.

◆ deepCopy()

template<int dim>
shared_ptr< GeometryObject > plask::StackContainer< dim >::deepCopy ( std::map< const GeometryObject *, shared_ptr< GeometryObject > > &  copied) const
overridevirtual

Get deep copy of this.

In the deep copy all children are copied.

Parameters
copiedmap containing copied objects to avoid double copying
Returns
deep copy of this

Implements plask::GeometryObject.

Definition at line 361 of file stack.cpp.

◆ DefaultAligner() [1/5]

const StackContainer< 2 >::ChildAligner & plask::StackContainer< 2 >::DefaultAligner ( )

Definition at line 213 of file stack.cpp.

◆ DefaultAligner() [2/5]

const StackContainer< 3 >::ChildAligner & plask::StackContainer< 3 >::DefaultAligner ( )

Definition at line 218 of file stack.cpp.

◆ DefaultAligner() [3/5]

template<int dim>
static const ChildAligner & plask::StackContainer< dim >::DefaultAligner ( )
static

◆ DefaultAligner() [4/5]

const StackContainer< 2 >::ChildAligner & plask::StackContainer< 2 >::DefaultAligner ( )

◆ DefaultAligner() [5/5]

const StackContainer< 3 >::ChildAligner & plask::StackContainer< 3 >::DefaultAligner ( )

◆ getAlignerAt()

template<int dim>
const ChildAligner & plask::StackContainer< dim >::getAlignerAt ( std::size_t  child_no) const
inline

Definition at line 503 of file stack.hpp.

◆ getTypeName()

template<int dim>
std::string plask::StackContainer< dim >::getTypeName ( ) const
inlineoverridevirtual

Get name of object type (like: "block2d", "shelf", "stack3d", etc.).

This name is used as tag name when object is serialized to XML.

Returns
name of object type

Implements plask::GeometryObject.

Definition at line 374 of file stack.hpp.

◆ insert() [1/2]

template<int dim>
PathHints::Hint plask::StackContainer< dim >::insert ( const shared_ptr< ChildType > &  el,
const std::size_t  pos 
)
inline

Definition at line 439 of file stack.hpp.

◆ insert() [2/2]

template<int dim>
PathHints::Hint plask::StackContainer< dim >::insert ( const shared_ptr< ChildType > &  el,
const std::size_t  pos,
const ChildAligner aligner 
)
inline

Insert children to stack at given position.

Parameters
elobject to insert
posposition where (before which) child should be inserted
aligneraligner which will be used to calculate horizontal translation of inserted object
Returns
path hint, see Paths
Exceptions
CyclicReferenceExceptionif adding the new child cause inception of cycle in geometry graph

Definition at line 434 of file stack.hpp.

◆ insertUnsafe() [1/2]

template<int dim>
PathHints::Hint plask::StackContainer< dim >::insertUnsafe ( const shared_ptr< ChildType > &  el,
const std::size_t  pos 
)
inline

Definition at line 422 of file stack.hpp.

◆ insertUnsafe() [2/2]

template<int dim>
PathHints::Hint plask::StackContainer< dim >::insertUnsafe ( const shared_ptr< ChildType > &  el,
const std::size_t  pos,
const ChildAligner aligner 
)

Insert children to stack at given position.

This method is fast but also unsafe because it doesn't ensure that there will be no cycle in geometry graph after adding the new child.

Parameters
elobject to insert
posposition where (before which) child should be inserted
aligneraligner which will be used to calculate horizontal translation of inserted object
Returns
path hint, see Paths

to use AccurateSum

Definition at line 224 of file stack.cpp.

◆ onChildChanged()

template<int dim>
void plask::StackContainer< dim >::onChildChanged ( const GeometryObject::Event evt)
overridevirtual

Called by child.change signal, call this change.

Reimplemented from plask::GeometryObjectContainer< dim >.

Definition at line 270 of file stack.cpp.

◆ push_back() [1/2]

template<int dim>
PathHints::Hint plask::StackContainer< dim >::push_back ( const shared_ptr< ChildType > &  el)
inline

Definition at line 483 of file stack.hpp.

◆ push_back() [2/2]

template<int dim>
PathHints::Hint plask::StackContainer< dim >::push_back ( const shared_ptr< ChildType > &  el,
const ChildAligner aligner 
)
inline

Add child to stack top.

Parameters
elobject to add
aligneraligner for horizontal translation of object
Returns
path hint, see Paths
Exceptions
CyclicReferenceExceptionif adding the new child cause inception of cycle in geometry graph

Definition at line 479 of file stack.hpp.

◆ push_front() [1/2]

template<int dim>
PathHints::Hint plask::StackContainer< dim >::push_front ( const shared_ptr< ChildType > &  el)
inline

Definition at line 499 of file stack.hpp.

◆ push_front() [2/2]

template<int dim>
PathHints::Hint plask::StackContainer< dim >::push_front ( const shared_ptr< ChildType > &  el,
const ChildAligner aligner 
)
inline

Add child to stack bottom, move all other children up.

Parameters
elobject to add
aligneraligner which describe horizontal translation of object
Returns
path hint, see Paths
Exceptions
CyclicReferenceExceptionif adding the new child cause inception of cycle in geometry graph

Definition at line 494 of file stack.hpp.

◆ removeAtUnsafe()

template<int dim>
void plask::StackContainer< dim >::removeAtUnsafe ( std::size_t  index)
overridevirtual

Remove child at given index.

This is unsafe but fast version, it doesn't check index and doesn't call fireChildrenChanged() to inform listeners about this object changes. Caller should do this manually or call removeAt(std::size_t) instead.

Parameters
indexindex of real child to remove

Reimplemented from plask::GeometryObjectContainer< dim >.

Definition at line 324 of file stack.cpp.

◆ removeIfTUnsafe()

template<int dim>
bool plask::StackContainer< dim >::removeIfTUnsafe ( const std::function< bool(const shared_ptr< TranslationT > &c)> &  predicate)
overridevirtual

Remove all children which fulfil predicate.

This is unsafe but fast version, it doesn't call fireChildrenChanged() to inform listeners about this object changes. Caller should do this manually or call removeIfT instead.

Parameters
predicatereturns true only if the child (with translation) passed as an argument should be deleted
Returns
true if anything has been removed

Reimplemented from plask::GeometryObjectContainer< dim >.

Definition at line 297 of file stack.cpp.

◆ shallowCopy()

template<int dim>
shared_ptr< GeometryObject > plask::StackContainer< dim >::shallowCopy ( ) const
overridevirtual

Get shallow copy of this.

In the shallow copy all children are the same

Returns
shallow copy of this

Implements plask::GeometryObject.

Definition at line 352 of file stack.cpp.

◆ writeXML()

template<int dim>
void plask::StackContainer< dim >::writeXML ( XMLWriter::Element parent_xml_object,
GeometryObject::WriteXMLCallback write_cb,
AxisNames  axes 
) const
overridevirtual

Call writeXMLAttr for this container attribute and writeXMLChildAttr for each child tag.

Parameters
parent_xml_object
write_cb
axes

Reimplemented from plask::GeometryObjectContainer< dim >.

Definition at line 332 of file stack.cpp.

◆ writeXMLChildAttr()

template<int dim>
void plask::StackContainer< dim >::writeXMLChildAttr ( XMLWriter::Element dest_xml_child_tag,
std::size_t  child_index,
const AxisNames axes 
) const
overrideprotectedvirtual

Add attributes to child tag.

Default implementation do nothing.

Parameters
dest_xml_child_tagdestination, child tag
child_indexindex of child
axesnames of axes

Reimplemented from plask::GeometryObjectContainer< dim >.

Definition at line 346 of file stack.cpp.

Member Data Documentation

◆ default_aligner

template<int dim>
ChildAligner plask::StackContainer< dim >::default_aligner

Definition at line 376 of file stack.hpp.

◆ NAME

template<int dim>
const char * plask::StackContainer< dim >::NAME = dim == 2 ? PLASK_STACK2D_NAME : PLASK_STACK3D_NAME
static

Definition at line 372 of file stack.hpp.


The documentation for this struct was generated from the following files: