/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * This file is part of the libmspub project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef INCLUDED_SHAPEGROUPELEMENT_H #define INCLUDED_SHAPEGROUPELEMENT_H #include #include #include #include #include "ShapeInfo.h" #include "VectorTransformation2D.h" namespace libmspub { struct Coordinate; class ShapeGroupElement { boost::optional m_shapeInfo; std::weak_ptr m_parent; std::vector> m_children; unsigned m_seqNum; ShapeGroupElement &operator=(const ShapeGroupElement &) = delete; ShapeGroupElement(const ShapeGroupElement &) = delete; VectorTransformation2D m_transform; ShapeGroupElement(const std::shared_ptr &parent, unsigned seqNum); public: ~ShapeGroupElement(); static std::shared_ptr create(const std::shared_ptr &parent, unsigned seqNum = 0); void setShapeInfo(const ShapeInfo &shapeInfo); void setup(std::function visitor); void visit(std::function< std::function (const ShapeInfo &info, const Coordinate &relativeTo, const VectorTransformation2D &foldedTransform, bool isGroup, const VectorTransformation2D &thisTransform)> visitor, const Coordinate &relativeTo, const VectorTransformation2D &foldedTransform) const; void visit(std::function< std::function (const ShapeInfo &info, const Coordinate &relativeTo, const VectorTransformation2D &foldedTransform, bool isGroup, const VectorTransformation2D &thisTransform)> visitor) const; bool isGroup() const; std::shared_ptr getParent() const; void setSeqNum(unsigned seqNum); void setTransform(const VectorTransformation2D &transform); unsigned getSeqNum() const; }; } #endif /* vim:set shiftwidth=2 softtabstop=2 expandtab: */