ShapeGroupElement.h
Go to the documentation of this file.
/* -*- 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 <functional>
#include <memory>
#include <vector>
#include <boost/optional.hpp>
#include "ShapeInfo.h"
#include "VectorTransformation2D.h"
namespace libmspub
{
struct Coordinate;
class ShapeGroupElement
{
boost::optional<ShapeInfo> m_shapeInfo;
std::weak_ptr<ShapeGroupElement> m_parent;
std::vector<std::shared_ptr<ShapeGroupElement>> m_children;
unsigned m_seqNum;
ShapeGroupElement &operator=(const ShapeGroupElement &) = delete;
ShapeGroupElement(const ShapeGroupElement &) = delete;
VectorTransformation2D m_transform;
ShapeGroupElement(const std::shared_ptr<ShapeGroupElement> &parent, unsigned seqNum);
public:
~ShapeGroupElement();
static std::shared_ptr<ShapeGroupElement> create(const std::shared_ptr<ShapeGroupElement> &parent, unsigned seqNum = 0);
void setShapeInfo(const ShapeInfo &shapeInfo);
void setup(std::function<void(ShapeGroupElement &self)> visitor);
void visit(std::function<
std::function<void(void)>
(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<void(void)>
(const ShapeInfo &info, const Coordinate &relativeTo, const VectorTransformation2D &foldedTransform, bool isGroup, const VectorTransformation2D &thisTransform)> visitor) const;
bool isGroup() const;
std::shared_ptr<ShapeGroupElement> getParent() const;
void setSeqNum(unsigned seqNum);
void setTransform(const VectorTransformation2D &transform);
unsigned getSeqNum() const;
};
}
#endif
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
ShapeInfo.h
VectorTransformation2D.h
libmspub::ShapeGroupElement::~ShapeGroupElement
~ShapeGroupElement()
Definition ShapeGroupElement.cpp:24
libmspub::ShapeGroupElement::isGroup
bool isGroup() const
Definition ShapeGroupElement.cpp:88
libmspub::ShapeGroupElement::m_children
std::vector< std::shared_ptr< ShapeGroupElement > > m_children
Definition ShapeGroupElement.h:31
libmspub::ShapeGroupElement::m_seqNum
unsigned m_seqNum
Definition ShapeGroupElement.h:32
libmspub::ShapeGroupElement::setTransform
void setTransform(const VectorTransformation2D &transform)
Definition ShapeGroupElement.cpp:41
libmspub::ShapeGroupElement::visit
void visit(std::function< std::function< void(void)>(const ShapeInfo &info, const Coordinate &relativeTo, const VectorTransformation2D &foldedTransform, bool isGroup, const VectorTransformation2D &thisTransform)> visitor, const Coordinate &relativeTo, const VectorTransformation2D &foldedTransform) const
libmspub::ShapeGroupElement::setSeqNum
void setSeqNum(unsigned seqNum)
Definition ShapeGroupElement.cpp:98
libmspub::ShapeGroupElement::operator=
ShapeGroupElement & operator=(const ShapeGroupElement &)=delete
libmspub::ShapeGroupElement::getParent
std::shared_ptr< ShapeGroupElement > getParent() const
Definition ShapeGroupElement.cpp:93
libmspub::ShapeGroupElement::m_transform
VectorTransformation2D m_transform
Definition ShapeGroupElement.h:35
libmspub::ShapeGroupElement::create
static std::shared_ptr< ShapeGroupElement > create(const std::shared_ptr< ShapeGroupElement > &parent, unsigned seqNum=0)
Definition ShapeGroupElement.cpp:28
libmspub::ShapeGroupElement::ShapeGroupElement
ShapeGroupElement(const ShapeGroupElement &)=delete
libmspub::ShapeGroupElement::m_shapeInfo
boost::optional< ShapeInfo > m_shapeInfo
Definition ShapeGroupElement.h:29
libmspub::ShapeGroupElement::visit
void visit(std::function< std::function< void(void)>(const ShapeInfo &info, const Coordinate &relativeTo, const VectorTransformation2D &foldedTransform, bool isGroup, const VectorTransformation2D &thisTransform)> visitor) const
libmspub::ShapeGroupElement::getSeqNum
unsigned getSeqNum() const
Definition ShapeGroupElement.cpp:103
libmspub::ShapeGroupElement::setup
void setup(std::function< void(ShapeGroupElement &self)> visitor)
Definition ShapeGroupElement.cpp:46
libmspub::ShapeGroupElement::m_parent
std::weak_ptr< ShapeGroupElement > m_parent
Definition ShapeGroupElement.h:30
libmspub::ShapeGroupElement::setShapeInfo
void setShapeInfo(const ShapeInfo &shapeInfo)
Definition ShapeGroupElement.cpp:36
libmspub::VectorTransformation2D
Definition VectorTransformation2D.h:26
libmspub
Definition Arrow.h:14
libmspub::Coordinate
Definition Coordinate.h:22
libmspub::ShapeInfo
Definition ShapeInfo.h:38